[webkit-reviews] review granted: [Bug 33213] Make png image decoder work with segmented SharedBuffer : [Attachment 45927] fixed some issues

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 5 14:03:17 PST 2010


Darin Adler <darin at apple.com> has granted Yong Li <yong.li.webkit at gmail.com>'s
request for review:
Bug 33213: Make png image decoder work with segmented SharedBuffer
https://bugs.webkit.org/show_bug.cgi?id=33213

Attachment 45927: fixed some issues
https://bugs.webkit.org/attachment.cgi?id=45927&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
> +    // XBMs require 8 bytes of info.
> +    static const unsigned maxMarkerLength = 8;
> +
> +    char contents[maxMarkerLength];
> +    unsigned length = 0;
> +    for (;;) {
> +	   const char* moreContents;
> +	   unsigned moreContentsLength = data.getSomeData(moreContents, 0);
> +	   if (!moreContentsLength)
> +	       break;
> +	   unsigned bytesToCopy = min(maxMarkerLength - length,
moreContentsLength);
> +	   memcpy(contents + length, moreContents, bytesToCopy);
> +	   length += bytesToCopy;
> +	   if (length == maxMarkerLength)
> +	       break;
> +    }

This cries out for a helper function. SharedBuffer could provide a function to
that has this logic in it rather than requiring callers to repeatedly call
getSomeData. Or at least put this in a separate function in this file.

Seems OK. r=me


More information about the webkit-reviews mailing list