[webkit-reviews] review granted: [Bug 62505] Remove unnecessary strlen from DocumentWriter : [Attachment 96869] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jun 11 20:42:10 PDT 2011


Darin Adler <darin at apple.com> has granted Adam Barth <abarth at webkit.org>'s
request for review:
Bug 62505: Remove unnecessary strlen from DocumentWriter
https://bugs.webkit.org/show_bug.cgi?id=62505

Attachment 96869: Patch
https://bugs.webkit.org/attachment.cgi?id=96869&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=96869&action=review

> Source/WebCore/loader/DocumentWriter.cpp:204
> -void DocumentWriter::addData(const char* bytes, int length)
> +void DocumentWriter::addData(const char* bytes, size_t length)
>  {
> -    if (length == -1)
> -	   length = strlen(bytes);
> -
>      m_parser->appendBytes(this, bytes, length);
>  }

This function now truncates a passed-in size_t to an int by passing it to
appendBytes.

It would be possible to instead write a loop that does up to INT_MAX characters
at once. Or to make a more extensive change so we use size_t in the signature
of the appendBytes function too.


More information about the webkit-reviews mailing list