Bug 1402750 - Replace [Assign|Append|Insert|Equals](NS_LITERAL_STRING("")) with [Assign|Append|Insert|Equals]Literal(u""). r=aceman
authorJorg K <jorgk@jorgk.com>
Tue, 26 Sep 2017 00:43:54 +0200
changeset 22209 a921d6d8617f4a2498b97c676e44a3e86a47f69c
parent 22208 337c6fe6e0e723bcf16be9ebfa3979d78e39166c
child 22210 15ac102a32acd872add611441aa85babb2ee4b4d
push id13553
push usermozilla@jorgk.com
push dateMon, 25 Sep 2017 23:35:01 +0000
treeherdercomm-central@2434e5fd8480 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs1402750
Bug 1402750 - Replace [Assign|Append|Insert|Equals](NS_LITERAL_STRING("")) with [Assign|Append|Insert|Equals]Literal(u""). r=aceman
mailnews/addrbook/src/nsAbManager.cpp
mailnews/base/search/src/nsMsgFilterList.cpp
mailnews/base/src/nsMessenger.cpp
mailnews/base/src/nsMsgDBView.cpp
mailnews/base/src/nsMsgFolderDataSource.cpp
mailnews/base/src/nsMsgGroupView.cpp
mailnews/base/src/nsMsgWindow.cpp
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgProtocol.cpp
mailnews/compose/src/nsMsgCompose.cpp
mailnews/compose/src/nsMsgComposeService.cpp
--- a/mailnews/addrbook/src/nsAbManager.cpp
+++ b/mailnews/addrbook/src/nsAbManager.cpp
@@ -816,18 +816,18 @@ nsAbManager::ExportDirectoryToDelimitedT
 
               // Make sure we quote if containing CR/LF.
               if (newValue.FindChar('\r') != -1 ||
                   newValue.FindChar('\n') != -1)
                   needsQuotes = true;
 
               if (needsQuotes)
               {
-                newValue.Insert(NS_LITERAL_STRING("\""), 0);
-                newValue.AppendLiteral("\"");
+                newValue.InsertLiteral(u"\"", 0);
+                newValue.Append(u'"');
               }
 
               rv = nsMsgI18NConvertFromUnicode(useUTF8 ? "UTF-8" : nsMsgI18NFileSystemCharset(),
                                                newValue, valueCStr);
               NS_ENSURE_SUCCESS(rv,rv);
 
               if (NS_FAILED(rv)) {
                 NS_ERROR("failed to convert string to system charset.  use LDIF");
--- a/mailnews/base/search/src/nsMsgFilterList.cpp
+++ b/mailnews/base/search/src/nsMsgFilterList.cpp
@@ -192,17 +192,17 @@ nsMsgFilterList::GetLogFile(nsIFile **aF
 
     // NOTE:
     // we don't we need to call NS_MsgHashIfNecessary()
     // it's already been hashed, if necessary
     nsAutoString filterLogName;
     rv = filterLogFile->GetLeafName(filterLogName);
     NS_ENSURE_SUCCESS(rv,rv);
 
-    filterLogName.Append(NS_LITERAL_STRING(".htm"));
+    filterLogName.AppendLiteral(u".htm");
 
     rv = filterLogFile->SetLeafName(filterLogName);
     NS_ENSURE_SUCCESS(rv,rv);
 
     filterLogFile.forget(aFile);
   }
   else {
     rv = server->GetLocalPath(aFile);
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -521,17 +521,17 @@ nsMessenger::LoadURL(mozIDOMWindowProxy 
     NS_ENSURE_SUCCESS(rv, rv);
     nsCOMPtr <nsIFileURL> fileUrl = do_QueryInterface(fileUri, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
     nsCOMPtr <nsIFile> file;
     rv = fileUrl->GetFile(getter_AddRefs(file));
     NS_ENSURE_SUCCESS(rv, rv);
     file->GetFileSize(&fileSize);
     uriString.Replace(0, 5, NS_LITERAL_STRING("mailbox:"));
-    uriString.Append(NS_LITERAL_STRING("&number=0"));
+    uriString.AppendLiteral(u"&number=0");
     loadingFromFile = true;
     getDummyMsgHdr = true;
   }
   else if (StringBeginsWith(uriString, NS_LITERAL_STRING("mailbox:")) &&
            (CaseInsensitiveFindInReadable(NS_LITERAL_STRING(".eml?"), uriString)))
   {
     // if we have a mailbox:// url that points to an .eml file, we have to read
     // the file size as well
@@ -866,17 +866,17 @@ nsMessenger::SaveOneAttachment(const cha
     }
 
     nsString filterName;
     const char16_t *extensionParam[] = { extension.get() };
     rv = mStringBundle->FormatStringFromName(
       "saveAsType", extensionParam, 1, filterName);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    extension.Insert(NS_LITERAL_STRING("*."), 0);
+    extension.InsertLiteral(u"*.", 0);
     filePicker->AppendFilter(filterName, extension);
   }
 
   filePicker->AppendFilters(nsIFilePicker::filterAll);
 
   rv = GetLastSaveDirectory(getter_AddRefs(lastSaveDir));
   if (NS_SUCCEEDED(rv) && lastSaveDir)
     filePicker->SetDisplayDirectory(lastSaveDir);
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -511,17 +511,17 @@ nsresult nsMsgDBView::FetchRecipients(ns
       if (!curName.IsEmpty())
         recipient = curName;
       else
         CopyUTF8toUTF16(curAddress, recipient);
     }
 
     // add ', ' between each recipient
     if (i != 0)
-      aRecipientsString.Append(NS_LITERAL_STRING(", "));
+      aRecipientsString.AppendLiteral(u", ");
 
     aRecipientsString.Append(recipient);
   }
 
   if (numAddresses == 0 && unparsedRecipients.FindChar(':') != kNotFound) {
     // No addresses and a colon, so an empty group like "undisclosed-recipients: ;".
     // Add group name so at least something displays.
     nsString group;
--- a/mailnews/base/src/nsMsgFolderDataSource.cpp
+++ b/mailnews/base/src/nsMsgFolderDataSource.cpp
@@ -1008,17 +1008,17 @@ nsresult nsMsgFolderDataSource::createFo
   return NS_OK;
 }
 
 nsresult nsMsgFolderDataSource::CreateUnreadMessagesNameString(int32_t unreadMessages, nsAutoString &nameString)
 {
   //Only do this if unread messages are positive
   if(unreadMessages > 0)
   {
-    nameString.Append(NS_LITERAL_STRING(" ("));
+    nameString.AppendLiteral(u" (");
     nameString.AppendInt(unreadMessages);
     nameString.Append(u')');
   }
   return NS_OK;
 }
 
 nsresult
 nsMsgFolderDataSource::createFolderSpecialNode(nsIMsgFolder *folder,
--- a/mailnews/base/src/nsMsgGroupView.cpp
+++ b/mailnews/base/src/nsMsgGroupView.cpp
@@ -999,25 +999,25 @@ nsMsgGroupView::CellTextForColumn(int32_
 
         // Get number of unread messages.
         nsAutoString formattedCountUnrMsg;
         uint32_t numUnrMsg = 0;
         groupThread->GetNumUnreadChildren(&numUnrMsg);
         formattedCountUnrMsg.AppendInt(numUnrMsg);
 
         // Add text to header.
-        aValue.Append(NS_LITERAL_STRING(" ("));
+        aValue.AppendLiteral(u" (");
         if (numUnrMsg)
         {
           aValue.Append(formattedCountUnrMsg);
-          aValue.Append(NS_LITERAL_STRING("/"));
+          aValue.Append(u'/');
         }
 
         aValue.Append(formattedCountMsg);
-        aValue.Append(NS_LITERAL_STRING(")"));
+        aValue.Append(u')');
       }
     }
     else if (aColumnName[0] == 't' && aColumnName[1] == 'o')
     {
       nsAutoString formattedCountString;
       uint32_t numChildren = (groupThread) ? groupThread->NumRealChildren() : 0;
       formattedCountString.AppendInt(numChildren);
       aValue.Assign(formattedCountString);
--- a/mailnews/base/src/nsMsgWindow.cpp
+++ b/mailnews/base/src/nsMsgWindow.cpp
@@ -512,19 +512,19 @@ nsMsgWindow::DisplayURIInMessagePane(con
                          nullptr, nullptr, nullptr,
                          principal);
 }
 
 NS_IMETHODIMP
 nsMsgWindow::DisplayHTMLInMessagePane(const nsAString& title, const nsAString& body, bool clearMsgHdr)
 {
   nsString htmlStr;
-  htmlStr.Append(NS_LITERAL_STRING("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>"));
+  htmlStr.AppendLiteral(u"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>");
   htmlStr.Append(body);
-  htmlStr.Append(NS_LITERAL_STRING("</body></html>"));
+  htmlStr.AppendLiteral(u"</body></html>");
 
   char *encodedHtml = PL_Base64Encode(NS_ConvertUTF16toUTF8(htmlStr).get(), 0, nullptr);
   if (!encodedHtml)
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsCString dataSpec;
   dataSpec = "data:text/html;base64,";
   dataSpec += encodedHtml;
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -5514,17 +5514,17 @@ NS_IMETHODIMP nsMsgDBFolder::GetMsgTextF
     nsAutoCString contentTypeHdr;
     mimeHeaders->ExtractHeader("Content-Type", false, contentTypeHdr);
 
     // Get the content type
     // If we don't have a content type, then we assign text/plain
     // this is in violation of the RFC for multipart/digest, though
     // Also, if we've just passed an end boundary, we're going to ignore this.
     if (!justPassedEndBoundary && contentTypeHdr.IsEmpty())
-      contentType.Assign(NS_LITERAL_STRING("text/plain"));
+      contentType.AssignLiteral(u"text/plain");
     else
       mimeHdrParam->GetParameter(contentTypeHdr, nullptr, EmptyCString(), false, nullptr, contentType);
 
     justPassedEndBoundary = false;
 
     // If we are multipart, then we need to get the boundary
     if (StringBeginsWith(contentType, NS_LITERAL_STRING("multipart/"), nsCaseInsensitiveStringComparator()))
     {
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -357,19 +357,19 @@ void nsMsgProtocol::ShowAlertMessage(nsI
 
   NS_ASSERTION(errorString, "unknown error, but don't alert user.");
   if (errorString)
   {
     nsString errorMsg;
     errorMsg.Adopt(FormatStringWithHostNameByName(errorString, aMsgUrl));
     if (errorMsg.IsEmpty())
     {
-      errorMsg.Assign(NS_LITERAL_STRING("[StringID "));
+      errorMsg.AssignLiteral(u"[StringID ");
       errorMsg.Append(errorString);
-      errorMsg.AppendLiteral("?]");
+      errorMsg.AppendLiteral(u"?]");
     }
 
     nsCOMPtr<nsIMsgMailSession> mailSession =
       do_GetService(NS_MSGMAILSESSION_CONTRACTID);
     if (mailSession)
       mailSession->AlertUser(errorMsg, aMsgUrl);
   }
 }
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -2118,17 +2118,17 @@ nsresult nsMsgCompose::CreateMessage(con
           {
             if (!isFirstPass)       // safeguard, just in case...
             {
               PR_Free(uriList);
               return rv;
             }
             mQuotingToFollow = true;
 
-            subject.Insert(NS_LITERAL_STRING("Re: "), 0);
+            subject.InsertLiteral(u"Re: ", 0);
             m_compFields->SetSubject(subject);
 
             // Setup quoting callbacks for later...
             mWhatHolder = 1;
             break;
           }
         case nsIMsgCompType::ForwardAsAttachment:
           {
@@ -2152,17 +2152,17 @@ nsresult nsMsgCompose::CreateMessage(con
               references.Append('>');
               m_compFields->SetReferences(references.get());
             }
 
             uint32_t flags;
 
             msgHdr->GetFlags(&flags);
             if (flags & nsMsgMessageFlags::HasRe)
-              subject.Insert(NS_LITERAL_STRING("Re: "), 0);
+              subject.InsertLiteral(u"Re: ", 0);
 
             // Setup quoting callbacks for later...
             mQuotingToFollow = false;  //We don't need to quote the original message.
             nsCOMPtr<nsIMsgAttachment> attachment = do_CreateInstance(NS_MSGATTACHMENT_CONTRACTID, &rv);
             if (NS_SUCCEEDED(rv) && attachment)
             {
               bool addExtension = true;
               nsString sanitizedSubj;
@@ -2207,17 +2207,17 @@ nsresult nsMsgCompose::CreateMessage(con
               {
                 nsString unicodeFwdPrefix;
                 CopyUTF8toUTF16(fwdPrefix, unicodeFwdPrefix);
                 unicodeFwdPrefix.AppendLiteral(": ");
                 subject.Insert(unicodeFwdPrefix, 0);
               }
               else
               {
-                subject.Insert(NS_LITERAL_STRING("Fwd: "), 0);
+                subject.InsertLiteral(u"Fwd: ", 0);
               }
               m_compFields->SetSubject(subject);
             }
             break;
           }
         case nsIMsgCompType::Redirect:
           {
             // For a redirect, set the Reply-To: header to what was in the original From: header...
@@ -3181,17 +3181,17 @@ bool IsInDomainList(const nsAString &aDo
     if (right == kNotFound)
       right = aDomainList.Length();
     nsDependentSubstring domain = Substring(aDomainList, left, right);
 
     if (aDomain.Equals(domain, nsCaseInsensitiveStringComparator()))
       return true;
 
     nsAutoString dotDomain;
-    dotDomain.Assign(NS_LITERAL_STRING("."));
+    dotDomain.Assign(u'.');
     dotDomain.Append(domain);
     if (StringEndsWith(aDomain, dotDomain, nsCaseInsensitiveStringComparator()))
       return true;
 
     left = right + 1;
   }
   return false;
 }
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -732,19 +732,19 @@ NS_IMETHODIMP nsMsgTemplateReplyHelper::
   nsString templateSubject, replySubject;
 
   mHdrToReplyTo->GetMime2DecodedSubject(replySubject);
   mTemplateHdr->GetMime2DecodedSubject(templateSubject);
   nsString subject(NS_LITERAL_STRING("Auto: ")); // RFC 3834 3.1.5.
   subject.Append(templateSubject);
   if (!replySubject.IsEmpty())
   {
-    subject.Append(NS_LITERAL_STRING(" (was: "));
+    subject.AppendLiteral(u" (was: ");
     subject.Append(replySubject);
-    subject.Append(NS_LITERAL_STRING(")"));
+    subject.Append(u')');
   }
 
   compFields->SetSubject(subject);
   compFields->SetRawHeader("Auto-Submitted", NS_LITERAL_CSTRING("auto-replied"), nullptr);
 
   nsCString charset;
   rv = mTemplateHdr->GetCharset(getter_Copies(charset));
   NS_ENSURE_SUCCESS(rv, rv);