Bug 869836 - Part 10: Use Truncate instead of `AssignLiteral("")`. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 26 May 2014 21:54:53 +0300
changeset 185141 09385232f753e6a666a85da22f5f54e803f0cc66
parent 185140 8b8bbe7aa1cc72a399b98419766fce3bb2ad48e1
child 185142 64a0e8806b2226c1f638b5ad664a473b9709d5d4
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 10: Use Truncate instead of `AssignLiteral("")`. r=ehsan
content/base/src/nsPlainTextSerializer.cpp
dom/bluetooth/bluez/BluetoothHfpManager.cpp
dom/bluetooth2/bluez/BluetoothHfpManager.cpp
dom/events/PointerEvent.cpp
extensions/spellcheck/hunspell/src/mozHunspell.cpp
extensions/spellcheck/src/mozSpellChecker.cpp
netwerk/cache2/CacheFileIOManager.cpp
widget/android/GfxInfo.cpp
widget/gonk/GfxInfo.cpp
widget/windows/GfxInfo.cpp
widget/xpwidgets/GfxInfoX11.cpp
--- a/content/base/src/nsPlainTextSerializer.cpp
+++ b/content/base/src/nsPlainTextSerializer.cpp
@@ -1598,17 +1598,17 @@ nsPlainTextSerializer::Write(const nsASt
         if ('\r' == *iter && bol < totLen && '\n' == *++iter) {
           // There was a CRLF in the input. This used to be illegal and
           // stripped by the parser. Apparently not anymore. Let's skip
           // over the LF.
           bol++;
         }
       }
 
-      mCurrentLine.AssignLiteral("");
+      mCurrentLine.Truncate();
       if (mFlags & nsIDocumentEncoder::OutputFormatFlowed) {
         if ((outputLineBreak || !spacesOnly) && // bugs 261467,125928
             !stringpart.EqualsLiteral("-- ") &&
             !stringpart.EqualsLiteral("- -- "))
           stringpart.Trim(" ", false, true, true);
         if (IsSpaceStuffable(stringpart.get()) && stringpart[0] != '>')
           mCurrentLine.Append(char16_t(' '));
       }
--- a/dom/bluetooth/bluez/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/bluez/BluetoothHfpManager.cpp
@@ -1524,17 +1524,17 @@ BluetoothHfpManager::HandleCallStateChan
 
         if (mBSIR) {
           // Setup audio connection for in-band ring tone
           ConnectSco();
         }
 
         nsAutoString number(aNumber);
         if (!mCLIP) {
-          number.AssignLiteral("");
+          number.Truncate();
         }
 
         MessageLoop::current()->PostDelayedTask(
           FROM_HERE,
           new SendRingIndicatorTask(number,
                                     mCurrentCallArray[aCallIndex].mType),
           sRingInterval);
       }
--- a/dom/bluetooth2/bluez/BluetoothHfpManager.cpp
+++ b/dom/bluetooth2/bluez/BluetoothHfpManager.cpp
@@ -1524,17 +1524,17 @@ BluetoothHfpManager::HandleCallStateChan
 
         if (mBSIR) {
           // Setup audio connection for in-band ring tone
           ConnectSco();
         }
 
         nsAutoString number(aNumber);
         if (!mCLIP) {
-          number.AssignLiteral("");
+          number.Truncate();
         }
 
         MessageLoop::current()->PostDelayedTask(
           FROM_HERE,
           new SendRingIndicatorTask(number,
                                     mCurrentCallArray[aCallIndex].mType),
           sRingInterval);
       }
