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
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
@@ -1265,17 +1265,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))