Bug 669586 - Replace some nsCStringArray instances with nsTArray<nsCString>; r=bienvenu
authorMark Banner <bugzilla@standard8.plus.com>
Mon, 25 Jul 2011 22:05:12 +0100
changeset 8626 9875fdbfc9db2680007f3305f85e951606725465
parent 8625 9eafe179ea092c754372049f24c6cb6c28593866
child 8627 d5812a6f28b98a7d2ccbb851a31a44acc5476df5
push id1
push userhg
push dateTue, 08 Jul 2014 14:20:55 +0000
treeherdercomm-esr31@1665b2be5642 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu
bugs669586
Bug 669586 - Replace some nsCStringArray instances with nsTArray<nsCString>; r=bienvenu
mailnews/addrbook/src/nsAbLDAPCard.cpp
mailnews/addrbook/src/nsAbLDAPCard.h
mailnews/base/search/src/nsMsgSearchSession.cpp
mailnews/base/search/src/nsMsgSearchSession.h
mailnews/base/src/nsMsgDBView.cpp
mailnews/base/src/nsMsgDBView.h
mailnews/base/src/nsMsgTagService.cpp
mailnews/base/src/nsMsgTagService.h
mailnews/imap/src/nsImapServerResponseParser.cpp
mailnews/imap/src/nsImapServerResponseParser.h
mailnews/local/src/nsParseMailbox.cpp
mailnews/local/src/nsParseMailbox.h
--- a/mailnews/addrbook/src/nsAbLDAPCard.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPCard.cpp
@@ -104,38 +104,38 @@ NS_IMETHODIMP nsAbLDAPCard::GetLDAPMessa
   // classes: if an entry has additional object classes, it's probably
   // for a good reason.
   nsCAutoString oclass;
   for (PRUint32 i = 0; i < aClassCount; ++i)
   {
     oclass.Assign(nsDependentCString(aClasses[i]));
     ToLowerCase(oclass);
    
-    if (m_objectClass.IndexOf(oclass) == -1)
+    if (m_objectClass.IndexOf(oclass) == nsTArray<nsCString>::NoIndex)
     {
-      m_objectClass.AppendCString(oclass);
+      m_objectClass.AppendElement(oclass);
       printf("LDAP : adding objectClass %s\n", oclass.get());
     }
   }
 
   nsCOMPtr<nsILDAPModification> mod =
     do_CreateInstance("@mozilla.org/network/ldap-modification;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
  
   nsCOMPtr<nsIMutableArray> values =
     do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   
-  for (PRInt32 i = 0; i < m_objectClass.Count(); ++i)
+  for (PRUint32 i = 0; i < m_objectClass.Length(); ++i)
   {
     nsCOMPtr<nsILDAPBERValue> value =
       do_CreateInstance("@mozilla.org/network/ldap-ber-value;1", &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    rv = value->SetFromUTF8(*m_objectClass.CStringAt(i));
+    rv = value->SetFromUTF8(m_objectClass.ElementAt(i));
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = values->AppendElement(value, PR_FALSE);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   
   rv = mod->SetUpModification(aType, NS_LITERAL_CSTRING("objectClass"), values);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -175,16 +175,18 @@ NS_IMETHODIMP nsAbLDAPCard::GetLDAPMessa
     // If the property is not mapped to an attribute, skip it.
     if (attr.IsEmpty())
       continue;
  
     nsCOMPtr<nsILDAPModification> mod =
       do_CreateInstance("@mozilla.org/network/ldap-modification;1", &rv);
     NS_ENSURE_SUCCESS(rv, rv);
    
+    PRUint32 index = m_attributes.IndexOf(attr);
+
     rv = GetPropertyAsAUTF8String(props[i], propvalue);
 
     if (NS_SUCCEEDED(rv) &&!propvalue.IsEmpty())
     {
       // If the new value is not empty, add/update it
       nsCOMPtr<nsILDAPBERValue> value =
         do_CreateInstance("@mozilla.org/network/ldap-ber-value;1", &rv);
       NS_ENSURE_SUCCESS(rv, rv);
@@ -193,35 +195,35 @@ NS_IMETHODIMP nsAbLDAPCard::GetLDAPMessa
       NS_ENSURE_SUCCESS(rv, rv);
  
       rv = mod->SetUpModificationOneValue(aType, attr, value);
       NS_ENSURE_SUCCESS(rv, rv);
     
       printf("LDAP : setting attribute %s (%s) to '%s'\n", attr.get(),
         props[i], propvalue.get());
       modArray->AppendElement(mod, PR_FALSE);
-      if (m_attributes.IndexOf(attr) != -1)
-        m_attributes.AppendCString(attr);
+      if (index != nsTArray<nsCString>::NoIndex)
+        m_attributes.AppendElement(attr);
 
     }
-    else if ((aType == nsILDAPModification::MOD_REPLACE) &&
-               (m_attributes.IndexOf(attr) != -1))
+    else if (aType == nsILDAPModification::MOD_REPLACE &&
+             index != nsTArray<nsCString>::NoIndex)
     {
       // If the new value is empty, we are performing an update
       // and the attribute was previously set, clear it
       nsCOMPtr<nsIMutableArray> novalues =
         do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
 
       rv = mod->SetUpModification(aType, attr, novalues);
       NS_ENSURE_SUCCESS(rv, rv);
       
       printf("LDAP : removing attribute %s (%s)\n", attr.get(), props[i]);
       modArray->AppendElement(mod, PR_FALSE);
-      m_attributes.RemoveCString(attr);
+      m_attributes.RemoveElementAt(index);
     }
   }
 
   NS_ADDREF(*aLDAPAddMessageInfo = modArray);
 
   return NS_OK;
 }
 
@@ -296,17 +298,17 @@ NS_IMETHODIMP nsAbLDAPCard::SetMetaPrope
   NS_ENSURE_SUCCESS(rv, rv);
  
   nsCAutoString attr;
   m_attributes.Clear();
   for (PRUint32 i = 0; i < attrs.GetSize(); ++i)
   {
     attr.Assign(nsDependentCString(attrs[i]));
     ToLowerCase(attr);
-    m_attributes.AppendCString(attr);
+    m_attributes.AppendElement(attr);
   }
 
   // Get the objectClass values
   m_objectClass.Clear();
   PRUnicharPtrArrayGuard vals;
   rv = aMessage->GetValues("objectClass", vals.GetSizeAddr(),
     vals.GetArrayAddr());
 
@@ -318,13 +320,13 @@ NS_IMETHODIMP nsAbLDAPCard::SetMetaPrope
 
   NS_ENSURE_SUCCESS(rv, rv);
   
   nsCAutoString oclass;
   for (PRUint32 i = 0; i < vals.GetSize(); ++i)
   {
     oclass.Assign(NS_LossyConvertUTF16toASCII(nsDependentString(vals[i])));
     ToLowerCase(oclass);
-    m_objectClass.AppendCString(oclass);
+    m_objectClass.AppendElement(oclass);
   }
 
   return NS_OK;
 }
