From a56370e043cabf054a506fbfbd17937c4139b602 Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Tue, 26 May 2009 10:53:15 +0200 Subject: [PATCH] Bug 467948 - fix some deprecated conversion from string constant warnings; r=dbaron --- accessible/src/atk/nsAccessibleWrap.cpp | 20 ------------ accessible/src/html/nsHTMLTableAccessible.cpp | 2 +- accessible/src/html/nsHTMLTableAccessible.h | 2 +- embedding/browser/gtk/src/EmbedPrompter.cpp | 4 +-- intl/uconv/tests/TestUConv.cpp | 32 +++++++++---------- modules/libreg/include/NSReg.h | 2 +- modules/libreg/src/reg.c | 2 +- modules/plugin/base/src/nsPluginsDirUnix.cpp | 5 ++- netwerk/cache/src/nsCache.cpp | 2 +- netwerk/cache/src/nsCache.h | 2 +- testing/mochitest/ssltunnel/ssltunnel.cpp | 2 +- xpcom/tests/TestFile.cpp | 2 +- xpcom/threads/nsProcessCommon.cpp | 2 +- 13 files changed, 29 insertions(+), 50 deletions(-) diff --git a/accessible/src/atk/nsAccessibleWrap.cpp b/accessible/src/atk/nsAccessibleWrap.cpp index 016377bb4c89..3fcab6a9c0e1 100644 --- a/accessible/src/atk/nsAccessibleWrap.cpp +++ b/accessible/src/atk/nsAccessibleWrap.cpp @@ -262,26 +262,6 @@ mai_atk_object_get_type(void) return type; } -/* - * Must keep sychronization with enumerate AtkProperty in - * accessible/src/base/nsAccessibleEventData.h - */ -static char * sAtkPropertyNameArray[PROP_LAST] = { - 0, - "accessible-name", - "accessible-description", - "accessible-parent", - "accessible-role", - "accessible-layer", - "accessible-mdi-zorder", - "accessible-table-caption", - "accessible-table-column-description", - "accessible-table-column-header", - "accessible-table-row-description", - "accessible-table-row-header", - "accessible-table-summary" -}; - #ifdef MAI_LOGGING PRInt32 nsAccessibleWrap::mAccWrapCreated = 0; PRInt32 nsAccessibleWrap::mAccWrapDeleted = 0; diff --git a/accessible/src/html/nsHTMLTableAccessible.cpp b/accessible/src/html/nsHTMLTableAccessible.cpp index a9191550c449..cbc6f7f938c1 100644 --- a/accessible/src/html/nsHTMLTableAccessible.cpp +++ b/accessible/src/html/nsHTMLTableAccessible.cpp @@ -1237,7 +1237,7 @@ NS_IMETHODIMP nsHTMLTableAccessible::GetDescription(nsAString& aDescription) return NS_OK; } -PRBool nsHTMLTableAccessible::HasDescendant(char *aTagName, PRBool aAllowEmpty) +PRBool nsHTMLTableAccessible::HasDescendant(const char *aTagName, PRBool aAllowEmpty) { nsCOMPtr tableElt(do_QueryInterface(mDOMNode)); NS_ENSURE_TRUE(tableElt, PR_FALSE); diff --git a/accessible/src/html/nsHTMLTableAccessible.h b/accessible/src/html/nsHTMLTableAccessible.h index 82fc2a393f3b..b99aa4f60460 100644 --- a/accessible/src/html/nsHTMLTableAccessible.h +++ b/accessible/src/html/nsHTMLTableAccessible.h @@ -210,7 +210,7 @@ protected: virtual void CacheChildren(); nsresult GetTableNode(nsIDOMNode **_retval); nsresult GetTableLayout(nsITableLayout **aLayoutObject); - PRBool HasDescendant(char *aTagName, PRBool aAllowEmpty = PR_TRUE); + PRBool HasDescendant(const char *aTagName, PRBool aAllowEmpty = PR_TRUE); #ifdef SHOW_LAYOUT_HEURISTIC nsAutoString mLayoutHeuristic; #endif diff --git a/embedding/browser/gtk/src/EmbedPrompter.cpp b/embedding/browser/gtk/src/EmbedPrompter.cpp index bf0ced4dd68a..dcde711c9b5f 100644 --- a/embedding/browser/gtk/src/EmbedPrompter.cpp +++ b/embedding/browser/gtk/src/EmbedPrompter.cpp @@ -47,8 +47,8 @@ enum { }; struct DialogDescription { - int flags; - gchar* icon; + int flags; + const gchar* icon; }; // This table contains the optional widgets and icons associated with diff --git a/intl/uconv/tests/TestUConv.cpp b/intl/uconv/tests/TestUConv.cpp index 916a61da0c3c..3c4642fc3e8f 100644 --- a/intl/uconv/tests/TestUConv.cpp +++ b/intl/uconv/tests/TestUConv.cpp @@ -76,10 +76,10 @@ private: public: - void AddTrace(char * aTrace); - void DelTrace(char * aTrace); - void PrintError(char * aCall, int aError); - void PrintError(char * aCall, char * aMessage); + void AddTrace(const char * aTrace); + void DelTrace(const char * aTrace); + void PrintError(const char * aCall, const int aError); + void PrintError(const char * aCall, const char * aMessage); }; //---------------------------------------------------------------------------- @@ -178,24 +178,24 @@ int main(int argc, char ** argv) const char * nsTestLog::kTraceDelimiter = "."; -void nsTestLog::AddTrace(char * aTrace) +void nsTestLog::AddTrace(const char * aTrace) { mTrace.Append(aTrace); mTrace.Append(kTraceDelimiter); } -void nsTestLog::DelTrace(char * aTrace) +void nsTestLog::DelTrace(const char * aTrace) { mTrace.Truncate(mTrace.Length() - strlen(aTrace) - strlen(kTraceDelimiter)); } -void nsTestLog::PrintError(char * aCall, int aError) +void nsTestLog::PrintError(const char * aCall, const int aError) { const char * trace = mTrace.get(); printf("ERROR at %s%s code=0x%x.\n", trace, aCall, aError); } -void nsTestLog::PrintError(char * aCall, char * aMessage) +void nsTestLog::PrintError(const char * aCall, const char * aMessage) { const char * trace = mTrace.get(); printf("ERROR at %s%s reason: %s.\n", trace, aCall, aMessage); @@ -206,7 +206,7 @@ void nsTestLog::PrintError(char * aCall, char * aMessage) nsresult nsTestUConv::TestEncoders() { - char * trace = "TestEncoders"; + const char * trace = "TestEncoders"; mLog.AddTrace(trace); nsresult res = NS_OK; @@ -234,7 +234,7 @@ nsresult nsTestUConv::TestEncoders() nsresult nsTestUConv::TestDecoders() { - char * trace = "TestDecoders"; + const char * trace = "TestDecoders"; mLog.AddTrace(trace); nsresult res = NS_OK; @@ -246,7 +246,7 @@ nsresult nsTestUConv::TestDecoders() nsresult nsTestUConv::TestCharsetManager() { - char * trace = "TestCharsetManager"; + const char * trace = "TestCharsetManager"; mLog.AddTrace(trace); nsresult res = NS_OK; nsAutoString name; @@ -265,7 +265,7 @@ nsresult nsTestUConv::TestCharsetManager() nsresult nsTestUConv::DisplayDetectors() { - char * trace = "DisplayDetectors"; + const char * trace = "DisplayDetectors"; mLog.AddTrace(trace); nsresult res = NS_OK; @@ -314,7 +314,7 @@ nsresult nsTestUConv::DisplayDetectors() nsresult nsTestUConv::DisplayCharsets() { - char * trace = "DisplayCharsets"; + const char * trace = "DisplayCharsets"; mLog.AddTrace(trace); nsresult res = NS_OK; @@ -448,7 +448,7 @@ nsresult nsTestUConv::DisplayCharsets() nsresult nsTestUConv::TestTempBug() { - char * trace = "TestTempBug"; + const char * trace = "TestTempBug"; mLog.AddTrace(trace); nsresult res = NS_OK; @@ -471,7 +471,7 @@ nsresult nsTestUConv::Encode(PRUnichar ** aSrc, PRUnichar * aSrcEnd, char ** aDest, char * aDestEnd, const nsAFlatCString& aCharset) { - char * trace = "Encode"; + const char * trace = "Encode"; mLog.AddTrace(trace); nsresult res = NS_OK; @@ -540,7 +540,7 @@ void nsTestUConv::PrintSpaces(int aCount) nsresult nsTestUConv::Main(int aArgC, char ** aArgV) { - char * trace = "Main"; + const char * trace = "Main"; mLog.AddTrace(trace); nsresult res = NS_OK; diff --git a/modules/libreg/include/NSReg.h b/modules/libreg/include/NSReg.h index 1125ea278445..c90b46b1e569 100644 --- a/modules/libreg/include/NSReg.h +++ b/modules/libreg/include/NSReg.h @@ -453,7 +453,7 @@ VR_INTERFACE(REGERR) NR_RegGetEntryInfo( VR_INTERFACE(REGERR) NR_RegGetEntryString( HREG hReg, /* handle of open registry */ RKEY key, /* containing key */ - char *name, /* entry name */ + const char *name, /* entry name */ char *buffer, /* buffer to hold value (UTF String) */ uint32 bufsize /* length of buffer */ ); diff --git a/modules/libreg/src/reg.c b/modules/libreg/src/reg.c index 7f00a4b55dbc..a500d6189d1c 100644 --- a/modules/libreg/src/reg.c +++ b/modules/libreg/src/reg.c @@ -2788,7 +2788,7 @@ VR_INTERFACE(REGERR) NR_RegGetEntryInfo( HREG hReg, RKEY key, char *name, * bufsize - size of buffer * --------------------------------------------------------------------- */ -VR_INTERFACE(REGERR) NR_RegGetEntryString( HREG hReg, RKEY key, char *name, +VR_INTERFACE(REGERR) NR_RegGetEntryString( HREG hReg, RKEY key, const char *name, char *buffer, uint32 bufsize) { REGERR err; diff --git a/modules/plugin/base/src/nsPluginsDirUnix.cpp b/modules/plugin/base/src/nsPluginsDirUnix.cpp index 18b074dd0815..5195a4f34f57 100644 --- a/modules/plugin/base/src/nsPluginsDirUnix.cpp +++ b/modules/plugin/base/src/nsPluginsDirUnix.cpp @@ -168,10 +168,9 @@ static void LoadExtraSharedLibs() nsresult res; nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &res)); if (NS_SUCCEEDED(res) && (prefs != nsnull)) { - char *sonamesListFromPref = PREF_PLUGINS_SONAME; char *sonameList = NULL; PRBool prefSonameListIsSet = PR_TRUE; - res = prefs->GetCharPref(sonamesListFromPref, &sonameList); + res = prefs->GetCharPref(PREF_PLUGINS_SONAME, &sonameList); if (!sonameList) { // pref is not set, lets use hardcoded list prefSonameListIsSet = PR_FALSE; @@ -247,7 +246,7 @@ static void LoadExtraSharedLibs() // if user specified some bogus soname I overwrite it here, // otherwise it'll decrease performance by calling popen() in SearchForSoname // every time for each bogus name - prefs->SetCharPref(sonamesListFromPref, (const char *)sonameListToSave); + prefs->SetCharPref(PREF_PLUGINS_SONAME, (const char *)sonameListToSave); } PL_strfree(sonameList); } diff --git a/netwerk/cache/src/nsCache.cpp b/netwerk/cache/src/nsCache.cpp index e2dd6e3ca092..a3372f741fa3 100644 --- a/netwerk/cache/src/nsCache.cpp +++ b/netwerk/cache/src/nsCache.cpp @@ -64,7 +64,7 @@ CacheLogInit() void -CacheLogPrintPath(PRLogModuleLevel level, char * format, nsIFile * item) +CacheLogPrintPath(PRLogModuleLevel level, const char * format, nsIFile * item) { nsCAutoString path; nsresult rv = item->GetNativePath(path); diff --git a/netwerk/cache/src/nsCache.h b/netwerk/cache/src/nsCache.h index 0c08d3346823..c44bd71b7e24 100644 --- a/netwerk/cache/src/nsCache.h +++ b/netwerk/cache/src/nsCache.h @@ -59,7 +59,7 @@ extern PRLogModuleInfo * gCacheLog; void CacheLogInit(); void CacheLogPrintPath(PRLogModuleLevel level, - char * format, + const char * format, nsIFile * item); #define CACHE_LOG_INIT() CacheLogInit() #define CACHE_LOG_ALWAYS(args) PR_LOG(gCacheLog, PR_LOG_ALWAYS, args) diff --git a/testing/mochitest/ssltunnel/ssltunnel.cpp b/testing/mochitest/ssltunnel/ssltunnel.cpp index d3aeb117bf1f..3f16c7b2721e 100644 --- a/testing/mochitest/ssltunnel/ssltunnel.cpp +++ b/testing/mochitest/ssltunnel/ssltunnel.cpp @@ -822,7 +822,7 @@ PRIntn freeClientAuthHashItems(PLHashEntry *he, PRIntn i, void *arg) int main(int argc, char** argv) { - char* configFilePath; + const char* configFilePath; if (argc == 1) configFilePath = "ssltunnel.cfg"; else diff --git a/xpcom/tests/TestFile.cpp b/xpcom/tests/TestFile.cpp index 9faf59d021d4..cbbf904156f3 100644 --- a/xpcom/tests/TestFile.cpp +++ b/xpcom/tests/TestFile.cpp @@ -45,7 +45,7 @@ static const char* gFunction = "main"; -static PRBool VerifyResult(nsresult aRV, char* aMsg) +static PRBool VerifyResult(nsresult aRV, const char* aMsg) { if (NS_FAILED(aRV)) { fail("%s %s, rv=%x", gFunction, aMsg, aRV); diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index 1f36aad21083..74d3e6f9b220 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -294,7 +294,7 @@ void nsProcess::ProcessComplete() mThread = nsnull; } - char* topic; + const char* topic; if (mExitValue < 0) topic = "process-failed"; else