Bug 1492735 - Port Bug 1486147: Adapt inheritance of string enumerators in mailnews/ and add QIs(). rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Thu, 20 Sep 2018 10:24:02 +0200
changeset 33192 9ebd1525937965ad68372dd6d971ffd178af6a0e
parent 33191 0efbfa471d1cb92cbb219a3ad725251e5a14866b
child 33193 2bfc93d3de04b819cd58cb5b9c5166e27584f15c
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersbustage-fix
bugs1492735, 1486147
Bug 1492735 - Port Bug 1486147: Adapt inheritance of string enumerators in mailnews/ and add QIs(). rs=bustage-fix
mailnews/db/msgdb/src/nsMsgHdr.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/mime/emitters/nsMimeHtmlEmitter.cpp
--- a/mailnews/db/msgdb/src/nsMsgHdr.cpp
+++ b/mailnews/db/msgdb/src/nsMsgHdr.cpp
@@ -6,16 +6,17 @@
 #include "msgCore.h"
 #include "mozilla/mailnews/MimeHeaderParser.h"
 #include "nsMsgHdr.h"
 #include "nsMsgDatabase.h"
 #include "nsMsgUtils.h"
 #include "nsIMsgThread.h"
 #include "nsMsgMimeCID.h"
 #include "mozilla/Attributes.h"
+#include "nsStringEnumerator.h"
 
 using namespace mozilla::mailnews;
 
 NS_IMPL_ISUPPORTS(nsMsgHdr, nsIMsgDBHdr)
 
 #define FLAGS_INITED 0x1
 #define CACHED_VALUES_INITED 0x2
 #define REFERENCES_INITED 0x4
