[GTK] Fix build on platforms where UChar is wchar_t
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Feb 2012 19:16:28 +0000 (19:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Feb 2012 19:16:28 +0000 (19:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78996

Patch by Kalev Lember <kalevlember@gmail.com> on 2012-02-19
Reviewed by Martin Robinson.

The ICU backend defines UChar as wchar_t for platforms where wchar_t is
16 bits wide, e.g. win32.

* platform/graphics/pango/FontPango.cpp:
(WebCore::utf16ToUtf8): Use reinterpret_cast instead of static_cast.
* platform/gtk/GtkPopupMenu.cpp:
(WebCore::GtkPopupMenu::typeAheadFind): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108191 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/pango/FontPango.cpp
Source/WebCore/platform/gtk/GtkPopupMenu.cpp

index f53d5f9..7729cc4 100644 (file)
@@ -1,3 +1,18 @@
+2012-02-19  Kalev Lember  <kalevlember@gmail.com>
+
+        [GTK] Fix build on platforms where UChar is wchar_t
+        https://bugs.webkit.org/show_bug.cgi?id=78996
+
+        Reviewed by Martin Robinson.
+
+        The ICU backend defines UChar as wchar_t for platforms where wchar_t is
+        16 bits wide, e.g. win32.
+
+        * platform/graphics/pango/FontPango.cpp:
+        (WebCore::utf16ToUtf8): Use reinterpret_cast instead of static_cast.
+        * platform/gtk/GtkPopupMenu.cpp:
+        (WebCore::GtkPopupMenu::typeAheadFind): Ditto.
+
 2012-02-19  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Fix make distcheck issues.
index 2684f53..0c60c76 100644 (file)
@@ -136,7 +136,7 @@ static gchar* utf16ToUtf8(const UChar* aText, gint aLength, gint &length)
 
     gchar* utf8Text;
     glong itemsWritten;
-    utf8Text = g_utf16_to_utf8(static_cast<const gunichar2*>(aText), aLength, 0, &itemsWritten, 0);
+    utf8Text = g_utf16_to_utf8(reinterpret_cast<const gunichar2*>(aText), aLength, 0, &itemsWritten, 0);
     length = itemsWritten;
 
     return utf8Text;
index b9112e9..fd7c84c 100644 (file)
@@ -178,9 +178,9 @@ bool GtkPopupMenu::typeAheadFind(GdkEventKey* event)
     // menulists.
     bool repeatingCharacter = unicodeCharacter != m_previousKeyEventCharacter;
     if (event->time - m_previousKeyEventTimestamp > gSearchTimeoutMs)
-        m_currentSearchString = String(static_cast<UChar*>(utf16String.get()), charactersWritten);
+        m_currentSearchString = String(reinterpret_cast<UChar*>(utf16String.get()), charactersWritten);
     else if (repeatingCharacter)
-        m_currentSearchString.append(String(static_cast<UChar*>(utf16String.get()), charactersWritten));
+        m_currentSearchString.append(String(reinterpret_cast<UChar*>(utf16String.get()), charactersWritten));
 
     m_previousKeyEventTimestamp = event->time;
     m_previousKeyEventCharacter = unicodeCharacter;