--- a/dom/events/PointerEvent.cpp
+++ b/dom/events/PointerEvent.cpp
@@ -99,17 +99,17 @@ PointerEvent::GetPointerType(nsAString& 
       break;
     case nsIDOMMouseEvent::MOZ_SOURCE_PEN:
       aPointerType.AssignLiteral("pen");
       break;
     case nsIDOMMouseEvent::MOZ_SOURCE_TOUCH:
       aPointerType.AssignLiteral("touch");
       break;
     case nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN:
-      aPointerType.AssignLiteral("");
+      aPointerType.Truncate();
       break;
   }
 }
 
 int32_t
 PointerEvent::PointerId()
 {
   return mEvent->AsPointerEvent()->pointerId;
--- a/extensions/spellcheck/hunspell/src/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/src/mozHunspell.cpp
@@ -150,19 +150,19 @@ NS_IMETHODIMP mozHunspell::GetDictionary
  */
 NS_IMETHODIMP mozHunspell::SetDictionary(const char16_t *aDictionary)
 {
   NS_ENSURE_ARG_POINTER(aDictionary);
 
   if (nsDependentString(aDictionary).IsEmpty()) {
     delete mHunspell;
     mHunspell = nullptr;
-    mDictionary.AssignLiteral("");
-    mAffixFileName.AssignLiteral("");
-    mLanguage.AssignLiteral("");
+    mDictionary.Truncate();
+    mAffixFileName.Truncate();
+    mLanguage.Truncate();
     mDecoder = nullptr;
     mEncoder = nullptr;
 
     nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
     if (obs) {
       obs->NotifyObservers(nullptr,
                            SPELLCHECK_DICTIONARY_UPDATE_NOTIFICATION,
                            nullptr);
--- a/extensions/spellcheck/src/mozSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozSpellChecker.cpp
@@ -314,17 +314,17 @@ mozSpellChecker::GetDictionaryList(nsTAr
 
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 mozSpellChecker::GetCurrentDictionary(nsAString &aDictionary)
 {
   if (!mSpellCheckingEngine) {
-    aDictionary.AssignLiteral("");
+    aDictionary.Truncate();
     return NS_OK;
   }
 
   nsXPIDLString dictname;
   mSpellCheckingEngine->GetDictionary(getter_Copies(dictname));
   aDictionary = dictname;
   return NS_OK;
 }
--- a/netwerk/cache2/CacheFileIOManager.cpp
+++ b/netwerk/cache2/CacheFileIOManager.cpp
@@ -3293,17 +3293,17 @@ CacheFileIOManager::CreateFile(CacheFile
   aHandle->mFileSize = 0;
   return NS_OK;
 }
 
 // static
 void
 CacheFileIOManager::HashToStr(const SHA1Sum::Hash *aHash, nsACString &_retval)
 {
-  _retval.AssignLiteral("");
+  _retval.Truncate();
   const char hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7',
                            '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
   for (uint32_t i=0 ; i<sizeof(SHA1Sum::Hash) ; i++) {
     _retval.Append(hexChars[(*aHash)[i] >> 4]);
     _retval.Append(hexChars[(*aHash)[i] & 0xF]);
   }
 }
 
--- a/widget/android/GfxInfo.cpp
+++ b/widget/android/GfxInfo.cpp
@@ -218,34 +218,34 @@ GfxInfo::GetAdapterDescription2(nsAStrin
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterRAM; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
 {
   EnsureInitialized();
-  aAdapterRAM.AssignLiteral("");
+  aAdapterRAM.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterRAM2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
 {
   EnsureInitialized();
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterDriver; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
 {
   EnsureInitialized();
-  aAdapterDriver.AssignLiteral("");
+  aAdapterDriver.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriver2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
 {
   EnsureInitialized();
@@ -269,17 +269,17 @@ GfxInfo::GetAdapterDriverVersion2(nsAStr
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterDriverDate; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
 {
   EnsureInitialized();
-  aAdapterDriverDate.AssignLiteral("");
+  aAdapterDriverDate.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriverDate2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
 {
   EnsureInitialized();
--- a/widget/gonk/GfxInfo.cpp
+++ b/widget/gonk/GfxInfo.cpp
@@ -34,107 +34,107 @@ GfxInfo::GetCleartypeParameters(nsAStrin
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterDescription; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
 {
-  aAdapterDescription.AssignLiteral("");
+  aAdapterDescription.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDescription2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterRAM; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
 {
-  aAdapterRAM.AssignLiteral("");
+  aAdapterRAM.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterRAM2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterDriver; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
 {
-  aAdapterDriver.AssignLiteral("");
+  aAdapterDriver.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriver2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterDriverVersion; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
 {
-  aAdapterDriverVersion.AssignLiteral("");
+  aAdapterDriverVersion.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriverVersion2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterDriverDate; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
 {
-  aAdapterDriverDate.AssignLiteral("");
+  aAdapterDriverDate.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriverDate2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterVendorID; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
 {
-  aAdapterVendorID.AssignLiteral("");
+  aAdapterVendorID.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterVendorID2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterDeviceID; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
 {
-  aAdapterDeviceID.AssignLiteral("");
+  aAdapterDeviceID.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDeviceID2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
 {
   return NS_ERROR_FAILURE;
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -587,17 +587,17 @@ GfxInfo::GetAdapterRAM(nsAString & aAdap
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterRAM2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
 {
   if (!mHasDualGPU) {
-    aAdapterRAM.AssignLiteral("");
+    aAdapterRAM.Truncate();
   } else if (NS_FAILED(GetKeyValue(mDeviceKey2.get(), L"HardwareInformation.MemorySize", aAdapterRAM, REG_DWORD))) {
     aAdapterRAM = L"Unknown";
   }
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriver; */
 NS_IMETHODIMP
@@ -608,17 +608,17 @@ GfxInfo::GetAdapterDriver(nsAString & aA
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriver2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
 {
   if (!mHasDualGPU) {
-    aAdapterDriver.AssignLiteral("");
+    aAdapterDriver.Truncate();
   } else if (NS_FAILED(GetKeyValue(mDeviceKey2.get(), L"InstalledDisplayDrivers", aAdapterDriver, REG_MULTI_SZ))) {
     aAdapterDriver = L"Unknown";
   }
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriverVersion; */
 NS_IMETHODIMP
--- a/widget/xpwidgets/GfxInfoX11.cpp
+++ b/widget/xpwidgets/GfxInfoX11.cpp
@@ -418,32 +418,32 @@ GfxInfo::GetAdapterDescription2(nsAStrin
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterRAM; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
 {
-  aAdapterRAM.AssignLiteral("");
+  aAdapterRAM.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterRAM2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterDriver; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
 {
-  aAdapterDriver.AssignLiteral("");
+  aAdapterDriver.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriver2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
 {
   return NS_ERROR_FAILURE;
@@ -464,17 +464,17 @@ GfxInfo::GetAdapterDriverVersion2(nsAStr
 {
   return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute DOMString adapterDriverDate; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
 {
-  aAdapterDriverDate.AssignLiteral("");
+  aAdapterDriverDate.Truncate();
   return NS_OK;
 }
 
 /* readonly attribute DOMString adapterDriverDate2; */
 NS_IMETHODIMP
 GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
 {
   return NS_ERROR_FAILURE;