From 859d8a7d135c403b53d81d6abf98fe234c096d42 Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Tue, 18 Sep 2012 18:33:12 +0100 Subject: [PATCH] Bug 789827 - Fix nullptr abuse in comm-central. r=Standard8. Bustage fix for CLOSED TREE --- mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp | 2 +- mailnews/base/util/nsMsgDBFolder.cpp | 2 +- mailnews/compose/src/nsMsgCompUtils.cpp | 10 +++++----- mailnews/compose/src/nsMsgSend.cpp | 8 ++++---- .../bayesian-spam-filter/src/nsBayesianFilter.cpp | 4 ++-- mailnews/imap/src/nsImapMailFolder.cpp | 4 ++-- mailnews/import/eudora/src/nsEudoraCompose.cpp | 2 +- mailnews/local/src/nsLocalMailFolder.cpp | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp b/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp index 1841434bab..b54333fce7 100644 --- a/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp +++ b/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp @@ -240,7 +240,7 @@ void nsMsgXFVirtualFolderDBView::UpdateCacheAndViewForPrevSearchedFolders(nsIMsg { // this must be a folder that had no hits with the current search. // So all cached hits, if any, need to be removed. - UpdateCacheAndViewForFolder(m_foldersSearchingOver[0], 0, nullptr); + UpdateCacheAndViewForFolder(m_foldersSearchingOver[0], nullptr, 0); m_foldersSearchingOver.RemoveObjectAt(0); } } diff --git a/mailnews/base/util/nsMsgDBFolder.cpp b/mailnews/base/util/nsMsgDBFolder.cpp index 765fe5b8c2..43f5e1cf3b 100644 --- a/mailnews/base/util/nsMsgDBFolder.cpp +++ b/mailnews/base/util/nsMsgDBFolder.cpp @@ -2754,7 +2754,7 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow *aMsgWindow, bool *aFiltersRun) // post analysis filters will run consistently on a folder, even if // disabled junk processing, which could be dynamic through whitelisting, // makes the bayes analysis unnecessary. - OnMessageClassified(nullptr, nullptr, nullptr); + OnMessageClassified(nullptr, nsIJunkMailPlugin::UNCLASSIFIED, 0); } return rv; diff --git a/mailnews/compose/src/nsMsgCompUtils.cpp b/mailnews/compose/src/nsMsgCompUtils.cpp index 4d342aaa33..d06f104112 100644 --- a/mailnews/compose/src/nsMsgCompUtils.cpp +++ b/mailnews/compose/src/nsMsgCompUtils.cpp @@ -1241,25 +1241,25 @@ RFC2231ParmFolding(const char *parmName, const nsCString& charset, // check to see if we are in the middle of escaped char if (*end == '%') { - tmp = '%'; *end = nullptr; + tmp = '%'; *end = 0; } else if (end-1 > start && *(end-1) == '%') { - end -= 1; tmp = '%'; *end = nullptr; + end -= 1; tmp = '%'; *end = 0; } else if (end-2 > start && *(end-2) == '%') { - end -= 2; tmp = '%'; *end = nullptr; + end -= 2; tmp = '%'; *end = 0; } else { - tmp = *end; *end = nullptr; + tmp = *end; *end = 0; } } else { // XXX should check if we are in the middle of escaped char (RFC 822) - tmp = *end; *end = nullptr; + tmp = *end; *end = 0; } NS_MsgSACat(&foldedParm, start); if (!needEscape) diff --git a/mailnews/compose/src/nsMsgSend.cpp b/mailnews/compose/src/nsMsgSend.cpp index 301e6c08ff..552c3a34dc 100644 --- a/mailnews/compose/src/nsMsgSend.cpp +++ b/mailnews/compose/src/nsMsgSend.cpp @@ -223,7 +223,7 @@ MsgDeliveryListener::~MsgDeliveryListener() NS_IMETHODIMP MsgDeliveryListener::OnStartRunningUrl(nsIURI *url) { if (mMsgSend) - mMsgSend->NotifyListenerOnStartSending(nullptr, nullptr); + mMsgSend->NotifyListenerOnStartSending(nullptr, 0); return NS_OK; } @@ -4260,7 +4260,7 @@ nsMsgComposeAndSend::CreateRFC822Message( aMsgType, aMsgBody, aMsgBodyLength, nullptr, aAttachments, - nullptr, EmptyCString(), nullptr); + nullptr, EmptyCString(), nsIMsgCompType::New); if (NS_FAILED(rv) && mSendReport) mSendReport->SetError(nsIMsgSendReport::process_Current, rv, false); @@ -4312,9 +4312,9 @@ nsMsgComposeAndSend::SendMessageFile( rv = Init(aUserIndentity, aAccountKey, (nsMsgCompFields *)fields, sendIFile, digest_p, false, mode, msgToReplace, - nullptr, nullptr, nullptr, + nullptr, nullptr, 0, nullptr, nullptr, - password, EmptyCString(), nullptr); + password, EmptyCString(), nsIMsgCompType::New); if (NS_SUCCEEDED(rv)) rv = DeliverMessage(); diff --git a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp index f883ef59ca..10a5ef3f36 100644 --- a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp +++ b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp @@ -1346,9 +1346,9 @@ public: { // call all listeners with null parameters to signify end of batch if (mJunkListener) - mJunkListener->OnMessageClassified(nullptr, nullptr, nullptr); + mJunkListener->OnMessageClassified(nullptr, nsIJunkMailPlugin::UNCLASSIFIED, 0); if (mTraitListener) - mTraitListener->OnMessageTraitsClassified(nullptr, nullptr, nullptr, nullptr); + mTraitListener->OnMessageTraitsClassified(nullptr, 0, nullptr, nullptr); mTokenListener = nullptr; // this breaks the circular ref that keeps this object alive // so we will be destroyed as a result. } diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index 822d5b77c4..4f8d8054ee 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -4646,7 +4646,7 @@ nsImapMailFolder::NormalEndMsgWriteStream(nsMsgKey uidOfMessage, msgUrl->GetMsgWindow(getter_AddRefs(msgWindow)); } m_filterList->ApplyFiltersToHdr(nsMsgFilterType::InboxRule, newMsgHdr, - this, mDatabase, nullptr, nullptr, this, + this, mDatabase, nullptr, 0, this, msgWindow); NotifyFolderEvent(mFiltersAppliedAtom); } @@ -9080,7 +9080,7 @@ nsImapMailFolder::OnMessageClassified(const char * aMsgURI, else // end of batch { // Parent will apply post bayes filters. - nsMsgDBFolder::OnMessageClassified(nullptr, nullptr, nullptr); + nsMsgDBFolder::OnMessageClassified(nullptr, nsIJunkMailPlugin::UNCLASSIFIED, 0); if (m_junkMessagesToMarkAsRead) { diff --git a/mailnews/import/eudora/src/nsEudoraCompose.cpp b/mailnews/import/eudora/src/nsEudoraCompose.cpp index 0a9173c187..5db61d8b72 100644 --- a/mailnews/import/eudora/src/nsEudoraCompose.cpp +++ b/mailnews/import/eudora/src/nsEudoraCompose.cpp @@ -527,7 +527,7 @@ nsresult nsEudoraCompose::GetLocalAttachments(nsIArray **aArray) nsCOMPtr uri; nsresult rv = NS_NewFileURI(getter_AddRefs(uri), pAttach->pAttachment); - NS_ENSURE_SUCCESS(rv, nullptr); + NS_ENSURE_SUCCESS(rv, rv); uri->GetSpec(urlStr); if (urlStr.IsEmpty()) return NS_ERROR_FAILURE; diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp index 78e47d4b48..89927c9d8e 100644 --- a/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mailnews/local/src/nsLocalMailFolder.cpp @@ -3380,7 +3380,7 @@ nsMsgLocalMailFolder::OnMessageClassified(const char *aMsgURI, else // end of batch { // Parent will apply post bayes filters. - nsMsgDBFolder::OnMessageClassified(nullptr, nullptr, nullptr); + nsMsgDBFolder::OnMessageClassified(nullptr, nsIJunkMailPlugin::UNCLASSIFIED, 0); nsCOMPtr messages(do_CreateInstance(NS_ARRAY_CONTRACTID)); if (!mSpamKeysToMove.IsEmpty()) {