Bug 725810 Fix miscalculation of expunged bytes r=bienvenu, a=bienvenu
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -1815,27 +1815,27 @@ nsresult nsMsgDBFolder::HandleAutoCompac
nsCOMPtr<nsISupportsArray> allServers;
rv = accountMgr->GetAllServers(getter_AddRefs(allServers));
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 numServers = 0, serverIndex = 0;
rv = allServers->Count(&numServers);
PRInt32 offlineSupportLevel;
if (numServers > 0)
{
- nsCOMPtr<nsIMsgIncomingServer> server = do_QueryElementAt(allServers, serverIndex);
- NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMutableArray> folderArray = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMutableArray> offlineFolderArray = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 totalExpungedBytes = 0;
PRInt32 offlineExpungedBytes = 0;
PRInt32 localExpungedBytes = 0;
do
{
+ nsCOMPtr<nsIMsgIncomingServer> server = do_QueryElementAt(allServers, serverIndex);
+ NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgPluggableStore> msgStore;
rv = server->GetMsgStore(getter_AddRefs(msgStore));
NS_ENSURE_SUCCESS(rv, rv);
if (!msgStore)
continue;
bool supportsCompaction;
msgStore->GetSupportsCompaction(&supportsCompaction);
if (!supportsCompaction)
@@ -1870,26 +1870,26 @@ nsresult nsMsgDBFolder::HandleAutoCompac
}
}
}
else //pop or local
{
for (PRUint32 i = 0; i < cnt; i++)
{
nsCOMPtr<nsIMsgFolder> folder = do_QueryElementAt(allDescendents, i);
+ expungedBytes = 0;
folder->GetExpungedBytes(&expungedBytes);
if (expungedBytes > 0 )
{
folderArray->AppendElement(folder, false);
localExpungedBytes += expungedBytes;
}
}
}
}
- server = do_QueryElementAt(allServers, serverIndex);
}
while (++serverIndex < numServers);
totalExpungedBytes = localExpungedBytes + offlineExpungedBytes;
PRInt32 purgeThreshold;
rv = GetPurgeThreshold(&purgeThreshold);
NS_ENSURE_SUCCESS(rv, rv);
if (totalExpungedBytes > (purgeThreshold * 1024))
{