Bug 1412421 - Change some nsAuto[C]String parameters back to ns[C]String. r=erahm
authorJorg K <jorgk@jorgk.com>
Sat, 28 Oct 2017 00:24:11 +0200
changeset 29273 6982e252d9b925a3db5d1fd6e64ba8ba52723fbb
parent 29272 d25546081788fa16c88358ddbb607405ca09ae68
child 29274 6c1a4df211346f193535e3d5a2e4281b1984837b
push id2068
push userclokep@gmail.com
push dateMon, 13 Nov 2017 19:02:14 +0000
treeherdercomm-beta@9c7e7ce8672b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1412421
Bug 1412421 - Change some nsAuto[C]String parameters back to ns[C]String. r=erahm
mailnews/base/util/nsMsgUtils.cpp
mailnews/base/util/nsMsgUtils.h
mailnews/imap/src/nsImapProtocol.cpp
mailnews/jsaccount/src/JaUrl.cpp
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -2100,20 +2100,20 @@ NS_MSG_BASE nsMsgKey msgKeyFromInt(uint3
 
 NS_MSG_BASE nsMsgKey msgKeyFromInt(uint64_t aValue)
 {
   NS_ASSERTION(aValue <= PR_UINT32_MAX, "Msg key value too big!");
   return aValue;
 }
 
 // Helper function to extract a query qualifier.
-nsAutoCString MsgExtractQueryPart(nsAutoCString spec, const char* queryToExtract)
+nsCString MsgExtractQueryPart(const nsACString& spec, const char* queryToExtract)
 {
-  nsAutoCString queryPart;
-  int32_t queryIndex = spec.Find(queryToExtract);
+  nsCString queryPart;
+  int32_t queryIndex = nsPromiseFlatCString(spec).Find(queryToExtract);
   if (queryIndex == kNotFound)
     return queryPart;
 
   int32_t queryEnd = spec.FindChar('&', queryIndex + 1);
   if (queryEnd == kNotFound)
     queryEnd = spec.FindChar('?', queryIndex + 1);
   if (queryEnd == kNotFound) {
     // Nothing follows, so return from where the query qualifier started.
--- a/mailnews/base/util/nsMsgUtils.h
+++ b/mailnews/base/util/nsMsgUtils.h
@@ -367,17 +367,17 @@ NS_MSG_BASE bool MsgIsHex(const char *aH
  */
 NS_MSG_BASE nsMsgKey msgKeyFromInt(uint32_t aValue);
 
 NS_MSG_BASE nsMsgKey msgKeyFromInt(uint64_t aValue);
 
 /**
  * Helper function to extract query part from URL spec.
  */
-nsAutoCString MsgExtractQueryPart(nsAutoCString spec, const char* queryToExtract);
+nsCString MsgExtractQueryPart(const nsACString& spec, const char* queryToExtract);
 
 /**
  * Helper macro for defining getter/setters. Ported from nsISupportsObsolete.h
  */
 #define NS_IMPL_GETSET(clazz, attr, type, member) \
   NS_IMETHODIMP clazz::Get##attr(type *result) \
   { \
     NS_ENSURE_ARG_POINTER(result); \
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -9356,25 +9356,25 @@ nsresult nsImapMockChannel::OpenCacheEnt
 
   // First we need to "normalise" the URL by extracting ?part= and &filename.
   // The path should only contain: ?part=x.y&filename=file.ext
   // These are seen in the wild:
   // /;section=2?part=1.2&filename=A01.JPG
   // ?section=2?part=1.2&filename=A01.JPG&type=image/jpeg&filename=A01.JPG
   // ?part=1.2&type=image/jpeg&filename=IMG_C0030.jpg
   // ?header=quotebody&part=1.2&filename=lijbmghmkilicioj.png
-  nsAutoCString partQuery = MsgExtractQueryPart(path, "?part=");
+  nsCString partQuery = MsgExtractQueryPart(path, "?part=");
   if (partQuery.IsEmpty()) {
     partQuery = MsgExtractQueryPart(path, "&part=");
     if (!partQuery.IsEmpty()) {
       // ? indicates a part query, so set the first character to that.
       partQuery.SetCharAt('?', 0);
     }
   }
-  nsAutoCString filenameQuery = MsgExtractQueryPart(path, "&filename=");
+  nsCString filenameQuery = MsgExtractQueryPart(path, "&filename=");
 
   // Truncate path at either /; or ?
   int32_t ind = path.FindChar('?');
   if (ind != kNotFound)
     path.SetLength(ind);
   ind = path.Find("/;");
   if (ind != kNotFound)
     path.SetLength(ind);
--- a/mailnews/jsaccount/src/JaUrl.cpp
+++ b/mailnews/jsaccount/src/JaUrl.cpp
@@ -103,17 +103,17 @@ NS_IMETHODIMP JaBaseCppUrl::GetPrincipal
   // URLs contain a lot of query parts. We want need a normalised form:
   // scheme://server/folder?number=123
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsURL;
   QueryInterface(NS_GET_IID(nsIMsgMailNewsUrl), getter_AddRefs(mailnewsURL));
 
   nsAutoCString spec;
   mailnewsURL->GetSpecIgnoringRef(spec);
 
-  nsAutoCString queryPart = MsgExtractQueryPart(spec, "number=");
+  nsCString queryPart = MsgExtractQueryPart(spec, "number=");
 
   // Strip any query part beginning with ? or /;
   int32_t ind = spec.Find("/;");
   if (ind != kNotFound)
     spec.SetLength(ind);
 
   ind = spec.FindChar('?');
   if (ind != kNotFound)