Bug 629479 - Remove various nsVoidArray instances and headers; r=bienvenu
authorMark Banner <bugzilla@standard8.plus.com>
Fri, 04 Feb 2011 19:03:04 +0000
changeset 7086 b6407b0f63242ec307c9d7d71f0423d2ebefa31d
parent 7085 33fc203adc4fc17d1404bd5652ddd5ba83f9e6b7
child 7087 265fc01100ee9eb659c883bffc61024e9671473c
push id5423
push userbugzilla@standard8.plus.com
push dateFri, 04 Feb 2011 19:05:07 +0000
treeherdercomm-central@b6407b0f6324 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu
bugs629479
Bug 629479 - Remove various nsVoidArray instances and headers; r=bienvenu
mailnews/addrbook/src/nsAbAddressCollector.h
mailnews/addrbook/src/nsVCardObj.cpp
mailnews/base/public/msgCore.h
mailnews/base/src/nsMsgCopyService.h
mailnews/base/src/nsMsgPrintEngine.cpp
mailnews/base/src/nsMsgPrintEngine.h
mailnews/base/src/nsMsgTagService.h
mailnews/base/util/nsMsgI18N.h
mailnews/base/util/nsMsgIdentity.h
mailnews/base/util/nsMsgProtocol.h
mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
mailnews/compose/src/nsMsgAppleEncode.cpp
mailnews/extensions/smime/src/nsEncryptedSMIMEURIsService.cpp
mailnews/extensions/smime/src/nsEncryptedSMIMEURIsService.h
mailnews/imap/src/nsIMAPBodyShell.h
mailnews/imap/src/nsIMAPNamespace.h
mailnews/imap/src/nsImapSearchResults.h
mailnews/local/src/nsPop3Sink.cpp
mailnews/local/src/nsPop3Sink.h
mailnews/mime/src/nsMsgHeaderParser.cpp
--- a/mailnews/addrbook/src/nsAbAddressCollector.h
+++ b/mailnews/addrbook/src/nsAbAddressCollector.h
@@ -39,16 +39,17 @@
 #ifndef _nsAbAddressCollector_H_
 #define _nsAbAddressCollector_H_
 
 #include "nsIAbAddressCollector.h"
 #include "nsCOMPtr.h"
 #include "nsIAbDirectory.h"
 #include "nsIAbCard.h"
 #include "nsIObserver.h"
