RESOLVED FIXED 62505
Remove unnecessary strlen from DocumentWriter
https://bugs.webkit.org/show_bug.cgi?id=62505
Summary Remove unnecessary strlen from DocumentWriter
Adam Barth
Reported 2011-06-11 19:02:42 PDT
Remove unnecessary strlen from DocumentWriter
Attachments
Patch (3.92 KB, patch)
2011-06-11 19:04 PDT, Adam Barth
no flags
Adam Barth
Comment 1 2011-06-11 19:04:40 PDT
Darin Adler
Comment 2 2011-06-11 20:42:11 PDT
Comment on attachment 96869 [details] Patch 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.
WebKit Review Bot
Comment 3 2011-06-11 21:19:51 PDT
Comment on attachment 96869 [details] Patch Clearing flags on attachment: 96869 Committed r88610: <http://trac.webkit.org/changeset/88610>
WebKit Review Bot
Comment 4 2011-06-11 21:19:55 PDT
All reviewed patches have been landed. Closing bug.
Adam Barth
Comment 5 2011-06-11 22:09:06 PDT
> 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. It seems like we should just use size_t everywhere for the length of the buffer. There's a bunch of code sites that need to change. I'll study it.
Note You need to log in before you can comment on or make changes to this bug.