Bug 869836 - Part 11: Use `Append('c')` instead of `AppendLiteral("c")`. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 26 May 2014 21:54:58 +0300
changeset 185142 64a0e8806b2226c1f638b5ad664a473b9709d5d4
parent 185141 09385232f753e6a666a85da22f5f54e803f0cc66
child 185143 cfaa8aa6237017044dc4fa3448194bcfad550722
push id26844
push userryanvm@gmail.com
push dateTue, 27 May 2014 20:23:53 +0000
treeherdermozilla-central@448f2153d6d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs869836
milestone32.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 869836 - Part 11: Use `Append('c')` instead of `AppendLiteral("c")`. r=ehsan
browser/components/shell/src/nsWindowsShellService.cpp
content/base/src/Element.cpp
dom/bluetooth/bluez/BluetoothHfpManager.cpp
dom/bluetooth2/bluedroid/BluetoothOppManager.cpp
dom/bluetooth2/bluez/BluetoothHfpManager.cpp
dom/bluetooth2/bluez/BluetoothOppManager.cpp
gfx/thebes/gfxFT2FontList.cpp
netwerk/protocol/http/Http2Stream.cpp
netwerk/protocol/http/SpdyStream3.cpp
netwerk/protocol/http/SpdyStream31.cpp
rdf/base/src/rdfTriplesSerializer.cpp
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/xre/nsXREDirProvider.cpp
widget/windows/winrt/MetroContracts.cpp
widget/xpwidgets/GfxInfoX11.cpp
xpcom/io/SpecialSystemDirectory.cpp
--- a/browser/components/shell/src/nsWindowsShellService.cpp
+++ b/browser/components/shell/src/nsWindowsShellService.cpp
@@ -985,17 +985,17 @@ nsWindowsShellService::OpenApplication(i
 
   if (REG_FAILED(res) || !*buf)
     return NS_OK;
 
   // Close the key we opened.
   ::RegCloseKey(theKey);
 
   // Find the "open" command
-  application.AppendLiteral("\\");
+  application.Append('\\');
   application.Append(buf);
   application.AppendLiteral("\\shell\\open\\command");
 
   rv = OpenKeyForReading(HKEY_CLASSES_ROOT, application, &theKey);
   if (NS_FAILED(rv))
     return rv;
 
   ::ZeroMemory(buf, sizeof(buf));
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -2257,17 +2257,17 @@ Element::DescribeAttribute(uint32_t inde
   aOutDescription.AppendLiteral("=\"");
   nsAutoString value;
   mAttrsAndChildren.AttrAt(index)->ToString(value);
   for (int i = value.Length(); i >= 0; --i) {
     if (value[i] == char16_t('"'))
       value.Insert(char16_t('\\'), uint32_t(i));
   }
   aOutDescription.Append(value);
-  aOutDescription.AppendLiteral("\"");
+  aOutDescription.Append('"');
 }
 
 #ifdef DEBUG
 void
 Element::ListAttributes(FILE* out) const
 {
   uint32_t index, count = mAttrsAndChildren.AttrCount();
   for (index = 0; index < count; index++) {
--- a/dom/bluetooth/bluez/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/bluez/BluetoothHfpManager.cpp
@@ -806,17 +806,17 @@ BluetoothHfpManager::ReceiveSocketData(B
       }
       return;
     }
   } else if (msg.Find("AT+COPS?") != -1) {
     nsAutoCString message("+COPS: ");
     message.AppendInt(mNetworkSelectionMode);
     message.AppendLiteral(",0,\"");
     message.Append(NS_ConvertUTF16toUTF8(mOperatorName));
-    message.AppendLiteral("\"");
+    message.Append('"');
     SendLine(message.get());
   } else if (msg.Find("AT+VTS=") != -1) {
     ParseAtCommand(msg, 7, atCommandValues);
 
     if (atCommandValues.Length() != 1) {
       BT_WARNING("Couldn't get the value of command [AT+VTS=]");
       goto respond_with_ok;
     }
--- a/dom/bluetooth2/bluedroid/BluetoothOppManager.cpp
+++ b/dom/bluetooth2/bluedroid/BluetoothOppManager.cpp
@@ -711,17 +711,17 @@ BluetoothOppManager::RetrieveSentFileNam
       mBlob->GetType(mimeType);
 
       nsCString extension;
       nsresult rv =
         mimeSvc->GetPrimaryExtension(NS_LossyConvertUTF16toASCII(mimeType),
                                      EmptyCString(),
                                      extension);
       if (NS_SUCCEEDED(rv)) {
-        mFileName.AppendLiteral(".");
+        mFileName.Append('.');
         AppendUTF8toUTF16(extension, mFileName);
       }
     }
   }
 }
 
 bool
 BluetoothOppManager::IsReservedChar(char16_t c)
