Bug 467948 - fix some deprecated conversion from string constant warnings; r=dbaron
authorArpad Borsos <arpad.borsos@googlemail.com>
Tue, 26 May 2009 10:53:15 +0200
changeset 29050 96c833c60acb30793e59cc586a466ff1eb74f1c7
parent 29049 a12ef932037a5da6b5d3eebf9a0cbff287314870
child 29051 b7a674c24602259597d76fe89d2a46caad05e9ad
push idunknown
push userunknown
push dateunknown
reviewersdbaron
bugs467948
milestone1.9.2a1pre
Bug 467948 - fix some deprecated conversion from string constant warnings; r=dbaron
accessible/src/atk/nsAccessibleWrap.cpp
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/src/html/nsHTMLTableAccessible.h
embedding/browser/gtk/src/EmbedPrompter.cpp
intl/uconv/tests/TestUConv.cpp
modules/libreg/include/NSReg.h
modules/libreg/src/reg.c
modules/plugin/base/src/nsPluginsDirUnix.cpp
netwerk/cache/src/nsCache.cpp
netwerk/cache/src/nsCache.h
testing/mochitest/ssltunnel/ssltunnel.cpp
xpcom/tests/TestFile.cpp
xpcom/threads/nsProcessCommon.cpp
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -257,36 +257,16 @@ mai_atk_object_get_type(void)
 
         type = g_type_register_static(ATK_TYPE_OBJECT,
                                       "MaiAtkObject", &tinfo, GTypeFlags(0));
         quark_mai_hyperlink = g_quark_from_static_string("MaiHyperlink");
     }
     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;
 #endif
 
 nsAccessibleWrap::nsAccessibleWrap(nsIDOMNode* aNode,
                                    nsIWeakReference *aShell)
     : nsAccessible(aNode, aShell),
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -1232,17 +1232,17 @@ NS_IMETHODIMP nsHTMLTableAccessible::Get
 #ifdef DEBUG_A11Y
   printf("\nTABLE: %s\n", NS_ConvertUTF16toUTF8(mLayoutHeuristic).get());
 #endif
 #endif
 
   return NS_OK;
 }
 
-PRBool nsHTMLTableAccessible::HasDescendant(char *aTagName, PRBool aAllowEmpty)
+PRBool nsHTMLTableAccessible::HasDescendant(const char *aTagName, PRBool aAllowEmpty)
 {
   nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mDOMNode));
   NS_ENSURE_TRUE(tableElt, PR_FALSE);
 
   nsCOMPtr<nsIDOMNodeList> nodeList;
   nsAutoString tagName;
   tagName.AssignWithConversion(aTagName);
   tableElt->GetElementsByTagName(tagName, getter_AddRefs(nodeList));
--- a/accessible/src/html/nsHTMLTableAccessible.h
+++ b/accessible/src/html/nsHTMLTableAccessible.h
@@ -205,17 +205,17 @@ protected:
    * @param aDoSelect - indicates whether cell should be selected or unselected
    */
   nsresult SelectCell(nsISelection *aSelection, nsIDocument *aDocument,
                       nsIDOMElement *aCellElement, PRBool aDoSelect);
 
   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
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLTableAccessible,
                               NS_TABLEACCESSIBLE_IMPL_CID)
 
