Bug 869836 - Part 8: Use `Append('c')` instead of `Append("c")`. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 22 May 2014 06:48:52 +0300
changeset 204660 ff0eb85179cd93b259ee76bfdac3a032809c360e
parent 204659 1a64b22632bc5423e3c74f5eb819cdf45ee052d8
child 204661 75287df86a00c67c9bc91649c6ef79a9af37b8c1
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [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 8: Use `Append('c')` instead of `Append("c")`. r=ehsan
content/media/MediaResource.cpp
dom/base/Console.cpp
dom/devicestorage/nsDeviceStorage.cpp
dom/plugins/base/nsPluginStreamListenerPeer.cpp
embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
extensions/pref/autoconfig/src/nsAutoConfig.cpp
gfx/layers/Layers.cpp
image/src/imgLoader.cpp
layout/base/FrameLayerBuilder.cpp
layout/base/nsLayoutDebugger.cpp
modules/libjar/nsZipArchive.cpp
netwerk/cookie/nsCookieService.h
rdf/base/src/nsRDFContainer.cpp
startupcache/StartupCacheUtils.cpp
storage/src/mozStorageConnection.cpp
storage/test/storage_test_harness.h
toolkit/components/downloads/ApplicationReputation.cpp
toolkit/components/places/Helpers.cpp
toolkit/components/url-classifier/Classifier.cpp
toolkit/components/url-classifier/LookupCache.cpp
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
widget/gtk/nsPSPrinters.cpp
xpcom/base/SystemMemoryReporter.cpp
--- a/content/media/MediaResource.cpp
+++ b/content/media/MediaResource.cpp
@@ -660,17 +660,17 @@ nsresult ChannelMediaResource::SetupChan
     // complete file download.
     nsAutoCString rangeString("bytes=");
     if (!mByteRange.IsNull()) {
       rangeString.AppendInt(mByteRange.mStart);
       mOffset = mByteRange.mStart;
     } else {
       rangeString.AppendInt(mOffset);
     }
-    rangeString.Append("-");
+    rangeString.Append('-');
     if (!mByteRange.IsNull()) {
       rangeString.AppendInt(mByteRange.mEnd);
     }
     nsresult rv = hc->SetRequestHeader(NS_LITERAL_CSTRING("Range"), rangeString, false);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Send Accept header for video and audio types only (Bug 489071)
     NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
--- a/dom/base/Console.cpp
+++ b/dom/base/Console.cpp
@@ -1434,23 +1434,23 @@ Console::ProcessArguments(JSContext* aCx
     aSequence.AppendElement(aData[index]);
   }
 }
 
 void
 Console::MakeFormatString(nsCString& aFormat, int32_t aInteger,
                           int32_t aMantissa, char aCh)
 {
-  aFormat.Append("%");
+  aFormat.Append('%');
   if (aInteger >= 0) {
     aFormat.AppendInt(aInteger);
   }
 
   if (aMantissa >= 0) {
-    aFormat.Append(".");
+    aFormat.Append('.');
     aFormat.AppendInt(aMantissa);
   }
 
   aFormat.Append(aCh);
 }
 
 void
 Console::ComposeGroupName(JSContext* aCx,
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -3435,17 +3435,17 @@ nsDOMDeviceStorage::Add(nsIDOMBlob* aBlo
   // will post an onerror to the requestee.
 
   // possible race here w/ unique filename
   char buffer[32];
   NS_MakeRandomString(buffer, ArrayLength(buffer) - 1);
 
   nsAutoCString path;
   path.Assign(nsDependentCString(buffer));
-  path.Append(".");
+  path.Append('.');
   path.Append(extension);
 
   return AddNamed(aBlob, NS_ConvertASCIItoUTF16(path), aRv);
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::AddNamed(nsIDOMBlob *aBlob,
                              const nsAString & aPath,
--- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp
+++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp
@@ -603,20 +603,20 @@ nsPluginStreamListenerPeer::MakeByteRang
 
   for (NPByteRange * range = aRangeList; range != nullptr; range = range->next) {
     // XXX zero length?
     if (!range->length)
       continue;
 
     // XXX needs to be fixed for negative offsets
     string.AppendInt(range->offset);
-    string.Append("-");
+    string.Append('-');
     string.AppendInt(range->offset + range->length - 1);
     if (range->next)
-      string += ",";
+      string.Append(',');
 
     requestCnt++;
   }
 
   // get rid of possible trailing comma
   string.Trim(",", false);
 
   rangeRequest = string;
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
@@ -2197,17 +2197,17 @@ nsWebBrowserPersist::CalculateAndAppendF
                         if (fileExt.Length() > kDefaultMaxFilenameLength/2)
                             fileExt.Truncate(kDefaultMaxFilenameLength/2);
 
                         uint32_t diff = kDefaultMaxFilenameLength - 1 -
                                         fileExt.Length();
                         if (newFileName.Length() > diff)
                             newFileName.Truncate(diff);
                     }
-                    newFileName.Append(".");
+                    newFileName.Append('.');
                     newFileName.Append(fileExt);
                 }
 
                 if (localFile)
                 {
                     localFile->SetLeafName(NS_ConvertUTF8toUTF16(newFileName));
 
                     // Resync the URI with the file after the extension has been appended
--- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp
@@ -256,17 +256,17 @@ nsresult nsAutoConfig::downloadAutoConfi
     rv = mPrefBranch->GetBoolPref("autoadmin.append_emailaddr", &appendMail);
     if (NS_SUCCEEDED(rv) && appendMail) {
         rv = getEmailAddr(emailAddr);
         if (NS_SUCCEEDED(rv) && emailAddr.get()) {
             /* Adding the unique identifier at the end of autoconfig URL. 
                In this case the autoconfig URL is a script and 
                emailAddr as passed as an argument 
             */
-            mConfigURL.Append("?");
+            mConfigURL.Append('?');
             mConfigURL.Append(emailAddr); 
         }
     }
     
     // create a new url 
     nsCOMPtr<nsIURI> url;
     nsCOMPtr<nsIChannel> channel;
     
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -1200,31 +1200,31 @@ static nsACString& PrintInfo(nsACString&
 #ifdef MOZ_DUMP_PAINTING
 template <typename T>
 void WriteSnapshotLinkToDumpFile(T* aObj, FILE* aFile)
 {
   if (!aObj) {
     return;
   }
   nsCString string(aObj->Name());
-  string.Append("-");
+  string.Append('-');
   string.AppendInt((uint64_t)aObj);
   fprintf_stderr(aFile, "href=\"javascript:ViewImage('%s')\"", string.BeginReading());
 }
 
 template <typename T>
 void WriteSnapshotToDumpFile_internal(T* aObj, DataSourceSurface* aSurf)
 {
   nsRefPtr<gfxImageSurface> deprecatedSurf =
     new gfxImageSurface(aSurf->GetData(),
                         ThebesIntSize(aSurf->GetSize()),
                         aSurf->Stride(),
                         SurfaceFormatToImageFormat(aSurf->GetFormat()));
   nsCString string(aObj->Name());
-  string.Append("-");
+  string.Append('-');
   string.AppendInt((uint64_t)aObj);
   if (gfxUtils::sDumpPaintFile) {
     fprintf_stderr(gfxUtils::sDumpPaintFile, "array[\"%s\"]=\"", string.BeginReading());
   }
   deprecatedSurf->DumpAsDataURL(gfxUtils::sDumpPaintFile);
   if (gfxUtils::sDumpPaintFile) {
     fprintf_stderr(gfxUtils::sDumpPaintFile, "\";");
   }
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -125,17 +125,17 @@ public:
 
 #undef REPORT
 
 #define REPORT_VECTOR(_path, _uri, _amount, _desc)                            \
     do {                                                                      \
       nsAutoCString path(NS_LITERAL_CSTRING(_path));                          \
       path.AppendLiteral("/(");                                               \
       path.Append(_uri);                                                      \
-      path.Append(")");                                                       \
+      path.Append(')');                                                       \
       nsresult rv;                                                            \
       rv = callback->Callback(EmptyCString(), path,                           \
                               KIND_HEAP, UNITS_BYTES, _amount,                \
                               NS_LITERAL_CSTRING(_desc), closure);            \
       NS_ENSURE_SUCCESS(rv, rv);                                              \
     } while (0)
 
     for (uint32_t i = 0; i < chrome.mVectorImageDocInfo.Length(); i++) {
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -2302,17 +2302,17 @@ ContainerState::FindThebesLayerFor(nsDis
   return thebesLayerData;
 }
 
 #ifdef MOZ_DUMP_PAINTING
 static void
 DumpPaintedImage(nsDisplayItem* aItem, gfxASurface* aSurf)
 {
   nsCString string(aItem->Name());
-  string.Append("-");
+  string.Append('-');
   string.AppendInt((uint64_t)aItem);
   fprintf_stderr(gfxUtils::sDumpPaintFile, "array[\"%s\"]=\"", string.BeginReading());
   aSurf->DumpAsDataURL(gfxUtils::sDumpPaintFile);
   fprintf_stderr(gfxUtils::sDumpPaintFile, "\";");
 }
 #endif
 
 static void
--- a/layout/base/nsLayoutDebugger.cpp
+++ b/layout/base/nsLayoutDebugger.cpp
@@ -148,17 +148,17 @@ PrintDisplayItemTo(nsDisplayListBuilder*
   nsDisplayList* list = aItem->GetChildren();
   const DisplayItemClip& clip = aItem->GetClip();
   nsRegion opaque;
   if (!list || list->DidComputeVisibility()) {
     opaque = aItem->GetOpaqueRegion(aBuilder, &snap);
   }
   if (aDumpHtml && aItem->Painted()) {
     nsCString string(aItem->Name());
-    string.Append("-");
+    string.Append('-');
     string.AppendInt((uint64_t)aItem);
     str += nsPrintfCString("<a href=\"javascript:ViewImage('%s')\">", string.BeginReading());
   }
   str += nsPrintfCString("%s %p(%s) bounds(%d,%d,%d,%d) visible(%d,%d,%d,%d) componentAlpha(%d,%d,%d,%d) clip(%s) %s",
           aItem->Name(), (void*)f, NS_ConvertUTF16toUTF8(fName).get(),
           rect.x, rect.y, rect.width, rect.height,
           vis.x, vis.y, vis.width, vis.height,
           component.x, component.y, component.width, component.height,
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -114,17 +114,17 @@ public:
 #else
       rv = logFile->OpenNSPRFileDesc(PR_WRONLY|PR_CREATE_FILE|PR_APPEND, 0644, &file);
       if (NS_FAILED(rv))
         return;
 #endif
       fd = file;
     }
     nsCString buf(zip);
-    buf.Append(" ");
+    buf.Append(' ');
     buf.Append(entry);
     buf.Append('\n');
     PR_Write(fd, buf.get(), buf.Length());
   }
 
   void AddRef() {
     MOZ_ASSERT(refCnt >= 0);
     ++refCnt;
--- a/netwerk/cookie/nsCookieService.h
+++ b/netwerk/cookie/nsCookieService.h
@@ -92,19 +92,19 @@ public:
   {
     return &aKey;
   }
 
   static PLDHashNumber HashKey(KeyTypePointer aKey)
   {
     // TODO: more efficient way to generate hash?
     nsAutoCString temp(aKey->mBaseDomain);
-    temp.Append("#");
+    temp.Append('#');
     temp.Append(aKey->mAppId);
-    temp.Append("#");
+    temp.Append('#');
     temp.Append(aKey->mInBrowserElement ? 1 : 0);
     return mozilla::HashString(temp);
   }
 
   size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
   enum { ALLOW_MEMMOVE = true };
 
--- a/rdf/base/src/nsRDFContainer.cpp
+++ b/rdf/base/src/nsRDFContainer.cpp
@@ -685,17 +685,17 @@ RDFContainerImpl::GetNextValue(nsIRDFRes
             nextVal += *p - '0';
         }
     }
 
     static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
     char buf[sizeof(kRDFNameSpaceURI) + 16];
     nsFixedCString nextValStr(buf, sizeof(buf), 0);
     nextValStr = kRDFNameSpaceURI;
-    nextValStr.Append("_");
+    nextValStr.Append('_');
     nextValStr.AppendInt(nextVal, 10);
 
     rv = gRDFService->GetResource(nextValStr, aResult);
     if (NS_FAILED(rv)) return rv;
 
     // Now increment the RDF:nextVal property.
     rv = mDataSource->Unassert(mContainer, kRDF_nextVal, nextValLiteral);
     if (NS_FAILED(rv)) return rv;
--- a/startupcache/StartupCacheUtils.cpp
+++ b/startupcache/StartupCacheUtils.cpp
@@ -227,24 +227,24 @@ PathifyURI(nsIURI *in, nsACString &out)
             NS_ENSURE_SUCCESS(rv, rv);
 
             rv = PathifyURI(jarFileURI, out);
             NS_ENSURE_SUCCESS(rv, rv);
 
             nsAutoCString path;
             rv = jarURI->GetJAREntry(path);
             NS_ENSURE_SUCCESS(rv, rv);
-            out.Append("/");
+            out.Append('/');
             out.Append(path);
         } else { // Very unlikely
             nsAutoCString spec;
             rv = uri->GetSpec(spec);
             NS_ENSURE_SUCCESS(rv, rv);
 
-            out.Append("/");
+            out.Append('/');
             out.Append(spec);
         }
     }
     return NS_OK;
 }
 
 }
 }
