2011-02-06 Patrick Gansterer <paroga@webkit.org>
authorparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Feb 2011 18:52:58 +0000 (18:52 +0000)
committerparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Feb 2011 18:52:58 +0000 (18:52 +0000)
        Reviewed by Adam Roben.

        [WIN] Use WCHAR instead of TCHAR
        https://bugs.webkit.org/show_bug.cgi?id=53863

        We always use the UNICODE versions of windows functions, so
        the usage of TCHAR makes no sense and mixing them is bad style.

        * platform/graphics/win/IconWin.cpp:
        (WebCore::Icon::createIconForFiles):
        * platform/graphics/win/QTMovie.cpp:
        * platform/graphics/win/QTMovieGWorld.cpp:
        (QTMovieGWorld::fullscreenWndProc):
        (QTMovieGWorld::enterFullscreen):
        * platform/graphics/win/SimpleFontDataCGWin.cpp:
        (WebCore::SimpleFontData::platformInit):
        * platform/graphics/win/SimpleFontDataCairoWin.cpp:
        * platform/graphics/win/SimpleFontDataWin.cpp:
        * platform/graphics/wince/SimpleFontDataWinCE.cpp:
        * platform/win/BString.cpp:
        * platform/win/ClipboardWin.cpp:
        (WebCore::filesystemPathFromUrlOrTitle):
        (WebCore::createGlobalHDropContent):
        (WebCore::createGlobalImageFileDescriptor):
        * platform/win/ContextMenuWin.cpp:
        * platform/win/CursorWin.cpp:
        (WebCore::loadSharedCursor):
        * platform/win/FileChooserWin.cpp:
        (WebCore::FileChooser::basenameForWidth):
        * platform/win/PopupMenuWin.cpp:
        (WebCore::PopupMenuWin::popupClassName):
        (WebCore::PopupMenuWin::show):
        * platform/win/PopupMenuWin.h:

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

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/IconWin.cpp
Source/WebCore/platform/graphics/win/QTMovie.cpp
Source/WebCore/platform/graphics/win/QTMovieGWorld.cpp
Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp
Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
Source/WebCore/platform/win/BString.cpp
Source/WebCore/platform/win/ClipboardWin.cpp
Source/WebCore/platform/win/ContextMenuWin.cpp
Source/WebCore/platform/win/CursorWin.cpp
Source/WebCore/platform/win/FileChooserWin.cpp
Source/WebCore/platform/win/PopupMenuWin.cpp
Source/WebCore/platform/win/PopupMenuWin.h

index 2d43eb043d66f52089f1f51b771170f6c1c694db..78e367221dbf6522ce233f2c51e6208a44cd097d 100644 (file)
@@ -1,3 +1,39 @@
+2011-02-06  Patrick Gansterer  <paroga@webkit.org>
+
+        Reviewed by Adam Roben.
+
+        [WIN] Use WCHAR instead of TCHAR
+        https://bugs.webkit.org/show_bug.cgi?id=53863
+
+        We always use the UNICODE versions of windows functions, so
+        the usage of TCHAR makes no sense and mixing them is bad style.
+
+        * platform/graphics/win/IconWin.cpp:
+        (WebCore::Icon::createIconForFiles):
+        * platform/graphics/win/QTMovie.cpp:
+        * platform/graphics/win/QTMovieGWorld.cpp:
+        (QTMovieGWorld::fullscreenWndProc):
+        (QTMovieGWorld::enterFullscreen):
+        * platform/graphics/win/SimpleFontDataCGWin.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/win/SimpleFontDataCairoWin.cpp:
+        * platform/graphics/win/SimpleFontDataWin.cpp:
+        * platform/graphics/wince/SimpleFontDataWinCE.cpp:
+        * platform/win/BString.cpp:
+        * platform/win/ClipboardWin.cpp:
+        (WebCore::filesystemPathFromUrlOrTitle):
+        (WebCore::createGlobalHDropContent):
+        (WebCore::createGlobalImageFileDescriptor):
+        * platform/win/ContextMenuWin.cpp:
+        * platform/win/CursorWin.cpp:
+        (WebCore::loadSharedCursor):
+        * platform/win/FileChooserWin.cpp:
+        (WebCore::FileChooser::basenameForWidth):
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::popupClassName):
+        (WebCore::PopupMenuWin::show):
+        * platform/win/PopupMenuWin.h:
+
 2011-02-06  Patrick Gansterer  <paroga@webkit.org>
 
         Reviewed by Andreas Kling.