--- a/mailnews/addrbook/src/nsAbLDAPCard.h
+++ b/mailnews/addrbook/src/nsAbLDAPCard.h
@@ -38,28 +38,27 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsAbLDAPCard_h__
 #define nsAbLDAPCard_h__
 
 #include "nsAbCardProperty.h"
 #include "nsIAbLDAPCard.h"
-#include "nsVoidArray.h"
 
 class nsIMutableArray;
 
 class nsAbLDAPCard : public nsAbCardProperty,
                      public nsIAbLDAPCard
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIABLDAPCARD
 
   nsAbLDAPCard();
   virtual ~nsAbLDAPCard();
 
 protected:
-  nsCStringArray m_attributes;
-  nsCStringArray m_objectClass;
+  nsTArray<nsCString> m_attributes;
+  nsTArray<nsCString> m_objectClass;
 };
 
 #endif
--- a/mailnews/base/search/src/nsMsgSearchSession.cpp
+++ b/mailnews/base/search/src/nsMsgSearchSession.cpp
@@ -393,17 +393,17 @@ NS_IMETHODIMP nsMsgSearchSession::OnStop
   // tell the current adapter that the current url has run.
   if (NS_SUCCEEDED(rv) && runningAdapter)
   {
     runningAdapter->CurrentUrlDone(aExitCode);
     EnableFolderNotifications(PR_TRUE);
     ReleaseFolderDBRef();
   }
   m_idxRunningScope++;
