Bug 769533 - Part 1. Replace AppendWithConversion with others. r=jlebar
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 06 Jul 2012 18:43:28 +0900
changeset 98511 3c3fc27e97468a017912b714824c790e6aea9846
parent 98510 510602478d52567267471daa06e67758990ad967
child 98512 5a96f6193e75f6433d8c445d18af82d58046a086
push id23059
push usereakhgari@mozilla.com
push dateFri, 06 Jul 2012 14:45:18 +0000
treeherdermozilla-central@a8f682801a6d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs769533
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 769533 - Part 1. Replace AppendWithConversion with others. r=jlebar
caps/src/nsScriptSecurityManager.cpp
editor/libeditor/text/nsPlaintextEditor.cpp
modules/libjar/nsJAR.cpp
security/manager/ssl/src/nsCRLManager.cpp
security/manager/ssl/src/nsNSSComponent.cpp
widget/windows/GfxInfo.cpp
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -3611,17 +3611,17 @@ static PLDHashOperator
 PrintPropertyPolicy(PLDHashTable *table, PLDHashEntryHdr *entry,
                     PRUint32 number, void *arg)
 {
     PropertyPolicy* pp = (PropertyPolicy*)entry;
     nsCAutoString prop("        ");
     JSContext* cx = (JSContext*)arg;
     prop.AppendInt((PRUint32)pp->key);
     prop += ' ';
-    prop.AppendWithConversion((PRUnichar*)JS_GetStringChars(pp->key));
+    LossyAppendUTF16toASCII((PRUnichar*)JS_GetStringChars(pp->key), prop);
     prop += ": Get=";
     if (SECURITY_ACCESS_LEVEL_FLAG(pp->mGet))
         prop.AppendInt(pp->mGet.level);
     else
         prop += pp->mGet.capability;
 
     prop += " Set=";
     if (SECURITY_ACCESS_LEVEL_FLAG(pp->mSet))
--- a/editor/libeditor/text/nsPlaintextEditor.cpp
+++ b/editor/libeditor/text/nsPlaintextEditor.cpp
@@ -1178,17 +1178,17 @@ NS_IMETHODIMP
 nsPlaintextEditor::GetAndInitDocEncoder(const nsAString& aFormatType,
                                         PRUint32 aFlags,
                                         const nsACString& aCharset,
                                         nsIDocumentEncoder** encoder)
 {
   nsresult rv = NS_OK;
 
   nsCAutoString formatType(NS_DOC_ENCODER_CONTRACTID_BASE);
-  formatType.AppendWithConversion(aFormatType);
+  LossyAppendUTF16toASCII(aFormatType, formatType);
   nsCOMPtr<nsIDocumentEncoder> docEncoder (do_CreateInstance(formatType.get(), &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIDOMDocument> domDoc = do_QueryReferent(mDocWeak);
   NS_ASSERTION(domDoc, "Need a document");
 
   rv = docEncoder->Init(domDoc, aFormatType, aFlags);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/modules/libjar/nsJAR.cpp
+++ b/modules/libjar/nsJAR.cpp
@@ -801,17 +801,17 @@ nsJAR::VerifyEntry(nsJARManifestItem* aM
 }
 
 void nsJAR::ReportError(const nsACString &aFilename, PRInt16 errorCode)
 {
   //-- Generate error message
   nsAutoString message; 
   message.AssignLiteral("Signature Verification Error: the signature on ");
   if (!aFilename.IsEmpty())
-    message.AppendWithConversion(aFilename);
+    AppendASCIItoUTF16(aFilename, message);
   else
     message.AppendLiteral("this .jar archive");
   message.AppendLiteral(" is invalid because ");
   switch(errorCode)
   {
   case JAR_NOT_SIGNED:
     message.AppendLiteral("the archive did not contain a valid PKCS7 signature.");
     break;
--- a/security/manager/ssl/src/nsCRLManager.cpp
+++ b/security/manager/ssl/src/nsCRLManager.cpp
@@ -187,34 +187,34 @@ done:
     }
     nsCOMPtr<nsIPrefService> prefSvc = do_GetService(NS_PREFSERVICE_CONTRACTID,&rv);
     nsCOMPtr<nsIPrefBranch> pref = do_GetService(NS_PREFSERVICE_CONTRACTID,&rv);
     if (NS_FAILED(rv)){
       return rv;
     }
     
     nsCAutoString updateErrCntPrefStr(CRL_AUTOUPDATE_ERRCNT_PREF);
-    updateErrCntPrefStr.AppendWithConversion(crlKey);
+    LossyAppendUTF16toASCII(crlKey, updateErrCntPrefStr);
     if(importSuccessful){
       PRUnichar *updateTime;
       nsCAutoString updateTimeStr;
       nsCString updateURL;
       PRInt32 timingTypePref;
       double dayCnt;
       char *dayCntStr;
       nsCAutoString updateTypePrefStr(CRL_AUTOUPDATE_TIMIINGTYPE_PREF);
       nsCAutoString updateTimePrefStr(CRL_AUTOUPDATE_TIME_PREF);
       nsCAutoString updateUrlPrefStr(CRL_AUTOUPDATE_URL_PREF);
       nsCAutoString updateDayCntPrefStr(CRL_AUTOUPDATE_DAYCNT_PREF);
       nsCAutoString updateFreqCntPrefStr(CRL_AUTOUPDATE_FREQCNT_PREF);
-      updateTypePrefStr.AppendWithConversion(crlKey);
-      updateTimePrefStr.AppendWithConversion(crlKey);
-      updateUrlPrefStr.AppendWithConversion(crlKey);
-      updateDayCntPrefStr.AppendWithConversion(crlKey);
-      updateFreqCntPrefStr.AppendWithConversion(crlKey);
+      LossyAppendUTF16toASCII(crlKey, updateTypePrefStr);
+      LossyAppendUTF16toASCII(crlKey, updateTimePrefStr);
+      LossyAppendUTF16toASCII(crlKey, updateUrlPrefStr);
+      LossyAppendUTF16toASCII(crlKey, updateDayCntPrefStr);
+      LossyAppendUTF16toASCII(crlKey, updateFreqCntPrefStr);
 
       pref->GetIntPref(updateTypePrefStr.get(),&timingTypePref);
       
       //Compute and update the next download instant
       if(timingTypePref == TYPE_AUTOUPDATE_TIME_BASED){
         pref->GetCharPref(updateDayCntPrefStr.get(),&dayCntStr);
       }else{
         pref->GetCharPref(updateFreqCntPrefStr.get(),&dayCntStr);
@@ -248,17 +248,17 @@ done:
         nssComponent->RemoveCrlFromList(hashKey);
         nssComponent->DefineNextTimer();
       }
 
     } else{
       PRInt32 errCnt;
       nsCAutoString errMsg;
       nsCAutoString updateErrDetailPrefStr(CRL_AUTOUPDATE_ERRDETAIL_PREF);
-      updateErrDetailPrefStr.AppendWithConversion(crlKey);
+      LossyAppendUTF16toASCII(crlKey, updateErrDetailPrefStr);
       errMsg.AssignWithConversion(errorMessage.get());
       rv = pref->GetIntPref(updateErrCntPrefStr.get(),&errCnt);
       if(NS_FAILED(rv))
         errCnt = 0;
 
       pref->SetIntPref(updateErrCntPrefStr.get(),errCnt+1);
       pref->SetCharPref(updateErrDetailPrefStr.get(),errMsg.get());
     }
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -1282,17 +1282,17 @@ nsresult nsNSSComponent::getParamsForNex
     nsStringKey hashKey(tempCrlKey.get());
     if(crlsScheduledForDownload->Exists(&hashKey)){
       continue;
     }
 
     char *tempTimeString;
     PRTime tempTime;
     nsCAutoString timingPrefCString(updateTimePref);
-    timingPrefCString.AppendWithConversion(tempCrlKey);
+    LossyAppendUTF16toASCII(tempCrlKey, timingPrefCString);
     // No PRTime/Int64 type in prefs; stored as string; parsed here as PRInt64
     rv = pref->GetCharPref(timingPrefCString.get(), &tempTimeString);
     if (NS_FAILED(rv)){
       // Assume corrupted. Force download. Pref should be reset after download.
       tempTime = PR_Now();
       PR_LOG(gPIPNSSLog, PR_LOG_DEBUG,
              ("get %s failed: forcing download\n", timingPrefCString.get()));
     } else {
@@ -1322,17 +1322,17 @@ nsresult nsNSSComponent::getParamsForNex
               explodedTime.tm_month+1, explodedTime.tm_mday,
               explodedTime.tm_year, explodedTime.tm_hour,
               explodedTime.tm_min, explodedTime.tm_sec));
 #endif
     }
 
     if(nearestUpdateTime == 0 || tempTime < nearestUpdateTime){
       nsCAutoString urlPrefCString(updateURLPref);
-      urlPrefCString.AppendWithConversion(tempCrlKey);
+      LossyAppendUTF16toASCII(tempCrlKey, urlPrefCString);
       rv = pref->GetCharPref(urlPrefCString.get(), &tempUrl);
       if (NS_FAILED(rv) || (!tempUrl)){
         continue;
       }
       nearestUpdateTime = tempTime;
       crlKey = tempCrlKey;
     }
   }
@@ -3295,28 +3295,26 @@ PSMContentDownloader::handleContentDownl
     //TO DO: Handle network errors in details
     //XXXXXXXXXXXXXXXXXX
     nssComponent->GetPIPNSSBundleString("CrlImportFailureNetworkProblem", tmpMessage);
       
     if (mDoSilentDownload) {
       //This is the case for automatic download. Update failure history
       nsCAutoString updateErrCntPrefStr(CRL_AUTOUPDATE_ERRCNT_PREF);
       nsCAutoString updateErrDetailPrefStr(CRL_AUTOUPDATE_ERRDETAIL_PREF);
-      PRUnichar *nameInDb;
       nsCString errMsg;
       PRInt32 errCnt;
 
       nsCOMPtr<nsIPrefBranch> pref = do_GetService(NS_PREFSERVICE_CONTRACTID,&rv);
       if(NS_FAILED(rv)){
         return rv;
       }
       
-      nameInDb = (PRUnichar *)mCrlAutoDownloadKey.get();
-      updateErrCntPrefStr.AppendWithConversion(nameInDb);
-      updateErrDetailPrefStr.AppendWithConversion(nameInDb);  
+      LossyAppendUTF16toASCII(mCrlAutoDownloadKey, updateErrCntPrefStr);
+      LossyAppendUTF16toASCII(mCrlAutoDownloadKey, updateErrDetailPrefStr);
       errMsg.AssignWithConversion(tmpMessage.get());
       
       rv = pref->GetIntPref(updateErrCntPrefStr.get(),&errCnt);
       if( (NS_FAILED(rv)) || (errCnt == 0) ){
         pref->SetIntPref(updateErrCntPrefStr.get(),1);
       }else{
         pref->SetIntPref(updateErrCntPrefStr.get(),errCnt+1);
       }
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -689,19 +689,19 @@ GfxInfo::AddCrashReportAnnotations()
   note.Append(narrowDeviceID);
   note.AppendPrintf(", AdapterSubsysID: %08x, ", mAdapterSubsysID);
   note.Append("AdapterDriverVersion: ");
   note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString));
 
   if (vendorID == GfxDriverInfo::GetDeviceVendor(VendorAll)) {
     /* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */
     note.Append(", ");
-    note.AppendWithConversion(mDeviceID);
+    LossyAppendUTF16toASCII(mDeviceID, note);
     note.Append(", ");
-    note.AppendWithConversion(mDeviceKeyDebug);
+    LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
     LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
   }
   note.Append("\n");
 
   if (mHasDualGPU) {
     nsString deviceID2, vendorID2;
     nsAutoString adapterDriverVersionString2;
     nsCString narrowDeviceID2, narrowVendorID2;