[webkit-reviews] review granted: [Bug 50123] Add an overload to makeString for Vector<char> : [Attachment 74963] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Dec 10 10:40:40 PST 2010


Darin Adler <darin at apple.com> has granted Patrick R. Gansterer
<paroga at paroga.com>'s request for review:
Bug 50123: Add an overload to makeString for Vector<char>
https://bugs.webkit.org/show_bug.cgi?id=50123

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

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

> JavaScriptCore/wtf/text/StringConcatenate.h:124
> +    unsigned length() { return m_buffer.size(); }
> +
> +    void writeTo(UChar* destination)
> +    {
> +	   for (unsigned i = 0; i < m_buffer.size(); ++i)
> +	       destination[i] = m_buffer[i];

It’s better style to use size_t, which makes the type of vector’s size than
unsigned, which can be narrower.

This will widen characters to UChar based on the signed-ness of characters on a
particular platform. If the characters are all ASCII, that’s OK, but if there
are non-ASCII characters we probably want the characters treated as Latin-1 as
we do in most other contexts. To accomplish that, we will need to cast the
characters to unsigned char before letting them get widened to UChar.

The same applies for const char*.

We should either have an isASCII assertion or a typecast to unsigned char.


More information about the webkit-reviews mailing list