Bug 1340972 - Part 16: replace xxx.swap(*yyy) with xxx.forget(yyy) in mailnews. r=aceman

This commit is contained in:
Jorg K 2017-09-15 20:30:56 +02:00
Родитель 269b36af3d
Коммит 409c949fcc
24 изменённых файлов: 58 добавлений и 61 удалений

Просмотреть файл

@ -1530,6 +1530,6 @@ nsresult OutlookCardForURI(const nsACString &aUri, nsIAbCard **newCard)
card->SetPropertyAsUint32(kBirthDayProperty, day);
}
card.swap(*newCard);
card.forget(newCard);
return NS_OK;
}

Просмотреть файл

@ -330,7 +330,7 @@ NS_IMETHODIMP nsMsgSearchSession::GetWindow(nsIMsgWindow **aWindow)
NS_ENSURE_ARG_POINTER(aWindow);
*aWindow = nullptr;
nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(m_msgWindowWeak));
msgWindow.swap(*aWindow);
msgWindow.forget(aWindow);
return NS_OK;
}

Просмотреть файл

@ -84,7 +84,7 @@ nsMailDirProvider::GetFile(const char *aKey, bool *aPersist,
rv = EnsureDirectory(file);
*aPersist = true;
file.swap(*aResult);
file.forget(aResult);
return rv;
}

Просмотреть файл

@ -803,7 +803,7 @@ nsMessenger::SaveAttachmentToFolder(const nsACString& contentType, const nsACStr
#endif
rv = SaveAttachment(attachmentDestination, url, messageUri, contentType, nullptr, nullptr);
attachmentDestination.swap(*aOutFile);
attachmentDestination.forget(aOutFile);
return rv;
}
@ -1326,7 +1326,7 @@ nsMessenger::GetSaveAsFile(const nsAString& aMsgFilename, int32_t *aSaveAsFileTy
}
*aSaveAsFile = nullptr;
localFile.swap(*aSaveAsFile);
localFile.forget(aSaveAsFile);
return NS_OK;
}
@ -1369,7 +1369,7 @@ nsMessenger::GetSaveToDir(nsIFile **aSaveDir)
NS_ENSURE_SUCCESS(rv, rv);
*aSaveDir = nullptr;
dir.swap(*aSaveDir);
dir.forget(aSaveDir);
return NS_OK;
}

Просмотреть файл

@ -290,7 +290,7 @@ nsMessengerOSXIntegration::GetStringBundle(nsIStringBundle **aBundle)
nsCOMPtr<nsIStringBundle> bundle;
if (bundleService && NS_SUCCEEDED(rv))
bundleService->CreateBundle("chrome://messenger/locale/messenger.properties", getter_AddRefs(bundle));
bundle.swap(*aBundle);
bundle.forget(aBundle);
return rv;
}

Просмотреть файл

@ -150,7 +150,7 @@ nsresult nsMessengerUnixIntegration::GetStringBundle(nsIStringBundle **aBundle)
nsCOMPtr<nsIStringBundle> bundle;
bundleService->CreateBundle("chrome://messenger/locale/messenger.properties",
getter_AddRefs(bundle));
bundle.swap(*aBundle);
bundle.forget(aBundle);
return NS_OK;
}

Просмотреть файл

@ -251,7 +251,7 @@ nsMsgAccount::GetDefaultIdentity(nsIMsgIdentity **aDefaultIdentity)
return NS_OK;
nsCOMPtr<nsIMsgIdentity> identity = do_QueryElementAt(m_identities, 0, &rv);
identity.swap(*aDefaultIdentity);
identity.forget(aDefaultIdentity);
return rv;
}

Просмотреть файл