@@ -985,22 +986,24 @@ NS_IMETHODIMP nsMsgHdr::GetIsKilled(bool
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 #include "nsIStringEnumerator.h"
 #include "nsAutoPtr.h"
 #define NULL_MORK_COLUMN 0
-class nsMsgPropertyEnumerator : public nsIUTF8StringEnumerator
+class nsMsgPropertyEnumerator : public nsStringEnumeratorBase
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUTF8STRINGENUMERATOR
 
+  using nsStringEnumeratorBase::GetNext;
+
   explicit nsMsgPropertyEnumerator(nsMsgHdr* aHdr);
   void PrefetchNext();
 
 protected:
   virtual ~nsMsgPropertyEnumerator();
   nsCOMPtr<nsIMdbRowCellCursor> mRowCellCursor;
   nsCOMPtr<nsIMdbEnv> m_mdbEnv;
   nsCOMPtr<nsIMdbStore> m_mdbStore;
@@ -1032,17 +1035,17 @@ nsMsgPropertyEnumerator::nsMsgPropertyEn
 
 nsMsgPropertyEnumerator::~nsMsgPropertyEnumerator()
 {
   // Need to clear this before the nsMsgHdr and its corresponding
   // nsIMdbRow potentially go away.
   mRowCellCursor = nullptr;
 }
 
-NS_IMPL_ISUPPORTS(nsMsgPropertyEnumerator, nsIUTF8StringEnumerator)
+NS_IMPL_ISUPPORTS(nsMsgPropertyEnumerator, nsIUTF8StringEnumerator, nsIStringEnumerator)
 
 NS_IMETHODIMP nsMsgPropertyEnumerator::GetNext(nsACString& aItem)
 {
   PrefetchNext();
   if (mNextColumn == NULL_MORK_COLUMN)
     return NS_ERROR_FAILURE; // call HasMore first
   if (!m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NOT_INITIALIZED;
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -78,17 +78,17 @@
 #include "nsCExternalHandlerService.h"
 #include "prprf.h"
 #include "nsIMutableArray.h"
 #include "nsArrayUtils.h"
 #include "nsArrayEnumerator.h"
 #include "nsAutoSyncManager.h"
 #include "nsIMsgFilterCustomAction.h"
 #include "nsMsgReadStateTxn.h"
-#include "nsIStringEnumerator.h"
+#include "nsStringEnumerator.h"
 #include "nsIMsgStatusFeedback.h"
 #include "nsMsgLineBuffer.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Attributes.h"
 #include "nsStringStream.h"
 #include "nsIStreamListener.h"
 
 static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
@@ -6330,36 +6330,39 @@ bool nsMsgIMAPFolderACL::SetFolderRights
 }
 
 NS_IMETHODIMP nsImapMailFolder::GetOtherUsersWithAccess(
         nsIUTF8StringEnumerator** aResult)
 {
   return GetFolderACL()->GetOtherUsers(aResult);
 }
 
-class AdoptUTF8StringEnumerator final : public nsIUTF8StringEnumerator
+class AdoptUTF8StringEnumerator final : public nsStringEnumeratorBase
 {
 public:
   explicit AdoptUTF8StringEnumerator(nsTArray<nsCString>* array) :
     mStrings(array), mIndex(0)
   {}
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUTF8STRINGENUMERATOR
+
+  using nsStringEnumeratorBase::GetNext;
+
 private:
   ~AdoptUTF8StringEnumerator()
   {
     delete mStrings;
   }
 
   nsTArray<nsCString>* mStrings;
   uint32_t             mIndex;
 };
 
-NS_IMPL_ISUPPORTS(AdoptUTF8StringEnumerator, nsIUTF8StringEnumerator)
+NS_IMPL_ISUPPORTS(AdoptUTF8StringEnumerator, nsIUTF8StringEnumerator, nsIStringEnumerator)
 
 NS_IMETHODIMP
 AdoptUTF8StringEnumerator::HasMore(bool *aResult)
 {
   *aResult = mIndex < mStrings->Length();
   return NS_OK;
 }
 
--- a/mailnews/mime/emitters/nsMimeHtmlEmitter.cpp
+++ b/mailnews/mime/emitters/nsMimeHtmlEmitter.cpp
@@ -13,50 +13,52 @@
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIMimeStreamConverter.h"
 #include "nsIMsgWindow.h"
 #include "nsIMsgMailNewsUrl.h"
 #include "nsMimeTypes.h"
 #include "prtime.h"
 #include "prprf.h"
-#include "nsIStringEnumerator.h"
+#include "nsStringEnumerator.h"
 #include "nsServiceManagerUtils.h"
 // hack: include this to fix opening news attachments.
 #include "nsINntpUrl.h"
 #include "nsComponentManagerUtils.h"
 #include "nsMsgMimeCID.h"
 #include "nsMsgUtils.h"
 #include "nsAutoPtr.h"
 #include "nsMemory.h"
 #include "mozilla/Services.h"
 
 #define VIEW_ALL_HEADERS 2
 
 /**
  * A helper class to implement nsIUTF8StringEnumerator
  */
 
-class nsMimeStringEnumerator final : public nsIUTF8StringEnumerator {
+class nsMimeStringEnumerator final : public nsStringEnumeratorBase {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUTF8STRINGENUMERATOR
 
   nsMimeStringEnumerator() : mCurrentIndex(0) {}
 
   template<class T>
   nsCString* Append(T value) { return mValues.AppendElement(value); }
 
+  using nsStringEnumeratorBase::GetNext;
+
 protected:
   ~nsMimeStringEnumerator() {}
   nsTArray<nsCString> mValues;
   uint32_t mCurrentIndex; // consumers expect first-in first-out enumeration
 };
 
-NS_IMPL_ISUPPORTS(nsMimeStringEnumerator, nsIUTF8StringEnumerator)
+NS_IMPL_ISUPPORTS(nsMimeStringEnumerator, nsIUTF8StringEnumerator, nsIStringEnumerator)
 
 NS_IMETHODIMP
 nsMimeStringEnumerator::HasMore(bool *result)
 {
   NS_ENSURE_ARG_POINTER(result);
   *result = mCurrentIndex < mValues.Length();
   return NS_OK;
 }