[webkit-reviews] review granted: [Bug 15555] XMLHttpRequest does not support charset "x-user-defined", which can facilitate loading of binary data : [Attachment 16860] proposed fix

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 26 00:15:01 PDT 2007


Darin Adler <darin at apple.com> has granted Alexey Proskuryakov <ap at webkit.org>'s
request for review:
Bug 15555: XMLHttpRequest does not support charset "x-user-defined", which can
facilitate loading of binary data
http://bugs.webkit.org/show_bug.cgi?id=15555

Attachment 16860: proposed fix
http://bugs.webkit.org/attachment.cgi?id=16860&action=edit

------- Additional Comments from Darin Adler <darin at apple.com>
+	 unsigned char c = bytes[i];
+	 characters[i] = (c < 0x80) ? c : 0xf700 + c;

If you used "signed char" you wouldn't need to do as much math:

	signed char signedByte = bytes[i];
	characters[i] = signedByte & 0xF7FF;

+	 UChar32 highBits = c & 0xffffff80;
+	 if (!highBits || highBits == 0xf780)
+	     bytes[resultLength++] = static_cast<char>(c);

And I'd just write this as:

    signed char signedByte = c;
    if (signedByte & 0xF7FF == c)
	bytes[resultLength++] = signedByte;

r=me with or without my suggested optimization


More information about the webkit-reviews mailing list