@ -398,7 +398,7 @@ nsMsgAccountManager::GetIdentity(const nsACString& key, nsIMsgIdentity **_retval
nsCOMPtr<nsIMsgIdentity> identity;
m_identities.Get(key, getter_AddRefs(identity));
if (identity)
identity.swap(*_retval);
identity.forget(_retval);
else // identity doesn't exist. create it.
rv = createKeyedIdentity(key, _retval);
}
@ -421,7 +421,7 @@ nsMsgAccountManager::createKeyedIdentity(const nsACString& key,
identity->SetKey(key);
m_identities.Put(key, identity);
identity.swap(*aIdentity);
identity.forget(aIdentity);
return NS_OK;
}
@ -617,7 +617,7 @@ nsMsgAccountManager::createKeyedServer(const nsACString& key,
rootFolder->AddFolderListener(iter.GetNext());
}
server.swap(*aServer);
server.forget(aServer);
return NS_OK;
}
@ -1735,7 +1735,7 @@ nsMsgAccountManager::createKeyedAccount(const nsCString& key,
}
m_prefs->SetCharPref(PREF_MAIL_ACCOUNTMANAGER_ACCOUNTS, mAccountKeyList.get());
account.swap(*aAccount);
account.forget(aAccount);
return NS_OK;
}
@ -1763,7 +1763,7 @@ nsMsgAccountManager::GetAccount(const nsACString& aKey, nsIMsgAccount **aAccount
account->GetKey(key);
if (key.Equals(aKey))
{
account.swap(*aAccount);
account.forget(aAccount);
break;
}
}
@ -2082,7 +2082,7 @@ nsMsgAccountManager::GetFirstIdentityForServer(nsIMsgIncomingServer *aServer, ns
{
nsCOMPtr<nsIMsgIdentity> identity(do_QueryElementAt(identities, 0, &rv));
NS_ENSURE_SUCCESS(rv, rv);
identity.swap(*aIdentity);
identity.forget(aIdentity);
}
else
*aIdentity = nullptr;

Просмотреть файл

@ -258,7 +258,7 @@ NS_IMETHODIMP nsMsgFolderCache::GetCacheElement(const nsACString& pathKey, bool
nsCOMPtr<nsIMsgFolderCacheElement> folderCacheEl;
m_cacheElements.Get(pathKey, getter_AddRefs(folderCacheEl));
folderCacheEl.swap(*result);
folderCacheEl.forget(result);
if (*result)
return NS_OK;
@ -352,7 +352,7 @@ nsresult nsMsgFolderCache::AddCacheElement(const nsACString& key, nsIMdbRow *row
folderCacheEl->SetKey(hashStrKey);
m_cacheElements.Put(hashStrKey, folderCacheEl);
if (result)
folderCacheEl.swap(*result);
folderCacheEl.forget(result);
return NS_OK;
}

Просмотреть файл

@ -982,7 +982,7 @@ NS_IMETHODIMP nsMsgGroupView::GetThreadContainingMsgHdr(nsIMsgDBHdr *msgHdr, nsI
{
nsCOMPtr<nsIMsgThread> thread;
m_groupsTable.Get(hashKey, getter_AddRefs(thread));
thread.swap(*pThread);
thread.forget(pThread);
}
return (*pThread) ? NS_OK : NS_ERROR_FAILURE;
}

Просмотреть файл

@ -93,7 +93,7 @@ NS_IMETHODIMP nsMsgWindow::GetMessageWindowDocShell(nsIDocShell ** aDocShell)
mMessageWindowDocShellWeak = do_GetWeakReference(docShell);
}
}
docShell.swap(*aDocShell);
docShell.forget(aDocShell);
return NS_OK;
}
@ -229,7 +229,7 @@ NS_IMETHODIMP nsMsgWindow::GetAuthPrompt(nsIAuthPrompt * *aAuthPrompt)
nsCOMPtr<nsIAuthPrompt> prompt = do_GetInterface(docShell, &rv);
NS_ENSURE_SUCCESS(rv, rv);
prompt.swap(*aAuthPrompt);
prompt.forget(aAuthPrompt);
return rv;
}
@ -484,7 +484,7 @@ NS_IMETHODIMP nsMsgWindow::GetPromptDialog(nsIPrompt **aPrompt)
{
nsCOMPtr<nsIPrompt> dialog;
dialog = do_GetInterface(rootShell, &rv);
dialog.swap(*aPrompt);
dialog.forget(aPrompt);
}
return rv;
}

Просмотреть файл

