Bug 1394013 Fix forbidden string constant assignment r=froydnj
authorTom Ritter <tom@mozilla.com>
Tue, 22 Aug 2017 16:58:06 -0500
changeset 428945 2b7ede324ce2142fef0451f3b84d7f128cbffdf0
parent 428944 92659c8ed9f20e968f6cc764328cc002da831471
child 428946 4f5afb7fe096fefc59c62c5dcfe95f95589645de
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1394013
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1394013 Fix forbidden string constant assignment r=froydnj ISO C++ forbids converting a string constant to 'wchar_t*' [-Werror=write-strings] Either change it to a nullptr (which has same intent) or pass through a static MozReview-Commit-ID: CSunOCyO9PN
uriloader/exthandler/win/nsMIMEInfoWin.cpp
xpcom/base/nsVersionComparator.cpp
xpcom/io/nsLocalFileWin.cpp
old mode 100644
new mode 100755
--- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp
+++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp
@@ -414,17 +414,17 @@ bool nsMIMEInfoWin::GetDllLaunchInfo(nsI
     return false;
 
   nsAutoString appFilesystemCommand;
   if (NS_SUCCEEDED(appKey->ReadStringValue(EmptyString(),
                                            appFilesystemCommand))) {
     // Replace embedded environment variables.
     uint32_t bufLength = 
       ::ExpandEnvironmentStringsW(appFilesystemCommand.get(),
-                                  L"", 0);
+                                  nullptr, 0);
     if (bufLength == 0) // Error
       return false;
 
     auto destination = mozilla::MakeUniqueFallible<wchar_t[]>(bufLength);
     if (!destination)
       return false;
     if (!::ExpandEnvironmentStringsW(appFilesystemCommand.get(),
                                      destination.get(),
old mode 100644
new mode 100755
--- a/xpcom/base/nsVersionComparator.cpp
+++ b/xpcom/base/nsVersionComparator.cpp
@@ -133,18 +133,20 @@ ParseVP(wchar_t* aPart, VersionPartW& aR
   }
 
   dot = wcschr(aPart, '.');
   if (dot) {
     *dot = '\0';
   }
 
   if (aPart[0] == '*' && aPart[1] == '\0') {
+    static wchar_t kEmpty[] = L"";
+
     aResult.numA = INT32_MAX;
-    aResult.strB = L"";
+    aResult.strB = kEmpty;
   } else {
     aResult.numA = wcstol(aPart, const_cast<wchar_t**>(&aResult.strB), 10);
   }
 
   if (!*aResult.strB) {
     aResult.strB = nullptr;
     aResult.strBlen = 0;
   } else {
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -1264,17 +1264,17 @@ nsLocalFile::CleanupCmdHandlerPath(nsASt
   // rundll32.exe "%ProgramFiles%\Win...ery\PhotoViewer.dll", var var
   // rundll32.exe "%ProgramFiles%\Windows Photo Gallery\PhotoViewer.dll"
   // C:\Windows\System32\rundll32.exe "path to dll", var var
   // %SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Win...ery\Photo
   //    Viewer.dll", var var
 
   // Expand environment variables so we have full path strings.
   uint32_t bufLength = ::ExpandEnvironmentStringsW(handlerCommand.get(),
-                                                   L"", 0);
+                                                   nullptr, 0);
   if (bufLength == 0) // Error
     return false;
 
   auto destination = mozilla::MakeUniqueFallible<wchar_t[]>(bufLength);
   if (!destination)
     return false;
   if (!::ExpandEnvironmentStringsW(handlerCommand.get(), destination.get(),
                                    bufLength))