Bug 1594892 - xpidl [array] removal from nsIMsgDatabase.deleteMessages(). r=mkmelin

This commit is contained in:
Ben Campbell 2019-12-19 14:13:38 +02:00
Родитель 09a2472bcf
Коммит 004d57a201
11 изменённых файлов: 24 добавлений и 36 удалений

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

@ -417,8 +417,7 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
Array<nsMsgKey> markAllRead();
void deleteMessages(in unsigned long aNumKeys,
[array, size_is(aNumKeys)] in nsMsgKey nsMsgKeys,
void deleteMessages(in Array<nsMsgKey> nsMsgKeys,
in nsIDBChangeListener instigator);
void DeleteMessage(in nsMsgKey key,
in nsIDBChangeListener instigator,

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

@ -31,7 +31,7 @@ class nsImapMailDatabase : public nsMailDatabase {
NS_IMETHOD SetUint64AttributeOnPendingHdr(nsIMsgDBHdr *aPendingHdr,
const char *aProperty,
uint64_t aPropertyVal) override;
NS_IMETHOD DeleteMessages(uint32_t aNumKeys, nsMsgKey *nsMsgKeys,
NS_IMETHOD DeleteMessages(nsTArray<nsMsgKey> const &nsMsgKeys,
nsIDBChangeListener *instigator) override;
NS_IMETHOD UpdatePendingAttributes(nsIMsgDBHdr *aNewHdr) override;

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

@ -22,7 +22,7 @@ class nsMailDatabase : public nsMsgDatabase {
nsMailDatabase();
virtual ~nsMailDatabase();
NS_IMETHOD ForceClosed() override;
NS_IMETHOD DeleteMessages(uint32_t aNumKeys, nsMsgKey *nsMsgKeys,
NS_IMETHOD DeleteMessages(nsTArray<nsMsgKey> const &nsMsgKeys,
nsIDBChangeListener *instigator) override;
nsresult Open(nsMsgDBService *aDBService, nsIFile *aSummaryFile, bool create,

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

@ -47,8 +47,8 @@ void nsImapMailDatabase::UpdateFolderFlag(
// We override this to avoid our parent class (nsMailDatabase)'s
// grabbing of the folder semaphore, and bailing on failure.
NS_IMETHODIMP nsImapMailDatabase::DeleteMessages(
uint32_t aNumKeys, nsMsgKey *nsMsgKeys, nsIDBChangeListener *instigator) {
return nsMsgDatabase::DeleteMessages(aNumKeys, nsMsgKeys, instigator);
nsTArray<nsMsgKey> const &nsMsgKeys, nsIDBChangeListener *instigator) {
return nsMsgDatabase::DeleteMessages(nsMsgKeys, instigator);
}
nsresult nsImapMailDatabase::AdjustExpungedBytesOnDelete(nsIMsgDBHdr *msgHdr) {

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

@ -65,9 +65,8 @@ nsresult nsMailDatabase::GetAllOfflineOpsTable() {
return rv;
}
NS_IMETHODIMP nsMailDatabase::DeleteMessages(uint32_t aNumKeys,
nsMsgKey *nsMsgKeys,
nsIDBChangeListener *instigator) {
NS_IMETHODIMP nsMailDatabase::DeleteMessages(
nsTArray<nsMsgKey> const &nsMsgKeys, nsIDBChangeListener *instigator) {
nsresult rv;
if (m_folder) {
bool isLocked;
@ -78,7 +77,7 @@ NS_IMETHODIMP nsMailDatabase::DeleteMessages(uint32_t aNumKeys,
}
}
rv = nsMsgDatabase::DeleteMessages(aNumKeys, nsMsgKeys, instigator);
rv = nsMsgDatabase::DeleteMessages(nsMsgKeys, instigator);
SetSummaryValid(true);
return rv;
}

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

@ -1756,13 +1756,12 @@ NS_IMETHODIMP nsMsgDatabase::DeleteMessage(nsMsgKey key,
return rv;
}
NS_IMETHODIMP nsMsgDatabase::DeleteMessages(uint32_t aNumKeys,
nsMsgKey *nsMsgKeys,
NS_IMETHODIMP nsMsgDatabase::DeleteMessages(nsTArray<nsMsgKey> const &nsMsgKeys,
nsIDBChangeListener *instigator) {
nsresult err = NS_OK;
uint32_t kindex;
for (kindex = 0; kindex < aNumKeys; kindex++) {
for (kindex = 0; kindex < nsMsgKeys.Length(); kindex++) {
nsMsgKey key = nsMsgKeys[kindex];
nsCOMPtr<nsIMsgDBHdr> msgHdr;
@ -4807,7 +4806,7 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(uint32_t daysToKeepHdrs,
}
if (!hdrsToDelete) {
DeleteMessages(keysToDelete.Length(), keysToDelete.Elements(), nullptr);
DeleteMessages(keysToDelete, nullptr);
if (keysToDelete.Length() >
10) // compress commit if we deleted more than 10
@ -4864,7 +4863,7 @@ nsresult nsMsgDatabase::PurgeExcessMessages(uint32_t numHeadersToKeep,
if (!hdrsToDelete) {
int32_t numKeysToDelete = keysToDelete.Length();
if (numKeysToDelete > 0) {
DeleteMessages(keysToDelete.Length(), keysToDelete.Elements(), nullptr);
DeleteMessages(keysToDelete, nullptr);
if (numKeysToDelete > 10) // compress commit if we deleted more than 10
Commit(nsMsgDBCommitType::kCompressCommit);
else

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

@ -2064,8 +2064,7 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(
if (notifier) notifier->NotifyMsgsDeleted(messages);
}
DeleteStoreMessages(messages);
database->DeleteMessages(srcKeyArray.Length(), srcKeyArray.Elements(),
nullptr);
database->DeleteMessages(srcKeyArray, nullptr);
EnableNotifications(allMessageCountNotifications, true);
}
if (listener) {
@ -2548,8 +2547,7 @@ NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(
}
DeleteStoreMessages(hdrsToDelete);
EnableNotifications(nsIMsgFolder::allMessageCountNotifications, false);
mDatabase->DeleteMessages(keysToDelete.Length(), keysToDelete.Elements(),
nullptr);
mDatabase->DeleteMessages(keysToDelete, nullptr);
EnableNotifications(nsIMsgFolder::allMessageCountNotifications, true);
}
int32_t numUnreadFromServer;
@ -4689,8 +4687,7 @@ nsImapMailFolder::NotifyMessageDeleted(const char *onlineFolderName,
if (!affectedMessages.IsEmpty()) // perhaps Search deleted these messages
{
DeleteStoreMessages(affectedMessages);
mDatabase->DeleteMessages(affectedMessages.Length(),
affectedMessages.Elements(), nullptr);
mDatabase->DeleteMessages(affectedMessages, nullptr);
}
} else // && !imapDeleteIsMoveToTrash // TODO: can this ever be executed?
SetIMAPDeletedFlag(mDatabase, affectedMessages, false);
@ -4956,8 +4953,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode) {
// assume that the src is also imap that uses offline
// storage.
DeleteStoreMessages(srcKeyArray, srcFolder);
srcDB->DeleteMessages(srcKeyArray.Length(),
srcKeyArray.Elements(), nullptr);
srcDB->DeleteMessages(srcKeyArray, nullptr);
} else
MarkMessagesImapDeleted(&srcKeyArray, true, srcDB);
}
@ -5080,8 +5076,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode) {
if (!supportsCompaction && numHdrs)
DeleteStoreMessages(msgHdrs);
db->DeleteMessages(keyArray.Length(), keyArray.Elements(),
nullptr);
db->DeleteMessages(keyArray, nullptr);
db->SetSummaryValid(true);
db->Commit(nsMsgDBCommitType::kLargeCommit);
}
@ -6780,8 +6775,7 @@ nsresult nsImapMailFolder::CopyMessagesOffline(
DeleteStoreMessages(keysToDelete, srcFolder);
srcFolder->EnableNotifications(nsIMsgFolder::allMessageCountNotifications,
false);
sourceMailDB->DeleteMessages(keysToDelete.Length(), keysToDelete.Elements(),
nullptr);
sourceMailDB->DeleteMessages(keysToDelete, nullptr);
srcFolder->EnableNotifications(nsIMsgFolder::allMessageCountNotifications,
true);
}

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

@ -293,8 +293,7 @@ nsresult nsImapMoveCopyMsgTxn::RedoMailboxDelete() {
if (NS_FAILED(rv) || !srcFolder) return rv;
rv = srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
if (NS_SUCCEEDED(rv)) {
srcDB->DeleteMessages(m_srcKeyArray.Length(), m_srcKeyArray.Elements(),
nullptr);
srcDB->DeleteMessages(m_srcKeyArray, nullptr);
srcDB->SetSummaryValid(true);
}
return NS_OK; // always return NS_OK

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

@ -267,8 +267,7 @@ nsresult nsLocalMoveCopyMsgTxn::UndoTransactionInternal() {
srcDB->SetSummaryValid(true);
}
dstDB->DeleteMessages(m_dstKeyArray.Length(), m_dstKeyArray.Elements(),
nullptr);
dstDB->DeleteMessages(m_dstKeyArray, nullptr);
dstDB->SetSummaryValid(true);
return rv;
@ -340,8 +339,7 @@ nsLocalMoveCopyMsgTxn::RedoTransaction() {
localFolder->MarkMsgsOnPop3Server(srcMessages,
POP3_DELETE /*deleteMsgs*/);
rv = srcDB->DeleteMessages(m_srcKeyArray.Length(),
m_srcKeyArray.Elements(), nullptr);
rv = srcDB->DeleteMessages(m_srcKeyArray, nullptr);
srcDB->SetSummaryValid(true);
} else {
nsCOMPtr<nsIMsgDBHdr> srcHdr;

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

@ -772,7 +772,8 @@ bool MsgMapiListContext::DeleteMessage(nsMsgKey key) {
if (!m_db) return FALSE;
if (!IsIMAPHost()) {
return NS_SUCCEEDED((m_db->DeleteMessages(1, &key, nullptr)));
nsTArray<nsMsgKey> doomed({key});
return NS_SUCCEEDED((m_db->DeleteMessages(doomed, nullptr)));
}
#if 0
else if ( m_folder->GetIMAPFolderInfoMail() )

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

@ -1399,8 +1399,7 @@ NS_IMETHODIMP nsMsgNewsFolder::RemoveMessages(nsTArray<nsMsgKey> &aMsgKeys) {
notifier->NotifyMsgsDeleted(msgHdrs);
}
return mDatabase->DeleteMessages(aMsgKeys.Length(), aMsgKeys.Elements(),
nullptr);
return mDatabase->DeleteMessages(aMsgKeys, nullptr);
}
NS_IMETHODIMP nsMsgNewsFolder::CancelComplete() {