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

--HG--
extra : rebase_source : bfdabc1f463eca75987c6561f7c3ea60acf0340f
This commit is contained in:
Tom Ritter 2017-08-22 16:58:06 -05:00
parent ef58a48ce4
commit 6fd392825a
3 changed files with 5 additions and 3 deletions

2
uriloader/exthandler/win/nsMIMEInfoWin.cpp Normal file → Executable file
View File

@ -419,7 +419,7 @@ bool nsMIMEInfoWin::GetDllLaunchInfo(nsIFile * aDll,
// Replace embedded environment variables.
uint32_t bufLength =
::ExpandEnvironmentStringsW(appFilesystemCommand.get(),
L"", 0);
nullptr, 0);
if (bufLength == 0) // Error
return false;

4
xpcom/base/nsVersionComparator.cpp Normal file → Executable file
View File

@ -138,8 +138,10 @@ ParseVP(wchar_t* aPart, VersionPartW& aResult)
}
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);
}

View File

@ -1269,7 +1269,7 @@ nsLocalFile::CleanupCmdHandlerPath(nsAString& aCommandHandler)
// 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;