@ -926,7 +926,7 @@ nsresult nsMsgDBFolder::CreateFileForDB(const nsAString& userLeafName, nsIFile *
proposedDBName.SetLength(proposedDBName.Length() - NS_LITERAL_CSTRING(SUMMARY_SUFFIX).Length());
dbPath->SetLeafName(proposedDBName);
dbPath.swap(*dbFile);
dbPath.forget(dbFile);
return NS_OK;
}
@ -3027,7 +3027,7 @@ nsMsgDBFolder::FindSubFolder(const nsACString& aEscapedSubFolderName, nsIMsgFold
if (NS_FAILED(rv))
return rv;
folder.swap(*aFolder);
folder.forget(aFolder);
return NS_OK;
}
@ -3085,7 +3085,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetParent(nsIMsgFolder **aParent)
{
NS_ENSURE_ARG_POINTER(aParent);
nsCOMPtr<nsIMsgFolder> parent = do_QueryReferent(mParent);
parent.swap(*aParent);
parent.forget(aParent);
return NS_OK;
}
@ -3122,7 +3122,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetServer(nsIMsgIncomingServer ** aServer)
rv = parseURI(true);
server = do_QueryReferent(mServer);
}
server.swap(*aServer);
server.forget(aServer);
return *aServer ? NS_OK : NS_ERROR_FAILURE;
}
@ -3788,7 +3788,7 @@ NS_IMETHODIMP nsMsgDBFolder::AddSubfolder(const nsAString& name,
if (folder)
mSubFolders.AppendObject(folder);
folder.swap(*child);
folder.forget(child);
// at this point we must be ok and we don't want to return failure in case
// GetIsServer failed.
return NS_OK;
@ -3936,7 +3936,7 @@ nsresult nsMsgDBFolder::CreateDirectoryForFolder(nsIFile **resultFile)
}
}
if (NS_SUCCEEDED(rv))
path.swap(*resultFile);
path.forget(resultFile);
return rv;
}
@ -3966,7 +3966,7 @@ nsresult nsMsgDBFolder::CreateBackupDirectory(nsIFile **resultFile)
path->Create(nsIFile::DIRECTORY_TYPE, 0700);
}
if (NS_SUCCEEDED(rv))
path.swap(*resultFile);
path.forget(resultFile);
return rv;
}
@ -4003,7 +4003,7 @@ nsresult nsMsgDBFolder::GetBackupSummaryFile(nsIFile **aBackupFile, const nsACSt
rv = GetSummaryFileLocation(backupDBDummyFolder, getter_AddRefs(backupDBFile));
NS_ENSURE_SUCCESS(rv, rv);
backupDBFile.swap(*aBackupFile);
backupDBFile.forget(aBackupFile);
return NS_OK;
}
@ -4698,7 +4698,7 @@ nsMsgDBFolder::GetFilePath(nsIFile * *aFile)
if (!mPath)
parseURI(true);
rv = file->InitWithFile(mPath);
file.swap(*aFile);
file.forget(aFile);
return NS_OK;
}
@ -5196,7 +5196,7 @@ nsMsgDBFolder::GetBaseStringBundle(nsIStringBundle **aBundle)
nsCOMPtr<nsIStringBundle> bundle;
bundleService->CreateBundle("chrome://messenger/locale/messenger.properties",
getter_AddRefs(bundle));
bundle.swap(*aBundle);
bundle.forget(aBundle);
return NS_OK;
}

Просмотреть файл

@ -927,7 +927,7 @@ nsMsgIncomingServer::GetLocalPath(nsIFile **aLocalPath)
rv = SetLocalPath(localPath);
NS_ENSURE_SUCCESS(rv, rv);
localPath.swap(*aLocalPath);
localPath.forget(aLocalPath);
return NS_OK;
}

Просмотреть файл

