[Webkit-unassigned] [Bug 33213] Make png image decoder work with segmented SharedBuffer

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


https://bugs.webkit.org/show_bug.cgi?id=33213


Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #45927|review?                     |review+
               Flag|                            |




--- Comment #8 from Darin Adler <darin at apple.com>  2010-01-05 14:03:18 PST ---
(From update of attachment 45927)
> +    // 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

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list