[webkit-reviews] review requested: [Bug 48625] [GTK] Optimize foldCase, toLower and toUpper methods in glib unicode backend : [Attachment 72318] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 29 05:37:40 PDT 2010


Carlos Garcia Campos <cgarcia at igalia.com> has asked  for review:
Bug 48625: [GTK] Optimize foldCase, toLower and toUpper methods in glib unicode
backend
https://bugs.webkit.org/show_bug.cgi?id=48625

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

------- Additional Comments from Carlos Garcia Campos <cgarcia at igalia.com>
GLib methods use UTF-8 strings, so we have to convert from UTF-16 to UTF-8 to
perform the case operations and then convert back the result to UTF-16. GLib
conversion methods return a new allocated string, so we have to memcpy the
result into the destination buffer too. Using our own methods to convert
between UTF-8 and UTF-16 from wtf/unicode/UTF8.h we don't need such memcpy,
since they take an already allocated buffer rather than returning a new one.
There's another optimization for the case when the destination buffer is not
large enough. In that case, methods should return the expected destination
buffer size and are called again with a new buffer. We can avoid the conversion
to UTF-16 by pre-calculating the required size for the destination buffer.


More information about the webkit-reviews mailing list