Bug 944913 - Fixed char16_t/wchar_t mismatch in tollkit/. r=ehsan
authorJacek Caban <jacek@codeweavers.com>
Tue, 03 Dec 2013 16:07:22 +0100
changeset 161549 a41081c1026cba02882bcf4b7dac84441dc05889
parent 161548 e8925e8c0f00a080bb4680b9b76e85495dcb85c7
child 161550 32fcd54fd18b111cf6d4ade2276d0a04ca9e56fe
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-esr52@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs944913
milestone28.0a1
Bug 944913 - Fixed char16_t/wchar_t mismatch in tollkit/. r=ehsan
toolkit/components/downloads/nsDownloadScanner.cpp
toolkit/components/startup/nsUserInfoWin.cpp
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsAppRunner.h
toolkit/xre/nsEmbedFunctions.cpp
toolkit/xre/nsNativeAppSupportWin.cpp
toolkit/xre/nsWindowsRestart.cpp
toolkit/xre/nsWindowsWMain.cpp
toolkit/xre/nsXREDirProvider.cpp
toolkit/xre/test/win/TestXREMakeCommandLineWin.cpp
--- a/toolkit/components/downloads/nsDownloadScanner.cpp
+++ b/toolkit/components/downloads/nsDownloadScanner.cpp
@@ -454,20 +454,20 @@ nsDownloadScanner::Scan::DoScanAES()
 
   // If we (somehow) already timed out, then don't bother scanning
   if (CheckAndSetState(AVSCAN_SCANNING, AVSCAN_NOTSTARTED)) {
     AVScanState newState;
     if (SUCCEEDED(hr)) {
       bool gotException = false;
       MOZ_SEH_TRY {
         (void)ae->SetClientGuid(GUID_MozillaVirusScannerPromptGeneric);
-        (void)ae->SetLocalPath(mPath.BeginWriting());
+        (void)ae->SetLocalPath(mPath.get());
         // Provide the src for everything but data: schemes.
         if (!mSkipSource)
-          (void)ae->SetSource(mOrigin.BeginWriting());
+          (void)ae->SetSource(mOrigin.get());
 
         // Save() will invoke the scanner
         hr = ae->Save();
       } MOZ_SEH_EXCEPT(ExceptionFilterFunction(GetExceptionCode())) {
         gotException = true;
       }
 
       MOZ_SEH_TRY {
--- a/toolkit/components/startup/nsUserInfoWin.cpp
+++ b/toolkit/components/startup/nsUserInfoWin.cpp
@@ -27,42 +27,42 @@ NS_IMPL_ISUPPORTS1(nsUserInfo, nsIUserIn
 
 NS_IMETHODIMP
 nsUserInfo::GetUsername(char **aUsername)
 {
   NS_ENSURE_ARG_POINTER(aUsername);
   *aUsername = nullptr;
 
   // ULEN is the max username length as defined in lmcons.h
-  PRUnichar username[UNLEN +1];
+  wchar_t username[UNLEN +1];
   DWORD size = mozilla::ArrayLength(username);
   if (!GetUserNameW(username, &size))
     return NS_ERROR_FAILURE;
 
   *aUsername = ToNewUTF8String(nsDependentString(username));
   return (*aUsername) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsUserInfo::GetFullname(PRUnichar **aFullname)
 {
   NS_ENSURE_ARG_POINTER(aFullname);
   *aFullname = nullptr;
 
-  PRUnichar fullName[512];
+  wchar_t fullName[512];
   DWORD size = mozilla::ArrayLength(fullName);
 
   if (GetUserNameExW(NameDisplay, fullName, &size)) {
     *aFullname = ToNewUnicode(nsDependentString(fullName));
   } else {
     DWORD getUsernameError = GetLastError();
 
     // Try to use the net APIs regardless of the error because it may be
     // able to obtain the information.
-    PRUnichar username[UNLEN + 1];
+    wchar_t username[UNLEN + 1];
     size = mozilla::ArrayLength(username);
     if (!GetUserNameW(username, &size)) {
       // ERROR_NONE_MAPPED means the user info is not filled out on this computer
       return getUsernameError == ERROR_NONE_MAPPED ?
              NS_ERROR_NOT_AVAILABLE : NS_ERROR_FAILURE;
     }
 
     const DWORD level = 2;
@@ -114,17 +114,17 @@ nsUserInfo::GetDomain(char **aDomain)
 
 NS_IMETHODIMP
 nsUserInfo::GetEmailAddress(char **aEmailAddress)
 {
   NS_ENSURE_ARG_POINTER(aEmailAddress);
   *aEmailAddress = nullptr;
 
   // RFC3696 says max length of an email address is 254
-  PRUnichar emailAddress[255];
+  wchar_t emailAddress[255];
   DWORD size = mozilla::ArrayLength(emailAddress);
 
   if (!GetUserNameExW(NameUserPrincipal, emailAddress, &size)) {
     DWORD getUsernameError = GetLastError();
     return getUsernameError == ERROR_NONE_MAPPED ?
            NS_ERROR_NOT_AVAILABLE : NS_ERROR_FAILURE;
   }
 
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -866,17 +866,17 @@ nsresult SetExceptionHandler(nsIFile* aX
 #endif
 
     exePath->AppendNative(NS_LITERAL_CSTRING(CRASH_REPORTER_FILENAME));
 
 #ifdef XP_WIN32
     nsString crashReporterPath_temp;
 
     exePath->GetPath(crashReporterPath_temp);
-    crashReporterPath = ToNewUnicode(crashReporterPath_temp);
+    crashReporterPath = reinterpret_cast<wchar_t*>(ToNewUnicode(crashReporterPath_temp));
 #elif !defined(__ANDROID__)
     nsCString crashReporterPath_temp;
 
     exePath->GetNativePath(crashReporterPath_temp);
     crashReporterPath = ToNewCString(crashReporterPath_temp);
 #else
     // On Android, we launch using the application package name
     // instead of a filename, so use ANDROID_PACKAGE_NAME to do that here.
@@ -1093,17 +1093,17 @@ bool GetMinidumpPath(nsAString& aPath)
 
 nsresult SetMinidumpPath(const nsAString& aPath)
 {
   if (!gExceptionHandler)
     return NS_ERROR_NOT_INITIALIZED;
 
 #ifndef XP_LINUX
   gExceptionHandler->set_dump_path(
-      CONVERT_UTF16_TO_XP_CHAR(aPath).BeginReading());
+      char16ptr_t(CONVERT_UTF16_TO_XP_CHAR(aPath).BeginReading()));
 #else
   gExceptionHandler->set_minidump_descriptor(
       MinidumpDescriptor(CONVERT_UTF16_TO_XP_CHAR(aPath).BeginReading()));
 #endif
   return NS_OK;
 }
 
 static nsresult
@@ -1917,17 +1917,17 @@ FindPendingDir()
   }
   else {
     pendingDir->Append(NS_LITERAL_STRING("Crash Reports"));
     pendingDir->Append(NS_LITERAL_STRING("pending"));
 
 #ifdef XP_WIN
     nsString path;
     pendingDir->GetPath(path);
-    pendingDirectory = ToNewUnicode(path);
+    pendingDirectory = reinterpret_cast<wchar_t*>(ToNewUnicode(path));
 #else
     nsCString path;
     pendingDir->GetNativePath(path);
     pendingDirectory = ToNewCString(path);
 #endif
   }
 }
 
@@ -2498,17 +2498,17 @@ SetRemoteExceptionHandler(const nsACStri
 
   gExceptionHandler = new google_breakpad::
     ExceptionHandler(L"",
                      FPEFilter,
                      nullptr,    // no minidump callback
                      nullptr,    // no callback context
                      google_breakpad::ExceptionHandler::HANDLER_ALL,
                      MiniDumpNormal,
-                     NS_ConvertASCIItoUTF16(crashPipe).BeginReading(),
+                     NS_ConvertASCIItoUTF16(crashPipe).get(),
                      nullptr);
 #ifdef XP_WIN
   gExceptionHandler->set_handle_debug_exceptions(true);
 #endif
 
   // we either do remote or nothing, no fallback to regular crash reporting
   return gExceptionHandler->IsOutOfProcess();
 }
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -148,18 +148,18 @@
 #include <unistd.h>
 #include <pwd.h>
 #endif
 
 #ifdef XP_WIN
 #include <process.h>
 #include <shlobj.h>
 #include "nsThreadUtils.h"
-#include <comutil.h>
-#include <Wbemidl.h>
+#include <comdef.h>
+#include <wbemidl.h>
 #endif
 
 #ifdef XP_MACOSX
 #include "nsILocalFileMac.h"
 #include "nsCommandLineServiceMac.h"
 #endif
 
 // for X remote support
--- a/toolkit/xre/nsAppRunner.h
+++ b/toolkit/xre/nsAppRunner.h
@@ -92,17 +92,17 @@ NS_HIDDEN_(nsresult)
 NS_LockProfilePath(nsIFile* aPath, nsIFile* aTempPath,
                    nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult);
 
 NS_HIDDEN_(void)
 WriteConsoleLog();
 
 #ifdef XP_WIN
 BOOL
-WinLaunchChild(const PRUnichar *exePath, int argc, 
+WinLaunchChild(const wchar_t *exePath, int argc,
                char **argv, HANDLE userToken = nullptr,
                HANDLE *hProcess = nullptr);
 BOOL
 WriteStatusPending(LPCWSTR updateDirPath);
 BOOL
 WriteStatusApplied(LPCWSTR updateDirPath);
 #endif
 
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -94,17 +94,17 @@ using mozilla::ipc::TestShellParent;
 using mozilla::ipc::TestShellCommandParent;
 using mozilla::ipc::XPCShellEnvironment;
 
 using mozilla::startup::sChildProcessType;
 
 static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
 
 #ifdef XP_WIN
-static const PRUnichar kShellLibraryName[] =  L"shell32.dll";
+static const wchar_t kShellLibraryName[] =  L"shell32.dll";
 #endif
 
 nsresult
 XRE_LockProfileDirectory(nsIFile* aDirectory,
                          nsISupports* *aLockObject)
 {
   nsCOMPtr<nsIProfileLock> lock;
 
--- a/toolkit/xre/nsNativeAppSupportWin.cpp
+++ b/toolkit/xre/nsNativeAppSupportWin.cpp
@@ -471,19 +471,19 @@ struct MessageWindow {
     }
 
     // Act like an HWND.
     operator HWND() {
         return mHandle;
     }
 
     // Class name: appName + "MessageWindow"
-    static const PRUnichar *className() {
-        static PRUnichar classNameBuffer[128];
-        static PRUnichar *mClassName = 0;
+    static const wchar_t *className() {
+        static wchar_t classNameBuffer[128];
+        static wchar_t *mClassName = 0;
         if ( !mClassName ) {
             ::_snwprintf(classNameBuffer,
                          128,   // size of classNameBuffer in PRUnichars
                          L"%s%s",
                          NS_ConvertUTF8toUTF16(gAppData->name).get(),
                          L"MessageWindow" );
             mClassName = classNameBuffer;
         }
@@ -638,17 +638,18 @@ nsNativeAppSupportWin::Start( bool *aRes
     }
 
     nsresult rv = NS_ERROR_FAILURE;
     *aResult = false;
 
     // Grab mutex first.
 
     // Build mutex name from app name.
-    ::_snwprintf(mMutexName, sizeof mMutexName / sizeof(PRUnichar), L"%s%s%s", 
+    ::_snwprintf(reinterpret_cast<wchar_t*>(mMutexName),
+                 sizeof mMutexName / sizeof(PRUnichar), L"%s%s%s",
                  MOZ_MUTEX_NAMESPACE,
                  NS_ConvertUTF8toUTF16(gAppData->name).get(),
                  MOZ_STARTUP_MUTEX_NAME );
     Mutex startupLock = Mutex( mMutexName );
 
     NS_ENSURE_TRUE( startupLock.Lock( MOZ_DDE_START_TIMEOUT ), NS_ERROR_FAILURE );
 
     // Search for existing message window.
@@ -1213,17 +1214,17 @@ void nsNativeAppSupportWin::ParseDDEArg(
 void nsNativeAppSupportWin::ParseDDEArg( HSZ args, int index, nsString& aString) {
     DWORD argLen = DdeQueryStringW( mInstance, args, nullptr, 0, CP_WINUNICODE );
     // there wasn't any string, so return empty string
     if ( !argLen ) return;
     nsAutoString temp;
     // Ensure result's buffer is sufficiently big.
     temp.SetLength( argLen );
     // Now get the string contents.
-    DdeQueryString( mInstance, args, temp.BeginWriting(), temp.Length(), CP_WINUNICODE );
+    DdeQueryString( mInstance, args, reinterpret_cast<wchar_t*>(temp.BeginWriting()), temp.Length(), CP_WINUNICODE );
     // Parse out the given arg.
     ParseDDEArg(temp.get(), index, aString);
     return;
 }
 
 HDDEDATA nsNativeAppSupportWin::CreateDDEData( DWORD value ) {
     return CreateDDEData( (LPBYTE)&value, sizeof value );
 }
--- a/toolkit/xre/nsWindowsRestart.cpp
+++ b/toolkit/xre/nsWindowsRestart.cpp
@@ -19,17 +19,17 @@
 #include <userenv.h>
 #pragma comment(lib, "userenv.lib")
 
 /**
  * Get the length that the string will take and takes into account the
  * additional length if the string needs to be quoted and if characters need to
  * be escaped.
  */
-static int ArgStrLen(const PRUnichar *s)
+static int ArgStrLen(const wchar_t *s)
 {
   int backslashes = 0;
   int i = wcslen(s);
   BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr;
   // Only add doublequotes if the string contains a space or a tab
   BOOL addDoubleQuotes = wcspbrk(s, L" \t") != nullptr;
 
   if (addDoubleQuotes) {
@@ -60,17 +60,17 @@ static int ArgStrLen(const PRUnichar *s)
  * Copy string "s" to string "d", quoting the argument as appropriate and
  * escaping doublequotes along with any backslashes that immediately precede
  * doublequotes.
  * The CRT parses this to retrieve the original argc/argv that we meant,
  * see STDARGV.C in the MSVC CRT sources.
  *
  * @return the end of the string
  */
-static PRUnichar* ArgToString(PRUnichar *d, const PRUnichar *s)
+static wchar_t* ArgToString(wchar_t *d, const wchar_t *s)
 {
   int backslashes = 0;
   BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr;
   // Only add doublequotes if the string contains a space or a tab
   BOOL addDoubleQuotes = wcspbrk(s, L" \t") != nullptr;
 
   if (addDoubleQuotes) {
     *d = '"'; // initial doublequote
@@ -111,35 +111,35 @@ static PRUnichar* ArgToString(PRUnichar 
 }
 
 /**
  * Creates a command line from a list of arguments. The returned
  * string is allocated with "malloc" and should be "free"d.
  *
  * argv is UTF8
  */
-PRUnichar*
-MakeCommandLine(int argc, PRUnichar **argv)
+wchar_t*
+MakeCommandLine(int argc, wchar_t **argv)
 {
   int i;
   int len = 0;
 
   // The + 1 of the last argument handles the allocation for null termination
   for (i = 0; i < argc; ++i)
     len += ArgStrLen(argv[i]) + 1;
 
   // Protect against callers that pass 0 arguments
   if (len == 0)
     len = 1;
 
-  PRUnichar *s = (PRUnichar*) malloc(len * sizeof(PRUnichar));
+  wchar_t *s = (wchar_t*) malloc(len * sizeof(wchar_t));
   if (!s)
     return nullptr;
 
-  PRUnichar *c = s;
+  wchar_t *c = s;
   for (i = 0; i < argc; ++i) {
     c = ArgToString(c, argv[i]);
     if (i + 1 != argc) {
       *c = ' ';
       ++c;
     }
   }
 
@@ -163,17 +163,17 @@ AllocConvertUTF8toUTF16(const char *arg)
 
   ConvertUTF8toUTF16 convert(s);
   convert.write(arg, len);
   convert.write_terminator();
   return s;
 }
 
 static void
-FreeAllocStrings(int argc, PRUnichar **argv)
+FreeAllocStrings(int argc, wchar_t **argv)
 {
   while (argc) {
     --argc;
     delete [] argv[argc];
   }
 
   delete [] argv;
 }
@@ -182,52 +182,52 @@ FreeAllocStrings(int argc, PRUnichar **a
 
 /**
  * Launch a child process with the specified arguments.
  * @note argv[0] is ignored
  * @note The form of this function that takes char **argv expects UTF-8
  */
 
 BOOL
-WinLaunchChild(const PRUnichar *exePath, 
-               int argc, PRUnichar **argv, 
+WinLaunchChild(const wchar_t *exePath,
+               int argc, wchar_t **argv,
                HANDLE userToken = nullptr,
                HANDLE *hProcess = nullptr);
 
 BOOL
-WinLaunchChild(const PRUnichar *exePath, 
-               int argc, char **argv, 
+WinLaunchChild(const wchar_t *exePath,
+               int argc, char **argv,
                HANDLE userToken,
                HANDLE *hProcess)
 {
-  PRUnichar** argvConverted = new PRUnichar*[argc];
+  wchar_t** argvConverted = new wchar_t*[argc];
   if (!argvConverted)
     return FALSE;
 
   for (int i = 0; i < argc; ++i) {
-    argvConverted[i] = AllocConvertUTF8toUTF16(argv[i]);
+      argvConverted[i] = reinterpret_cast<wchar_t*>(AllocConvertUTF8toUTF16(argv[i]));
     if (!argvConverted[i]) {
       FreeAllocStrings(i, argvConverted);
       return FALSE;
     }
   }
 
   BOOL ok = WinLaunchChild(exePath, argc, argvConverted, userToken, hProcess);
   FreeAllocStrings(argc, argvConverted);
   return ok;
 }
 
 BOOL
-WinLaunchChild(const PRUnichar *exePath, 
+WinLaunchChild(const wchar_t *exePath,
                int argc, 
-               PRUnichar **argv, 
+               wchar_t **argv,
                HANDLE userToken,
                HANDLE *hProcess)
 {
-  PRUnichar *cl;
+  wchar_t *cl;
   BOOL ok;
 
   cl = MakeCommandLine(argc, argv);
   if (!cl) {
     return FALSE;
   }
 
   STARTUPINFOW si = {0};
--- a/toolkit/xre/nsWindowsWMain.cpp
+++ b/toolkit/xre/nsWindowsWMain.cpp
@@ -44,17 +44,17 @@ int main(int argc, char **argv)
 
 #ifndef XRE_WANT_ENVIRON
 int main(int argc, char **argv);
 #else
 int main(int argc, char **argv, char **envp);
 #endif
 
 static char*
-AllocConvertUTF16toUTF8(const WCHAR *arg)
+AllocConvertUTF16toUTF8(char16ptr_t arg)
 {
   // be generous... UTF16 units can expand up to 3 UTF8 units
   int len = wcslen(arg);
   char *s = new char[len * 3 + 1];
   if (!s)
     return nullptr;
 
   ConvertUTF16toUTF8 convert(s);
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -874,17 +874,17 @@ nsXREDirProvider::DoShutdown()
     mProfileNotified = false;
   }
 }
 
 #ifdef XP_WIN
 static nsresult
 GetShellFolderPath(int folder, nsAString& _retval)
 {
-  PRUnichar* buf;
+  wchar_t* buf;
   uint32_t bufLength = _retval.GetMutableData(&buf, MAXPATHLEN + 3);
   NS_ENSURE_TRUE(bufLength >= (MAXPATHLEN + 3), NS_ERROR_OUT_OF_MEMORY);
 
   nsresult rv = NS_OK;
 
   LPITEMIDLIST pItemIDList = nullptr;
 
   if (SUCCEEDED(SHGetSpecialFolderLocation(nullptr, folder, &pItemIDList)) &&
@@ -955,24 +955,24 @@ GetRegWindowsAppDataFolder(bool aLocal, 
   return NS_OK;
 }
 
 static bool
 GetCachedHash(HKEY rootKey, const nsAString &regPath, const nsAString &path,
               nsAString &cachedHash)
 {
   HKEY baseKey;
-  if (RegOpenKeyExW(rootKey, regPath.BeginReading(), 0, KEY_READ, &baseKey) !=
+  if (RegOpenKeyExW(rootKey, reinterpret_cast<const wchar_t*>(regPath.BeginReading()), 0, KEY_READ, &baseKey) !=
       ERROR_SUCCESS) {
     return false;
   }
 
   wchar_t cachedHashRaw[512];
   DWORD bufferSize = sizeof(cachedHashRaw);
-  LONG result = RegQueryValueExW(baseKey, path.BeginReading(), 0, nullptr,
+  LONG result = RegQueryValueExW(baseKey, reinterpret_cast<const wchar_t*>(path.BeginReading()), 0, nullptr,
                                  (LPBYTE)cachedHashRaw, &bufferSize);
   RegCloseKey(baseKey);
   if (result == ERROR_SUCCESS) {
     cachedHash.Assign(cachedHashRaw);
   }
   return ERROR_SUCCESS == result;
 }
 
@@ -1040,17 +1040,17 @@ nsXREDirProvider::GetUpdateRootDir(nsIFi
 
   nsAutoString appPath;
   rv = updRoot->GetPath(appPath);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // AppDir may be a short path. Convert to long path to make sure
   // the consistency of the update folder location
   nsString longPath;
-  PRUnichar* buf;
+  wchar_t* buf;
 
   uint32_t bufLength = longPath.GetMutableData(&buf, MAXPATHLEN);
   NS_ENSURE_TRUE(bufLength >= MAXPATHLEN, NS_ERROR_OUT_OF_MEMORY);
 
   DWORD len = GetLongPathNameW(appPath.get(), buf, bufLength);
 
   // Failing GetLongPathName() is not fatal.
   if (len <= 0 || len >= bufLength)
--- a/toolkit/xre/test/win/TestXREMakeCommandLineWin.cpp
+++ b/toolkit/xre/test/win/TestXREMakeCommandLineWin.cpp
@@ -37,18 +37,18 @@
 // Verbose output can be enabled by defining VERBOSE 1
 #define VERBOSE 0
 
 // Compares compareCmdLine with the output of MakeCommandLine. This is
 // accomplished by converting inCmdLine to an argument list with
 // CommandLineToArgvW and converting it back to a command line with
 // MakeCommandLine.
 static int
-verifyCmdLineCreation(PRUnichar *inCmdLine,
-                      PRUnichar *compareCmdLine,
+verifyCmdLineCreation(wchar_t *inCmdLine,
+                      wchar_t *compareCmdLine,
                       bool passes, int testNum)
 {
   int rv = 0;
   int i;
   int inArgc;
   int outArgc;
   bool isEqual;
 
@@ -59,23 +59,23 @@ verifyCmdLineCreation(PRUnichar *inCmdLi
   // can also redirect the console output to a file that has been saved as Unicode
   // to view the characters.
 //  _setmode(_fileno(stdout), _O_WTEXT);
 
   // Prepend an additional argument to the command line. CommandLineToArgvW
   // handles argv[0] differently than other arguments since argv[0] is the path
   // to the binary being executed and MakeCommandLine only handles argv[1] and
   // larger.
-  PRUnichar *inCmdLineNew = (PRUnichar *) malloc((wcslen(DUMMY_ARG1) + wcslen(inCmdLine) + 1) * sizeof(PRUnichar));
+  wchar_t *inCmdLineNew = (wchar_t *) malloc((wcslen(DUMMY_ARG1) + wcslen(inCmdLine) + 1) * sizeof(wchar_t));
   wcscpy(inCmdLineNew, DUMMY_ARG1);
   wcscat(inCmdLineNew, inCmdLine);
   LPWSTR *inArgv = CommandLineToArgvW(inCmdLineNew, &inArgc);
 
-  PRUnichar *outCmdLine = MakeCommandLine(inArgc - 1, inArgv + 1);
-  PRUnichar *outCmdLineNew = (PRUnichar *) malloc((wcslen(DUMMY_ARG1) + wcslen(outCmdLine) + 1) * sizeof(PRUnichar));
+  wchar_t *outCmdLine = MakeCommandLine(inArgc - 1, inArgv + 1);
+  wchar_t *outCmdLineNew = (wchar_t *) malloc((wcslen(DUMMY_ARG1) + wcslen(outCmdLine) + 1) * sizeof(wchar_t));
   wcscpy(outCmdLineNew, DUMMY_ARG1);
   wcscat(outCmdLineNew, outCmdLine);
   LPWSTR *outArgv = CommandLineToArgvW(outCmdLineNew, &outArgc);
 
   if (VERBOSE) {
     wprintf(L"\n");
     wprintf(L"Verbose Output\n");
     wprintf(L"--------------\n");
@@ -155,51 +155,51 @@ verifyCmdLineCreation(PRUnichar *inCmdLi
   LocalFree(inArgv);
   LocalFree(outArgv);
   free(inCmdLineNew);
   free(outCmdLineNew);
   free(outCmdLine);
   return rv;
 }
 
-int wmain(int argc, PRUnichar *argv[])
+int wmain(int argc, wchar_t *argv[])
 {
   int i;
   int rv = 0;
 
   if (argc > 1 && (_wcsicmp(argv[1], L"-check-one") != 0 ||
                    _wcsicmp(argv[1], L"-check-one") == 0 && argc != 3)) {
     fwprintf(stderr, L"Displays and validates output from MakeCommandLine.\n\n");
     fwprintf(stderr, L"Usage: %s -check-one <test number>\n\n", argv[0]);
     fwprintf(stderr, L"  <test number>\tSpecifies the test number to run from the\n");
     fwprintf(stderr, L"\t\tTestXREMakeCommandLineWin.ini file.\n");
     return 255;
   }
 
-  PRUnichar inifile[MAXPATHLEN];
+  wchar_t inifile[MAXPATHLEN];
   if (!::GetModuleFileNameW(0, inifile, MAXPATHLEN)) {
     wprintf(L"TEST-UNEXPECTED-FAIL | %s | GetModuleFileNameW\n", TEST_NAME);
     return 2;
   }
 
   WCHAR *slash = wcsrchr(inifile, '\\');
   if (!slash) {
     wprintf(L"TEST-UNEXPECTED-FAIL | %s | wcsrchr\n", TEST_NAME);
     return 3;
   }
 
   wcscpy(slash + 1, L"TestXREMakeCommandLineWin.ini\0");
 
   for (i = 0; i < MAX_TESTS; ++i) {
-    PRUnichar sInputVal[MAXPATHLEN];
-    PRUnichar sOutputVal[MAXPATHLEN];
-    PRUnichar sPassesVal[MAXPATHLEN];
-    PRUnichar sInputKey[MAXPATHLEN];
-    PRUnichar sOutputKey[MAXPATHLEN];
-    PRUnichar sPassesKey[MAXPATHLEN];
+    wchar_t sInputVal[MAXPATHLEN];
+    wchar_t sOutputVal[MAXPATHLEN];
+    wchar_t sPassesVal[MAXPATHLEN];
+    wchar_t sInputKey[MAXPATHLEN];
+    wchar_t sOutputKey[MAXPATHLEN];
+    wchar_t sPassesKey[MAXPATHLEN];
 
     if (argc > 2 && _wcsicmp(argv[1], L"-check-one") == 0 && argc == 3) {
       i = _wtoi(argv[2]);
     }
 
     _snwprintf(sInputKey, MAXPATHLEN, L"input_%d", i);
     _snwprintf(sOutputKey, MAXPATHLEN, L"output_%d", i);
     _snwprintf(sPassesKey, MAXPATHLEN, L"passes_%d", i);