RESOLVED FIXED 101104
JSStringCreateWithCFString() Should create an 8 bit String if possible
https://bugs.webkit.org/show_bug.cgi?id=101104
Summary JSStringCreateWithCFString() Should create an 8 bit String if possible
Michael Saboff
Reported 2012-11-02 14:46:27 PDT
JSStringCreateWithCFString() uses CFStringGetCharacters() to get a pointer to the 16 bit character buffer for the argument CFString. First we should try using CFStringGetBytes(..., kCFStringEncodingISOLatin1, ...) to get a Latin-1 8 bit character buffer if possible.
Attachments
Patch (1.93 KB, patch)
2012-11-05 11:09 PST, Michael Saboff
darin: review+
Michael Saboff
Comment 1 2012-11-05 11:09:50 PST
Darin Adler
Comment 2 2012-11-06 09:36:48 PST
Comment on attachment 172366 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=172366&action=review > Source/JavaScriptCore/API/JSStringRefCF.cpp:45 > + CFIndex usedBufLen; How about a non-abbreviated version, usedBufferLength? > Source/JavaScriptCore/API/JSStringRefCF.cpp:46 > + CFIndex convertedsize = CFStringGetBytes(string, CFRangeMake(0, length), kCFStringEncodingISOLatin1, 0, false, lcharBuffer.data(), length, &usedBufLen); Typically we’d capitalize “size”. > Source/JavaScriptCore/API/JSStringRefCF.cpp:47 > + if ((static_cast<size_t>(convertedsize) == length) && (static_cast<size_t>(usedBufLen) == length)) We normally wouldn’t use parentheses in an a == b && c == d expression.
Michael Saboff
Comment 3 2012-11-06 14:17:09 PST
Note You need to log in before you can comment on or make changes to this bug.