--- a/dom/bluetooth2/bluez/BluetoothHfpManager.cpp
+++ b/dom/bluetooth2/bluez/BluetoothHfpManager.cpp
@@ -806,17 +806,17 @@ BluetoothHfpManager::ReceiveSocketData(B
       }
       return;
     }
   } else if (msg.Find("AT+COPS?") != -1) {
     nsAutoCString message("+COPS: ");
     message.AppendInt(mNetworkSelectionMode);
     message.AppendLiteral(",0,\"");
     message.Append(NS_ConvertUTF16toUTF8(mOperatorName));
-    message.AppendLiteral("\"");
+    message.Append('"');
     SendLine(message.get());
   } else if (msg.Find("AT+VTS=") != -1) {
     ParseAtCommand(msg, 7, atCommandValues);
 
     if (atCommandValues.Length() != 1) {
       BT_WARNING("Couldn't get the value of command [AT+VTS=]");
       goto respond_with_ok;
     }
@@ -1206,19 +1206,19 @@ bool
 BluetoothHfpManager::SendCLCC(const Call& aCall, int aIndex)
 {
   if (aCall.mState == nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
     return true;
   }
 
   nsAutoCString message(RESPONSE_CLCC);
   message.AppendInt(aIndex);
-  message.AppendLiteral(",");
+  message.Append(',');
   message.AppendInt(aCall.mDirection);
-  message.AppendLiteral(",");
+  message.Append(',');
 
   int status = 0;
   switch (aCall.mState) {
     case nsITelephonyProvider::CALL_STATE_CONNECTED:
       if (mPhoneType == PhoneType::CDMA && aIndex == 1) {
         status = (mCdmaSecondCall.IsActive()) ? 1 : 0;
       }
       message.AppendInt(status);
@@ -1285,41 +1285,41 @@ BluetoothHfpManager::SendCommand(const c
     }
 
     if ((aValue < 1) || (aValue > ArrayLength(sCINDItems) - 1)) {
       BT_WARNING("unexpected CINDType for CIEV command");
       return false;
     }
 
     message.AppendInt(aValue);
-    message.AppendLiteral(",");
+    message.Append(',');
     message.AppendInt(sCINDItems[aValue].value);
   } else if (!strcmp(aCommand, RESPONSE_CIND)) {
     if (!aValue) {
       // Query for range
       for (uint8_t i = 1; i < ArrayLength(sCINDItems); i++) {
         message.AppendLiteral("(\"");
         message.Append(sCINDItems[i].name);
         message.AppendLiteral("\",(");
         message.Append(sCINDItems[i].range);
-        message.AppendLiteral(")");
+        message.Append(')');
         if (i == (ArrayLength(sCINDItems) - 1)) {
-          message.AppendLiteral(")");
+          message.Append(')');
           break;
         }
         message.AppendLiteral("),");
       }
     } else {
       // Query for value
       for (uint8_t i = 1; i < ArrayLength(sCINDItems); i++) {
         message.AppendInt(sCINDItems[i].value);
         if (i == (ArrayLength(sCINDItems) - 1)) {
           break;
         }
-        message.AppendLiteral(",");
+        message.Append(',');
       }
     }
 #ifdef MOZ_B2G_RIL
   } else if (!strcmp(aCommand, RESPONSE_CLCC)) {
     bool rv = true;
     uint32_t callNumbers = mCurrentCallArray.Length();
     uint32_t i;
     for (i = 1; i < callNumbers; i++) {
--- a/dom/bluetooth2/bluez/BluetoothOppManager.cpp
+++ b/dom/bluetooth2/bluez/BluetoothOppManager.cpp
@@ -733,17 +733,17 @@ BluetoothOppManager::RetrieveSentFileNam
       mBlob->GetType(mimeType);
 
       nsCString extension;
       nsresult rv =
         mimeSvc->GetPrimaryExtension(NS_LossyConvertUTF16toASCII(mimeType),
                                      EmptyCString(),
                                      extension);
       if (NS_SUCCEEDED(rv)) {
-        mFileName.AppendLiteral(".");
+        mFileName.Append('.');
         AppendUTF8toUTF16(extension, mFileName);
       }
     }
   }
 }
 
 bool
 BluetoothOppManager::IsReservedChar(char16_t c)
--- a/gfx/thebes/gfxFT2FontList.cpp
+++ b/gfx/thebes/gfxFT2FontList.cpp
@@ -1190,17 +1190,17 @@ gfxFT2FontList::FindFonts()
                                              FindExInfoStandard,
                                              &results,
                                              FindExSearchNameMatch,
                                              nullptr,
                                              0);
             bool moreFiles = handle != INVALID_HANDLE_VALUE;
             while (moreFiles) {
                 nsAutoString filePath(path);
-                filePath.AppendLiteral("\\");
+                filePath.Append('\\');
                 filePath.Append(results.cFileName);
                 AppendFacesFromFontFile(NS_ConvertUTF16toUTF8(filePath));
                 moreFiles = FindNextFile(handle, &results);
             }
             if (handle != INVALID_HANDLE_VALUE)
                 FindClose(handle);
         }
     }