-  if (++m_urlQueueIndex < m_urlQueue.Count())
+  if (++m_urlQueueIndex < m_urlQueue.Length())
     GetNextUrl();
   else if (m_idxRunningScope < m_scopeList.Length())
     DoNextSearch();
   else
     NotifyListenersDone(aExitCode);
   return NS_OK;
 }
 
@@ -477,21 +477,21 @@ nsresult nsMsgSearchSession::BuildUrlQue
   PRUint32 i;
   for (i = m_idxRunningScope; i < m_scopeList.Length(); i++)
   {
     nsMsgSearchScopeTerm *scope = m_scopeList.ElementAt(i);
     if (scope->m_attribute != nsMsgSearchScope::onlineMail &&
       (scope->m_attribute != nsMsgSearchScope::news && scope->m_searchServer))
       break;
     nsCOMPtr <nsIMsgSearchAdapter> adapter = do_QueryInterface(scope->m_adapter);
-    nsCString url;
     if (adapter)
     {
+      nsCString url;
       adapter->GetEncoding(getter_Copies(url));
-      AddUrl (url.get());
+      m_urlQueue.AppendElement(url);
     }
   }
 
   if (i > 0)
     GetNextUrl();
 
   return NS_OK;
 }
@@ -504,17 +504,17 @@ nsresult nsMsgSearchSession::GetNextUrl(
 
   PRBool stopped = PR_FALSE;
   nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(m_msgWindowWeak));
   if (msgWindow)
     msgWindow->GetStopped(&stopped);
   if (stopped)
     return NS_OK;
 
-  m_urlQueue.CStringAt(m_urlQueueIndex, nextUrl);
+  nextUrl = m_urlQueue[m_urlQueueIndex];
   nsMsgSearchScopeTerm *currentTerm = GetRunningScope();
   NS_ENSURE_TRUE(currentTerm, NS_ERROR_NULL_POINTER);
   EnableFolderNotifications(PR_FALSE);
   nsCOMPtr <nsIMsgFolder> folder = currentTerm->m_folder;
   if (folder)
   {
     nsCString folderUri;
     folder->GetURI(folderUri);
@@ -523,23 +523,16 @@ nsresult nsMsgSearchSession::GetNextUrl(
     if (NS_SUCCEEDED(rv) && msgService && currentTerm)
       msgService->Search(this, msgWindow, currentTerm->m_folder, nextUrl.get());
 
     return rv;
   }
   return NS_OK;
 }
 
-nsresult nsMsgSearchSession::AddUrl(const char *url)
-{
-  nsCString urlCString(url);
-  m_urlQueue.AppendCString(urlCString);
-  return NS_OK;
-}
-
 /* static */ void nsMsgSearchSession::TimerCallback(nsITimer *aTimer, void *aClosure)
 {
   nsMsgSearchSession *searchSession = (nsMsgSearchSession *) aClosure;
   PRBool done;
   PRBool stopped = PR_FALSE;
 
   searchSession->TimeSlice(&done);
   nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(searchSession->m_msgWindowWeak));