--- a/embedding/browser/gtk/src/EmbedPrompter.cpp
+++ b/embedding/browser/gtk/src/EmbedPrompter.cpp
@@ -42,18 +42,18 @@
 enum {
     INCLUDE_USERNAME = 1 << 0,
     INCLUDE_PASSWORD = 1 << 1,
     INCLUDE_CHECKBOX = 1 << 2,
     INCLUDE_CANCEL   = 1 << 3
 };
 
 struct DialogDescription {
-    int    flags;
-    gchar* icon;
+    int          flags;
+    const gchar* icon;
 };
 
 // This table contains the optional widgets and icons associated with
 // each type of dialog.
 
 static const DialogDescription DialogTable[] = {
     { 0,                      GTK_STOCK_DIALOG_WARNING  },  // ALERT
     { INCLUDE_CHECKBOX,       GTK_STOCK_DIALOG_WARNING  },  // ALERT_CHECK
--- a/intl/uconv/tests/TestUConv.cpp
+++ b/intl/uconv/tests/TestUConv.cpp
@@ -71,20 +71,20 @@ class nsTestLog
 private:
 
   static const char * kTraceDelimiter;
 
   nsCAutoString mTrace;
 
 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);
 };
   
 //----------------------------------------------------------------------------
 // Class nsTestUConv [declaration]
 
 /**
  * The main class of the program.
  *
@@ -173,45 +173,45 @@ int main(int argc, char ** argv)
   return (NS_FAILED(res));
 }
 
 //----------------------------------------------------------------------------
 // Class nsTestLog [implementation]
 
 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);
 }
 
 //----------------------------------------------------------------------------
 // Class nsTestUConv [implementation]
 
 nsresult nsTestUConv::TestEncoders()
 {
-  char * trace = "TestEncoders";
+  const char * trace = "TestEncoders";
   mLog.AddTrace(trace);
   nsresult res = NS_OK;
 
   nsCOMPtr<nsICharsetConverterManager> ccMan = 
            do_GetService(kCharsetConverterManagerCID, &res);
   if (NS_FAILED(res)) return res;
   
   nsCOMPtr<nsIUTF8StringEnumerator> encoders;
@@ -229,29 +229,29 @@ nsresult nsTestUConv::TestEncoders()
   }
   
   mLog.DelTrace(trace);
   return res;
 }
 
 nsresult nsTestUConv::TestDecoders()
 {
-  char * trace = "TestDecoders";
+  const char * trace = "TestDecoders";
   mLog.AddTrace(trace);
   nsresult res = NS_OK;
 
   // XXX write me
 
   mLog.DelTrace(trace);
   return res;
 }
 
 nsresult nsTestUConv::TestCharsetManager()
 {
-  char * trace = "TestCharsetManager";
+  const char * trace = "TestCharsetManager";
   mLog.AddTrace(trace);
   nsresult res = NS_OK;
   nsAutoString name;
   nsCOMPtr<nsIAtom> csAtom;
 
   nsCOMPtr<nsICharsetConverterManager> ccMan = 
            do_GetService(kCharsetConverterManagerCID, &res);
   if (NS_FAILED(res)) {
@@ -260,17 +260,17 @@ nsresult nsTestUConv::TestCharsetManager
   }
 
   mLog.DelTrace(trace);
   return res;
 }
 
 nsresult nsTestUConv::DisplayDetectors()
 {
-  char * trace = "DisplayDetectors";
+  const char * trace = "DisplayDetectors";
   mLog.AddTrace(trace);
   nsresult res = NS_OK;
 
   nsCOMPtr<nsICharsetConverterManager> ccMan = 
            do_GetService(kCharsetConverterManagerCID, &res);
   if (NS_FAILED(res)) {
     mLog.PrintError("NS_WITH_SERVICE", res);
     return res;
@@ -309,17 +309,17 @@ nsresult nsTestUConv::DisplayDetectors()
   }
   
   mLog.DelTrace(trace);
   return NS_OK;
 }
 
 nsresult nsTestUConv::DisplayCharsets()
 {
-  char * trace = "DisplayCharsets";
+  const char * trace = "DisplayCharsets";
   mLog.AddTrace(trace);
   nsresult res = NS_OK;
 
   nsCOMPtr<nsICharsetConverterManager> ccMan = 
            do_GetService(kCharsetConverterManagerCID, &res);
   if (NS_FAILED(res)) {
     mLog.PrintError("NS_WITH_SERVICE", res);
     return res;
@@ -443,17 +443,17 @@ nsresult nsTestUConv::DisplayCharsets()
   printf("%u of %u encoders are basic (%d%%)\n",
          basicEncCount, encCount, (basicEncCount * 100) / encCount);
   mLog.DelTrace(trace);
   return NS_OK;
 }
 
 nsresult nsTestUConv::TestTempBug()
 {
-  char * trace = "TestTempBug";
+  const char * trace = "TestTempBug";
   mLog.AddTrace(trace);
   nsresult res = NS_OK;
 
   NS_NAMED_LITERAL_CSTRING(charset, "ISO-2022-JP");
   PRUnichar src[] = {0x0043, 0x004e, 0x0045, 0x0054, 0x0020, 0x004A, 0x0061, 
     0x0070, 0x0061, 0x006E, 0x0020, 0x7DE8, 0x96C6, 0x5C40};
   PRUnichar * srcEnd = src + ARRAY_SIZE(src);
   char dest[BIG_BUFFER_SIZE];
@@ -466,17 +466,17 @@ nsresult nsTestUConv::TestTempBug()
   mLog.DelTrace(trace);
   return res;
 }
 
 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;
 
   nsCOMPtr<nsICharsetConverterManager> ccMan = 
            do_GetService(kCharsetConverterManagerCID, &res);
   if (NS_FAILED(res)) {
     mLog.PrintError("NS_WITH_SERVICE", res);
     return res;
@@ -535,17 +535,17 @@ nsresult nsTestUConv::FinishEncode(char 
 
 void nsTestUConv::PrintSpaces(int aCount)
 {
   for (int i = 0; i < aCount; i++) printf(" ");
 }
 
 nsresult nsTestUConv::Main(int aArgC, char ** aArgV)
 {
-  char * trace = "Main";
+  const char * trace = "Main";
   mLog.AddTrace(trace);
   nsresult res = NS_OK;
 
   if (aArgC < 2) {
     // no arguments were passed to the program, so we just run the self tests
     res = TestCharsetManager();
     if (NS_SUCCEEDED(res)) res = TestEncoders();
     if (NS_SUCCEEDED(res)) res = TestDecoders();
--- a/modules/libreg/include/NSReg.h
+++ b/modules/libreg/include/NSReg.h
@@ -448,17 +448,17 @@ VR_INTERFACE(REGERR) NR_RegGetEntryInfo(
  *    name     - name of entry
  *    buffer   - destination for string
  *    bufsize  - size of buffer
  * ---------------------------------------------------------------------
  */
 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 */
        );
 
 /* ---------------------------------------------------------------------
  * NR_RegGetEntry - Get the value data associated with the
  *                  named entry of the specified key.
  *
--- a/modules/libreg/src/reg.c
+++ b/modules/libreg/src/reg.c
@@ -2783,17 +2783,17 @@ VR_INTERFACE(REGERR) NR_RegGetEntryInfo(
  * Parameters:
  *    hReg     - handle of open registry
  *    key      - RKEY of key that contains entry--obtain with NR_RegGetKey()
  *    name     - name of entry
  *    buffer   - destination for string
  *    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;
     REGFILE*    reg;
     REGDESC     desc;
 
     XP_ASSERT( regStartCount > 0 );
 
--- a/modules/plugin/base/src/nsPluginsDirUnix.cpp
+++ b/modules/plugin/base/src/nsPluginsDirUnix.cpp
@@ -163,20 +163,19 @@ static PRBool LoadExtraSharedLib(const c
 */
 
 static void LoadExtraSharedLibs()
 {
     // check out if user's prefs.js has libs name
     nsresult res;
     nsCOMPtr<nsIPrefBranch> 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;
             sonameList = PL_strdup(DEFAULT_EXTRA_LIBS_LIST);
         }
         if (sonameList) {
             char *arrayOfLibs[PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS] = {0};
             int numOfLibs = 0;
@@ -242,17 +241,17 @@ static void LoadExtraSharedLibs()
             if (sonameListToSave[0]) 
                 for (p = &sonameListToSave[PL_strlen(sonameListToSave) - 1]; *p == ':'; p--)
                     *p = 0; //delete tail ":" delimiters
 
             if (!prefSonameListIsSet || PL_strcmp(sonameList, sonameListToSave)) {
                 // 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);
         }
     }
 }
 #endif //MOZ_WIDGET_GTK2
 
 