--- a/netwerk/protocol/http/Http2Stream.cpp
+++ b/netwerk/protocol/http/Http2Stream.cpp
@@ -381,17 +381,17 @@ Http2Stream::ParseHttpRequestHeaders(con
 
     // Our normal authority has an implicit port, best to use an
     // explicit one with a tunnel
     nsHttpConnectionInfo *ci = mTransaction->ConnectionInfo();
     if (!ci) {
       return NS_ERROR_UNEXPECTED;
     }
     authorityHeader = ci->GetHost();
-    authorityHeader.AppendLiteral(":");
+    authorityHeader.Append(':');
     authorityHeader.AppendInt(ci->Port());
   }
 
   mSession->Compressor()->EncodeHeaderBlock(mFlatHttpRequestHeaders,
                                             head->Method(),
                                             head->RequestURI(),
                                             authorityHeader,
                                             scheme,
--- a/netwerk/protocol/http/SpdyStream3.cpp
+++ b/netwerk/protocol/http/SpdyStream3.cpp
@@ -487,17 +487,17 @@ SpdyStream3::ParseHttpRequestHeaders(con
     mIsTunnel = true;
     // Connect places host:port in :path. Don't use default port.
     nsHttpConnectionInfo *ci = mTransaction->ConnectionInfo();
     if (!ci) {
       return NS_ERROR_UNEXPECTED;
     }
     nsAutoCString route;
     route = ci->GetHost();
-    route.AppendLiteral(":");
+    route.Append(':');
     route.AppendInt(ci->Port());
     CompressToFrame(route);
   }
 
   CompressToFrame(NS_LITERAL_CSTRING(":version"));
   CompressToFrame(versionHeader);
 
   CompressToFrame(NS_LITERAL_CSTRING(":host"));
--- a/netwerk/protocol/http/SpdyStream31.cpp
+++ b/netwerk/protocol/http/SpdyStream31.cpp
@@ -493,17 +493,17 @@ SpdyStream31::ParseHttpRequestHeaders(co
     mIsTunnel = true;
     // Connect places host:port in :path. Don't use default port.
     nsHttpConnectionInfo *ci = mTransaction->ConnectionInfo();
     if (!ci) {
       return NS_ERROR_UNEXPECTED;
     }
     nsAutoCString route;
     route = ci->GetHost();
-    route.AppendLiteral(":");
+    route.Append(':');
     route.AppendInt(ci->Port());
     CompressToFrame(route);
   }
 
   CompressToFrame(NS_LITERAL_CSTRING(":version"));
   CompressToFrame(versionHeader);
 
   CompressToFrame(NS_LITERAL_CSTRING(":host"));
--- a/rdf/base/src/rdfTriplesSerializer.cpp
+++ b/rdf/base/src/rdfTriplesSerializer.cpp
@@ -72,17 +72,17 @@ TriplesVisitor::Visit(nsIRDFNode *aSubje
     nsCOMPtr<nsIRDFInt> intLit;
     uint32_t wroteCount;
     if (res) {
         rv = writeResource(res);
     } else if ((lit = do_QueryInterface(aObject)) != nullptr) {
         const char16_t *value;
         lit->GetValueConst(&value);
         nsAutoCString object;
-        object.AppendLiteral("\"");
+        object.Append('"');
         AppendUTF16toUTF8(value, object);
         object.AppendLiteral("\" ");
         uint32_t writeCount = object.Length();
         rv = mOut->Write(object.get(), writeCount, &wroteCount);
         NS_ENSURE_TRUE(writeCount == wroteCount, NS_ERROR_FAILURE);
     } else if ((intLit = do_QueryInterface(aObject)) != nullptr) {
         int32_t value;
         intLit->GetValue(&value);
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -1900,25 +1900,25 @@ static nsresult PrefSubmitReports(bool* 
   // write values to it
   
   // Create appVendor key
   if(!appVendor.IsEmpty()) {
     regPath.Append(appVendor);
     regKey->Create(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
                    NS_ConvertUTF8toUTF16(regPath),
                    nsIWindowsRegKey::ACCESS_SET_VALUE);
-    regPath.AppendLiteral("\\");
+    regPath.Append('\\');
   }
 
   // Create appName key
   regPath.Append(appName);
   regKey->Create(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
                  NS_ConvertUTF8toUTF16(regPath),
                  nsIWindowsRegKey::ACCESS_SET_VALUE);
-  regPath.AppendLiteral("\\");
+  regPath.Append('\\');
 
   // Create Crash Reporter key
   regPath.AppendLiteral("Crash Reporter");
   regKey->Create(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
                  NS_ConvertUTF8toUTF16(regPath),
                  nsIWindowsRegKey::ACCESS_SET_VALUE);
 
   // If we're saving the pref value, just write it to ROOT_KEY_CURRENT_USER
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -1066,17 +1066,17 @@ nsXREDirProvider::GetUpdateRootDir(nsIFi
 
   // Use <UserLocalDataDir>\updates\<relative path to app dir from
   // Program Files> if app dir is under Program Files to avoid the
   // folder virtualization mess on Windows Vista
   nsAutoString programFiles;
   rv = GetShellFolderPath(CSIDL_PROGRAM_FILES, programFiles);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  programFiles.AppendLiteral("\\");
+  programFiles.Append('\\');
   uint32_t programFilesLen = programFiles.Length();
 
   nsAutoString programName;
   if (_wcsnicmp(programFiles.get(), longPath.get(), programFilesLen) == 0) {
     programName = Substring(longPath, programFilesLen);
   } else {
     // We need the update root directory to live outside of the installation
     // directory, because otherwise the updater writing the log file can cause
--- a/widget/windows/winrt/MetroContracts.cpp
+++ b/widget/windows/winrt/MetroContracts.cpp
@@ -296,20 +296,20 @@ FrameworkView::PerformSearch(HString& aQ
   nsCOMPtr<nsICommandLineRunner> cmdLine =
     (do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
   if (!cmdLine) {
     NS_WARNING("Unable to instantiate command line runner.");
     return;
   }
 
   nsAutoCString parameter;
-  parameter.AppendLiteral("\"");
+  parameter.Append('"');
   unsigned int length;
   parameter.Append(NS_ConvertUTF16toUTF8(aQuery.GetRawBuffer(&length)));
-  parameter.AppendLiteral("\"");
+  parameter.Append('"');
 
   // NB: The first argument gets stripped by nsICommandLineRunner::Init,
   //     so it doesn't matter what we pass as the first argument, but we
   //     have to pass something.
   const char *argv[] = { "", // This argument gets stripped
                          "-search",
                          parameter.BeginReading() };
   nsresult rv = cmdLine->Init(ArrayLength(argv),
--- a/widget/xpwidgets/GfxInfoX11.cpp
+++ b/widget/xpwidgets/GfxInfoX11.cpp
@@ -188,17 +188,17 @@ GfxInfo::GetData()
 
     nsAutoCString note;
     note.AppendLiteral("OpenGL: ");
     note.Append(mAdapterDescription);
     note.AppendLiteral(" -- ");
     note.Append(mVersion);
     if (mHasTextureFromPixmap)
         note.AppendLiteral(" -- texture_from_pixmap");
-    note.AppendLiteral("\n");
+    note.Append('\n');
 #ifdef MOZ_CRASHREPORTER
     CrashReporter::AppendAppNotesToCrashReport(note);
 #endif
 
     // determine the major OpenGL version. That's the first integer in the version string.
     mGLMajorVersion = strtol(mVersion.get(), 0, 10);
 
     // determine driver type (vendor) and where in the version string
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -161,17 +161,17 @@ GetLibrarySaveToPath(int aFallbackFolder
 
   if (shellLib &&
       SUCCEEDED(shellLib->GetDefaultSaveFolder(DSFT_DETECT, IID_IShellItem,
                                                getter_AddRefs(savePath)))) {
     wchar_t* str = nullptr;
     if (SUCCEEDED(savePath->GetDisplayName(SIGDN_FILESYSPATH, &str))) {
       nsAutoString path;
       path.Assign(str);
-      path.AppendLiteral("\\");
+      path.Append('\\');
       nsresult rv =
         NS_NewLocalFile(path, false, aFile);
       CoTaskMemFree(str);
       return rv;
     }
   }
 
   return GetWindowsFolder(aFallbackFolderId, aFile);