index 4d4d219780dae313bb6b824ac843fcced92054cd..7e033628c9afdd072ccc6e0b05dcea2fa3edd0ff 100644 (file)
@@ -25,7 +25,6 @@
 #include "GraphicsContext.h"
 #include "LocalWindowsContext.h"
 #include "PlatformString.h"
-#include <tchar.h>
 #include <windows.h>
 
 #if OS(WINCE)
@@ -68,16 +67,16 @@ PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames)
 #if OS(WINCE)
     return 0;
 #else
-    TCHAR buffer[MAX_PATH];    
-    UINT length = ::GetSystemDirectory(buffer, WTF_ARRAY_LENGTH(buffer));
+    WCHAR buffer[MAX_PATH];
+    UINT length = ::GetSystemDirectoryW(buffer, WTF_ARRAY_LENGTH(buffer));
     if (!length)
         return 0;
-    
-    if (_tcscat_s(buffer, TEXT("\\shell32.dll")))
+
+    if (wcscat_s(buffer, L"\\shell32.dll"))
         return 0;
 
     HICON hIcon;
-    if (!::ExtractIconEx(buffer, shell32MultipleFileIconIndex, 0, &hIcon, 1))
+    if (!::ExtractIconExW(buffer, shell32MultipleFileIconIndex, 0, &hIcon, 1))
         return 0;
     return adoptRef(new Icon(hIcon));
 #endif
index 797571ef0c4159fc2df2592ca09444d4d548ee12..4cd81614f244f75dd12293d57eb3e308b07b80c9 100644 (file)
@@ -48,7 +48,6 @@ static const long subTitleTrackType = 'sbtl';
 static const long mpeg4ObjectDescriptionTrackType = 'odsm';
 static const long mpeg4SceneDescriptionTrackType = 'sdsm';
 static const long closedCaptionDisplayPropertyID = 'disp';
-static LPCTSTR fullscreenQTMoviePointerProp = TEXT("fullscreenQTMoviePointer");
 
 // Resizing GWorlds is slow, give them a minimum size so size of small 
 // videos can be animated smoothly
index e13f7325b9fd060dc1074ff6db1e3908b86f60c8..4be1bbb0ea45e4df716bc46e66f90216a932482c 100644 (file)
@@ -40,7 +40,7 @@ using namespace std;
 
 static const long minimumQuickTimeVersion = 0x07300000; // 7.3
 
-static LPCTSTR fullscreenQTMovieGWorldPointerProp = TEXT("fullscreenQTMovieGWorldPointer");
+static LPCWSTR fullscreenQTMovieGWorldPointerProp = L"fullscreenQTMovieGWorldPointer";
 
 // Resizing GWorlds is slow, give them a minimum size so size of small 
 // videos can be animated smoothly
@@ -378,10 +378,10 @@ bool QTMovieGWorld::isDisabled() const
 
 LRESULT QTMovieGWorld::fullscreenWndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    QTMovieGWorld* movie = static_cast<QTMovieGWorld*>(GetProp(wnd, fullscreenQTMovieGWorldPointerProp));
+    QTMovieGWorld* movie = static_cast<QTMovieGWorld*>(GetPropW(wnd, fullscreenQTMovieGWorldPointerProp));
 
     if (message == WM_DESTROY)
-        RemoveProp(wnd, fullscreenQTMovieGWorldPointerProp);
+        RemovePropW(wnd, fullscreenQTMovieGWorldPointerProp);
 
     if (!movie)
         return DefWindowProc(wnd, message, wParam, lParam);
@@ -423,7 +423,7 @@ HWND QTMovieGWorld::enterFullscreen(QTMovieGWorldFullscreenClient* client)
 
     // Set the 'this' pointer on the HWND
     HWND wnd = static_cast<HWND>(GetPortNativeWindow(m_private->m_fullscreenWindow));