--- a/mailnews/base/search/src/nsMsgSearchSession.h
+++ b/mailnews/base/search/src/nsMsgSearchSession.h
@@ -68,17 +68,16 @@ protected:
   nsresult Initialize();
   nsresult StartTimer();
   nsresult TimeSlice (PRBool *aDone);
   nsMsgSearchScopeTerm *GetRunningScope();
   void StopRunning();
   nsresult BeginSearching();
   nsresult DoNextSearch();
   nsresult BuildUrlQueue ();
-  nsresult AddUrl(const char *url);
   nsresult SearchWOUrls ();
   nsresult GetNextUrl();
   nsresult NotifyListenersDone(nsresult status);
   void EnableFolderNotifications(PRBool aEnable);
   void ReleaseFolderDBRef();
 
   nsTArray<nsMsgSearchScopeTerm*> m_scopeList;
   nsCOMPtr <nsISupportsArray> m_termList;
@@ -110,16 +109,16 @@ protected:
   // support for searching multiple scopes in serial
   nsresult TimeSliceSerial (PRBool *aDone);
   nsresult TimeSliceParallel ();
 
   nsMsgSearchAttribValue m_sortAttribute;
   PRUint32 m_idxRunningScope;
   nsMsgSearchType m_searchType;
   PRBool m_handlingError;
-  PRInt32 m_urlQueueIndex;
-  nsCStringArray m_urlQueue;
+  PRUint32 m_urlQueueIndex;
+  nsTArray<nsCString> m_urlQueue;
   nsCOMPtr <nsITimer> m_backgroundTimer;
   PRBool m_searchPaused;
   nsMsgSearchBoolExpression *m_expressionTree;
 };
 
 #endif
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -1893,36 +1893,31 @@ NS_IMETHODIMP nsMsgDBView::GetCellValue(
   }
   return rv;
 }
 
 void nsMsgDBView::RememberDeletedMsgHdr(nsIMsgDBHdr *msgHdr)
 {
   nsCString messageId;
   msgHdr->GetMessageId(getter_Copies(messageId));
-  if (mRecentlyDeletedArrayIndex >= mRecentlyDeletedMsgIds.Count())
-    mRecentlyDeletedMsgIds.AppendCString(messageId);
+  if (mRecentlyDeletedArrayIndex >= mRecentlyDeletedMsgIds.Length())
+    mRecentlyDeletedMsgIds.AppendElement(messageId);
   else
-    mRecentlyDeletedMsgIds.ReplaceCStringAt(messageId, mRecentlyDeletedArrayIndex);
+    mRecentlyDeletedMsgIds[mRecentlyDeletedArrayIndex] = messageId;
   // only remember last 20 deleted msgs.
   mRecentlyDeletedArrayIndex = ++mRecentlyDeletedArrayIndex % 20;
 }
 
 PRBool nsMsgDBView::WasHdrRecentlyDeleted(nsIMsgDBHdr *msgHdr)
 {
   nsCString messageId;
   msgHdr->GetMessageId(getter_Copies(messageId));
-  for (PRInt32 i = 0; i < mRecentlyDeletedMsgIds.Count(); i++)
-  {
-    if (messageId.Equals(*(mRecentlyDeletedMsgIds[i])))
-      return PR_TRUE;
-  }
-  return PR_FALSE;
-
-}
+  return mRecentlyDeletedMsgIds.Contains(messageId);
+}
+
 //add a custom column handler
 NS_IMETHODIMP nsMsgDBView::AddColumnHandler(const nsAString& column, nsIMsgCustomColumnHandler* handler)
 {
 
   PRInt32 index = m_customColumnHandlerIDs.IndexOf(column);
 
   nsAutoString strColID(column);
 
@@ -2810,17 +2805,17 @@ nsresult nsMsgDBView::ListCollapsedChild
   return rv;
 }
 
 PRBool nsMsgDBView::OperateOnMsgsInCollapsedThreads()
 {
   if (mTreeSelection)
   {
     nsCOMPtr<nsITreeBoxObject> selTree;
-    nsresult rv = mTreeSelection->GetTree(getter_AddRefs(selTree));
+    mTreeSelection->GetTree(getter_AddRefs(selTree));
     // no tree means stand-alone message window
     if (!selTree)
       return PR_FALSE;
   }
 
   nsresult rv = NS_OK;
   nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, PR_FALSE);