+#include "nsStringGlue.h"
 
 class nsIPrefBranch;
 
 class nsAbAddressCollector : public nsIAbAddressCollector,
                              public nsIObserver
 {
 public:
   nsAbAddressCollector();
--- a/mailnews/addrbook/src/nsVCardObj.cpp
+++ b/mailnews/addrbook/src/nsVCardObj.cpp
@@ -78,18 +78,18 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, 
  * vobject, and convert a vobject into its textual representation.
  */
 
 #include "prlog.h"
 #include "nsVCard.h"
 #include "nsVCardObj.h"
 #include "prmem.h"
 #include "plstr.h"
-#include "msgCore.h"
 #include "prprf.h"
+#include "nsStringGlue.h"
 
 /* debugging utilities */
 #define DBG_(x)
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
--- a/mailnews/base/public/msgCore.h
+++ b/mailnews/base/public/msgCore.h
@@ -39,17 +39,16 @@
    NSPR, memory, and string header files among others */
 
 #ifndef msgCore_h__
 #define msgCore_h__
 
 #include "nscore.h"
 #include "plstr.h"
 #include "nsCRTGlue.h"
-#include "nsVoidArray.h"
 
 class nsIMsgDBHdr;
 class nsIMsgFolder;
 
 // include common interfaces such as the service manager and the repository....
 #include "nsIServiceManager.h"
 #include "nsIComponentManager.h"
 
--- a/mailnews/base/src/nsMsgCopyService.h
+++ b/mailnews/base/src/nsMsgCopyService.h
@@ -40,16 +40,17 @@
 
 #include "nscore.h"
 #include "nsIMsgCopyService.h"
 #include "nsCOMPtr.h"
 #include "nsIMsgFolder.h"
 #include "nsIMsgHdr.h"
 #include "nsIMsgWindow.h"
 #include "nsIMutableArray.h"
+#include "nsVoidArray.h"
 
 typedef enum _nsCopyRequestType
 {
     nsCopyMessagesType = 0x0,
     nsCopyFileMessageType = 0x1,
     nsCopyFoldersType = 0x2
 } nsCopyRequestType;
 
--- a/mailnews/base/src/nsMsgPrintEngine.cpp
+++ b/mailnews/base/src/nsMsgPrintEngine.cpp
@@ -326,17 +326,17 @@ nsMsgPrintEngine::ShowWindow(PRBool aSho
     baseWindow->SetVisibility(aShow);
   }
   return rv;
 }
 
 NS_IMETHODIMP
 nsMsgPrintEngine::AddPrintURI(const PRUnichar *aMsgURI)
 {
-  mURIArray.AppendString(nsDependentString(aMsgURI));
+  mURIArray.AppendElement(nsDependentString(aMsgURI));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgPrintEngine::SetPrintURICount(PRInt32 aCount)
 {
   mURICount = aCount;
   return NS_OK;
@@ -436,33 +436,33 @@ nsMsgPrintEngine::StartNextPrintOperatio
 
   // Only do this the first time through...
   if (mCurrentlyPrintingURI == -1)
     InitializeDisplayCharset();
 
   mCurrentlyPrintingURI++;
 
   // First, check if we are at the end of this stuff!
-  if ( mCurrentlyPrintingURI >= mURIArray.Count() )
+  if (mCurrentlyPrintingURI >= mURIArray.Length())
   {
     // This is the end...dum, dum, dum....my only friend...the end
     mWindow->Close();
 
     // Tell the user we are done...
     nsString msg;
     GetString(NS_LITERAL_STRING("PrintingComplete").get(), msg);
     SetStatusMessage(msg);
     return NS_OK;
   }
 
   if (!mDocShell)
     return StartNextPrintOperation();
 
-  nsString *uri = mURIArray.StringAt(mCurrentlyPrintingURI);
-  rv = FireThatLoadOperationStartup(*uri);
+  const nsString &uri = mURIArray[mCurrentlyPrintingURI];
+  rv = FireThatLoadOperationStartup(uri);
   if (NS_FAILED(rv))
     return StartNextPrintOperation();
   else
     return rv;
 }
 
 NS_IMETHODIMP    
 nsMsgPrintEngine::SetStatusFeedback(nsIMsgStatusFeedback *aFeedback)
@@ -480,18 +480,18 @@ nsMsgPrintEngine::FireThatLoadOperationS
   if (!uri.IsEmpty()) 
     mLoadURI = uri;
   else
     mLoadURI.Truncate();
 
   PRBool   notify = PR_FALSE;
   nsresult rv     = NS_ERROR_FAILURE;
   // Don't show dialog if we are out of URLs
-  //if ( mCurrentlyPrintingURI < mURIArray.Count() && !mIsDoingPrintPreview)
-  if ( mCurrentlyPrintingURI < mURIArray.Count())
+  //if ( mCurrentlyPrintingURI < mURIArray.Length() && !mIsDoingPrintPreview)
+  if ( mCurrentlyPrintingURI < mURIArray.Length())
     rv = ShowProgressDialog(!mIsDoingPrintPreview, notify);
   if (NS_FAILED(rv) || !notify) 
     return FireThatLoadOperation(uri);
   return NS_OK;
 }
 
 nsresult
 nsMsgPrintEngine::FireThatLoadOperation(const nsString& uri)
--- a/mailnews/base/src/nsMsgPrintEngine.h
+++ b/mailnews/base/src/nsMsgPrintEngine.h
@@ -38,17 +38,16 @@
 // implementing mozISimpleContainer,
 // which provides a DocShell container for use in simple programs
 // using the layout engine
 
 #include "nscore.h"
 #include "nsCOMPtr.h"
 
 #include "nsIDocShell.h"
-#include "nsVoidArray.h"
 #include "nsIDocShell.h"
 #include "nsIMsgPrintEngine.h"
 #include "nsIStreamListener.h"
 #include "nsIWebProgressListener.h"
 #include "nsIMsgStatusFeedback.h"
 #include "nsIStringBundle.h"
 #include "nsIWebBrowserPrint.h"
 #include "nsIWebProgressListener.h"
