[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r4294: Qt 4.6 now hardcodes the QT_WA macro to always execute the U (in vidalia/trunk: . src/common)



Author: edmanm
Date: 2010-05-17 23:58:45 -0400 (Mon, 17 May 2010)
New Revision: 4294

Modified:
   vidalia/trunk/CHANGELOG
   vidalia/trunk/src/common/win32.cpp
Log:

Qt 4.6 now hardcodes the QT_WA macro to always execute the Unicode half, even
if the UNICODE flag is not set. So, work around this awesome new behavior so
that Vidalia will work correctly again on Windows with Qt >= 4.6. Otherwise,
we would try to parse UTF-16 from an ASCII string.


Modified: vidalia/trunk/CHANGELOG
===================================================================
--- vidalia/trunk/CHANGELOG	2010-05-18 00:17:31 UTC (rev 4293)
+++ vidalia/trunk/CHANGELOG	2010-05-18 03:58:45 UTC (rev 4294)
@@ -6,6 +6,8 @@
     build with the latest versions of MinGW.
   o Modify miniupnpc.c from MiniUPnPc's source so that it will build on
     Mac OS X 10.4.
+  o Work around Qt's new behavior for the QT_WA macro so that Vidalia will
+    work correctly again on Windows with Qt >= 4.6.
   o Force CMake to include the *_RELEASE versions of Qt libraries when
     building a .dmg on Mac OS X, so that it will work with CMake >= 2.8 as
     well.

Modified: vidalia/trunk/src/common/win32.cpp
===================================================================
--- vidalia/trunk/src/common/win32.cpp	2010-05-18 00:17:31 UTC (rev 4293)
+++ vidalia/trunk/src/common/win32.cpp	2010-05-18 03:58:45 UTC (rev 4294)
@@ -22,7 +22,7 @@
 
 #include <tlhelp32.h>
 #include <shlobj.h>
-#
+
 #if defined(UNICODE)
 /* Force the ascii verisons of these functions, so we can run on Win98. We
  * don't pass any Unicode strings to these functions anyway. */
@@ -49,6 +49,12 @@
   IMalloc *m;
   HRESULT result;
 
+  /* XXX: It would probably be a good idea to replace this function with simple
+   *      calls to QDesktopServices::storageLocation(). Note that it returns the
+   *      "Local Settings" application data directory though, so our installers
+   *      would need to be updated as well.
+   */
+
   /* Find the location of %PROGRAMFILES% */
   if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, folder, &idl))) {
     /* Get the path from the IDL */
@@ -58,8 +64,11 @@
       m->Release();
     }
     if (SUCCEEDED(result)) {
-      QT_WA(return QString::fromUtf16((const ushort *)path);,
-            return QString::fromLocal8Bit((char *)path);)
+#if defined(UNICODE)
+      return QString::fromUtf16(static_cast<const ushort *>(path));
+#else
+      return QString::fromLocal8Bit(static_cast<const char *>(path));
+#endif
     }
   }
   return defaultPath;