Bug 530314 - TestXREMakeCommandLineWin.cpp compilation fails on mingw due to unsupported wmain, r=ted
authorJacek Caban <jacek@codeweavers.com>
Sun, 13 Dec 2009 09:44:15 -0800
changeset 35676 929bce835cdb6f1ebe497d35923dce3a44738f61
parent 35675 c5d0457346b6d4214d53dacf054d62ef2dd23f8b
child 35677 b3c1f6691f8e5fbd0292f5e4f426e8ac91e666ed
push id10673
push userphilringnalda@gmail.com
push dateSun, 13 Dec 2009 17:44:42 +0000
treeherdermozilla-central@b3c1f6691f8e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs530314
milestone1.9.3a1pre
Bug 530314 - TestXREMakeCommandLineWin.cpp compilation fails on mingw due to unsupported wmain, r=ted
toolkit/xre/test/win/TestXREMakeCommandLineWin.cpp
--- a/toolkit/xre/test/win/TestXREMakeCommandLineWin.cpp
+++ b/toolkit/xre/test/win/TestXREMakeCommandLineWin.cpp
@@ -269,8 +269,30 @@ int wmain(int argc, PRUnichar *argv[])
   if (rv == 0) {
     wprintf(L"TEST-PASS | %s | all checks passed\n", TEST_NAME);
   } else {
     wprintf(L"TEST-UNEXPECTED-FAIL | %s | some checks failed\n", TEST_NAME);
   }
 
   return rv;
 }
+
+#ifdef __MINGW32__
+
+/* MingW currently does not implement a wide version of the
+   startup routines.  Workaround is to implement something like
+   it ourselves.  See bug 411826 */
+
+#include <shellapi.h>
+
+int main(int argc, char **argv)
+{
+  LPWSTR commandLine = GetCommandLineW();
+  int argcw = 0;
+  LPWSTR *argvw = CommandLineToArgvW(commandLine, &argcw);
+  if (!argvw)
+    return 127;
+
+  int result = wmain(argcw, argvw);
+  LocalFree(argvw);
+  return result;
+}
+#endif /* __MINGW32__ */