@@ -96,17 +95,17 @@ protected:
   nsresult    SetStatusMessage(const nsString& aMsgString);
   void GetString(const PRUnichar *aStringName, nsString& aOutString);
   nsresult    ShowProgressDialog(PRBool aIsForPrinting, PRBool& aDoNotify);
 
   nsCOMPtr<nsIDocShell>       mDocShell;
   nsCOMPtr<nsIDOMWindowInternal>      mWindow;
   nsCOMPtr<nsIDOMWindowInternal>      mParentWindow;
   PRInt32                     mURICount;
-  nsStringArray               mURIArray;
+  nsTArray<nsString>          mURIArray;
   PRInt32                     mCurrentlyPrintingURI;
 
   nsCOMPtr<nsIContentViewer>  mContentViewer;
   nsCOMPtr<nsIStringBundle>   mStringBundle;    // String bundles...
   nsCOMPtr<nsIMsgStatusFeedback> mFeedback;     // Tell the user something why don't ya'
   nsCOMPtr<nsIWebBrowserPrint> mWebBrowserPrint;
   nsCOMPtr<nsIPrintSettings>   mPrintSettings;
   nsCOMPtr<nsIDOMWindow>       mMsgDOMWin;
--- a/mailnews/base/src/nsMsgTagService.h
+++ b/mailnews/base/src/nsMsgTagService.h
@@ -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"
 
 class nsMsgTag : public nsIMsgTag
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMSGTAG
 
   nsMsgTag(const nsACString &aKey,
--- a/mailnews/base/util/nsMsgI18N.h
+++ b/mailnews/base/util/nsMsgI18N.h
@@ -35,16 +35,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _nsMsgI18N_H_
 #define _nsMsgI18N_H_
 
 #include "nscore.h"
 #include "msgCore.h"
+#include "nsStringGlue.h"
 class nsILocalFile;
 
 /**
  * Encode an input string into RFC 2047 form.
  *
  * @param header       [IN] A header to encode.
  * @param structured   [IN] Specify the header is structured or non-structured field (See RFC-822).
  * @param charset      [IN] Charset name to convert.
--- a/mailnews/base/util/nsMsgIdentity.h
+++ b/mailnews/base/util/nsMsgIdentity.h
@@ -38,17 +38,17 @@
 
 #ifndef nsMsgIdentity_h___
 #define nsMsgIdentity_h___
 
 #include "nsIMsgIdentity.h"
 #include "nsIPrefBranch.h"
 #include "msgCore.h"
 #include "nsCOMPtr.h"
-
+#include "nsStringGlue.h"
 
 class NS_MSG_BASE nsMsgIdentity : public nsIMsgIdentity
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMSGIDENTITY
   
 private:
--- a/mailnews/base/util/nsMsgProtocol.h
+++ b/mailnews/base/util/nsMsgProtocol.h
@@ -48,16 +48,17 @@
 #include "nsIFile.h"
 #include "nsCOMPtr.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIProgressEventSink.h"
 #include "nsITransport.h"
 #include "nsIAsyncOutputStream.h"
 #include "nsIAuthModule.h"
+#include "nsStringGlue.h"
 
 class nsIMsgWindow;
 
 #define UNKNOWN_ERROR             101
 #define UNKNOWN_HOST_ERROR        102
 #define CONNECTION_REFUSED_ERROR  103
 #define NET_TIMEOUT_ERROR         104
 
--- a/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
+++ b/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
@@ -43,17 +43,17 @@
 *
 *  	  The codes to do apple double encoding/decoding.
 *		
 *		02aug95		mym		created.
 *		
 */
 #include "nsID.h"
 #include "nscore.h"
-#include "msgCore.h"
+#include "nsStringGlue.h"
 #include "nsMsgAppleDouble.h"
 #include "nsMsgAppleCodes.h"
 #include "nsMsgCompUtils.h"
 #include "nsCExternalHandlerService.h"
 #include "nsIMIMEService.h"
 #include "nsMimeTypes.h"
 #include "prmem.h"
 #include "nsNetUtil.h"
--- a/mailnews/compose/src/nsMsgAppleEncode.cpp
+++ b/mailnews/compose/src/nsMsgAppleEncode.cpp
@@ -43,17 +43,17 @@
  *
  *    The routines doing the Apple Double Encoding.
  *		
  *			2aug95	mym	Created.
  *		
  */
 
 #include "nscore.h"
-#include "msgCore.h"
+#include "nsStringGlue.h"
 #include "nsMimeTypes.h"
 #include "prprf.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMsgAppleDouble.h"
 #include "nsMsgAppleCodes.h"
 #include "nsILocalFileMac.h"
 
 /*
--- a/mailnews/extensions/smime/src/nsEncryptedSMIMEURIsService.cpp
+++ b/mailnews/extensions/smime/src/nsEncryptedSMIMEURIsService.cpp
@@ -30,41 +30,39 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsEncryptedSMIMEURIsService.h"
-#include "nsStringGlue.h"
-
 
 NS_IMPL_ISUPPORTS1(nsEncryptedSMIMEURIsService, nsIEncryptedSMIMEURIsService)
 
 nsEncryptedSMIMEURIsService::nsEncryptedSMIMEURIsService()
 {
 }
 
 nsEncryptedSMIMEURIsService::~nsEncryptedSMIMEURIsService()
 {
 }
 
 NS_IMETHODIMP nsEncryptedSMIMEURIsService::RememberEncrypted(const nsACString & uri)
 {
   // Assuming duplicates are allowed.
-  mEncryptedURIs.AppendCString(nsCString(uri));
+  mEncryptedURIs.AppendElement(uri);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsEncryptedSMIMEURIsService::ForgetEncrypted(const nsACString & uri)
 {
   // Assuming, this will only remove one copy of the string, if the array
   // contains multiple copies of the same string.
-  mEncryptedURIs.RemoveCString(nsCString(uri));
+  mEncryptedURIs.RemoveElement(uri);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsEncryptedSMIMEURIsService::IsEncrypted(const nsACString & uri, PRBool *_retval)
 {
-  *_retval = (mEncryptedURIs.IndexOf(nsCString(uri)) != -1);
+  *_retval = (mEncryptedURIs.IndexOf(uri) != -1);
   return NS_OK;
 }
--- a/mailnews/extensions/smime/src/nsEncryptedSMIMEURIsService.h
+++ b/mailnews/extensions/smime/src/nsEncryptedSMIMEURIsService.h
@@ -33,24 +33,25 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _nsEncryptedSMIMEURIsService_H_
 #define _nsEncryptedSMIMEURIsService_H_
 
 #include "nsIEncryptedSMIMEURIsSrvc.h"
-#include "nsVoidArray.h"
+#include "nsTArray.h"
+#include "nsStringGlue.h"
 
 class nsEncryptedSMIMEURIsService : public nsIEncryptedSMIMEURIsService
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIENCRYPTEDSMIMEURISSERVICE
 
   nsEncryptedSMIMEURIsService();
   virtual ~nsEncryptedSMIMEURIsService();
 
 protected:
-  nsCStringArray mEncryptedURIs;
+  nsTArray<nsCString> mEncryptedURIs;
 };
 
 #endif
--- a/mailnews/imap/src/nsIMAPBodyShell.h
+++ b/mailnews/imap/src/nsIMAPBodyShell.h
@@ -40,16 +40,17 @@ nsIMAPBodyShell and associated classes
 */ 
 
 #ifndef IMAPBODY_H
 #define IMAPBODY_H
 
 #include "nsImapCore.h"
 #include "nsStringGlue.h"
 #include "nsClassHashtable.h"
+#include "nsVoidArray.h"
 
 class nsImapProtocol;
 
 typedef enum _nsIMAPBodypartType {
 	IMAP_BODY_MESSAGE_RFC822,
 	IMAP_BODY_MESSAGE_HEADER,
 	IMAP_BODY_LEAF,
 	IMAP_BODY_MULTIPART
--- a/mailnews/imap/src/nsIMAPNamespace.h
+++ b/mailnews/imap/src/nsIMAPNamespace.h
@@ -33,16 +33,18 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _nsIMAPNamespace_H_
 #define _nsIMAPNamespace_H_
 
+#include "nsVoidArray.h"
+
 class nsIMAPNamespace
 {
   
 public:
   nsIMAPNamespace(EIMAPNamespaceType type, const char *prefix, char delimiter, PRBool from_prefs);
   
   ~nsIMAPNamespace();
   
--- a/mailnews/imap/src/nsImapSearchResults.h
+++ b/mailnews/imap/src/nsImapSearchResults.h
@@ -33,16 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsImapSearchResults_h___
 #define nsImapSearchResults_h___
 
+#include "nsVoidArray.h"
 
 class nsImapSearchResultSequence : public nsVoidArray
 {
 public:
     virtual ~nsImapSearchResultSequence();
     static nsImapSearchResultSequence *CreateSearchResultSequence();
     
     virtual void AddSearchResultLine(const char *searchLine);
--- a/mailnews/local/src/nsPop3Sink.cpp
+++ b/mailnews/local/src/nsPop3Sink.cpp
@@ -152,25 +152,16 @@ nsPop3Sink::GetMailAccountURL(char* *url
 {
   NS_ASSERTION(urlString, "null getter in getMailAccountURL");
   if (!urlString) return NS_ERROR_NULL_POINTER;
 
   *urlString = strdup(m_accountUrl);
   return NS_OK;
 }
 
-struct partialRecord
-{
-  partialRecord();
-  ~partialRecord();
-
-  nsCOMPtr<nsIMsgDBHdr> m_msgDBHdr;
-  nsCString m_uidl;
-};
-
 partialRecord::partialRecord() :
   m_msgDBHdr(nsnull)
 {
 }
 
 partialRecord::~partialRecord()
 {
 }
@@ -243,24 +234,24 @@ nsPop3Sink::FindPartialMessages(nsILocal
 
 // For all the partial messages saved by FindPartialMessages,
 // ask the protocol handler if they still exist on the server.
 // Any messages that don't exist any more are deleted from the
 // msgDB.
 void
 nsPop3Sink::CheckPartialMessages(nsIPop3Protocol *protocol)
 {
-  PRUint32 count = m_partialMsgsArray.Count();
+  PRUint32 count = m_partialMsgsArray.Length();
   PRBool deleted = PR_FALSE;
 
   for (PRUint32 i = 0; i < count; i++)
   {
     partialRecord *partialMsg;
     PRBool found = PR_TRUE;
-    partialMsg = static_cast<partialRecord *>(m_partialMsgsArray.ElementAt(i));
+    partialMsg = m_partialMsgsArray.ElementAt(i);
     protocol->CheckMessage(partialMsg->m_uidl.get(), &found);
     if (!found && partialMsg->m_msgDBHdr)
     {
       m_newMailParser->m_mailDB->DeleteHeader(partialMsg->m_msgDBHdr, nsnull, PR_FALSE, PR_TRUE);
       deleted = PR_TRUE;
     }
     delete partialMsg;
   }
--- a/mailnews/local/src/nsPop3Sink.h
+++ b/mailnews/local/src/nsPop3Sink.h
@@ -45,16 +45,25 @@
 #include "prio.h"
 #include "plstr.h"
 #include "prenv.h"
 #include "nsIMsgFolder.h"
 
 class nsParseNewMailState;
 class nsIMsgFolder;
 
+struct partialRecord
+{
+  partialRecord();
+  ~partialRecord();
+
+  nsCOMPtr<nsIMsgDBHdr> m_msgDBHdr;
+  nsCString m_uidl;
+};
+
 class nsPop3Sink : public nsIPop3Sink
 {
 public:
     nsPop3Sink();
     virtual ~nsPop3Sink();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIPOP3SINK
@@ -90,12 +99,12 @@ protected:
     nsCOMPtr <nsIOutputStream> m_outFileStream;
     PRBool m_buildMessageUri;
     PRBool m_downloadingToTempFile;
     nsCOMPtr <nsILocalFile> m_tmpDownloadFile;
     nsCString m_messageUri;
     nsCString m_baseMessageUri;
     nsCString m_origMessageUri;
     nsCString m_accountKey;
-    nsVoidArray m_partialMsgsArray;
+    nsTArray<partialRecord*> m_partialMsgsArray;
 };
 
 #endif
--- a/mailnews/mime/src/nsMsgHeaderParser.cpp
+++ b/mailnews/mime/src/nsMsgHeaderParser.cpp
@@ -38,16 +38,17 @@
 
 #include "msgCore.h"    // precompiled header...
 #include "nsMsgHeaderParser.h"
 #include "nsISimpleEnumerator.h"
 #include "comi18n.h"
 #include "prmem.h"
 #include <ctype.h>
 #include "nsAlgorithm.h"
+#include "nsStringGlue.h"
 
 nsresult FillResultsArray(const char * aName, const char *aAddress, PRUnichar ** aOutgoingEmailAddress, PRUnichar ** aOutgoingName,
                           PRUnichar ** aOutgoingFullName, nsIMsgHeaderParser *aParser);
 
 /*
  * Macros used throughout the RFC-822 parsing code.
  */