--- a/storage/src/mozStorageConnection.cpp
+++ b/storage/src/mozStorageConnection.cpp
@@ -740,17 +740,17 @@ Connection::databaseElementExists(enum D
       query.AppendLiteral("index");
       break;
     case TABLE:
       query.AppendLiteral("table");
       break;
   }
   query.AppendLiteral("' AND name ='");
   query.Append(element);
-  query.Append("'");
+  query.Append('\'');
 
   sqlite3_stmt *stmt;
   int srv = prepareStatement(mDBConn, query, &stmt);
   if (srv != SQLITE_OK)
     return convertResultCode(srv);
 
   srv = stepStatement(mDBConn, stmt);
   // we just care about the return value from step
--- a/storage/test/storage_test_harness.h
+++ b/storage/test/storage_test_harness.h
@@ -155,17 +155,17 @@ AsyncStatementSpinner::HandleError(mozIS
   NS_ENSURE_SUCCESS(rv, rv);
   nsAutoCString message;
   rv = aError->GetMessage(message);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString warnMsg;
   warnMsg.AppendLiteral("An error occurred while executing an async statement: ");
   warnMsg.AppendInt(result);
-  warnMsg.Append(" ");
+  warnMsg.Append(' ');
   warnMsg.Append(message);
   NS_WARNING(warnMsg.get());
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AsyncStatementSpinner::HandleCompletion(uint16_t aReason)
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -279,17 +279,17 @@ PendingDBLookup::LookupSpecInternal(cons
   nsAutoCString allowlist;
   Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, &allowlist);
   if (!allowlist.IsEmpty()) {
     tables.Append(allowlist);
   }
   nsAutoCString blocklist;
   Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, &blocklist);
   if (!mAllowlistOnly && !blocklist.IsEmpty()) {
-    tables.Append(",");
+    tables.Append(',');
     tables.Append(blocklist);
   }
   return dbService->Lookup(principal, tables, this);
 }
 
 NS_IMETHODIMP
 PendingDBLookup::HandleEvent(const nsACString& tables)
 {
--- a/toolkit/components/places/Helpers.cpp
+++ b/toolkit/components/places/Helpers.cpp
@@ -47,17 +47,17 @@ AsyncStatementCallback::HandleError(mozI
   NS_ENSURE_SUCCESS(rv, rv);
   nsAutoCString message;
   rv = aError->GetMessage(message);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString warnMsg;
   warnMsg.AppendLiteral("An error occurred while executing an async statement: ");
   warnMsg.AppendInt(result);
-  warnMsg.Append(" ");
+  warnMsg.Append(' ');
   warnMsg.Append(message);
   NS_WARNING(warnMsg.get());
 #endif
 
   return NS_OK;
 }
 
 #define URI_TO_URLCSTRING(uri, spec) \
--- a/toolkit/components/url-classifier/Classifier.cpp
+++ b/toolkit/components/url-classifier/Classifier.cpp
@@ -186,17 +186,17 @@ Classifier::TableRequest(nsACString& aRe
     if (!store)
       continue;
 
     nsresult rv = store->Open();
     if (NS_FAILED(rv))
       continue;
 
     aResult.Append(store->TableName());
-    aResult.Append(";");
+    aResult.Append(';');
 
     ChunkSet &adds = store->AddChunks();
     ChunkSet &subs = store->SubChunks();
 
     if (adds.Length() > 0) {
       aResult.AppendLiteral("a:");
       nsAutoCString addList;
       adds.Serialize(addList);
--- a/toolkit/components/url-classifier/LookupCache.cpp
+++ b/toolkit/components/url-classifier/LookupCache.cpp
@@ -389,38 +389,38 @@ LookupCache::GetKey(const nsACString& aS
    return NS_OK;
   }
 
   const nsCSubstring& host = Substring(begin, iter);
 
   if (IsCanonicalizedIP(host)) {
     nsAutoCString key;
     key.Assign(host);
-    key.Append("/");
+    key.Append('/');
     return aHash->FromPlaintext(key, aCryptoHash);
   }
 
   nsTArray<nsCString> hostComponents;
   ParseString(PromiseFlatCString(host), '.', hostComponents);
 
   if (hostComponents.Length() < 2)
     return NS_ERROR_FAILURE;
 
   int32_t last = int32_t(hostComponents.Length()) - 1;
   nsAutoCString lookupHost;
 
   if (hostComponents.Length() > 2) {
     lookupHost.Append(hostComponents[last - 2]);
-    lookupHost.Append(".");
+    lookupHost.Append('.');
   }
 
   lookupHost.Append(hostComponents[last - 1]);
-  lookupHost.Append(".");
+  lookupHost.Append('.');
   lookupHost.Append(hostComponents[last]);
-  lookupHost.Append("/");
+  lookupHost.Append('/');
 
   return aHash->FromPlaintext(lookupHost, aCryptoHash);
 }
 
 /* static */ nsresult
 LookupCache::GetLookupFragments(const nsACString& aSpec,
                                 nsTArray<nsCString>* aFragments)
 
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -1202,17 +1202,17 @@ nsUrlClassifierDBService::Classify(nsIPr
   // LookupURI takes a comma-separated list already.
   Preferences::GetCString(MALWARE_TABLE_PREF, &malware);
   if (!malware.IsEmpty()) {
     tables.Append(malware);
   }
   nsAutoCString phishing;
   Preferences::GetCString(PHISH_TABLE_PREF, &phishing);
   if (!phishing.IsEmpty()) {
-    tables.Append(",");
+    tables.Append(',');
     tables.Append(phishing);
   }
   nsresult rv = LookupURI(aPrincipal, tables, callback, false, result);
   if (rv == NS_ERROR_MALFORMED_URI) {
     *result = false;
     // The URI had no hostname, don't try to classify it.
     return NS_OK;
   }
--- a/widget/gtk/nsPSPrinters.cpp
+++ b/widget/gtk/nsPSPrinters.cpp
@@ -61,17 +61,17 @@ nsPSPrinterList::GetPrinterList(nsTArray
         cups_dest_t *dests;
 
         int num_dests = (gCupsShim.mCupsGetDests)(&dests);
         if (num_dests) {
             for (int i = 0; i < num_dests; i++) {
                 nsAutoCString fullName(NS_CUPS_PRINTER);
                 fullName.Append(dests[i].name);
                 if (dests[i].instance != nullptr) {
-                    fullName.Append("/");
+                    fullName.Append('/');
                     fullName.Append(dests[i].instance);
                 }
                 if (dests[i].is_default)
                     aList.InsertElementAt(0, fullName);
                 else
                     aList.AppendElement(fullName);
             }
         }
--- a/xpcom/base/SystemMemoryReporter.cpp
+++ b/xpcom/base/SystemMemoryReporter.cpp
@@ -256,17 +256,17 @@ private:
             // about:memory) have to undo this change.
             processName.ReplaceChar('/', '\\');
             processName.AppendLiteral(", ");
           }
           fclose(f);
         }
         processName.AppendLiteral("pid=");
         processName.Append(pidStr);
-        processName.Append(")");
+        processName.Append(')');
 
         // Read the PSS values from the smaps file.
         nsPrintfCString smapsPath("/proc/%s/smaps", pidStr);
         f = fopen(smapsPath.get(), "r");
         if (!f) {
           // Processes can terminate between the readdir() call above and now,
           // so just skip if we can't open the file.
           continue;
@@ -459,24 +459,24 @@ private:
       aDesc.AppendLiteral(
         "Memory in anonymous mappings outside the boundaries defined by "
         "brk() / sbrk().");
       *aProcessSizeKind = AnonymousOutsideBrk;
     }
 
     aName.AppendLiteral("/[");
     aName.Append(aPerms);
-    aName.Append("]");
+    aName.Append(']');
 
     // Append the permissions.  This is useful for non-verbose mode in
     // about:memory when the filename is long and goes of the right side of the
     // window.
     aDesc.AppendLiteral(" [");
     aDesc.Append(aPerms);
-    aDesc.Append("]");
+    aDesc.Append(']');
   }
 
   nsresult ParseMapBody(
     FILE* aFile,
     const nsACString& aProcessName,
     const nsACString& aName,
     const nsACString& aDescription,
     nsIHandleReportCallback* aHandleReport,
@@ -513,17 +513,17 @@ private:
 
       // Don't report zero values.
       if (*aPss == 0) {
         return NS_OK;
       }
 
       nsAutoCString path("mem/processes/");
       path.Append(aProcessName);
-      path.Append("/");
+      path.Append('/');
       path.Append(aName);
 
       REPORT(path, *aPss, aDescription);
     } else {
       *aPss = 0;
     }
 
     return NS_OK;