-    SetProp(wnd, fullscreenQTMovieGWorldPointerProp, static_cast<HANDLE>(this));
+    SetPropW(wnd, fullscreenQTMovieGWorldPointerProp, static_cast<HANDLE>(this));
 
     return wnd;
 }
index e8f066f10387eb4067f4f69d3fdb4c34a56d9b50..30a931e1106ca590302db0f8ed54bbb1b70c608c 100644 (file)
 #include "config.h"
 #include "SimpleFontData.h"
 
-#include <winsock2.h>
 #include "Font.h"
 #include "FontCache.h"
 #include "FloatRect.h"
 #include "FontDescription.h"
 #include "PlatformString.h"
-#include <wtf/MathExtras.h>
-#include <wtf/RetainPtr.h>
-#include <unicode/uchar.h>
-#include <unicode/unorm.h>
 #include <ApplicationServices/ApplicationServices.h>
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
 #include <mlang.h>
-#include <tchar.h>
+#include <unicode/uchar.h>
+#include <unicode/unorm.h>
+#include <winsock2.h>
+#include <wtf/MathExtras.h>
+#include <wtf/RetainPtr.h>
 
 namespace WebCore {
 
@@ -74,9 +73,9 @@ void SimpleFontData::platformInit()
         HDC dc = GetDC(0);
         HGDIOBJ oldFont = SelectObject(dc, m_platformData.hfont());
         int faceLength = GetTextFace(dc, 0, 0);
-        Vector<TCHAR> faceName(faceLength);
+        Vector<WCHAR> faceName(faceLength);
         GetTextFace(dc, faceLength, faceName.data());
-        m_isSystemFont = !_tcscmp(faceName.data(), _T("Lucida Grande"));
+        m_isSystemFont = !wcscmp(faceName.data(), L"Lucida Grande");
         SelectObject(dc, oldFont);
         ReleaseDC(0, dc);
 
@@ -88,7 +87,7 @@ void SimpleFontData::platformInit()
             // web standard. The AppKit adjustment of 20% is too big and is
             // incorrectly added to line spacing, so we use a 15% adjustment instead
             // and add it to the ascent.
-            if (!_tcscmp(faceName.data(), _T("Times")) || !_tcscmp(faceName.data(), _T("Helvetica")) || !_tcscmp(faceName.data(), _T("Courier")))
+            if (!wcscmp(faceName.data(), L"Times") || !wcscmp(faceName.data(), L"Helvetica") || !wcscmp(faceName.data(), L"Courier"))
                 fAscent += floorf(((fAscent + fDescent) * 0.15f) + 0.5f);
         }
     }
index eea10df33a6bfbee66d1e23f6ec8a8911a69c77e..277a13f453a8ebf72573f3af2d348169d5cbcac3 100644 (file)
@@ -37,7 +37,6 @@
 #include <cairo.h>
 #include <cairo-win32.h>
 #include <mlang.h>