--- a/netwerk/cache/src/nsCache.cpp
+++ b/netwerk/cache/src/nsCache.cpp
@@ -59,17 +59,17 @@ CacheLogInit()
 {
     if (gCacheLog) return;
     gCacheLog = PR_NewLogModule("cache");
     NS_ASSERTION(gCacheLog, "\nfailed to allocate cache log.\n");
 }
 
 
 void
-CacheLogPrintPath(PRLogModuleLevel level, char * format, nsIFile * item)
+CacheLogPrintPath(PRLogModuleLevel level, const char * format, nsIFile * item)
 {
     nsCAutoString path;
     nsresult rv = item->GetNativePath(path);
     if (NS_SUCCEEDED(rv)) {
         PR_LOG(gCacheLog, level, (format, path.get()));
     } else {
         PR_LOG(gCacheLog, level, ("GetNativePath failed: %x", rv));
     }
--- a/netwerk/cache/src/nsCache.h
+++ b/netwerk/cache/src/nsCache.h
@@ -54,17 +54,17 @@
 #include "nsError.h"
 #include "prlog.h"
 
 // PR_LOG args = "format string", arg, arg, ...
 #if defined(PR_LOGGING)
 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)
 #define CACHE_LOG_ERROR(args)   PR_LOG(gCacheLog, PR_LOG_ERROR, args)
 #define CACHE_LOG_WARNING(args) PR_LOG(gCacheLog, PR_LOG_WARNING, args)
 #define CACHE_LOG_DEBUG(args)   PR_LOG(gCacheLog, PR_LOG_DEBUG, args)
 #define CACHE_LOG_PATH(level, format, item) \
                                 CacheLogPrintPath(level, format, item)
