Bug 180312 - Do not call NS_NewISupportsArray in constructor of nsMsgFilterList::nsMsgFilterList(). r=standard8, sr=bienvenu
authoraceman <acelists@atlas.sk>
Tue, 26 Jun 2012 20:58:21 -0400
changeset 12735 9631a5ce50645b2b8e6e19c1412c37a01adfc449
parent 12734 9ccbefb9df5e86b90c4b69fc6741e627c977a40e
child 12736 c3444a3d3436db36bb9edb47c03971e161147778
push id654
push userbugzilla@standard8.plus.com
push dateMon, 27 Aug 2012 20:27:17 +0000
treeherdercomm-beta@f9b6f18872f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8, bienvenu
bugs180312
Bug 180312 - Do not call NS_NewISupportsArray in constructor of nsMsgFilterList::nsMsgFilterList(). r=standard8, sr=bienvenu
mailnews/base/search/public/nsIMsgFilter.idl
mailnews/base/search/src/nsMsgFilter.cpp
mailnews/base/search/src/nsMsgFilter.h
mailnews/base/search/src/nsMsgFilterList.cpp
mailnews/base/search/src/nsMsgFilterList.h
--- a/mailnews/base/search/public/nsIMsgFilter.idl
+++ b/mailnews/base/search/public/nsIMsgFilter.idl
@@ -36,34 +36,34 @@ interface nsIMsgRuleAction : nsISupports
   attribute ACString customId;
 
   // custom action associated with customId
   // (which must be set prior to reading this attribute)
   readonly attribute nsIMsgFilterCustomAction customAction;
   
 };
 
-[scriptable, uuid(346C8CC6-35EA-4F44-B348-94E84D7C03E0)]
+[scriptable, uuid(ed4b7a8e-3190-4b0b-b842-d4f1ca65216f)]
 interface nsIMsgFilter : nsISupports {
     attribute nsMsgFilterTypeType filterType;
     /**
      * some filters are "temporary".  For example, the filters we create when the user
      * filters return receipts to the Sent folder.
      * we don't show temporary filters in the UI
      * and we don't write them to disk.
      */
     attribute boolean temporary;
     attribute boolean enabled;
     attribute AString filterName;
     attribute ACString filterDesc;
     attribute ACString unparsedBuffer; //holds the entire filter if we don't know how to handle it
     attribute boolean unparseable;  //whether we could parse the filter or not
 
-    readonly attribute nsIMsgFilterList filterList; // owning filter list
-    
+    attribute nsIMsgFilterList filterList; // owning filter list
+
     void AddTerm(in nsMsgSearchAttribValue attrib,
                  in nsMsgSearchOpValue op,
                  in nsIMsgSearchValue value,
                  in boolean BooleanAND,
                  in ACString arbitraryHeader);
 
     void GetTerm(in long termIndex,
                  out nsMsgSearchAttribValue attrib,
@@ -93,10 +93,11 @@ interface nsIMsgFilter : nsISupports {
 
     nsIMsgRuleAction getActionAt(in long aIndex);
 
     void appendAction(in nsIMsgRuleAction action);
 
     void clearActionList();
     void getSortedActionList(in nsISupportsArray actionList);  //will return an action list with moveAction (if present) as last one.
     readonly attribute nsISupportsArray actionList;
+
+    void SaveToTextFile(in nsIOutputStream aStream);
 };
-
--- a/mailnews/base/search/src/nsMsgFilter.cpp
+++ b/mailnews/base/search/src/nsMsgFilter.cpp
@@ -608,29 +608,30 @@ nsMsgFilter::MatchHdr(nsIMsgDBHdr *msgHd
   // use offlineMail because
   nsCString folderCharset;
   folder->GetCharset(folderCharset);
   nsresult rv = nsMsgSearchOfflineMail::MatchTermsForFilter(msgHdr, m_termList,
                   folderCharset.get(),  m_scope,  db,  headers,  headersSize, &m_expressionTree, pResult);
   return rv;
 }
 
-void
+NS_IMETHODIMP
 nsMsgFilter::SetFilterList(nsIMsgFilterList *filterList)
 {
   // doesn't hold a ref.
   m_filterList = filterList;
+  return NS_OK;
 }
 
-nsresult
+NS_IMETHODIMP
 nsMsgFilter::GetFilterList(nsIMsgFilterList **aResult)
 {
-    NS_ENSURE_ARG_POINTER(aResult);
-    NS_IF_ADDREF(*aResult = m_filterList);
-    return NS_OK;
+  NS_ENSURE_ARG_POINTER(aResult);
+  NS_IF_ADDREF(*aResult = m_filterList);
+  return NS_OK;
 }
 
 void nsMsgFilter::SetFilterScript(nsCString *fileName)
 {
   m_scriptFileName = *fileName;
 }
 
 nsresult nsMsgFilter::ConvertMoveOrCopyToFolderValue(nsIMsgRuleAction *filterAction, nsCString &moveValue)
@@ -736,17 +737,18 @@ nsresult nsMsgFilter::ConvertMoveOrCopyT
   }
   else
     filterAction->SetTargetFolderUri(moveValue);
 
   return NS_OK;
   // set m_action.m_value.m_folderUri
 }
 