@@ -2851,17 +2846,16 @@ nsresult nsMsgDBView::GetHeadersFromSele
     if (viewIndexFlags & MSG_VIEW_FLAG_DUMMY)
     {
       // if collapsed dummy header selected, list its children
       if (includeCollapsedMsgs && viewIndexFlags & nsMsgMessageFlags::Elided &&
           m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)
         rv = ListCollapsedChildren(viewIndex, messageArray);
       continue;
     }
-    nsMsgKey key = m_keys[viewIndex];
     nsCOMPtr<nsIMsgDBHdr> msgHdr;
     rv = GetMsgHdrForViewIndex(viewIndex, getter_AddRefs(msgHdr));
     if (NS_SUCCEEDED(rv) && msgHdr)
     {
       rv = messageArray->AppendElement(msgHdr, PR_FALSE);
       if (NS_SUCCEEDED(rv) && includeCollapsedMsgs && 
           viewIndexFlags & nsMsgMessageFlags::Elided &&
           viewIndexFlags & MSG_VIEW_FLAG_HASCHILDREN &&
@@ -2989,17 +2983,16 @@ nsMsgDBView::ApplyCommandToIndices(nsMsg
     // Turn the selection into an array of msg hdrs. This may include messages
     // in collapsed threads
     PRUint32 length;
     nsCOMPtr<nsIMutableArray> messages(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
     NS_ENSURE_SUCCESS(rv, rv);
     rv = GetHeadersFromSelection(indices, numIndices, messages);
     NS_ENSURE_SUCCESS(rv, rv);
     messages->GetLength(&length);
-    PRUint32 numMsgsSelected = length;
 
     if (thisIsImapFolder)
       imapUids.SetLength(length);
 
     for (PRUint32 i = 0; i < length; i++)
     {
       nsMsgKey msgKey;
       nsCOMPtr<nsIMsgDBHdr> msgHdr = do_QueryElementAt(messages, i);
--- a/mailnews/base/src/nsMsgDBView.h
+++ b/mailnews/base/src/nsMsgDBView.h
@@ -48,17 +48,16 @@
 #include "nsIMsgHdr.h"
 #include "nsMsgLineBuffer.h" // for nsByteArray
 #include "MailNewsTypes.h"
 #include "nsTArray.h"
 #include "nsIDBChangeListener.h"
 #include "nsITreeView.h"
 #include "nsITreeBoxObject.h"
 #include "nsITreeSelection.h"
-#include "nsVoidArray.h"
 #include "nsIMsgFolder.h"
 #include "nsIDateTimeFormat.h"
 #include "nsIMsgHeaderParser.h"
 #include "nsIDOMElement.h"
 #include "nsIAtom.h"
 #include "nsIImapIncomingServer.h"
 #include "nsIWeakReference.h"
 #include "nsIMsgFilterPlugin.h"
@@ -494,18 +493,18 @@ protected:
   
   nsTArray<PRUint32> mIndicesToNoteChange;
 
   // the saved search views keep track of the XX most recently deleted msg ids, so that if the 
   // delete is undone, we can add the msg back to the search results, even if it no longer
   // matches the search criteria (e.g., a saved search over unread messages).
   // We use mRecentlyDeletedArrayIndex to treat the array as a list of the XX
   // most recently deleted msgs.
-  nsCStringArray mRecentlyDeletedMsgIds;
-  PRInt32        mRecentlyDeletedArrayIndex;
+  nsTArray<nsCString> mRecentlyDeletedMsgIds;
+  PRUint32 mRecentlyDeletedArrayIndex;
   void RememberDeletedMsgHdr(nsIMsgDBHdr *msgHdr);
   PRBool WasHdrRecentlyDeleted(nsIMsgDBHdr *msgHdr);
   
   //these hold pointers (and IDs) for the nsIMsgCustomColumnHandler object that constitutes the custom column handler
   nsCOMArray <nsIMsgCustomColumnHandler> m_customColumnHandlers;
   nsTArray<nsString> m_customColumnHandlerIDs;
   
   nsIMsgCustomColumnHandler* GetColumnHandler(const PRUnichar*);
--- a/mailnews/base/src/nsMsgTagService.cpp
+++ b/mailnews/base/src/nsMsgTagService.cpp
@@ -557,17 +557,17 @@ nsresult nsMsgTagService::MigrateLabelsT
   }
   m_tagPrefBranch->SetIntPref(TAG_PREF_VERSION, 2);
   return rv;
 }
 
 NS_IMETHODIMP nsMsgTagService::IsValidKey(const nsACString &aKey, PRBool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
-  *aResult = m_keys.IndexOf(aKey) >= 0;
+  *aResult = m_keys.Contains(aKey);
   return NS_OK;
 }
 
 // refresh the local tag key array m_keys from preferences
 nsresult nsMsgTagService::RefreshKeyCache()
 {
   nsIMsgTag **tagArray;
   PRUint32 numTags;
@@ -579,16 +579,16 @@ nsresult nsMsgTagService::RefreshKeyCach
   {
     nsIMsgTag *tag = tagArray[tagIndex];
     if (!tag) {
       rv = NS_ERROR_FAILURE;
       break;
     }
     nsCAutoString key;
     tag->GetKey(key);
-    if (!m_keys.InsertCStringAt(key, tagIndex)) {
+    if (!m_keys.InsertElementAt(tagIndex, key)) {
       rv = NS_ERROR_FAILURE;
       break;
     }
   }
   NS_FREE_XPCOM_ISUPPORTS_POINTER_ARRAY(numTags, tagArray);
   return rv;
 }
--- a/mailnews/base/src/nsMsgTagService.h
+++ b/mailnews/base/src/nsMsgTagService.h
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -38,17 +38,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsMsgTagService_h__
 #define nsMsgTagService_h__
 
 #include "nsIMsgTagService.h"
 #include "nsIPrefBranch.h"
 #include "nsCOMPtr.h"
-#include "nsVoidArray.h"
+#include "nsStringGlue.h"
 
 class nsMsgTag : public nsIMsgTag
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMSGTAG
 
   nsMsgTag(const nsACString &aKey,
@@ -75,17 +75,15 @@ private:
   ~nsMsgTagService();
 
 protected:
   nsresult SetUnicharPref(const char *prefName,
                           const nsAString &prefValue);
   nsresult GetUnicharPref(const char *prefName,
                           nsAString &prefValue);
   nsresult MigrateLabelsToTags();
+  nsresult RefreshKeyCache();
 
   nsCOMPtr<nsIPrefBranch> m_tagPrefBranch;
-
-  nsCStringArray m_keys;
-
-  nsresult RefreshKeyCache();
+  nsTArray<nsCString> m_keys;
 };
 
 #endif
--- a/mailnews/imap/src/nsImapServerResponseParser.cpp
+++ b/mailnews/imap/src/nsImapServerResponseParser.cpp
@@ -1366,18 +1366,18 @@ void nsImapServerResponseParser::msg_fet
         }
         
         if (ContinueParse())
         {
           if (CurrentResponseUID() && CurrentResponseUID() != nsMsgKey_None 
             && fCurrentLineContainedFlagInfo && fFlagState)
           {
             fFlagState->AddUidFlagPair(CurrentResponseUID(), fSavedFlagInfo, fFetchResponseIndex - 1);
-            for (PRInt32 i = 0; i < fCustomFlags.Count(); i++)
-              fFlagState->AddUidCustomFlagPair(CurrentResponseUID(), fCustomFlags.CStringAt(i)->get());
+            for (PRInt32 i = 0; i < fCustomFlags.Length(); i++)
+              fFlagState->AddUidCustomFlagPair(CurrentResponseUID(), fCustomFlags[i].get());
             fCustomFlags.Clear();
           }
           
           if (fFetchingAllFlags)
             fCurrentLineContainedFlagInfo = PR_FALSE;	// do not fire if in PostProcessEndOfLine          
           
           AdvanceToNextToken();	// eat the ')' ending token
 										// should be at end of line
@@ -1719,17 +1719,17 @@ void nsImapServerResponseParser::flags()
       nsCAutoString flag(fNextToken);
       PRInt32 parenIndex = flag.FindChar(')');
       if (parenIndex > 0)
         flag.SetLength(parenIndex);
       messageFlags |= kImapMsgCustomKeywordFlag;
       if (CurrentResponseUID() != nsMsgKey_None)
         fFlagState->AddUidCustomFlagPair(CurrentResponseUID(), flag.get());
       else
-        fCustomFlags.AppendCString(flag);
+        fCustomFlags.AppendElement(flag);
     }
     if (PL_strcasestr(fNextToken, ")"))
     {
       // eat token chars until we get the ')'
       while (*fNextToken != ')')
         fNextToken++;
     }
     else
--- a/mailnews/imap/src/nsImapServerResponseParser.h
+++ b/mailnews/imap/src/nsImapServerResponseParser.h
@@ -232,17 +232,17 @@ private:
   // when issuing a fetch command, are we fetching everything or just a part?
   PRPackedBool    fFetchEverythingRFC822;
   // Is the server a Netscape 3.x Messaging Server?
   PRPackedBool    fServerIsNetscape3xServer;
   PRPackedBool    fDownloadingHeaders;
   PRPackedBool    fCurrentCommandIsSingleMessageFetch;
   PRPackedBool    fGotPermanentFlags;
   imapMessageFlagsType   fSavedFlagInfo;
-  nsCStringArray  fCustomFlags;
+  nsTArray<nsCString> fCustomFlags;
 
   PRUint16  fSupportsUserDefinedFlags;
   PRUint16  fSettablePermanentFlags;
 
   PRInt32           fFolderUIDValidity;
   PRInt32           fNumberOfUnseenMessages;
   PRInt32           fNumberOfExistingMessages;
   PRInt32           fNumberOfRecentMessages;
--- a/mailnews/local/src/nsParseMailbox.cpp
+++ b/mailnews/local/src/nsParseMailbox.cpp
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -2150,25 +2150,25 @@ NS_IMETHODIMP nsParseNewMailState::Apply
         msgHdr->SetStringProperty("junkscore", junkScoreStr.get());
         msgHdr->SetStringProperty("junkscoreorigin", "filter");
         break;
       }
       case nsMsgFilterAction::Forward:
         {
           nsCString forwardTo;
           filterAction->GetStrValue(forwardTo);
-          m_forwardTo.AppendCString(forwardTo);
+          m_forwardTo.AppendElement(forwardTo);
           m_msgToForwardOrReply = msgHdr;
         }
         break;
       case nsMsgFilterAction::Reply:
         {
           nsCString replyTemplateUri;
           filterAction->GetStrValue(replyTemplateUri);
-          m_replyTemplateUri.AppendCString(replyTemplateUri);
+          m_replyTemplateUri.AppendElement(replyTemplateUri);
           m_msgToForwardOrReply = msgHdr;
         }
         break;
       case nsMsgFilterAction::DeleteFromPop3Server:
         {
           PRUint32 flags = 0;
           nsCOMPtr <nsIMsgFolder> downloadFolder;
           msgHdr->GetFolder(getter_AddRefs(downloadFolder));
@@ -2262,49 +2262,52 @@ NS_IMETHODIMP nsParseNewMailState::Apply
 }
 
 // this gets run in a second pass, after apply filters to a header.
 nsresult nsParseNewMailState::ApplyForwardAndReplyFilter(nsIMsgWindow *msgWindow)
 {
   nsresult rv = NS_OK;
   nsCOMPtr <nsIMsgIncomingServer> server;
 
-  PRInt32 i;
-  for (i = 0; i < m_forwardTo.Count(); i++)
+  PRUint32 i;
+  PRUint32 count = m_forwardTo.Length();
+  for (i = 0; i < count; i++)
   {
-    if (!m_forwardTo[i]->IsEmpty())
+    if (!m_forwardTo[i].IsEmpty())
     {
       nsAutoString forwardStr;
-      CopyASCIItoUTF16(*(m_forwardTo[i]), forwardStr);
+      CopyASCIItoUTF16(m_forwardTo[i], forwardStr);
       rv = m_rootFolder->GetServer(getter_AddRefs(server));
       NS_ENSURE_SUCCESS(rv, rv);
       {
         nsCOMPtr<nsIMsgComposeService> compService =
           do_GetService (NS_MSGCOMPOSESERVICE_CONTRACTID, &rv);
         NS_ENSURE_SUCCESS(rv, rv);
         rv = compService->ForwardMessage(forwardStr, m_msgToForwardOrReply,
                                          msgWindow, server,
                                          nsIMsgComposeService::kForwardAsDefault);
       }
     }
   }
   m_forwardTo.Clear();
 
-  for (i = 0; i < m_replyTemplateUri.Count(); i++)
+  count = m_replyTemplateUri.Length();
+  for (i = 0; i < count; i++)
   {
-    if (!m_replyTemplateUri[i]->IsEmpty())
+    if (!m_replyTemplateUri[i].IsEmpty())
     {
       // copy this and truncate the original, so we don't accidentally re-use it on the next hdr.
-      nsCAutoString replyTemplateUri(*m_replyTemplateUri[i]);
       rv = m_rootFolder->GetServer(getter_AddRefs(server));
-      if (server && !replyTemplateUri.IsEmpty())
+      if (server)
       {
         nsCOMPtr <nsIMsgComposeService> compService = do_GetService (NS_MSGCOMPOSESERVICE_CONTRACTID) ;
         if (compService)
-          rv = compService->ReplyWithTemplate(m_msgToForwardOrReply, replyTemplateUri.get(), msgWindow, server);
+          rv = compService->ReplyWithTemplate(m_msgToForwardOrReply,
+                                              m_replyTemplateUri[i].get(),
+                                              msgWindow, server);
       }
     }
   }
   m_replyTemplateUri.Clear();
   m_msgToForwardOrReply = nsnull;
   return rv;
 }
 
--- a/mailnews/local/src/nsParseMailbox.h
+++ b/mailnews/local/src/nsParseMailbox.h
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -35,17 +35,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsParseMailbox_H
 #define nsParseMailbox_H
 
 #include "nsIURI.h"
 #include "nsIMsgParseMailMsgState.h"
-#include "nsVoidArray.h"
 #include "nsIStreamListener.h"
 #include "nsMsgLineBuffer.h"
 #include "nsIMsgHeaderParser.h"
 #include "nsIMsgDatabase.h"
 #include "nsIMsgHdr.h"
 #include "nsIMsgStatusFeedback.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
@@ -291,14 +290,14 @@ protected:
   // used for applying move filters, because in the case of using a temporary
   // download file, the offset/key in the msg hdr is not right.
   PRUint64      m_curHdrOffset;
 
   // we have to apply the reply/forward filters in a second pass, after
   // msg quarantining and moving to other local folders, so we remember the
   // info we'll need to apply them with these vars.
   // these need to be arrays in case we have multiple reply/forward filters.
-  nsCStringArray     m_forwardTo;
-  nsCStringArray     m_replyTemplateUri;
+  nsTArray<nsCString> m_forwardTo;
+  nsTArray<nsCString> m_replyTemplateUri;
   nsCOMPtr <nsIMsgDBHdr> m_msgToForwardOrReply;
 };
 
 #endif