--- a/testing/mochitest/ssltunnel/ssltunnel.cpp
+++ b/testing/mochitest/ssltunnel/ssltunnel.cpp
@@ -817,17 +817,17 @@ PRIntn freeClientAuthHashItems(PLHashEnt
 {
   delete [] (char*)he->key;
   delete (client_auth_option*)he->value;
   return HT_ENUMERATE_REMOVE;
 }
 
 int main(int argc, char** argv)
 {
-  char* configFilePath;
+  const char* configFilePath;
   if (argc == 1)
     configFilePath = "ssltunnel.cfg";
   else
     configFilePath = argv[1];
 
   if (parseConfigFile(configFilePath)) {
     fprintf(stderr, "Error: config file \"%s\" missing or formating incorrect\n"
       "Specify path to the config file as parameter to ssltunnel or \n"
--- a/xpcom/tests/TestFile.cpp
+++ b/xpcom/tests/TestFile.cpp
@@ -40,17 +40,17 @@
 #include "TestHarness.h"
 
 #include "nsILocalFile.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 
 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);
         return PR_FALSE;
     }
     return PR_TRUE;
 }
 
--- a/xpcom/threads/nsProcessCommon.cpp
+++ b/xpcom/threads/nsProcessCommon.cpp
@@ -289,17 +289,17 @@ void nsProcess::ProcessComplete()
     if (mThread) {
         nsCOMPtr<nsIObserverService> os = do_GetService("@mozilla.org/observer-service;1");
         if (os)
             os->RemoveObserver(this, "xpcom-shutdown");
         PR_JoinThread(mThread);
         mThread = nsnull;
     }
 
-    char* topic;
+    const char* topic;
     if (mExitValue < 0)
         topic = "process-failed";
     else
         topic = "process-finished";
 
     mPid = -1;
     nsCOMPtr<nsIObserver> observer;
     if (mWeakObserver)