[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:57:04 PST 2010


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





--- Comment #9 from Yong Li <yong.li.webkit at gmail.com>  2010-01-05 14:57:04 PST ---
(In reply to comment #8)
> (From update of attachment 45927 [details])
> > +    // 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

I'm putting it into a new function with a bug fixed too: getSomeData() should
be called with increasing offset but not 0.

Would you like to review the new patch? Or I can commit it now?

-- 
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