-#include <tchar.h>
 #include <wtf/MathExtras.h>
 
 namespace WebCore {
index d466c29227ab7713bb6e9a7998d1247c16986bad..323ff733e9ef814c2ce06ef435964b976f88818f 100644 (file)
 #include "config.h"
 #include "SimpleFontData.h"
 
-#include <winsock2.h>
 #include "Font.h"
 #include "FontCache.h"
 #include "FloatRect.h"
 #include "FontDescription.h"
-#include <wtf/MathExtras.h>
+#include <mlang.h>
 #include <unicode/uchar.h>
 #include <unicode/unorm.h>
-#include <mlang.h>
-#include <tchar.h>
+#include <winsock2.h>
+#include <wtf/MathExtras.h>
 
 #if PLATFORM(CG)
 #include <ApplicationServices/ApplicationServices.h>
index f3e511c9a45cd901d90b965c2abd2a860b7d1e05..8abafbdbe1b92db152e66dfa8a46a48944b8d648 100644 (file)
@@ -27,7 +27,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
 #include "config.h"
 #include "SimpleFontData.h"
 
@@ -35,9 +34,8 @@
 #include "Font.h"
 #include "FontCache.h"
 #include "FontDescription.h"
-#include <wtf/MathExtras.h>
 #include <mlang.h>
-#include <tchar.h>
+#include <wtf/MathExtras.h>
 
 namespace WebCore {
 
index 4d6d11ed123eaabcf01ea934d42f1661ca4e8814..6622f96611baecf8cfb4c9be19817cd22a6a4e3e 100644 (file)
@@ -28,9 +28,8 @@
 
 #include "KURL.h"
 #include "PlatformString.h"
-#include <wtf/text/AtomicString.h>
-#include <tchar.h>
 #include <windows.h>
+#include <wtf/text/AtomicString.h>
 
 #if PLATFORM(CF)
 #include <CoreFoundation/CoreFoundation.h>
@@ -102,7 +101,7 @@ BString::BString(CFStringRef cfstr)
 
     const UniChar* uniChars = CFStringGetCharactersPtr(cfstr);
     if (uniChars) {
-        m_bstr = SysAllocStringLen((LPCTSTR)uniChars, CFStringGetLength(cfstr));
+        m_bstr = SysAllocStringLen((LPCWSTR)uniChars, CFStringGetLength(cfstr));
         return;
     }
 
@@ -158,7 +157,7 @@ bool operator ==(const BString& a, const BString& b)
         return true;
     if (!(BSTR)a || !(BSTR)b)
         return false;
-    return !_tcscmp((BSTR)a, (BSTR)b);
+    return !wcscmp((BSTR)a, (BSTR)b);
 }
 
 bool operator !=(const BString& a, const BString& b)
@@ -174,7 +173,7 @@ bool operator ==(const BString& a, BSTR b)
         return true;
     if (!(BSTR)a || !b)
         return false;
-    return !_tcscmp((BSTR)a, b);
+    return !wcscmp((BSTR)a, b);
 }
 
 bool operator !=(const BString& a, BSTR b)
@@ -190,7 +189,7 @@ bool operator ==(BSTR a, const BString& b)
         return true;
     if (!a || !(BSTR)b)
         return false;
-    return !_tcscmp(a, (BSTR)b);
+    return !wcscmp(a, (BSTR)b);
 }
 
 bool operator !=(BSTR a, const BString& b)
index 394610c795cc19f8c067c1df95d602bb86e89fa7..c0af71234e151b1a8ec85e1ea8574d868493dbe8 100644 (file)
@@ -115,7 +115,7 @@ static inline void pathRemoveBadFSCharacters(PWSTR psz, size_t length)
 }
 #endif
 
-static String filesystemPathFromUrlOrTitle(const String& url, const String& title, TCHAR* extension, bool isLink)
+static String filesystemPathFromUrlOrTitle(const String& url, const String& title, const UChar* extension, bool isLink)
 {
 #if OS(WINCE)
     notImplemented();
@@ -163,7 +163,7 @@ static String filesystemPathFromUrlOrTitle(const String& url, const String& titl
     }
 
     String result(static_cast<UChar*>(fsPathBuffer));
-    result += String(static_cast<UChar*>(extension));
+    result += String(extension);
     return result;
 #endif
 }
