From 201683afe4596ae32f7b1ea12dfca52995d59f9d Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 10 Nov 2019 19:11:03 -0500 Subject: Bug 1487082 - Resolve potential for build bustage regarding bad implicit conversion constructors * Part 1: make conversion CTORs explicit. Minor tweaks to conform with new(ish) static analysis rule which flags up implicit single-argument conversion constructors. * Part 2: fix a couple of double-mRefCnt declaration errors. * Part 3: Fix unsafe use of NS_ConvertASCIItoUTF16(). Tag #1273 --- mailnews/addrbook/src/nsAbBSDirectory.cpp | 2 +- mailnews/addrbook/src/nsAbMDBDirProperty.h | 2 +- mailnews/addrbook/src/nsAbUtils.h | 4 ++-- mailnews/addrbook/src/nsAddrDatabase.cpp | 2 +- mailnews/base/search/public/nsMsgResultElement.h | 2 +- mailnews/base/search/public/nsMsgSearchBoolExpression.h | 2 +- mailnews/base/search/src/nsMsgSearchValue.h | 2 +- mailnews/base/src/nsMailDirProvider.h | 2 +- mailnews/base/src/nsMsgCopyService.h | 2 +- mailnews/base/src/nsMsgDBView.h | 2 +- mailnews/base/src/nsMsgGroupThread.h | 2 +- mailnews/base/src/nsMsgPrintEngine.cpp | 4 ++-- mailnews/base/util/nsMsgKeySet.h | 2 +- mailnews/base/util/nsMsgLineBuffer.h | 2 +- mailnews/compose/src/nsMsgSendLater.h | 2 +- mailnews/compose/src/nsMsgSendPart.h | 2 +- mailnews/compose/src/nsSmtpProtocol.cpp | 4 +++- mailnews/compose/src/nsSmtpProtocol.h | 2 +- mailnews/compose/src/nsURLFetcher.h | 2 +- mailnews/db/msgdb/public/nsDBFolderInfo.h | 2 +- mailnews/db/msgdb/src/nsMailDatabase.cpp | 2 +- mailnews/db/msgdb/src/nsMsgDatabase.cpp | 2 +- mailnews/db/msgdb/src/nsMsgHdr.cpp | 2 +- .../extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp | 2 +- .../extensions/bayesian-spam-filter/src/nsBayesianFilter.h | 4 ++-- mailnews/imap/src/nsAutoSyncState.h | 2 +- mailnews/imap/src/nsImapFlagAndUidState.h | 2 +- mailnews/imap/src/nsImapMailFolder.cpp | 2 +- mailnews/imap/src/nsImapMailFolder.h | 2 +- mailnews/imap/src/nsImapProtocol.cpp | 4 ++-- mailnews/imap/src/nsImapSearchResults.h | 2 +- mailnews/imap/src/nsImapServerResponseParser.h | 2 +- mailnews/imap/src/nsSyncRunnableHelpers.h | 10 +++++----- mailnews/import/src/nsImportFieldMap.h | 2 +- mailnews/import/src/nsImportMail.cpp | 4 ++-- mailnews/import/text/src/nsTextImport.cpp | 2 +- mailnews/import/vcard/src/nsVCardImport.cpp | 2 +- mailnews/jsaccount/src/DelegateList.h | 2 +- mailnews/jsaccount/src/JaAbDirectory.h | 2 +- mailnews/jsaccount/src/JaCompose.h | 2 +- mailnews/jsaccount/src/JaIncomingServer.h | 2 +- mailnews/jsaccount/src/JaMsgFolder.h | 2 +- mailnews/jsaccount/src/JaSend.h | 2 +- mailnews/jsaccount/src/JaUrl.h | 2 +- mailnews/local/src/nsMailboxProtocol.h | 2 +- mailnews/local/src/nsParseMailbox.h | 2 +- mailnews/local/src/nsPop3Protocol.h | 2 +- mailnews/mime/public/MimeHeaderParser.h | 2 +- mailnews/mime/src/nsCMS.h | 2 +- mailnews/mime/src/nsSimpleMimeConverterStub.cpp | 2 +- 50 files changed, 61 insertions(+), 59 deletions(-) (limited to 'mailnews') diff --git a/mailnews/addrbook/src/nsAbBSDirectory.cpp b/mailnews/addrbook/src/nsAbBSDirectory.cpp index 0d018bbda..7ebe67845 100644 --- a/mailnews/addrbook/src/nsAbBSDirectory.cpp +++ b/mailnews/addrbook/src/nsAbBSDirectory.cpp @@ -242,7 +242,7 @@ NS_IMETHODIMP nsAbBSDirectory::DeleteDirectory(nsIAbDirectory *directory) struct GetDirectories { - GetDirectories(DIR_Server* aServer) : mServer(aServer) { } + explicit GetDirectories(DIR_Server* aServer) : mServer(aServer) { } nsCOMArray directories; DIR_Server* mServer; diff --git a/mailnews/addrbook/src/nsAbMDBDirProperty.h b/mailnews/addrbook/src/nsAbMDBDirProperty.h index 3ee90d17e..fce4db297 100644 --- a/mailnews/addrbook/src/nsAbMDBDirProperty.h +++ b/mailnews/addrbook/src/nsAbMDBDirProperty.h @@ -28,7 +28,7 @@ class nsAbMDBDirProperty: public nsIAbMDBDirectory, public nsAbDirProperty public: nsAbMDBDirProperty(void); - NS_DECL_ISUPPORTS + NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIABMDBDIRECTORY protected: diff --git a/mailnews/addrbook/src/nsAbUtils.h b/mailnews/addrbook/src/nsAbUtils.h index d6b8915e0..c50ba4d0d 100644 --- a/mailnews/addrbook/src/nsAbUtils.h +++ b/mailnews/addrbook/src/nsAbUtils.h @@ -15,7 +15,7 @@ class CharPtrArrayGuard { public: - CharPtrArrayGuard (bool freeElements = true) : + explicit CharPtrArrayGuard (bool freeElements = true) : mFreeElements (freeElements), mArray (0), mSize (0) @@ -80,7 +80,7 @@ private: class PRUnicharPtrArrayGuard { public: - PRUnicharPtrArrayGuard (bool freeElements = true) : + explicit PRUnicharPtrArrayGuard (bool freeElements = true) : mFreeElements (freeElements), mArray (0), mSize (0) diff --git a/mailnews/addrbook/src/nsAddrDatabase.cpp b/mailnews/addrbook/src/nsAddrDatabase.cpp index ea29ba8af..9b1450b94 100644 --- a/mailnews/addrbook/src/nsAddrDatabase.cpp +++ b/mailnews/addrbook/src/nsAddrDatabase.cpp @@ -2507,7 +2507,7 @@ public: NS_DECL_NSIADDRDBLISTENER // nsAddrDBEnumerator methods: - nsAddrDBEnumerator(nsAddrDatabase* aDb); + explicit nsAddrDBEnumerator(nsAddrDatabase* aDb); void Clear(); protected: virtual ~nsAddrDBEnumerator(); diff --git a/mailnews/base/search/public/nsMsgResultElement.h b/mailnews/base/search/public/nsMsgResultElement.h index 384436299..f8cdf4404 100644 --- a/mailnews/base/search/public/nsMsgResultElement.h +++ b/mailnews/base/search/public/nsMsgResultElement.h @@ -20,7 +20,7 @@ class nsMsgResultElement { public: - nsMsgResultElement (nsIMsgSearchAdapter *); + explicit nsMsgResultElement (nsIMsgSearchAdapter *); virtual ~nsMsgResultElement (); static nsresult AssignValues (nsIMsgSearchValue *src, nsMsgSearchValue *dst); diff --git a/mailnews/base/search/public/nsMsgSearchBoolExpression.h b/mailnews/base/search/public/nsMsgSearchBoolExpression.h index c65e5c24a..9c6a9c8d8 100644 --- a/mailnews/base/search/public/nsMsgSearchBoolExpression.h +++ b/mailnews/base/search/public/nsMsgSearchBoolExpression.h @@ -41,7 +41,7 @@ class nsMsgSearchBoolExpression public: // create a leaf node expression - nsMsgSearchBoolExpression(nsIMsgSearchTerm * aNewTerm, + explicit nsMsgSearchBoolExpression(nsIMsgSearchTerm * aNewTerm, char * aEncodingString = NULL); // create a non-leaf node expression containing 2 expressions diff --git a/mailnews/base/search/src/nsMsgSearchValue.h b/mailnews/base/search/src/nsMsgSearchValue.h index ef50ad1ed..3d08d27fa 100644 --- a/mailnews/base/search/src/nsMsgSearchValue.h +++ b/mailnews/base/search/src/nsMsgSearchValue.h @@ -11,7 +11,7 @@ class nsMsgSearchValueImpl : public nsIMsgSearchValue { public: - nsMsgSearchValueImpl(nsMsgSearchValue *aInitialValue); + explicit nsMsgSearchValueImpl(nsMsgSearchValue *aInitialValue); NS_DECL_ISUPPORTS NS_DECL_NSIMSGSEARCHVALUE diff --git a/mailnews/base/src/nsMailDirProvider.h b/mailnews/base/src/nsMailDirProvider.h index d12876d89..613551a79 100644 --- a/mailnews/base/src/nsMailDirProvider.h +++ b/mailnews/base/src/nsMailDirProvider.h @@ -29,7 +29,7 @@ private: NS_DECL_ISUPPORTS NS_DECL_NSISIMPLEENUMERATOR - AppendingEnumerator(nsISimpleEnumerator* aBase); + explicit AppendingEnumerator(nsISimpleEnumerator* aBase); private: ~AppendingEnumerator() {} diff --git a/mailnews/base/src/nsMsgCopyService.h b/mailnews/base/src/nsMsgCopyService.h index dfb9acc7a..8df9ccff5 100644 --- a/mailnews/base/src/nsMsgCopyService.h +++ b/mailnews/base/src/nsMsgCopyService.h @@ -29,7 +29,7 @@ class nsCopySource { public: nsCopySource(); - nsCopySource(nsIMsgFolder* srcFolder); + explicit nsCopySource(nsIMsgFolder* srcFolder); ~nsCopySource(); void AddMessage(nsIMsgDBHdr* aMsg); diff --git a/mailnews/base/src/nsMsgDBView.h b/mailnews/base/src/nsMsgDBView.h index 6dcbbea3b..feba5f14f 100644 --- a/mailnews/base/src/nsMsgDBView.h +++ b/mailnews/base/src/nsMsgDBView.h @@ -500,7 +500,7 @@ private: NS_DECL_NSISIMPLEENUMERATOR // nsMsgThreadEnumerator methods: - nsMsgViewHdrEnumerator(nsMsgDBView *view); + explicit nsMsgViewHdrEnumerator(nsMsgDBView *view); RefPtr m_view; nsMsgViewIndex m_curHdrIndex; diff --git a/mailnews/base/src/nsMsgGroupThread.h b/mailnews/base/src/nsMsgGroupThread.h index 3d1cb4fb4..076d7432a 100644 --- a/mailnews/base/src/nsMsgGroupThread.h +++ b/mailnews/base/src/nsMsgGroupThread.h @@ -21,7 +21,7 @@ public: friend class nsMsgGroupView; nsMsgGroupThread(); - nsMsgGroupThread(nsIMsgDatabase *db); + explicit nsMsgGroupThread(nsIMsgDatabase *db); NS_DECL_NSIMSGTHREAD NS_DECL_ISUPPORTS diff --git a/mailnews/base/src/nsMsgPrintEngine.cpp b/mailnews/base/src/nsMsgPrintEngine.cpp index d2f8157ed..2a509f380 100644 --- a/mailnews/base/src/nsMsgPrintEngine.cpp +++ b/mailnews/base/src/nsMsgPrintEngine.cpp @@ -653,7 +653,7 @@ nsMsgPrintEngine::PrintMsgWindow() class nsPrintMsgWindowEvent : public mozilla::Runnable { public: - nsPrintMsgWindowEvent(nsMsgPrintEngine *mpe) + explicit nsPrintMsgWindowEvent(nsMsgPrintEngine *mpe) : mMsgPrintEngine(mpe) {} @@ -672,7 +672,7 @@ private: class nsStartNextPrintOpEvent : public mozilla::Runnable { public: - nsStartNextPrintOpEvent(nsMsgPrintEngine *mpe) + explicit nsStartNextPrintOpEvent(nsMsgPrintEngine *mpe) : mMsgPrintEngine(mpe) {} diff --git a/mailnews/base/util/nsMsgKeySet.h b/mailnews/base/util/nsMsgKeySet.h index c33306ad8..f38dbd013 100644 --- a/mailnews/base/util/nsMsgKeySet.h +++ b/mailnews/base/util/nsMsgKeySet.h @@ -80,7 +80,7 @@ public: protected: nsMsgKeySet(/* MSG_NewsHost* host */); - nsMsgKeySet(const char* /* , MSG_NewsHost* host */); + explicit nsMsgKeySet(const char* /* , MSG_NewsHost* host */); bool Grow(); bool Optimize(); diff --git a/mailnews/base/util/nsMsgLineBuffer.h b/mailnews/base/util/nsMsgLineBuffer.h index 0383b2d43..eff3f7c7e 100644 --- a/mailnews/base/util/nsMsgLineBuffer.h +++ b/mailnews/base/util/nsMsgLineBuffer.h @@ -50,7 +50,7 @@ public: // flush last line, though it won't be CRLF terminated. virtual nsresult FlushLastLine(); protected: - nsMsgLineBuffer(bool convertNewlinesP); + explicit nsMsgLineBuffer(bool convertNewlinesP); nsresult ConvertAndSendBuffer(); void SetLookingForCRLF(bool b); diff --git a/mailnews/compose/src/nsMsgSendLater.h b/mailnews/compose/src/nsMsgSendLater.h index 734396acc..7b6cdf8f7 100644 --- a/mailnews/compose/src/nsMsgSendLater.h +++ b/mailnews/compose/src/nsMsgSendLater.h @@ -27,7 +27,7 @@ class SendOperationListener : public nsIMsgSendListener, public nsIMsgCopyServiceListener { public: - SendOperationListener(nsMsgSendLater *aSendLater); + explicit SendOperationListener(nsMsgSendLater *aSendLater); NS_DECL_ISUPPORTS NS_DECL_NSIMSGSENDLISTENER diff --git a/mailnews/compose/src/nsMsgSendPart.h b/mailnews/compose/src/nsMsgSendPart.h index edb5422ea..84d12bbd7 100644 --- a/mailnews/compose/src/nsMsgSendPart.h +++ b/mailnews/compose/src/nsMsgSendPart.h @@ -22,7 +22,7 @@ typedef int (*MSG_SendPartWriteFunc)(const char* line, int32_t size, class nsMsgSendPart { typedef mozilla::mailnews::MimeEncoder MimeEncoder; public: - nsMsgSendPart(nsIMsgSend* state, const char *part_charset = NULL); + explicit nsMsgSendPart(nsIMsgSend* state, const char *part_charset = NULL); virtual ~nsMsgSendPart(); // Note that the destructor also destroys // any children that were added. diff --git a/mailnews/compose/src/nsSmtpProtocol.cpp b/mailnews/compose/src/nsSmtpProtocol.cpp index 54d1e6f64..04347c1d0 100644 --- a/mailnews/compose/src/nsSmtpProtocol.cpp +++ b/mailnews/compose/src/nsSmtpProtocol.cpp @@ -2261,10 +2261,12 @@ nsSmtpProtocol::GetUsernamePassword(nsACString &aUsername, nsCString hostname; rv = smtpServer->GetHostname(hostname); NS_ENSURE_SUCCESS(rv, rv); + nsAutoString hostnameUTF16; + CopyASCIItoUTF16(hostname, hostnameUTF16); const char16_t *formatStrings[] = { - NS_ConvertASCIItoUTF16(hostname).get(), + hostnameUTF16.get(), nullptr }; diff --git a/mailnews/compose/src/nsSmtpProtocol.h b/mailnews/compose/src/nsSmtpProtocol.h index c5dba76e3..c8cbf1406 100644 --- a/mailnews/compose/src/nsSmtpProtocol.h +++ b/mailnews/compose/src/nsSmtpProtocol.h @@ -109,7 +109,7 @@ public: #endif // Creating a protocol instance requires the URL which needs to be run. - nsSmtpProtocol(nsIURI * aURL); + explicit nsSmtpProtocol(nsIURI * aURL); virtual nsresult LoadUrl(nsIURI * aURL, nsISupports * aConsumer = nullptr) override; virtual nsresult SendData(const char * dataBuffer, bool aSuppressLogging = false) override; diff --git a/mailnews/compose/src/nsURLFetcher.h b/mailnews/compose/src/nsURLFetcher.h index d252b014b..b23a66385 100644 --- a/mailnews/compose/src/nsURLFetcher.h +++ b/mailnews/compose/src/nsURLFetcher.h @@ -85,7 +85,7 @@ private: class nsURLFetcherStreamConsumer : public nsIStreamListener { public: - nsURLFetcherStreamConsumer(nsURLFetcher* urlFetcher); + explicit nsURLFetcherStreamConsumer(nsURLFetcher* urlFetcher); /* additional members */ NS_DECL_ISUPPORTS diff --git a/mailnews/db/msgdb/public/nsDBFolderInfo.h b/mailnews/db/msgdb/public/nsDBFolderInfo.h index 9b3a51348..b9747feb9 100644 --- a/mailnews/db/msgdb/public/nsDBFolderInfo.h +++ b/mailnews/db/msgdb/public/nsDBFolderInfo.h @@ -31,7 +31,7 @@ class nsDBFolderInfo : public nsIDBFolderInfo public: friend class nsMsgDatabase; - nsDBFolderInfo(nsMsgDatabase *mdb); + explicit nsDBFolderInfo(nsMsgDatabase *mdb); NS_DECL_ISUPPORTS // interface methods. diff --git a/mailnews/db/msgdb/src/nsMailDatabase.cpp b/mailnews/db/msgdb/src/nsMailDatabase.cpp index 13a53485f..b9202a4b2 100644 --- a/mailnews/db/msgdb/src/nsMailDatabase.cpp +++ b/mailnews/db/msgdb/src/nsMailDatabase.cpp @@ -336,7 +336,7 @@ public: // nsISimpleEnumerator methods: NS_DECL_NSISIMPLEENUMERATOR - nsMsgOfflineOpEnumerator(nsMailDatabase* db); + explicit nsMsgOfflineOpEnumerator(nsMailDatabase* db); protected: virtual ~nsMsgOfflineOpEnumerator(); diff --git a/mailnews/db/msgdb/src/nsMsgDatabase.cpp b/mailnews/db/msgdb/src/nsMsgDatabase.cpp index 8b366ab5c..eb5f345f6 100644 --- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp +++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp @@ -1024,7 +1024,7 @@ class MsgDBReporter final : public nsIMemoryReporter { nsMsgDatabase *mDatabase; public: - MsgDBReporter(nsMsgDatabase *db) : mDatabase(db) {} + explicit MsgDBReporter(nsMsgDatabase *db) : mDatabase(db) {} NS_DECL_ISUPPORTS NS_IMETHOD GetName(nsACString &aName) diff --git a/mailnews/db/msgdb/src/nsMsgHdr.cpp b/mailnews/db/msgdb/src/nsMsgHdr.cpp index ba1663e3b..136079473 100644 --- a/mailnews/db/msgdb/src/nsMsgHdr.cpp +++ b/mailnews/db/msgdb/src/nsMsgHdr.cpp @@ -998,7 +998,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIUTF8STRINGENUMERATOR - nsMsgPropertyEnumerator(nsMsgHdr* aHdr); + explicit nsMsgPropertyEnumerator(nsMsgHdr* aHdr); void PrefetchNext(); protected: diff --git a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp index 0fa5aa1e2..d0336db1d 100644 --- a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp +++ b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp @@ -898,7 +898,7 @@ public: NS_DECL_NSISTREAMLISTENER NS_DECL_NSIMSGHEADERSINK - TokenStreamListener(TokenAnalyzer* analyzer); + explicit TokenStreamListener(TokenAnalyzer* analyzer); protected: virtual ~TokenStreamListener(); TokenAnalyzer* mAnalyzer; diff --git a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.h b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.h index 32a9d26d0..a1e2beaab 100644 --- a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.h +++ b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.h @@ -40,7 +40,7 @@ struct CorpusToken; */ class TokenEnumeration { public: - TokenEnumeration(PLDHashTable* table); + explicit TokenEnumeration(PLDHashTable* table); bool hasMoreTokens(); BaseToken* nextToken(); @@ -96,7 +96,7 @@ public: BaseToken* add(const char* word); protected: - TokenHash(uint32_t entrySize); + explicit TokenHash(uint32_t entrySize); PLArenaPool mWordPool; uint32_t mEntrySize; PLDHashTable mTokenTable; diff --git a/mailnews/imap/src/nsAutoSyncState.h b/mailnews/imap/src/nsAutoSyncState.h index c28c10d60..0b10c8c94 100644 --- a/mailnews/imap/src/nsAutoSyncState.h +++ b/mailnews/imap/src/nsAutoSyncState.h @@ -56,7 +56,7 @@ public: NS_DECL_NSIAUTOSYNCSTATE NS_DECL_NSIURLLISTENER - nsAutoSyncState(nsImapMailFolder *aOwnerFolder, PRTime aLastSyncTime = 0UL); + explicit nsAutoSyncState(nsImapMailFolder *aOwnerFolder, PRTime aLastSyncTime = 0UL); /// Called by owner folder when new headers are fetched from the server void OnNewHeaderFetchCompleted(const nsTArray &aMsgKeyList); diff --git a/mailnews/imap/src/nsImapFlagAndUidState.h b/mailnews/imap/src/nsImapFlagAndUidState.h index 6bf5f3fbe..259bc016f 100644 --- a/mailnews/imap/src/nsImapFlagAndUidState.h +++ b/mailnews/imap/src/nsImapFlagAndUidState.h @@ -20,7 +20,7 @@ class nsImapFlagAndUidState : public nsIImapFlagAndUidState { public: NS_DECL_THREADSAFE_ISUPPORTS - nsImapFlagAndUidState(int numberOfMessages); + explicit nsImapFlagAndUidState(int numberOfMessages); NS_DECL_NSIIMAPFLAGANDUIDSTATE diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index 12e687360..4ed12a026 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -6363,7 +6363,7 @@ NS_IMETHODIMP nsImapMailFolder::GetOtherUsersWithAccess( class AdoptUTF8StringEnumerator final : public nsIUTF8StringEnumerator { public: - AdoptUTF8StringEnumerator(nsTArray* array) : + explicit AdoptUTF8StringEnumerator(nsTArray* array) : mStrings(array), mIndex(0) {} diff --git a/mailnews/imap/src/nsImapMailFolder.h b/mailnews/imap/src/nsImapMailFolder.h index b2a9430b3..71665ee79 100644 --- a/mailnews/imap/src/nsImapMailFolder.h +++ b/mailnews/imap/src/nsImapMailFolder.h @@ -115,7 +115,7 @@ class nsImapMailFolder; class nsMsgIMAPFolderACL { public: - nsMsgIMAPFolderACL(nsImapMailFolder *folder); + explicit nsMsgIMAPFolderACL(nsImapMailFolder *folder); ~nsMsgIMAPFolderACL(); bool SetFolderRightsForUser(const nsACString& userName, const nsACString& rights); diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index 1d0c98d48..bf00e0206 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -1057,7 +1057,7 @@ void nsImapProtocol::ReleaseUrlState(bool rerunning) class nsImapThreadShutdownEvent : public mozilla::Runnable { public: - nsImapThreadShutdownEvent(nsIThread *thread) : mThread(thread) { + explicit nsImapThreadShutdownEvent(nsIThread *thread) : mThread(thread) { } NS_IMETHOD Run() { mThread->Shutdown(); @@ -9580,7 +9580,7 @@ nsresult nsImapMockChannel::ReadFromMemCache(nsICacheEntry *entry) class nsReadFromImapConnectionFailure : public mozilla::Runnable { public: - nsReadFromImapConnectionFailure(nsImapMockChannel *aChannel) + explicit nsReadFromImapConnectionFailure(nsImapMockChannel *aChannel) : mImapMockChannel(aChannel) {} diff --git a/mailnews/imap/src/nsImapSearchResults.h b/mailnews/imap/src/nsImapSearchResults.h index b4333417b..b03268d4d 100644 --- a/mailnews/imap/src/nsImapSearchResults.h +++ b/mailnews/imap/src/nsImapSearchResults.h @@ -25,7 +25,7 @@ private: class nsImapSearchResultIterator { public: - nsImapSearchResultIterator(nsImapSearchResultSequence &sequence); + explicit nsImapSearchResultIterator(nsImapSearchResultSequence &sequence); virtual ~nsImapSearchResultIterator(); void ResetIterator(); diff --git a/mailnews/imap/src/nsImapServerResponseParser.h b/mailnews/imap/src/nsImapServerResponseParser.h index 5b46f8a43..fb5762b6b 100644 --- a/mailnews/imap/src/nsImapServerResponseParser.h +++ b/mailnews/imap/src/nsImapServerResponseParser.h @@ -28,7 +28,7 @@ class nsCString; class nsImapServerResponseParser : public nsIMAPGenericParser { public: - nsImapServerResponseParser(nsImapProtocol &imapConnection); + explicit nsImapServerResponseParser(nsImapProtocol &imapConnection); virtual ~nsImapServerResponseParser(); // Overridden from the base parser class diff --git a/mailnews/imap/src/nsSyncRunnableHelpers.h b/mailnews/imap/src/nsSyncRunnableHelpers.h index 4740fab10..273810a70 100644 --- a/mailnews/imap/src/nsSyncRunnableHelpers.h +++ b/mailnews/imap/src/nsSyncRunnableHelpers.h @@ -27,7 +27,7 @@ class StreamListenerProxy final : public nsIStreamListener { public: - StreamListenerProxy(nsIStreamListener* receiver) + explicit StreamListenerProxy(nsIStreamListener* receiver) : mReceiver(receiver) { } @@ -45,7 +45,7 @@ private: class ImapMailFolderSinkProxy final : public nsIImapMailFolderSink { public: - ImapMailFolderSinkProxy(nsIImapMailFolderSink* receiver) + explicit ImapMailFolderSinkProxy(nsIImapMailFolderSink* receiver) : mReceiver(receiver) { NS_ASSERTION(receiver, "Don't allow receiver is nullptr"); @@ -64,7 +64,7 @@ private: class ImapServerSinkProxy final : public nsIImapServerSink { public: - ImapServerSinkProxy(nsIImapServerSink* receiver) + explicit ImapServerSinkProxy(nsIImapServerSink* receiver) : mReceiver(receiver) { } @@ -82,7 +82,7 @@ private: class ImapMessageSinkProxy final : public nsIImapMessageSink { public: - ImapMessageSinkProxy(nsIImapMessageSink* receiver) + explicit ImapMessageSinkProxy(nsIImapMessageSink* receiver) : mReceiver(receiver) { } @@ -99,7 +99,7 @@ private: class ImapProtocolSinkProxy final : public nsIImapProtocolSink { public: - ImapProtocolSinkProxy(nsIImapProtocolSink* receiver) + explicit ImapProtocolSinkProxy(nsIImapProtocolSink* receiver) : mReceiver(receiver) { } diff --git a/mailnews/import/src/nsImportFieldMap.h b/mailnews/import/src/nsImportFieldMap.h index a25069b1e..314abd800 100644 --- a/mailnews/import/src/nsImportFieldMap.h +++ b/mailnews/import/src/nsImportFieldMap.h @@ -24,7 +24,7 @@ public: NS_DECL_NSIIMPORTFIELDMAP - nsImportFieldMap(nsIStringBundle *aBundle); + explicit nsImportFieldMap(nsIStringBundle *aBundle); static NS_METHOD Create(nsIStringBundle *aBundle, nsISupports *aOuter, REFNSIID aIID, void **aResult); diff --git a/mailnews/import/src/nsImportMail.cpp b/mailnews/import/src/nsImportMail.cpp index ad584b8a6..9e0f6bcd2 100644 --- a/mailnews/import/src/nsImportMail.cpp +++ b/mailnews/import/src/nsImportMail.cpp @@ -993,7 +993,7 @@ bool nsImportGenericMail::CreateFolder(nsIMsgFolder **ppFolder) class GetSubFoldersRunnable : public mozilla::Runnable { public: - GetSubFoldersRunnable(nsIMsgFolder *aFolder); + explicit GetSubFoldersRunnable(nsIMsgFolder *aFolder); NS_DECL_NSIRUNNABLE private: nsCOMPtr m_folder; @@ -1182,7 +1182,7 @@ nsresult ProxyCreateSubfolder(nsIMsgFolder *aFolder, const nsAString &aName) class ForceDBClosedRunnable : public mozilla::Runnable { public: - ForceDBClosedRunnable(nsIMsgFolder *aFolder); + explicit ForceDBClosedRunnable(nsIMsgFolder *aFolder); NS_DECL_NSIRUNNABLE protected: nsCOMPtr m_folder; diff --git a/mailnews/import/text/src/nsTextImport.cpp b/mailnews/import/text/src/nsTextImport.cpp index 61615e4d7..0b99e652b 100644 --- a/mailnews/import/text/src/nsTextImport.cpp +++ b/mailnews/import/text/src/nsTextImport.cpp @@ -51,7 +51,7 @@ PRLogModuleInfo* TEXTIMPORTLOGMODULE; class ImportAddressImpl final : public nsIImportAddressBooks { public: - ImportAddressImpl(nsIStringBundle* aStringBundle); + explicit ImportAddressImpl(nsIStringBundle* aStringBundle); static nsresult Create(nsIImportAddressBooks** aImport, nsIStringBundle *aStringBundle); diff --git a/mailnews/import/vcard/src/nsVCardImport.cpp b/mailnews/import/vcard/src/nsVCardImport.cpp index 6081c36d7..fc674e496 100644 --- a/mailnews/import/vcard/src/nsVCardImport.cpp +++ b/mailnews/import/vcard/src/nsVCardImport.cpp @@ -30,7 +30,7 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); class ImportVCardAddressImpl : public nsIImportAddressBooks { public: - ImportVCardAddressImpl(nsIStringBundle* aStringBundle); + explicit ImportVCardAddressImpl(nsIStringBundle* aStringBundle); static nsresult Create( nsIImportAddressBooks** aImport, nsIStringBundle* aStringBundle); diff --git a/mailnews/jsaccount/src/DelegateList.h b/mailnews/jsaccount/src/DelegateList.h index 943b3e726..aa7fc74c8 100644 --- a/mailnews/jsaccount/src/DelegateList.h +++ b/mailnews/jsaccount/src/DelegateList.h @@ -20,7 +20,7 @@ class DelegateList : public msgIDelegateList public: NS_DECL_ISUPPORTS NS_DECL_MSGIDELEGATELIST - DelegateList(const char *aWindowsPrefix) : + explicit DelegateList(const char *aWindowsPrefix) : mPrefix(aWindowsPrefix) { } nsDataHashtable mMethods; diff --git a/mailnews/jsaccount/src/JaAbDirectory.h b/mailnews/jsaccount/src/JaAbDirectory.h index 4ada7c761..8c7e37ff7 100644 --- a/mailnews/jsaccount/src/JaAbDirectory.h +++ b/mailnews/jsaccount/src/JaAbDirectory.h @@ -56,7 +56,7 @@ private: public nsIInterfaceRequestor { public: - Super(JaCppAbDirectoryDelegator* aFakeThis) {mFakeThis = aFakeThis;} + explicit Super(JaCppAbDirectoryDelegator* aFakeThis) {mFakeThis = aFakeThis;} NS_DECL_ISUPPORTS NS_FORWARD_NSIABDIRECTORY(mFakeThis->JaBaseCppAbDirectory::) NS_FORWARD_NSIABCOLLECTION(mFakeThis->JaBaseCppAbDirectory::) diff --git a/mailnews/jsaccount/src/JaCompose.h b/mailnews/jsaccount/src/JaCompose.h index b81adda5c..800d1975e 100644 --- a/mailnews/jsaccount/src/JaCompose.h +++ b/mailnews/jsaccount/src/JaCompose.h @@ -60,7 +60,7 @@ private: public nsIInterfaceRequestor { public: - Super(JaCppComposeDelegator* aFakeThis) {mFakeThis = aFakeThis;} + explicit Super(JaCppComposeDelegator* aFakeThis) {mFakeThis = aFakeThis;} NS_DECL_ISUPPORTS // Forward all overridable methods, bypassing JS override. NS_FORWARD_NSIMSGCOMPOSE(mFakeThis->JaBaseCppCompose::) diff --git a/mailnews/jsaccount/src/JaIncomingServer.h b/mailnews/jsaccount/src/JaIncomingServer.h index 5b0362324..cac0dfce4 100644 --- a/mailnews/jsaccount/src/JaIncomingServer.h +++ b/mailnews/jsaccount/src/JaIncomingServer.h @@ -63,7 +63,7 @@ private: public nsIInterfaceRequestor { public: - Super(JaCppIncomingServerDelegator* aFakeThis) {mFakeThis = aFakeThis;} + explicit Super(JaCppIncomingServerDelegator* aFakeThis) {mFakeThis = aFakeThis;} NS_DECL_ISUPPORTS // Forward all overridable methods, bypassing JS override. NS_FORWARD_NSIMSGINCOMINGSERVER(mFakeThis->JaBaseCppIncomingServer::) diff --git a/mailnews/jsaccount/src/JaMsgFolder.h b/mailnews/jsaccount/src/JaMsgFolder.h index 514d6e07f..d1b7d37aa 100644 --- a/mailnews/jsaccount/src/JaMsgFolder.h +++ b/mailnews/jsaccount/src/JaMsgFolder.h @@ -89,7 +89,7 @@ private: // Why fake this? Because this method is fully owned by // JaCppMsgFolderDelegator, and this reference is to the "this" of the // main method. But it is not really the local "this". - Super(JaCppMsgFolderDelegator* aFakeThis) {mFakeThis = aFakeThis;} + explicit Super(JaCppMsgFolderDelegator* aFakeThis) {mFakeThis = aFakeThis;} NS_DECL_ISUPPORTS NS_FORWARD_NSIMSGFOLDER(mFakeThis->JaBaseCppMsgFolder::) NS_FORWARD_NSIRDFRESOURCE(mFakeThis->JaBaseCppMsgFolder::) diff --git a/mailnews/jsaccount/src/JaSend.h b/mailnews/jsaccount/src/JaSend.h index c4d8ac3b8..42984798c 100644 --- a/mailnews/jsaccount/src/JaSend.h +++ b/mailnews/jsaccount/src/JaSend.h @@ -63,7 +63,7 @@ private: public nsIInterfaceRequestor { public: - Super(JaCppSendDelegator* aFakeThis) {mFakeThis = aFakeThis;} + explicit Super(JaCppSendDelegator* aFakeThis) {mFakeThis = aFakeThis;} NS_DECL_ISUPPORTS // Forward all overridable methods, bypassing JS override. NS_FORWARD_NSIMSGSEND(mFakeThis->JaBaseCppSend::) diff --git a/mailnews/jsaccount/src/JaUrl.h b/mailnews/jsaccount/src/JaUrl.h index 2de90ae68..c66f88f68 100644 --- a/mailnews/jsaccount/src/JaUrl.h +++ b/mailnews/jsaccount/src/JaUrl.h @@ -79,7 +79,7 @@ public: public nsIInterfaceRequestor { public: - Super(JaCppUrlDelegator *aFakeThis) {mFakeThis = aFakeThis;} + explicit Super(JaCppUrlDelegator *aFakeThis) {mFakeThis = aFakeThis;} NS_DECL_ISUPPORTS NS_FORWARD_NSIMSGMAILNEWSURL(mFakeThis->JaBaseCppUrl::) NS_FORWARD_NSIURI(mFakeThis->JaBaseCppUrl::) diff --git a/mailnews/local/src/nsMailboxProtocol.h b/mailnews/local/src/nsMailboxProtocol.h index 53c65b40f..e030c8d7c 100644 --- a/mailnews/local/src/nsMailboxProtocol.h +++ b/mailnews/local/src/nsMailboxProtocol.h @@ -50,7 +50,7 @@ class nsMailboxProtocol : public nsMsgProtocol public: // Creating a protocol instance requires the URL which needs to be run AND it requires // a transport layer. - nsMailboxProtocol(nsIURI * aURL); + explicit nsMailboxProtocol(nsIURI * aURL); virtual ~nsMailboxProtocol(); // initialization function given a new url and transport layer diff --git a/mailnews/local/src/nsParseMailbox.h b/mailnews/local/src/nsParseMailbox.h index aac40611a..646cfd533 100644 --- a/mailnews/local/src/nsParseMailbox.h +++ b/mailnews/local/src/nsParseMailbox.h @@ -133,7 +133,7 @@ protected: class nsMsgMailboxParser : public nsIStreamListener, public nsParseMailMessageState, public nsMsgLineBuffer { public: - nsMsgMailboxParser(nsIMsgFolder *); + explicit nsMsgMailboxParser(nsIMsgFolder *); nsMsgMailboxParser(); nsresult Init(); diff --git a/mailnews/local/src/nsPop3Protocol.h b/mailnews/local/src/nsPop3Protocol.h index a937427d1..a332eae84 100644 --- a/mailnews/local/src/nsPop3Protocol.h +++ b/mailnews/local/src/nsPop3Protocol.h @@ -254,7 +254,7 @@ class nsPop3Protocol : public nsMsgProtocol, public nsIMsgAsyncPromptListener { public: - nsPop3Protocol(nsIURI* aURL); + explicit nsPop3Protocol(nsIURI* aURL); NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIPOP3PROTOCOL diff --git a/mailnews/mime/public/MimeHeaderParser.h b/mailnews/mime/public/MimeHeaderParser.h index 429e759b1..fe9bf59d3 100644 --- a/mailnews/mime/public/MimeHeaderParser.h +++ b/mailnews/mime/public/MimeHeaderParser.h @@ -47,7 +47,7 @@ template class UTF16ArrayAdapter { public: - UTF16ArrayAdapter(nsTArray &aUTF8Array) + explicit UTF16ArrayAdapter(nsTArray &aUTF8Array) : mUTF8Array(aUTF8Array) {} ~UTF16ArrayAdapter() { detail::DoConversion(mUTF16Array, mUTF8Array); } operator nsTArray&() { return mUTF16Array; } diff --git a/mailnews/mime/src/nsCMS.h b/mailnews/mime/src/nsCMS.h index e8f2fdd4b..7c862eb46 100644 --- a/mailnews/mime/src/nsCMS.h +++ b/mailnews/mime/src/nsCMS.h @@ -32,7 +32,7 @@ public: NS_DECL_NSICMSMESSAGE2 nsCMSMessage(); - nsCMSMessage(NSSCMSMessage* aCMSMsg); + explicit nsCMSMessage(NSSCMSMessage* aCMSMsg); nsresult Init(); void referenceContext(nsIInterfaceRequestor* aContext) {m_ctx = aContext;} diff --git a/mailnews/mime/src/nsSimpleMimeConverterStub.cpp b/mailnews/mime/src/nsSimpleMimeConverterStub.cpp index 50dcf27fd..ca608b54c 100644 --- a/mailnews/mime/src/nsSimpleMimeConverterStub.cpp +++ b/mailnews/mime/src/nsSimpleMimeConverterStub.cpp @@ -164,7 +164,7 @@ MimeSimpleStubClassInitialize(MimeSimpleStubClass *clazz) class nsSimpleMimeConverterStub : public nsIMimeContentTypeHandler { public: - nsSimpleMimeConverterStub(const char *aContentType) : mContentType(aContentType) { } + explicit nsSimpleMimeConverterStub(const char *aContentType) : mContentType(aContentType) { } NS_DECL_ISUPPORTS -- cgit v1.2.3