@ -247,7 +247,7 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetMsgWindow(nsIMsgWindow **aMsgWindow)
*aMsgWindow = nullptr;
nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(m_msgWindowWeak));
msgWindow.swap(*aMsgWindow);
msgWindow.forget(aMsgWindow);
return *aMsgWindow ? NS_OK : NS_ERROR_NULL_POINTER;
}
@ -274,7 +274,7 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetStatusFeedback(nsIMsgStatusFeedback **aMsgFee
else
{
nsCOMPtr<nsIMsgStatusFeedback> statusFeedback(do_QueryReferent(m_statusFeedbackWeak));
statusFeedback.swap(*aMsgFeedback);
statusFeedback.forget(aMsgFeedback);
}
return *aMsgFeedback ? NS_OK : NS_ERROR_NULL_POINTER;
}
@ -317,7 +317,7 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetLoadGroup(nsILoadGroup **aLoadGroup)
m_loadGroupWeak = do_GetWeakReference(loadGroup);
}
}
loadGroup.swap(*aLoadGroup);
loadGroup.forget(aLoadGroup);
return *aLoadGroup ? NS_OK : NS_ERROR_NULL_POINTER;
}

Просмотреть файл

@ -490,7 +490,7 @@ nsSmtpService::createKeyedServer(const char *key, nsISmtpServer** aResult)
}
if (aResult)
server.swap(*aResult);
server.forget(aResult);
return NS_OK;
}

Просмотреть файл

@ -1316,7 +1316,7 @@ nsresult nsImapIncomingServer::GetFolder(const nsACString& name, nsIMsgFolder**
{
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
if (NS_SUCCEEDED(rv) && folder)
folder.swap(*pFolder);
folder.forget(pFolder);
}
}
}
@ -3272,7 +3272,7 @@ nsImapIncomingServer::GetMsgFolderFromURI(nsIMsgFolder *aFolderResource,
msgFolder = aFolderResource;
}
msgFolder.swap(*aFolder);
msgFolder.forget(aFolder);
return NS_OK;
}

Просмотреть файл

@ -325,7 +325,7 @@ NS_IMETHODIMP nsImapMailFolder::AddSubfolder(const nsAString& aName, nsIMsgFolde
folder->SetFlags(flags);
mSubFolders.AppendObject(folder);
folder.swap(*aChild);
folder.forget(aChild);
nsCOMPtr <nsIMsgImapMailFolder> imapChild = do_QueryInterface(*aChild);
if (imapChild)
@ -417,7 +417,7 @@ nsresult nsImapMailFolder::AddSubfolderWithPath(nsAString& name, nsIFile *dbPath
if (folder)
mSubFolders.AppendObject(folder);
folder.swap(*child);
folder.forget(child);
return NS_OK;
}
@ -1822,7 +1822,7 @@ nsImapMailFolder::GetImapIncomingServer(nsIImapIncomingServer **aImapIncomingSer
if (NS_SUCCEEDED(GetServer(getter_AddRefs(server))) && server)
{
nsCOMPtr <nsIImapIncomingServer> incomingServer = do_QueryInterface(server);
incomingServer.swap(*aImapIncomingServer);
incomingServer.forget(aImapIncomingServer);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
@ -6952,7 +6952,7 @@ nsresult nsImapMailFolder::GetClearedOriginalOp(nsIMsgOfflineImapOperation *op,
}
}
}
returnOp.swap(*originalOp);
returnOp.forget(originalOp);
return rv;
}
@ -6981,7 +6981,7 @@ nsresult nsImapMailFolder::GetOriginalOp(nsIMsgOfflineImapOperation *op, nsIMsgO
rv = (*originalDB)->GetOfflineOpForKey(originalKey, false, getter_AddRefs(returnOp));
}
}
returnOp.swap(*originalOp);
returnOp.forget(originalOp);
return rv;
}
@ -9458,7 +9458,7 @@ NS_IMETHODIMP nsImapMailFolder::GetCustomIdentity(nsIMsgIdentity **aIdentity)
}
if (retIdentity)
{
retIdentity.swap(*aIdentity);
retIdentity.forget(aIdentity);
return NS_OK;
}
}

Просмотреть файл

