Bug 824885 - Fix -Wdeprecated-writable-strings warnings in xremote code. r=karlt.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 26 Dec 2012 21:57:57 -0800
changeset 126402 9d29a67f90b6324088ceb393cde563a6644a6866
parent 126401 19296526f23d7e7bfae15ec93c15a38d7041217c
child 126403 dabddf3ea183100cd39a2b9a1b81b6035d81f209
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs824885
milestone20.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 824885 - Fix -Wdeprecated-writable-strings warnings in xremote code. r=karlt.
toolkit/components/remote/nsXRemoteService.cpp
widget/xremoteclient/XRemoteClient.cpp
widget/xremoteclient/XRemoteClient.h
--- a/toolkit/components/remote/nsXRemoteService.cpp
+++ b/toolkit/components/remote/nsXRemoteService.cpp
@@ -53,17 +53,17 @@ const unsigned char kRemoteVersion[] = "
 #define TO_LITTLE_ENDIAN32(x) \
     ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
     (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
 #else
 #define TO_LITTLE_ENDIAN32(x) (x)
 #endif
 
 // Minimize the roundtrips to the X server by getting all the atoms at once
-static char *XAtomNames[] = {
+static const char *XAtomNames[] = {
   MOZILLA_VERSION_PROP,
   MOZILLA_LOCK_PROP,
   MOZILLA_COMMAND_PROP,
   MOZILLA_RESPONSE_PROP,
   MOZILLA_USER_PROP,
   MOZILLA_PROFILE_PROP,
   MOZILLA_PROGRAM_PROP,
   MOZILLA_COMMANDLINE_PROP
@@ -272,18 +272,19 @@ nsXRemoteService::HandleCommand(char* aC
 
   if (!command.EqualsLiteral("ping")) {
     nsAutoCString desktopStartupID;
     nsDependentCString cmd(aCommand);
     FindExtensionParameterInCommand("DESKTOP_STARTUP_ID",
                                     cmd, '\n',
                                     &desktopStartupID);
 
-    char* argv[3] = {"dummyappname", "-remote", aCommand};
-    rv = cmdline->Init(3, argv, nullptr, nsICommandLine::STATE_REMOTE_EXPLICIT);
+    const char* argv[3] = {"dummyappname", "-remote", aCommand};
+    rv = cmdline->Init(3, const_cast<char**>(argv), nullptr,
+                       nsICommandLine::STATE_REMOTE_EXPLICIT);
     if (NS_FAILED(rv))
       return "509 internal error";
 
     if (aWindow)
       cmdline->SetWindowContext(aWindow);
 
     if (sRemoteImplementation)
       sRemoteImplementation->SetDesktopStartupIDOrTimestamp(desktopStartupID, aTimestamp);
@@ -367,18 +368,18 @@ nsXRemoteService::HandleCommandLine(char
 }
 
 void
 nsXRemoteService::EnsureAtoms(void)
 {
   if (sMozVersionAtom)
     return;
 
-  XInternAtoms(mozilla::DefaultXDisplay(), XAtomNames, ArrayLength(XAtomNames),
-               False, XAtoms);
+  XInternAtoms(mozilla::DefaultXDisplay(), const_cast<char**>(XAtomNames),
+               ArrayLength(XAtomNames), False, XAtoms);
 
   int i = 0;
   sMozVersionAtom     = XAtoms[i++];
   sMozLockAtom        = XAtoms[i++];
   sMozCommandAtom     = XAtoms[i++];
   sMozResponseAtom    = XAtoms[i++];
   sMozUserAtom        = XAtoms[i++];
   sMozProfileAtom     = XAtoms[i++];
--- a/widget/xremoteclient/XRemoteClient.cpp
+++ b/widget/xremoteclient/XRemoteClient.cpp
@@ -75,17 +75,17 @@ XRemoteClient::XRemoteClient()
 XRemoteClient::~XRemoteClient()
 {
   PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::~XRemoteClient"));
   if (mInitialized)
     Shutdown();
 }
 
 // Minimize the roundtrips to the X-server
-static char *XAtomNames[] = {
+static const char *XAtomNames[] = {
   MOZILLA_VERSION_PROP,
   MOZILLA_LOCK_PROP,
   MOZILLA_COMMAND_PROP,
   MOZILLA_RESPONSE_PROP,
   "WM_STATE",
   MOZILLA_USER_PROP,
   MOZILLA_PROFILE_PROP,
   MOZILLA_PROGRAM_PROP,
@@ -102,17 +102,18 @@ XRemoteClient::Init()
     return NS_OK;
 
   // try to open the display
   mDisplay = XOpenDisplay(0);
   if (!mDisplay)
     return NS_ERROR_FAILURE;
 
   // get our atoms
-  XInternAtoms(mDisplay, XAtomNames, ARRAY_LENGTH(XAtomNames), False, XAtoms);
+  XInternAtoms(mDisplay, const_cast<char**>(XAtomNames),
+               ARRAY_LENGTH(XAtomNames), False, XAtoms);
 
   int i = 0;
   mMozVersionAtom  = XAtoms[i++];
   mMozLockAtom     = XAtoms[i++];
   mMozCommandAtom  = XAtoms[i++];
   mMozResponseAtom = XAtoms[i++];
   mMozWMStateAtom  = XAtoms[i++];
   mMozUserAtom     = XAtoms[i++];
--- a/widget/xremoteclient/XRemoteClient.h
+++ b/widget/xremoteclient/XRemoteClient.h
@@ -60,14 +60,13 @@ private:
   Atom           mMozLockAtom;
   Atom           mMozCommandAtom;
   Atom           mMozCommandLineAtom;
   Atom           mMozResponseAtom;
   Atom           mMozWMStateAtom;
   Atom           mMozUserAtom;
   Atom           mMozProfileAtom;
   Atom           mMozProgramAtom;
-  Atom           mMozSupportsCLAtom;
 
   char          *mLockData;
 
   bool           mInitialized;
 };