@@ -195,7 +195,7 @@ static HGLOBAL createGlobalHDropContent(const KURL& url, String& fileName, Share
         // windows does not enjoy a leading slash on paths
         if (localPath[0] == '/')
             localPath = localPath.substring(1);
-        LPCTSTR localPathStr = localPath.charactersWithNullTermination();
+        LPCWSTR localPathStr = localPath.charactersWithNullTermination();
         if (wcslen(localPathStr) + 1 < MAX_PATH)
             wcscpy_s(filePath, MAX_PATH, localPathStr);
         else
@@ -277,7 +277,7 @@ static HGLOBAL createGlobalImageFileDescriptor(const String& url, const String&
         return 0;
     }
     extension.insert(".", 0);
-    fsPath = filesystemPathFromUrlOrTitle(url, preferredTitle, (TCHAR*)extension.charactersWithNullTermination(), false);
+    fsPath = filesystemPathFromUrlOrTitle(url, preferredTitle, extension.charactersWithNullTermination(), false);
 
     if (fsPath.length() <= 0) {
         GlobalUnlock(memObj);
index ed1b895b3dca12f8148114d6528315ba5e3f979f..530d64d4d6f5533830505073675fd4f86d2d30e5 100644 (file)
@@ -31,7 +31,6 @@
 #include "FrameView.h"
 #include "Node.h"
 #include "NotImplemented.h"
-#include <tchar.h>
 #include <windows.h>
 #include <wtf/Vector.h>
 #include <wtf/text/CString.h>
index 2dd1452bb28f98132fdd6eb9e8a0a6bcd06f30d3..0036388c3844dcfa30644f5347fce7672be19c3f 100644 (file)
@@ -123,9 +123,9 @@ static PassRefPtr<SharedCursor> createSharedCursor(Image* img, const IntPoint& h
     return impl.release();
 }
 
-static PassRefPtr<SharedCursor> loadSharedCursor(HINSTANCE hInstance, LPCTSTR lpCursorName)
+static PassRefPtr<SharedCursor> loadSharedCursor(HINSTANCE hInstance, LPCWSTR lpCursorName)
 {
-    return SharedCursor::create(::LoadCursor(hInstance, lpCursorName));
+    return SharedCursor::create(::LoadCursorW(hInstance, lpCursorName));
 }
 
 static PassRefPtr<SharedCursor> loadCursorByName(char* name, int x, int y)
index 7d07b5dc795ac2139457570b834589ba148a6d02..195b8eb03e3d0af583a9756c0f5302021666944b 100644 (file)
@@ -29,7 +29,6 @@
 #include "LocalizedStrings.h"
 #include "StringTruncator.h"
 #include <shlwapi.h>
-#include <tchar.h>
 #include <windows.h>
 
 namespace WebCore {
@@ -44,7 +43,7 @@ String FileChooser::basenameForWidth(const Font& font, int width) const
         string = fileButtonNoFileSelectedLabel();
     else if (m_filenames.size() == 1) {
         String tmpFilename = m_filenames[0];
-        LPTSTR basename = PathFindFileName(tmpFilename.charactersWithNullTermination());
+        LPWSTR basename = PathFindFileNameW(tmpFilename.charactersWithNullTermination());
         string = String(basename);
     } else
         return StringTruncator::rightTruncate(String::number(m_filenames.size()) + " files", width, font, false);
index 9c9388a812d1c504465ef4183a0b38ae7ae32ab8..3f3afa29b05a4bb8e39684f5fff7ec07fb8bc442 100644 (file)
@@ -42,7 +42,6 @@
 #include "SimpleFontData.h"
 #include "TextRun.h"
 #include "WebCoreInstanceHandle.h"
-#include <tchar.h>
 #include <windows.h>
 #include <windowsx.h>
 #if OS(WINCE)
@@ -64,7 +63,7 @@ static const int maxPopupHeight = 320;
 const int optionSpacingMiddle = 1;
 const int popupWindowBorderWidth = 1;
 
-static LPCTSTR kPopupWindowClassName = _T("PopupWindowClass");
+static LPCWSTR kPopupWindowClassName = L"PopupWindowClass";
 
 // This is used from within our custom message pump when we want to send a
 // message to the web view and not have our message stolen and sent to
@@ -121,7 +120,7 @@ void PopupMenuWin::disconnectClient()
     m_popupClient = 0;
 }
 
-LPCTSTR PopupMenuWin::popupClassName()
+LPCWSTR PopupMenuWin::popupClassName()
 {
     return kPopupWindowClassName;
 }
@@ -145,7 +144,7 @@ void PopupMenuWin::show(const IntRect& r, FrameView* view, int index)
 
         DWORD exStyle = WS_EX_LTRREADING;
 
-        m_popup = ::CreateWindowEx(exStyle, kPopupWindowClassName, _T("PopupMenu"),
+        m_popup = ::CreateWindowExW(exStyle, kPopupWindowClassName, L"PopupMenu",
             WS_POPUP | WS_BORDER,
             m_windowRect.x(), m_windowRect.y(), m_windowRect.width(), m_windowRect.height(),
             hostWindow, 0, WebCore::instanceHandle(), this);
index 0d7630c091b3b612c57421f204e11c97d61bf592..05edb07135fceb05cc7cedbf2455ae6281bcfe06 100644 (file)
@@ -49,7 +49,7 @@ public:
     virtual void updateFromElement();
     virtual void disconnectClient();
 
-    static LPCTSTR popupClassName();
+    static LPCWSTR popupClassName();
 
 private:
     PopupMenuClient* client() const { return m_popupClient; }