@ -890,7 +890,7 @@ nsresult nsImapService::DecomposeImapURI(const nsACString &aMessageURI,
nsCOMPtr<nsIMsgFolder> msgFolder = do_QueryInterface(res);
NS_ENSURE_TRUE(msgFolder, NS_ERROR_FAILURE);
msgFolder.swap(*aFolder);
msgFolder.forget(aFolder);
return NS_OK;
}
@ -2223,7 +2223,7 @@ nsresult nsImapService::GetImapConnectionAndLoadUrl(nsIImapUrl *aImapUrl,
if (aURL)
{
nsCOMPtr<nsIURI> msgUrlUri = do_QueryInterface(msgUrl);
msgUrlUri.swap(*aURL);
msgUrlUri.forget(aURL);
}
if (NS_SUCCEEDED(rv) && aMsgIncomingServer)
@ -2638,7 +2638,7 @@ NS_IMETHODIMP nsImapService::NewURI(const nsACString &aSpec,
// we got an imap url, so be sure to return it...
nsCOMPtr<nsIURI> imapUri = do_QueryInterface(aImapUrl);
imapUri.swap(*aRetVal);
imapUri.forget(aRetVal);
return rv;
}
@ -2896,7 +2896,7 @@ NS_IMETHODIMP nsImapService::GetDefaultLocalPath(nsIFile **aResult)
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to set root dir pref.");
}
localFile.swap(*aResult);
localFile.forget(aResult);
return NS_OK;
}

Просмотреть файл

@ -1145,7 +1145,7 @@ NS_IMETHODIMP nsImapUrl::GetMockChannel(nsIImapMockChannel ** aChannel)
NS_WARNING_ASSERTION(NS_IsMainThread(), "should only access mock channel on ui thread");
*aChannel = nullptr;
nsCOMPtr<nsIImapMockChannel> channel(do_QueryReferent(m_channelWeakPtr));
channel.swap(*aChannel);
channel.forget(aChannel);
return *aChannel ? NS_OK : NS_ERROR_FAILURE;
}

Просмотреть файл

@ -570,13 +570,10 @@ nsMsgLocalMailFolder::CreateSubfolderInternal(const nsAString& folderName,
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIMsgFolder> child = *aNewFolder;
//we need to notify explicitly the flag change because it failed when we did AddSubfolder
child->OnFlagChange(mFlags);
child->SetPrettyName(folderName); //because empty trash will create a new trash folder
NotifyItemAdded(child);
if (aNewFolder)
child.swap(*aNewFolder);
(*aNewFolder)->OnFlagChange(mFlags);
(*aNewFolder)->SetPrettyName(folderName); //because empty trash will create a new trash folder
NotifyItemAdded(*aNewFolder);
}
return rv;

Просмотреть файл

@ -562,7 +562,7 @@ NS_IMETHODIMP nsMailboxService::NewURI(const nsACString &aSpec,
{
(void) aMsgUri->SetSpec(aSpec);
}
aMsgUri.swap(*_retval);
aMsgUri.forget(_retval);
return rv;
}

Просмотреть файл

@ -251,7 +251,7 @@ NS_IMETHODIMP nsMsgMaildirStore::CreateFolder(nsIMsgFolder *aParent,
rv = NS_MSG_CANT_CREATE_FOLDER;
}
}
child.swap(*aResult);
child.forget(aResult);
return rv;
}

Просмотреть файл

@ -202,7 +202,7 @@ nsMsgNewsFolder::AddNewsgroup(const nsACString &name, const nsACString& setStr,
mSubFolders.AppendObject(folder);
folder->SetParent(this);
folder.swap(*child);
folder.forget(child);
return rv;
}
@ -1517,7 +1517,7 @@ nsMsgNewsFolder::GetNntpServer(nsINntpIncomingServer **result)
nsCOMPtr<nsINntpIncomingServer> nntpServer = do_QueryInterface(server, &rv);
if (NS_FAILED(rv))
return rv;
nntpServer.swap(*result);
nntpServer.forget(result);
return NS_OK;
}

Просмотреть файл

@ -383,7 +383,7 @@ nsNntpService::FetchMessage(nsIMsgFolder *folder, nsMsgKey key, nsIMsgWindow *aM
NS_ENSURE_SUCCESS(rv,rv);
if (aURL)
url.swap(*aURL);
url.forget(aURL);
return rv;
}
@ -593,7 +593,7 @@ nsNntpService::GetFolderFromUri(const char *aUri, nsIMsgFolder **aFolder)
getter_AddRefs(subFolder));
NS_ENSURE_SUCCESS(rv,rv);
subFolder.swap(*aFolder);
subFolder.forget(aFolder);
return NS_OK;
}