Bug 563191 - Fix clang warnings about string constants in nsAuthSambaNTLM::SpawnNTLMAuthHelper. r=ehsan
authorCameron McCormack <cam@mcc.id.au>
Thu, 12 Jul 2012 11:05:02 +1000
changeset 99026 f14591911ad8f0c6b0e47abc89c08cd830492320
parent 99025 56141758a0f0f262a427c274412b336a76a8ec94
child 99027 367729a91a97ea9895debf47a73deba6a437f08f
push id23099
push useremorley@mozilla.com
push dateThu, 12 Jul 2012 16:29:09 +0000
treeherdermozilla-central@f9499238bd4b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs563191
milestone16.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 563191 - Fix clang warnings about string constants in nsAuthSambaNTLM::SpawnNTLMAuthHelper. r=ehsan
extensions/auth/nsAuthSambaNTLM.cpp
--- a/extensions/auth/nsAuthSambaNTLM.cpp
+++ b/extensions/auth/nsAuthSambaNTLM.cpp
@@ -41,17 +41,17 @@ nsAuthSambaNTLM::Shutdown()
         PR_WaitProcess(mChildPID, &exitCode);
         mChildPID = nsnull;
     }
 }
 
 NS_IMPL_ISUPPORTS1(nsAuthSambaNTLM, nsIAuthModule)
 
 static bool
-SpawnIOChild(char** aArgs, PRProcess** aPID,
+SpawnIOChild(char* const* aArgs, PRProcess** aPID,
              PRFileDesc** aFromChildFD, PRFileDesc** aToChildFD)
 {
     PRFileDesc* toChildPipeRead;
     PRFileDesc* toChildPipeWrite;
     if (PR_CreatePipe(&toChildPipeRead, &toChildPipeWrite) != PR_SUCCESS)
         return false;
     PR_SetFDInheritable(toChildPipeRead, true);
     PR_SetFDInheritable(toChildPipeWrite, false);
@@ -167,25 +167,25 @@ static PRUint8* ExtractMessage(const nsA
 
 nsresult
 nsAuthSambaNTLM::SpawnNTLMAuthHelper()
 {
     const char* username = PR_GetEnv("USER");
     if (!username)
         return NS_ERROR_FAILURE;
 
-    char* args[] = {
+    const char* const args[] = {
         "ntlm_auth",
         "--helper-protocol", "ntlmssp-client-1",
         "--use-cached-creds",
-        "--username", const_cast<char*>(username),
+        "--username", username,
         nsnull
     };
 
-    bool isOK = SpawnIOChild(args, &mChildPID, &mFromChildFD, &mToChildFD);
+    bool isOK = SpawnIOChild(const_cast<char* const*>(args), &mChildPID, &mFromChildFD, &mToChildFD);
     if (!isOK)  
         return NS_ERROR_FAILURE;
 
     if (!WriteString(mToChildFD, NS_LITERAL_CSTRING("YR\n")))
         return NS_ERROR_FAILURE;
     nsCString line;
     if (!ReadLine(mFromChildFD, line))
         return NS_ERROR_FAILURE;