-nsresult nsMsgFilter::SaveToTextFile(nsIOutputStream *aStream)
+NS_IMETHODIMP
+nsMsgFilter::SaveToTextFile(nsIOutputStream *aStream)
 {
   NS_ENSURE_ARG_POINTER(aStream);
   if (m_unparseable)
   {
     PRUint32 bytesWritten;
     //we need to trim leading whitespaces before filing out
     m_unparsedBuffer.Trim(kWhitespace, true /*leadingCharacters*/, false /*trailingCharacters*/);
     return aStream->Write(m_unparsedBuffer.get(), m_unparsedBuffer.Length(), &bytesWritten);
--- a/mailnews/base/search/src/nsMsgFilter.h
+++ b/mailnews/base/search/src/nsMsgFilter.h
@@ -46,25 +46,23 @@ public:
   nsMsgFilter();
   virtual ~nsMsgFilter ();
 
   NS_DECL_NSIMSGFILTER
 
   nsMsgFilterTypeType  GetType() {return m_type;}
   void    SetType(nsMsgFilterTypeType  type) {m_type = type;}
   bool    GetEnabled() {return m_enabled;}
-  void    SetFilterScript(nsCString *filterName) ;
-  void    SetFilterList(nsIMsgFilterList* filterList);
+  void    SetFilterScript(nsCString *filterName);
 
   bool    IsScript() {return (m_type &
                                   (nsMsgFilterType::InboxJavaScript |
                                    nsMsgFilterType::NewsJavaScript)) != 0;}
 
   // filing routines.
-  nsresult  SaveToTextFile(nsIOutputStream *aStream);
   nsresult  SaveRule(nsIOutputStream *aStream);
 
   PRInt16   GetVersion();
 #ifdef DEBUG
   void      Dump();
 #endif
 
   nsresult  ConvertMoveOrCopyToFolderValue(nsIMsgRuleAction *filterAction, nsCString &relativePath);
--- a/mailnews/base/search/src/nsMsgFilterList.cpp
+++ b/mailnews/base/search/src/nsMsgFilterList.cpp
@@ -30,23 +30,16 @@ static const PRUnichar unicodeFormatter[
     (PRUnichar)'s',
     (PRUnichar)0,
 };
 
 
 nsMsgFilterList::nsMsgFilterList() :
     m_fileVersion(0)
 {
-  // I don't know how we're going to report this error if we failed to create the isupports array...
-#ifdef DEBUG
-  nsresult rv =
-#endif
-    NS_NewISupportsArray(getter_AddRefs(m_filters));
-  NS_ASSERTION(NS_SUCCEEDED(rv), "Fixme bug 180312: NS_NewISupportsArray() failed");
-
   m_loggingEnabled = false;
   m_startWritingToBuffer = false;
   m_temporaryList = false;
   m_curFilter = nsnull;
 }
 
 NS_IMPL_ADDREF(nsMsgFilterList)
 NS_IMPL_RELEASE(nsMsgFilterList)
@@ -283,20 +276,20 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsg
                                    nsIMsgDBHdr *msgHdr,
                                    nsIMsgFolder *folder,
                                    nsIMsgDatabase *db,
                                    const char*headers,
                                    PRUint32 headersSize,
                                    nsIMsgFilterHitNotify *listener,
                                    nsIMsgWindow *msgWindow)
 {
-  nsCOMPtr <nsIMsgFilter>  filter;
-  PRUint32    filterCount = 0;
-  nsresult    rv = GetFilterCount(&filterCount);
-  NS_ENSURE_SUCCESS(rv,rv);
+  nsCOMPtr<nsIMsgFilter> filter;
+  PRUint32 filterCount = 0;
+  nsresult rv = GetFilterCount(&filterCount);
+  NS_ENSURE_SUCCESS(rv, rv);
 
   nsMsgSearchScopeTerm* scope = new nsMsgSearchScopeTerm(nsnull, nsMsgSearchScope::offlineMail, folder);
   scope->AddRef();
   if (!scope) return NS_ERROR_OUT_OF_MEMORY;
 
   for (PRUint32 filterIndex = 0; filterIndex < filterCount; filterIndex++)
   {
     if (NS_SUCCEEDED(GetFilterAt(filterIndex, getter_AddRefs(filter))))
@@ -580,17 +573,17 @@ nsresult nsMsgFilterList::LoadTextFilter
         {
           // ### fix me - this is silly.
           PRUnichar *unicodeString =
             nsTextFormatter::smprintf(unicodeFormatter, value.get());
           filter->SetFilterName(nsDependentString(unicodeString));
           nsTextFormatter::smprintf_free(unicodeString);
         }
         m_curFilter = filter;
-        m_filters->AppendElement(static_cast<nsISupports*>(filter));
+        m_filters.AppendElement(filter);
       }
       break;
     case nsIMsgFilterList::attribEnabled:
       if (m_curFilter)
         m_curFilter->SetEnabled(StrToBool(value));
       break;
     case nsIMsgFilterList::attribDescription:
       if (m_curFilter)
@@ -866,222 +859,214 @@ nsMsgFilterList::WriteWstrAttr(nsMsgFilt
                                const PRUnichar *aFilterName, nsIOutputStream *aStream)
 {
     WriteStrAttr(attrib, NS_ConvertUTF16toUTF8(aFilterName).get(), aStream);
     return NS_OK;
 }
 
 nsresult nsMsgFilterList::SaveTextFilters(nsIOutputStream *aStream)
 {
-  nsresult  err = NS_OK;
   const char *attribStr;
-  PRUint32      filterCount;
-  m_filters->Count(&filterCount);
+  PRUint32   filterCount = 0;
+  nsresult   err = GetFilterCount(&filterCount);
+  NS_ENSURE_SUCCESS(err, err);
+  err = NS_OK;
 
   attribStr = GetStringForAttrib(nsIMsgFilterList::attribVersion);
   err = WriteIntAttr(nsIMsgFilterList::attribVersion, kFileVersion, aStream);
   err = WriteBoolAttr(nsIMsgFilterList::attribLogging, m_loggingEnabled, aStream);
   for (PRUint32 i = 0; i < filterCount; i ++)
   {
-    nsMsgFilter *filter;
-    if (GetMsgFilterAt(i, &filter) == NS_OK && filter != nsnull)
+    nsCOMPtr<nsIMsgFilter> filter;
+    if (NS_SUCCEEDED(GetFilterAt(i, getter_AddRefs(filter))) && filter)
     {
       filter->SetFilterList(this);
 
       // if the filter is temporary, don't write it to disk
       bool isTemporary;
       err = filter->GetTemporary(&isTemporary);
       if (NS_SUCCEEDED(err) && !isTemporary) {
         if ((err = filter->SaveToTextFile(aStream)) != NS_OK)
           break;
       }
-
-      NS_RELEASE(filter);
     }
     else
       break;
   }
   if (NS_SUCCEEDED(err))
     m_arbitraryHeaders.Truncate();
   return err;
 }
 
 nsMsgFilterList::~nsMsgFilterList()
 {
-  // filters should be released for free, because only isupports array
-  // is holding onto them, right?
-//  PRUint32      filterCount;
-//  m_filters->Count(&filterCount);
-//  for (PRUint32 i = 0; i < filterCount; i++)
-//  {
-//    nsIMsgFilter *filter;
-//    if (GetFilterAt(i, &filter) == NS_OK)
-//      NS_RELEASE(filter);
-//  }
 }
 
 nsresult nsMsgFilterList::Close()
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 nsresult nsMsgFilterList::GetFilterCount(PRUint32 *pCount)
 {
-  return m_filters->Count(pCount);
-}
+  NS_ENSURE_ARG_POINTER(pCount);
 
-nsresult nsMsgFilterList::GetMsgFilterAt(PRUint32 filterIndex, nsMsgFilter **filter)
-{
-  NS_ENSURE_ARG_POINTER(filter);
-
-  PRUint32      filterCount;
-  m_filters->Count(&filterCount);
-  NS_ENSURE_ARG(filterCount > filterIndex);
-  *filter = (nsMsgFilter *) m_filters->ElementAt(filterIndex);
+  *pCount = m_filters.Length();
   return NS_OK;
 }
 
 nsresult nsMsgFilterList::GetFilterAt(PRUint32 filterIndex, nsIMsgFilter **filter)
 {
   NS_ENSURE_ARG_POINTER(filter);
 
-  PRUint32      filterCount;
-  m_filters->Count(&filterCount);
-    NS_ENSURE_ARG(filterCount >= filterIndex);
+  PRUint32 filterCount = 0;
+  GetFilterCount(&filterCount);
+  NS_ENSURE_ARG_MAX(filterIndex, filterCount - 1);
 
-  return m_filters->QueryElementAt(filterIndex, NS_GET_IID(nsIMsgFilter),
-                                   (void **)filter);
+  NS_IF_ADDREF(*filter = m_filters[filterIndex]);
+  return NS_OK;
 }
 
 nsresult
 nsMsgFilterList::GetFilterNamed(const nsAString &aName, nsIMsgFilter **aResult)
 {
     NS_ENSURE_ARG_POINTER(aResult);
 
-    nsresult rv;
-    PRUint32 count=0;
-    m_filters->Count(&count);
+    PRUint32 count = 0;
+    nsresult rv = GetFilterCount(&count);
+    NS_ENSURE_SUCCESS(rv, rv);
 
     *aResult = nsnull;
-    PRUint32 i;
-    for (i=0; i<count; i++) {
-        nsCOMPtr<nsISupports> filterSupports;
-        rv = m_filters->GetElementAt(i, getter_AddRefs(filterSupports));
+    for (PRUint32 i = 0; i < count; i++) {
+        nsCOMPtr<nsIMsgFilter> filter;
+        rv = GetFilterAt(i, getter_AddRefs(filter));
         if (NS_FAILED(rv)) continue;
 
-        // cast is safe because array is private
-        nsIMsgFilter *filter = (nsIMsgFilter *)filterSupports.get();
         nsString filterName;
         filter->GetFilterName(filterName);
         if (filterName.Equals(aName))
         {
             *aResult = filter;
             break;
         }
     }
 
     NS_IF_ADDREF(*aResult);
     return NS_OK;
 }
 
 nsresult nsMsgFilterList::SetFilterAt(PRUint32 filterIndex, nsIMsgFilter *filter)
 {
-  m_filters->ReplaceElementAt(filter, filterIndex);
+  m_filters[filterIndex] = filter;
   return NS_OK;
 }
 
 
 nsresult nsMsgFilterList::RemoveFilterAt(PRUint32 filterIndex)
 {
-  m_filters->RemoveElementAt(filterIndex);
+  m_filters.RemoveElementAt(filterIndex);
   return NS_OK;
 }
 
 nsresult
 nsMsgFilterList::RemoveFilter(nsIMsgFilter *aFilter)
 {
-  return m_filters->RemoveElement(static_cast<nsISupports*>(aFilter));
+  m_filters.RemoveElement(aFilter);
+  return NS_OK;
 }
 
 nsresult nsMsgFilterList::InsertFilterAt(PRUint32 filterIndex, nsIMsgFilter *aFilter)
 {
-  nsMsgFilter *filter = static_cast<nsMsgFilter *>(aFilter);
   if (!m_temporaryList)
-    filter->SetFilterList(this);
-  m_filters->InsertElementAt(aFilter, filterIndex);
+    aFilter->SetFilterList(this);
+  m_filters.InsertElementAt(filterIndex, aFilter);
+
   return NS_OK;
 }
 
 // Attempt to move the filter at index filterIndex in the specified direction.
 // If motion not possible in that direction, we still return success.
 // We could return an error if the FE's want to beep or something.
 nsresult nsMsgFilterList::MoveFilterAt(PRUint32 filterIndex,
                                        nsMsgFilterMotionValue motion)
 {
-    NS_ENSURE_ARG((motion == nsMsgFilterMotion::up) ||
-                  (motion == nsMsgFilterMotion::down));
+  NS_ENSURE_ARG((motion == nsMsgFilterMotion::up) ||
+                (motion == nsMsgFilterMotion::down));
 
-  PRUint32      filterCount;
-  m_filters->Count(&filterCount);
+  PRUint32 filterCount = 0;
+  nsresult rv = GetFilterCount(&filterCount);
+  NS_ENSURE_SUCCESS(rv, rv);
 
-    NS_ENSURE_ARG(filterCount >= filterIndex);
+  NS_ENSURE_ARG_MAX(filterIndex, filterCount - 1);
 
-    PRUint32 newIndex = filterIndex;
+  PRUint32 newIndex = filterIndex;
 
   if (motion == nsMsgFilterMotion::up)
   {
-        newIndex = filterIndex - 1;
+    // are we already at the top?
+    if (filterIndex == 0)
+      return NS_OK;
 
-        // are we already at the top?
-    if (filterIndex == 0) return NS_OK;
+    newIndex = filterIndex - 1;
+
   }
   else if (motion == nsMsgFilterMotion::down)
   {
-        newIndex = filterIndex + 1;
+    // are we already at the bottom?
+    if (filterIndex == filterCount - 1)
+      return NS_OK;
+
+    newIndex = filterIndex + 1;
+  }
 
-        // are we already at the bottom?
-    if (newIndex > filterCount - 1) return NS_OK;
-  }
-    m_filters->MoveElement(filterIndex,newIndex);
+  nsCOMPtr<nsIMsgFilter> tempFilter1;
+  rv = GetFilterAt(newIndex, getter_AddRefs(tempFilter1));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  nsCOMPtr<nsIMsgFilter> tempFilter2;
+  rv = GetFilterAt(filterIndex, getter_AddRefs(tempFilter2));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  SetFilterAt(newIndex, tempFilter2);
+  SetFilterAt(filterIndex, tempFilter1);
+
   return NS_OK;
 }
 
 nsresult nsMsgFilterList::MoveFilter(nsIMsgFilter *aFilter,
                                      nsMsgFilterMotionValue motion)
 {
-  PRInt32 filterIndex;
-  nsresult rv = m_filters->GetIndexOf(static_cast<nsISupports*>(aFilter),
-                           &filterIndex);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_ARG_MIN(filterIndex,0);
+  PRInt32 filterIndex = m_filters.IndexOf(aFilter, 0);
+  NS_ENSURE_ARG(filterIndex != m_filters.NoIndex);
 
   return MoveFilterAt(filterIndex, motion);
 }
 
 nsresult
 nsMsgFilterList::GetVersion(PRInt16 *aResult)
 {
     NS_ENSURE_ARG_POINTER(aResult);
     *aResult = m_fileVersion;
     return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgFilterList::MatchOrChangeFilterTarget(const nsACString &oldFolderUri, const nsACString &newFolderUri, bool caseInsensitive, bool *found)
 {
   NS_ENSURE_ARG_POINTER(found);
 
-  PRUint32 numFilters;
-  nsresult rv = m_filters->Count(&numFilters);
+  PRUint32 numFilters = 0;
+  nsresult rv = GetFilterCount(&numFilters);
   NS_ENSURE_SUCCESS(rv, rv);
+
   nsCOMPtr<nsIMsgFilter> filter;
   nsCString folderUri;
   *found = false;
   for (PRUint32 index = 0; index < numFilters; index++)
   {
-    filter = do_QueryElementAt(m_filters, index, &rv);
+    rv = GetFilterAt(index, getter_AddRefs(filter));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsISupportsArray> filterActionList;
     rv = filter->GetActionList(getter_AddRefs(filterActionList));
     NS_ENSURE_SUCCESS(rv, rv);
     PRUint32 numActions;
     filterActionList->Count(&numActions);
 
@@ -1137,53 +1122,52 @@ NS_IMETHODIMP nsMsgFilterList::GetShould
 
   *aResult = false;
   return NS_OK;
 }
 
 // leaves m_arbitraryHeaders filed in with the arbitrary headers.
 nsresult nsMsgFilterList::ComputeArbitraryHeaders()
 {
-  nsresult rv = NS_OK;
-  if (m_arbitraryHeaders.IsEmpty())
+  NS_ENSURE_TRUE (m_arbitraryHeaders.IsEmpty(), NS_OK);
+
+  PRUint32 numFilters = 0;
+  nsresult rv = GetFilterCount(&numFilters);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  nsCOMPtr<nsIMsgFilter> filter;
+  nsMsgSearchAttribValue attrib;
+  nsCString arbitraryHeader;
+  for (PRUint32 index = 0; index < numFilters; index++)
   {
-    PRUint32 numFilters;
-    rv = m_filters->Count(&numFilters);
-    NS_ENSURE_SUCCESS(rv,rv);
-    nsCOMPtr <nsIMsgFilter> filter;
-    nsMsgSearchAttribValue attrib;
-    nsCString arbitraryHeader;
-    for (PRUint32 index = 0; index < numFilters; index++)
+    rv = GetFilterAt(index, getter_AddRefs(filter));
+    if (!(NS_SUCCEEDED(rv) && filter)) continue;
+
+    nsCOMPtr <nsISupportsArray> searchTerms;
+    PRUint32 numSearchTerms=0;
+    filter->GetSearchTerms(getter_AddRefs(searchTerms));
+    if (searchTerms)
+      searchTerms->Count(&numSearchTerms);
+    for (PRUint32 i = 0; i < numSearchTerms; i++)
     {
-      filter = do_QueryElementAt(m_filters, index, &rv);
-      if (NS_SUCCEEDED(rv) && filter)
+      filter->GetTerm(i, &attrib, nsnull, nsnull, nsnull, arbitraryHeader);
+      if (!arbitraryHeader.IsEmpty())
       {
-        nsCOMPtr <nsISupportsArray> searchTerms;
-        PRUint32 numSearchTerms=0;
-        filter->GetSearchTerms(getter_AddRefs(searchTerms));
-        if (searchTerms)
-          searchTerms->Count(&numSearchTerms);
-        for (PRUint32 i=0; i< numSearchTerms;i++)
+        if (m_arbitraryHeaders.IsEmpty())
+          m_arbitraryHeaders.Assign(arbitraryHeader);
+        else if (m_arbitraryHeaders.Find(arbitraryHeader, CaseInsensitiveCompare) == -1)
         {
-          filter->GetTerm(i, &attrib, nsnull, nsnull, nsnull, arbitraryHeader);
-          if (!arbitraryHeader.IsEmpty())
-          {
-            if (m_arbitraryHeaders.IsEmpty())
-              m_arbitraryHeaders.Assign(arbitraryHeader);
-            else if (m_arbitraryHeaders.Find(arbitraryHeader, CaseInsensitiveCompare) == -1)
-            {
-              m_arbitraryHeaders.Append(" ");
-              m_arbitraryHeaders.Append(arbitraryHeader);
-            }
-          }
+          m_arbitraryHeaders.Append(" ");
+          m_arbitraryHeaders.Append(arbitraryHeader);
         }
       }
     }
   }
-  return rv;
+
+  return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgFilterList::GetArbitraryHeaders(nsACString &aResult)
 {
   ComputeArbitraryHeaders();
   aResult = m_arbitraryHeaders;
   return NS_OK;
 }
@@ -1201,30 +1185,9 @@ NS_IMETHODIMP nsMsgFilterList::FlushLogI
     rv = GetLogStream(getter_AddRefs(logStream));
     if (NS_SUCCEEDED(rv) && logStream) {
       rv = logStream->Flush();
       NS_ENSURE_SUCCESS(rv,rv);
     }
   }
   return rv;
 }
-
-#ifdef DEBUG
-void nsMsgFilterList::Dump()
-{
-  PRUint32      filterCount;
-  m_filters->Count(&filterCount);
-  printf("%d filters\n", filterCount);
-
-  for (PRUint32 i = 0; i < filterCount; i++)
-  {
-    nsMsgFilter *filter;
-    if (GetMsgFilterAt(i, &filter) == NS_OK)
-    {
-      filter->Dump();
-      NS_RELEASE(filter);
-    }
-  }
-
-}
-#endif
-
 // ------------ End FilterList methods ------------------
--- a/mailnews/base/search/src/nsMsgFilterList.h
+++ b/mailnews/base/search/src/nsMsgFilterList.h
@@ -5,17 +5,17 @@
 
 #ifndef _nsMsgFilterList_H_
 #define _nsMsgFilterList_H_
 
 #include "nscore.h"
 #include "nsIMsgFolder.h"
 #include "nsIMsgFilterList.h"
 #include "nsCOMPtr.h"
-#include "nsISupportsArray.h"
+#include "nsIArray.h"
 #include "nsIFile.h"
 #include "nsIOutputStream.h"
 
 const PRInt16 kFileVersion = 9;
 const PRInt16 kManualContextVersion = 9;
 const PRInt16 k60Beta1Version = 7;
 const PRInt16 k45Version = 6;
 
@@ -40,44 +40,35 @@ public:
   virtual ~nsMsgFilterList();
 
   nsresult Close();
   nsresult LoadTextFilters(nsIInputStream *aStream);
 
   bool m_temporaryList;
 
 protected:
-  // type-safe accessor when you really have to have an nsMsgFilter
-  nsresult GetMsgFilterAt(PRUint32 filterIndex, nsMsgFilter **filter);
-#ifdef DEBUG
-  void Dump();
-#endif
-protected:
   nsresult ComputeArbitraryHeaders();
   nsresult SaveTextFilters(nsIOutputStream *aStream);
   // file streaming methods
   char ReadChar(nsIInputStream *aStream);
   char SkipWhitespace(nsIInputStream *aStream);
   bool StrToBool(nsCString &str);
   char LoadAttrib(nsMsgFilterFileAttribValue &attrib, nsIInputStream *aStream);
   const char *GetStringForAttrib(nsMsgFilterFileAttribValue attrib);
   nsresult LoadValue(nsCString &value, nsIInputStream *aStream);
   PRInt16 m_fileVersion;
   bool m_loggingEnabled;
   bool m_startWritingToBuffer; //tells us when to start writing one whole filter to m_unparsedBuffer
-  nsCOMPtr <nsIMsgFolder> m_folder;
+  nsCOMPtr<nsIMsgFolder> m_folder;
   nsMsgFilter *m_curFilter; // filter we're filing in or out(?)
   nsCString m_filterFileName;
-  nsCOMPtr<nsISupportsArray> m_filters;
+  nsTArray<nsCOMPtr<nsIMsgFilter> > m_filters;
   nsCString m_arbitraryHeaders;
   nsCOMPtr<nsIFile> m_defaultFile;
   nsCString m_unparsedFilterBuffer; //holds one entire filter unparsed 
 
 private:
   nsresult TruncateLog();
   nsresult GetLogFile(nsIFile **aFile);
   nsCOMPtr<nsIOutputStream> m_logStream;
 };
 
 #endif
-
-
-