[Webkit-unassigned] [Bug 93255] [GTK] Webkit 1.8.2 fails to build with MinGW with spellchecking enabled

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Sep 23 06:08:48 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=93255





--- Comment #7 from Kalev Lember <kalevlember at gmail.com>  2012-09-23 06:09:16 PST ---
(In reply to comment #6)
> > Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.cpp:64
> > -    GOwnPtr<gchar> utf8Text(g_utf16_to_utf8(const_cast<gunichar2*>(text), length, 0, 0, 0));
> > +    GOwnPtr<gchar> utf8Text(g_utf16_to_utf8(reinterpret_cast<const gunichar2*>(text), length, 0, 0, 0));
> 
> I mentioned this to pfor via IRC, but I'll leave it here for posterity: I think it might be necessary here to use  g_ucs4_to_utf8 instead of simply casting 32-bit characters to 16-bit.

I don't think the cast actually loses precision. It is from UChar* to gunichar2*; I believe these are both always defined as 16 bit types.

>From Source/JavaScriptCore/icu/unicode/umachine.h, which defines UChar for the ICU backend:

#if U_SIZEOF_WCHAR_T==2
    typedef wchar_t UChar;
#elif U_GNUC_UTF16_STRING
#if defined _GCC_
    typedef __CHAR16_TYPE__ char16_t;
#endif
    typedef char16_t UChar;
#else
    typedef uint16_t UChar;
#endif

e.g. if wchar_t is 16 bit wide, try to use this; otherwise fall back to another 16 bit type.

The case is even simpler for the glib unicode backend. UnicodeGLib.h:
typedef uint16_t UChar;

Again, a 16 bit type.

And same goes for gunichar2 which is defined in glib's gunicode.h header:
typedef guint16 gunichar2;

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list