Bug 647481 - Remove nsInt64, nsUint64 and nsTime from comm-central r=neil sr=bienvenu

This commit is contained in:
Ian Neal 2011-04-06 21:18:36 +01:00
Родитель 4ade06a6e5
Коммит 332c276f5b
24 изменённых файлов: 45 добавлений и 72 удалений

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

@ -40,7 +40,6 @@
#include "nsIFile.h"
#include "nsIInputStream.h"
#include "nsILineInputStream.h"
#include "nsInt64.h"
#include "nsIPrefBranch.h"
#include "nsIPrefLocalizedString.h"
#include "nsIPrefService.h"

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

@ -58,7 +58,6 @@
#include "nsMsgI18N.h"
#include "nsIMimeConverter.h"
#include "nsMsgMimeCID.h"
#include "nsTime.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIMsgFilterPlugin.h"
@ -881,7 +880,6 @@ NS_IMETHODIMP nsMsgSearchTerm::MatchUint32HdrProperty(nsIMsgDBHdr *aHdr, PRBool
PRUint32 dbHdrValue;
aHdr->GetUint32Property(m_hdrProperty.get(), &dbHdrValue);
nsresult rv = NS_OK;
PRBool result = PR_FALSE;
switch (m_operator)
@ -1239,19 +1237,18 @@ nsresult nsMsgSearchTerm::MatchDate (PRTime dateToMatch, PRBool *pResult)
nsresult err = NS_OK;
PRBool result = PR_FALSE;
nsTime t_date(dateToMatch);
switch (m_operator)
{
case nsMsgSearchOp::IsBefore:
if (t_date < nsTime(m_value.u.date))
if (dateToMatch < m_value.u.date)
result = PR_TRUE;
break;
case nsMsgSearchOp::IsAfter:
{
nsTime adjustedDate = nsTime(m_value.u.date);
PRTime adjustedDate = m_value.u.date;
adjustedDate += 60*60*24; // we want to be greater than the next day....
if (t_date > adjustedDate)
if (dateToMatch > adjustedDate)
result = PR_TRUE;
}
break;

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

@ -47,7 +47,6 @@
#include "nsITimer.h"
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
#include "nsInt64.h"
#include "nsIObserver.h"
#include "nsIAlertsService.h"

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

@ -52,7 +52,6 @@
#include "nsITimer.h"
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
#include "nsInt64.h"
#include "nsISupportsArray.h"
#include "nsIObserver.h"

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

@ -147,8 +147,7 @@ NS_IMETHODIMP nsMsgBiffManager::AddServerBiff(nsIMsgIncomingServer *server)
{
nsBiffEntry biffEntry;
biffEntry.server = server;
nsTime currentTime;
rv = SetNextBiffTime(biffEntry, currentTime);
rv = SetNextBiffTime(biffEntry, PR_Now());
if (NS_FAILED(rv))
return rv;
@ -229,7 +228,7 @@ nsresult nsMsgBiffManager::AddBiffEntry(nsBiffEntry &biffEntry)
return NS_OK;
}
nsresult nsMsgBiffManager::SetNextBiffTime(nsBiffEntry &biffEntry, const nsTime currentTime)
nsresult nsMsgBiffManager::SetNextBiffTime(nsBiffEntry &biffEntry, PRTime currentTime)
{
nsIMsgIncomingServer *server = biffEntry.server;
if (!server)
@ -241,7 +240,7 @@ nsresult nsMsgBiffManager::SetNextBiffTime(nsBiffEntry &biffEntry, const nsTime
// Add biffInterval, converted in microseconds, to current time.
// Force 64-bit multiplication.
nsTime chosenTimeInterval = biffInterval * 60000000LL;
PRTime chosenTimeInterval = biffInterval * 60000000LL;
biffEntry.nextBiffTime = currentTime + chosenTimeInterval;
// Check if we should jitter.
@ -272,9 +271,9 @@ nsresult nsMsgBiffManager::SetupNextBiff()
{
// Get the next biff entry
const nsBiffEntry &biffEntry = mBiffArray[0];
nsTime currentTime;
nsInt64 biffDelay;
nsInt64 ms(1000);
PRTime currentTime = PR_Now();
PRInt64 biffDelay;
PRInt64 ms(1000);
if (currentTime > biffEntry.nextBiffTime)
{
@ -287,7 +286,7 @@ nsresult nsMsgBiffManager::SetupNextBiff()
biffDelay = biffEntry.nextBiffTime - currentTime;
// Convert biffDelay into milliseconds
nsInt64 timeInMS = biffDelay / ms;
PRInt64 timeInMS = biffDelay / ms;
PRUint32 timeInMSUint32 = (PRUint32)timeInMS;
// Can't currently reset a timer when it's in the process of
@ -307,7 +306,7 @@ nsresult nsMsgBiffManager::SetupNextBiff()
//This is the function that does a biff on all of the servers whose time it is to biff.
nsresult nsMsgBiffManager::PerformBiff()
{
nsTime currentTime;
PRTime currentTime = PR_Now();
nsCOMArray<nsIMsgFolder> targetFolders;
PR_LOG(MsgBiffLogModule, PR_LOG_ALWAYS, ("performing biffs\n"));

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

@ -42,14 +42,13 @@
#include "nsIMsgBiffManager.h"
#include "nsITimer.h"
#include "nsTArray.h"
#include "nsTime.h"
#include "nsCOMPtr.h"
#include "nsIIncomingServerListener.h"
#include "nsWeakReference.h"
typedef struct {
nsCOMPtr<nsIMsgIncomingServer> server;
nsTime nextBiffTime;
PRTime nextBiffTime;
} nsBiffEntry;
@ -70,7 +69,7 @@ public:
protected:
PRInt32 FindServer(nsIMsgIncomingServer *server);
nsresult SetNextBiffTime(nsBiffEntry &biffEntry, const nsTime currentTime);
nsresult SetNextBiffTime(nsBiffEntry &biffEntry, PRTime currentTime);
nsresult SetupNextBiff();
nsresult AddBiffEntry(nsBiffEntry &biffEntry);

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

@ -44,7 +44,6 @@
#include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h"
#include "nsNetError.h"
#include "nsInt64.h"
#include "nsIWindowWatcher.h"
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
@ -282,8 +281,8 @@ NS_IMETHODIMP nsMsgProgress::OnProgress(nsIRequest *request, nsISupports* ctxt,
{
// XXX: What should the nsIWebProgress be?
// XXX: This truncates 64-bit to 32-bit
return OnProgressChange(nsnull, request, nsUint64(aProgress), nsUint64(aProgressMax),
nsUint64(aProgress) /* current total progress */, nsUint64(aProgressMax) /* max total progress */);
return OnProgressChange(nsnull, request, PRInt32(aProgress), PRInt32(aProgressMax),
PRInt32(aProgress) /* current total progress */, PRInt32(aProgressMax) /* max total progress */);
}
NS_IMETHODIMP nsMsgProgress::OnStatus(nsIRequest *request, nsISupports* ctxt,

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

@ -182,7 +182,7 @@ nsresult nsMsgPurgeService::PerformPurge()
nsCOMPtr<nsIMsgFolder> folderToPurge;
PRIntervalTime startTime = PR_IntervalNow();
PRInt32 purgeIntervalToUse;
nsTime oldestPurgeTime = 0; // we're going to pick the least-recently purged folder
PRTime oldestPurgeTime = 0; // we're going to pick the least-recently purged folder
// apply retention settings to folders that haven't had retention settings
// applied in mMinDelayBetweenPurges minutes (default 8 hours)
@ -222,7 +222,7 @@ nsresult nsMsgPurgeService::PerformPurge()
(void) childFolder->GetFlags(&folderFlags);
if (folderFlags & nsMsgFolderFlags::Virtual)
continue;
nsTime curFolderLastPurgeTime=0;
PRTime curFolderLastPurgeTime = 0;
nsCString curFolderLastPurgeTimeString, curFolderUri;
rv = childFolder->GetStringProperty("LastPurgeTime", curFolderLastPurgeTimeString);
if (NS_FAILED(rv))
@ -241,11 +241,10 @@ nsresult nsMsgPurgeService::PerformPurge()
// check if this folder is due to purge
// has to have been purged at least mMinDelayBetweenPurges minutes ago
// we don't want to purge the folders all the time - once a day is good enough
nsInt64 minDelayBetweenPurges(mMinDelayBetweenPurges);
nsInt64 microSecondsPerMinute(60000000);
nsTime nextPurgeTime = curFolderLastPurgeTime + (minDelayBetweenPurges * microSecondsPerMinute);
nsTime currentTime; // nsTime defaults to PR_Now
if (nextPurgeTime < currentTime)
PRInt64 minDelayBetweenPurges(mMinDelayBetweenPurges);
PRInt64 microSecondsPerMinute(60000000);
PRTime nextPurgeTime = curFolderLastPurgeTime + (minDelayBetweenPurges * microSecondsPerMinute);
if (nextPurgeTime < PR_Now())
{
PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("purging %s", curFolderUri.get()));
childFolder->ApplyRetentionSettings();
@ -315,7 +314,7 @@ nsresult nsMsgPurgeService::PerformPurge()
if (!junkFolder)
continue;
nsTime curJunkFolderLastPurgeTime=0;
PRTime curJunkFolderLastPurgeTime = 0;
nsCString curJunkFolderLastPurgeTimeString;
rv = junkFolder->GetStringProperty("curJunkFolderLastPurgeTime", curJunkFolderLastPurgeTimeString);
if (NS_FAILED(rv))
@ -333,9 +332,8 @@ nsresult nsMsgPurgeService::PerformPurge()
// check if this account is due to purge
// has to have been purged at least mMinDelayBetweenPurges minutes ago
// we don't want to purge the folders all the time
nsTime nextPurgeTime = curJunkFolderLastPurgeTime + nsInt64(mMinDelayBetweenPurges * 60000000 /* convert mMinDelayBetweenPurges to into microseconds */);
nsTime currentTime;
if (nextPurgeTime < currentTime)
PRTime nextPurgeTime = curJunkFolderLastPurgeTime + mMinDelayBetweenPurges * 60000000 /* convert mMinDelayBetweenPurges to into microseconds */;
if (nextPurgeTime < PR_Now())
{
PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] last purge greater than min delay", serverIndex));
@ -363,14 +361,14 @@ nsresult nsMsgPurgeService::PerformPurge()
PRInt32 purgeInterval;
spamSettings->GetPurgeInterval(&purgeInterval);
if ((oldestPurgeTime == nsInt64(0)) || (curJunkFolderLastPurgeTime < oldestPurgeTime))
if ((oldestPurgeTime == 0) || (curJunkFolderLastPurgeTime < oldestPurgeTime))
{
PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] purging! searching for messages older than %d days", serverIndex, purgeInterval));
oldestPurgeTime = curJunkFolderLastPurgeTime;
purgeIntervalToUse = purgeInterval;
folderToPurge = junkFolder;
// if we've never purged this folder, do it...
if (curJunkFolderLastPurgeTime == nsInt64(0))
if (curJunkFolderLastPurgeTime == 0)
break;
}
}

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

@ -45,7 +45,6 @@
#include "nsIMsgSearchSession.h"
#include "nsITimer.h"
#include "nsVoidArray.h"
#include "nsTime.h"
#include "nsCOMPtr.h"
#include "nsIMsgSearchNotify.h"
#include "nsIMsgFolder.h"

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

@ -47,7 +47,6 @@
#include "nsIDocShellTreeItem.h"
#include "nsIChannel.h"
#include "prinrval.h"
#include "nsInt64.h"
#include "nsITimelineService.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsIMimeMiscStatus.h"
@ -307,8 +306,8 @@ NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIRequest *request, nsISupports*
{
// XXX: What should the nsIWebProgress be?
// XXX: this truncates 64-bit to 32-bit
return OnProgressChange(nsnull, request, nsUint64(aProgress), nsUint64(aProgressMax),
nsUint64(aProgress) /* current total progress */, nsUint64(aProgressMax) /* max total progress */);
return OnProgressChange(nsnull, request, PRInt32(aProgress), PRInt32(aProgressMax),
PRInt32(aProgress) /* current total progress */, PRInt32(aProgressMax) /* max total progress */);
}
NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIRequest *request, nsISupports* ctxt,

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

@ -72,7 +72,6 @@
#include "nsIRDFService.h"
#include "nsTextFormatter.h"
#include "nsMsgDBCID.h"
#include "nsInt64.h"
#include "nsReadLine.h"
#include "nsParserCIID.h"
#include "nsIParser.h"

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

@ -1,6 +1,5 @@
#include "nsILocalFile.h"
#include "nsMsgFileStream.h"
#include "nsInt64.h"
#include "prerr.h"
#include "prerror.h"
@ -52,8 +51,8 @@ nsMsgFileStream::Seek(PRInt32 whence, PRInt64 offset)
if (mFileDesc == nsnull)
return NS_BASE_STREAM_CLOSED;
nsInt64 cnt = PR_Seek64(mFileDesc, offset, (PRSeekWhence)whence);
if (cnt == nsInt64(-1)) {
PRInt64 cnt = PR_Seek64(mFileDesc, offset, (PRSeekWhence)whence);
if (cnt == PRInt64(-1)) {
return ErrorAccordingToNSPR();
}
return NS_OK;
@ -65,8 +64,8 @@ nsMsgFileStream::Tell(PRInt64 *result)
if (mFileDesc == nsnull)
return NS_BASE_STREAM_CLOSED;
nsInt64 cnt = PR_Seek64(mFileDesc, 0, PR_SEEK_CUR);
if (cnt == nsInt64(-1)) {
PRInt64 cnt = PR_Seek64(mFileDesc, 0, PR_SEEK_CUR);
if (cnt == PRInt64(-1)) {
return ErrorAccordingToNSPR();
}
*result = cnt;

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

@ -299,8 +299,8 @@ nsresult nsMsgProtocol::OpenFileSocket(nsIURI * aURL, PRUint32 aStartPosition, P
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
rv = sts->CreateInputTransport(stream, nsInt64(aStartPosition),
nsInt64(aReadCount), PR_TRUE,
rv = sts->CreateInputTransport(stream, PRInt64(aStartPosition),
PRInt64(aReadCount), PR_TRUE,
getter_AddRefs(m_transport));
m_socketIsOpen = PR_FALSE;

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

@ -58,7 +58,6 @@
#include "nsIMdbFactoryFactory.h"
#include "prlog.h"
#include "prprf.h"
#include "nsTime.h"
#include "nsMsgDBCID.h"
#include "nsILocale.h"
#include "nsLocaleCID.h"
@ -2643,9 +2642,6 @@ NS_IMETHODIMP nsMsgDatabase::MarkReadByDate (PRTime startDate, PRTime endDate, n
if (NS_FAILED(rv))
return rv;
nsTime t_startDate(startDate);
nsTime t_endDate(endDate);
PRBool hasMore = PR_FALSE;
while (NS_SUCCEEDED(rv = hdrs->HasMoreElements(&hasMore)) && hasMore)
@ -2656,9 +2652,8 @@ NS_IMETHODIMP nsMsgDatabase::MarkReadByDate (PRTime startDate, PRTime endDate, n
PRTime headerDate;
(void)pHeader->GetDate(&headerDate);
nsTime t_headerDate(headerDate);
if (t_headerDate > t_startDate && t_headerDate <= t_endDate)
if (headerDate > startDate && headerDate <= endDate)
{
PRBool isRead;
nsMsgKey key;

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

@ -109,7 +109,6 @@
#include "nsIMimeHeaders.h"
#include "nsIMsgMdnGenerator.h"
#include "nsISpamSettings.h"
#include "nsInt64.h"
#include <time.h>
#include "nsIMsgMailNewsUrl.h"
#include "nsEmbedCID.h"

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

@ -100,7 +100,6 @@
#include "nsIAutoSyncManager.h"
#include "nsThreadUtils.h"
#include "nsNetUtil.h"
#include "nsInt64.h"
#include "nsMsgMessageFlags.h"
#define PREF_MAIL_ROOT_IMAP "mail.root.imap" // old - for backward compatibility only

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

@ -3928,9 +3928,8 @@ nsMsgLocalMailFolder::WarnIfLocalFileTooBig(nsIMsgWindow *aWindow, PRBool *aTooB
rv = filePath->GetFileSize(&sizeOnDisk);
if (NS_SUCCEEDED(rv))
{
const nsInt64 kMaxFolderSize = 0xFFF00000;
nsInt64 folderSize(sizeOnDisk);
if (folderSize > kMaxFolderSize)
const PRInt64 kMaxFolderSize = 0xFFF00000;
if (sizeOnDisk > kMaxFolderSize)
{
ThrowAlertMsg("mailboxTooLarge", aWindow);
*aTooBig = PR_TRUE;

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

@ -107,8 +107,8 @@ nsresult nsMailboxProtocol::OpenMultipleMsgTransport(PRUint32 offset, PRInt32 si
NS_ENSURE_SUCCESS(rv, rv);
// XXX 64-bit
rv = serv->CreateInputTransport(m_multipleMsgMoveCopyStream, nsInt64(offset),
nsInt64(size), PR_FALSE,
rv = serv->CreateInputTransport(m_multipleMsgMoveCopyStream, PRInt64(offset),
PRInt64(size), PR_FALSE,
getter_AddRefs(m_transport));
return rv;

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

@ -118,8 +118,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIRequest *request, nsISuppor
NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
nsTime currentTime;
m_startTime = currentTime;
m_startTime = PR_Now();
// extract the appropriate event sinks from the url and initialize them in our protocol data

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

@ -49,7 +49,6 @@
#include "nsIMsgStatusFeedback.h"
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsTime.h"
#include "nsIDBChangeListener.h"
#include "nsIWeakReference.h"
#include "nsIWeakReferenceUtils.h"
@ -219,7 +218,7 @@ protected:
PRUint32 m_graph_progress_total;
PRUint32 m_graph_progress_received;
PRBool m_parsingDone;
nsTime m_startTime;
PRTime m_startTime;
private:
// the following flag is used to determine when a url is currently being run. It is cleared on calls
// to ::StopBinding and it is set whenever we call Load on a url

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

@ -694,7 +694,7 @@ void nsPop3Protocol::UpdateProgressPercent (PRUint32 totalDone, PRUint32 total)
{
// XXX 64-bit
if (mProgressEventSink)
mProgressEventSink->OnProgress(this, m_channelContext, nsUint64(totalDone), nsUint64(total));
mProgressEventSink->OnProgress(this, m_channelContext, PRUint64(totalDone), PRUint64(total));
}
// note: SetUsername() expects an unescaped string

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

@ -61,7 +61,6 @@
#include "nsIMsgAccount.h"
#include "nsLocalMailFolder.h"
#include "nsIMailboxUrl.h"
#include "nsInt64.h"
#include "nsIPrompt.h"
#include "nsLocalStrings.h"
#include "nsINetUtil.h"

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

@ -5145,8 +5145,8 @@ void nsNNTPProtocol::SetProgressBarPercent(PRUint32 aProgress, PRUint32 aProgres
{
// XXX 64-bit
if (mProgressEventSink)
mProgressEventSink->OnProgress(this, m_channelContext, nsUint64(aProgress),
nsUint64(aProgressMax));
mProgressEventSink->OnProgress(this, m_channelContext, PRUint64(aProgress),
PRUint64(aProgressMax));
}
nsresult

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

@ -51,7 +51,6 @@
#include "nsNNTPProtocol.h"
#include "nsIDirectoryService.h"
#include "nsMailDirServiceDefs.h"
#include "nsInt64.h"
#include "nsMsgUtils.h"
#include "nsIPrompt.h"
#include "nsIStringBundle.h"
@ -280,7 +279,7 @@ nsNntpIncomingServer::GetNewsrcRootPath(nsILocalFile **aNewsrcRootPath)
nsresult nsNntpIncomingServer::SetupNewsrcSaveTimer()
{
nsInt64 ms(300000); // hard code, 5 minutes.
PRInt64 ms(300000); // hard code, 5 minutes.
//Convert biffDelay into milliseconds
PRUint32 timeInMSUint32 = (PRUint32)ms;
//Can't currently reset a timer when it's in the process of