Bug 773782 - Stop using LL_* macros. r=Neil

--HG--
extra : rebase_source : 35e5adf4c8df76c2022e4dc7931777cdd96f4788
This commit is contained in:
Joshua Cranmer 2012-07-12 14:26:29 -05:00
Родитель 89c9626f16
Коммит 02fa657e28
32 изменённых файлов: 101 добавлений и 283 удалений

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

@ -31,11 +31,11 @@ static NS_DEFINE_CID(kLDAPOperationCID, NS_LDAPOPERATION_CID);
//
nsLDAPServiceEntry::nsLDAPServiceEntry()
: mLeases(0),
mTimestamp(0),
mDelete(false),
mRebinding(false)
{
mTimestamp = LL_Zero();
}
// Init function

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

@ -31,8 +31,8 @@
nsNetscapeProfileMigratorBase::nsNetscapeProfileMigratorBase()
{
mObserverService = do_GetService("@mozilla.org/observer-service;1");
mMaxProgress = LL_ZERO;
mCurrentProgress = LL_ZERO;
mMaxProgress = 0;
mCurrentProgress = 0;
mFileCopyTransactionIndex = 0;
}
@ -349,7 +349,6 @@ void nsNetscapeProfileMigratorBase::CopyNextFolder()
{
if (mFileCopyTransactionIndex < mFileCopyTransactions.Length())
{
PRUint32 percentage = 0;
fileTransactionEntry fileTransaction =
mFileCopyTransactions.ElementAt(mFileCopyTransactionIndex++);
@ -360,14 +359,9 @@ void nsNetscapeProfileMigratorBase::CopyNextFolder()
// add to our current progress
PRInt64 fileSize;
fileTransaction.srcFile->GetFileSize(&fileSize);
LL_ADD(mCurrentProgress, mCurrentProgress, fileSize);
mCurrentProgress += fileSize;
PRInt64 percentDone;
LL_MUL(percentDone, mCurrentProgress, 100);
LL_DIV(percentDone, percentDone, mMaxProgress);
LL_L2UI(percentage, percentDone);
PRUint32 percentage = (PRUint32)(mCurrentProgress * 100 / mMaxProgress);
nsAutoString index;
index.AppendInt(percentage);

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

@ -101,7 +101,7 @@ nsSeamonkeyProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup
fileTransactionEntry fileTransaction = mFileCopyTransactions.ElementAt(i);
PRInt64 fileSize;
fileTransaction.srcFile->GetFileSize(&fileSize);
LL_ADD(mMaxProgress, mMaxProgress, fileSize);
mMaxProgress += fileSize;
}
CopyNextFolder();

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

@ -180,5 +180,8 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value)
#define NS_MSG_BASE
#define NS_MSG_BASE_STATIC_MEMBER_(type) type
/// The number of microseconds in a day. This comes up a lot.
#define PR_USEC_PER_DAY (PRTime(PR_USEC_PER_SEC) * 60 * 60 * 24)
#endif // msgCore_h__

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

@ -254,10 +254,8 @@ nsMsgFilterList::GetLogStream(nsIOutputStream **aLogStream)
rv = logFile->GetFileSize(&fileSize);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 fileLen;;
LL_L2UI(fileLen, fileSize);
// write the header at the start
if (fileLen == 0)
if (fileSize == 0)
{
PRUint32 writeCount;

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

@ -740,8 +740,7 @@ nsresult nsMsgSearchOfflineMail::Search (bool *aDone)
{
AddResultElement (msgDBHdr);
}
PRIntervalTime elapsedTime;
LL_SUB(elapsedTime, PR_IntervalNow(), startTime);
PRIntervalTime elapsedTime = PR_IntervalNow() - startTime;
// check if more than kTimeSliceInMS milliseconds have elapsed in this time slice started
if (PR_IntervalToMilliseconds(elapsedTime) > kTimeSliceInMS)
break;

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

@ -472,13 +472,7 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, bool really
// we need to adjust the date so we get greater than and not greater than or equal to which
// is what the IMAP server wants to search on
// won't work on Mac.
// ack, is this right? is PRTime seconds or microseconds?
PRInt64 microSecondsPerSecond, secondsInDay, microSecondsInDay;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_UI2L(secondsInDay, 60 * 60 * 24);
LL_MUL(microSecondsInDay, secondsInDay, microSecondsPerSecond);
LL_ADD(adjustedDate, adjustedDate, microSecondsInDay); // bump up to the day after this one...
adjustedDate += PR_USEC_PER_DAY;
}
PRExplodedTime exploded;
@ -498,15 +492,8 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, bool really
searchValue->GetAge(&ageInDays);
PRTime now = PR_Now();
PRTime matchDay;
PRTime matchDay = now - ageInDays * PR_USEC_PER_DAY;
PRInt64 microSecondsPerSecond, secondsInDays, microSecondsInDay;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_I2L(secondsInDays, 60 * 60 * 24 * ageInDays);
LL_MUL(microSecondsInDay, secondsInDays, microSecondsPerSecond);
LL_SUB(matchDay, now, microSecondsInDay); // = now - term->m_value.u.age * 60 * 60 * 24;
PRExplodedTime exploded;
PR_ExplodeTime(matchDay, PR_LocalTimeParameters, &exploded);
PR_FormatTimeUSEnglish(dateBuf, sizeof(dateBuf), "%d-%b-%Y", &exploded);

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

@ -1283,16 +1283,9 @@ nsresult nsMsgSearchTerm::MatchAge (PRTime msgDate, bool *pResult)
nsresult err = NS_OK;
PRTime now = PR_Now();
PRTime cutOffDay;
PRTime cutOffDay = now - m_value.u.age * PR_USEC_PER_DAY;
PRInt64 microSecondsPerSecond, secondsInDays, microSecondsInDays;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_I2L(secondsInDays, 60 * 60 * 24 * m_value.u.age);
LL_MUL(microSecondsInDays, secondsInDays, microSecondsPerSecond);
LL_SUB(cutOffDay, now, microSecondsInDays); // = now - term->m_value.u.age * 60 * 60 * 24;
bool cutOffDayInTheFuture = LL_CMP(m_value.u.age, <, 0);
bool cutOffDayInTheFuture = m_value.u.age < 0;
// So now cutOffDay is the PRTime cut-off point.
// Any msg with a time less than that will be past the age.
@ -1300,13 +1293,13 @@ nsresult nsMsgSearchTerm::MatchAge (PRTime msgDate, bool *pResult)
switch (m_operator)
{
case nsMsgSearchOp::IsGreaterThan: // is older than, or more in the future
if ((!cutOffDayInTheFuture && LL_CMP(msgDate, <, cutOffDay)) ||
(cutOffDayInTheFuture && LL_CMP(msgDate, >, cutOffDay)))
if ((!cutOffDayInTheFuture && msgDate < cutOffDay) ||
(cutOffDayInTheFuture && msgDate > cutOffDay))
result = true;
break;
case nsMsgSearchOp::IsLessThan: // is younger than, or less in the future
if ((!cutOffDayInTheFuture && LL_CMP(msgDate, >, cutOffDay)) ||
(cutOffDayInTheFuture && LL_CMP(msgDate, <, cutOffDay)))
if ((!cutOffDayInTheFuture && msgDate > cutOffDay) ||
(cutOffDayInTheFuture && msgDate < cutOffDay))
result = true;
break;
case nsMsgSearchOp::Is:

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

@ -282,10 +282,8 @@ nsresult nsMsgBiffManager::SetupNextBiff()
if (currentTime > biffEntry.nextBiffTime)
{
PRInt64 microSecondsPerSecond;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_MUL(biffDelay, 30, microSecondsPerSecond); //let's wait 30 seconds before firing biff again
// Let's wait 30 seconds before firing biff again
biffDelay = 30 * PR_USEC_PER_SEC;
}
else
biffDelay = biffEntry.nextBiffTime - currentTime;

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

@ -712,46 +712,24 @@ nsresult nsMsgDBView::FetchDate(nsIMsgDBHdr * aHdr, nsAString &aDateString, bool
// the following chunk of code allows us to show a day instead of a number if the message was received
// within the last 7 days. i.e. Mon 5:10pm. (depending on the mail.ui.display.dateformat.thisweek pref)
// The concrete format used is dependent on a preference setting (see InitDisplayFormats).
else if (LL_CMP(currentTime, >, dateOfMsg))
else if (currentTime > dateOfMsg)
{
// some constants for calculation
static PRInt64 microSecondsPerSecond;
static PRInt64 secondsPerDay;
static PRInt64 microSecondsPerDay;
static PRInt64 microSecondsPer6Days;
// Convert the times from GMT to local time
PRInt64 GMTLocalTimeShift = PR_USEC_PER_SEC *
PRInt64(explodedCurrentTime.tm_params.tp_gmt_offset +
explodedCurrentTime.tm_params.tp_dst_offset);
currentTime += GMTLocalTimeShift;
dateOfMsgLocal = dateOfMsg + GMTLocalTimeShift;
static bool bGotConstants = false;
if ( !bGotConstants )
{
// seeds
LL_I2L ( microSecondsPerSecond, PR_USEC_PER_SEC );
LL_UI2L ( secondsPerDay, 60 * 60 * 24 );
// derivees
LL_MUL( microSecondsPerDay, secondsPerDay, microSecondsPerSecond );
LL_MUL( microSecondsPer6Days, microSecondsPerDay, 6 );
bGotConstants = true;
}
// setting the time variables to local time
PRInt64 GMTLocalTimeShift;
LL_ADD( GMTLocalTimeShift, explodedCurrentTime.tm_params.tp_gmt_offset, explodedCurrentTime.tm_params.tp_dst_offset );
LL_MUL( GMTLocalTimeShift, GMTLocalTimeShift, microSecondsPerSecond );
LL_ADD( currentTime, currentTime, GMTLocalTimeShift );
LL_ADD( dateOfMsgLocal, dateOfMsg, GMTLocalTimeShift );
// the most recent midnight, counting from current time
PRInt64 todaysMicroSeconds, mostRecentMidnight;
LL_MOD( todaysMicroSeconds, currentTime, microSecondsPerDay );
LL_SUB( mostRecentMidnight, currentTime, todaysMicroSeconds );
// Find the most recent midnight
PRInt64 todaysMicroSeconds = currentTime % PR_USEC_PER_DAY;
PRInt64 mostRecentMidnight = currentTime - todaysMicroSeconds;
// most recent midnight minus 6 days
PRInt64 mostRecentWeek;
LL_SUB( mostRecentWeek, mostRecentMidnight, microSecondsPer6Days );
PRInt64 mostRecentWeek = mostRecentMidnight - (PR_USEC_PER_DAY * 6);
// was the message sent during the last week?
if ( LL_CMP( dateOfMsgLocal, >=, mostRecentWeek ) )
if (dateOfMsgLocal >= mostRecentWeek)
{ // yes ....
dateFormat = m_dateFormatThisWeek;
}

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

@ -130,56 +130,30 @@ nsresult nsMsgGroupView::GetAgeBucketValue(nsIMsgDBHdr *aMsgHdr, PRUint32 * aAge
*aAgeBucket = 1;
}
// figure out how many days ago this msg arrived
else if (LL_CMP(currentTime, >, dateOfMsg))
else if (currentTime > dateOfMsg)
{
// some constants for calculation
static PRInt64 microSecondsPerSecond;
static PRInt64 microSecondsPerDay;
static PRInt64 secondsPerDay;
static PRInt64 microSecondsPer6Days;
static PRInt64 microSecondsPer13Days;
static bool bGotConstants = false;
if ( !bGotConstants )
{
// seeds
LL_I2L ( microSecondsPerSecond, PR_USEC_PER_SEC );
LL_UI2L ( secondsPerDay, 60 * 60 * 24 );
// derivees
LL_MUL( microSecondsPerDay, secondsPerDay, microSecondsPerSecond );
LL_MUL( microSecondsPer6Days, microSecondsPerDay, 6 );
LL_MUL( microSecondsPer13Days, microSecondsPerDay, 13 );
bGotConstants = true;
}
// setting the time variables to local time
PRInt64 GMTLocalTimeShift;
LL_ADD( GMTLocalTimeShift, currentExplodedTime.tm_params.tp_gmt_offset, currentExplodedTime.tm_params.tp_dst_offset );
LL_MUL( GMTLocalTimeShift, GMTLocalTimeShift, microSecondsPerSecond );
LL_ADD( currentTime, currentTime, GMTLocalTimeShift );
LL_ADD( dateOfMsg, dateOfMsg, GMTLocalTimeShift );
PRInt64 GMTLocalTimeShift = currentExplodedTime.tm_params.tp_gmt_offset +
currentExplodedTime.tm_params.tp_dst_offset;
GMTLocalTimeShift *= PR_USEC_PER_SEC;
currentTime += GMTLocalTimeShift;
dateOfMsg += GMTLocalTimeShift;
// the most recent midnight, counting from current time
PRInt64 todaysMicroSeconds, mostRecentMidnight;
LL_MOD( todaysMicroSeconds, currentTime, microSecondsPerDay );
LL_SUB( mostRecentMidnight, currentTime, todaysMicroSeconds );
PRInt64 yesterday;
LL_SUB( yesterday, mostRecentMidnight, microSecondsPerDay );
PRInt64 mostRecentMidnight = currentTime - currentTime % PR_USEC_PER_DAY;
PRInt64 yesterday = mostRecentMidnight - PR_USEC_PER_DAY;
// most recent midnight minus 6 days
PRInt64 mostRecentWeek;
LL_SUB( mostRecentWeek, mostRecentMidnight, microSecondsPer6Days );
PRInt64 mostRecentWeek = mostRecentMidnight - (PR_USEC_PER_DAY * 6);
// was the message sent yesterday?
if ( LL_CMP( dateOfMsg, >=, yesterday ) ) // yes ....
if (dateOfMsg >= yesterday) // yes ....
*aAgeBucket = 2;
else if ( LL_CMP(dateOfMsg, >=, mostRecentWeek) )
else if (dateOfMsg >= mostRecentWeek)
*aAgeBucket = 3;
else
{
PRInt64 lastTwoWeeks;
LL_SUB( lastTwoWeeks, mostRecentMidnight, microSecondsPer13Days);
*aAgeBucket = LL_CMP(dateOfMsg, >=, lastTwoWeeks) ? 4 : 5;
PRInt64 lastTwoWeeks = mostRecentMidnight - PR_USEC_PER_DAY * 13;
*aAgeBucket = (dateOfMsg >= lastTwoWeeks) ? 4 : 5;
}
}
return NS_OK;

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

@ -214,8 +214,7 @@ nsresult nsMsgPurgeService::PerformPurge()
PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("purging %s", curFolderUri.get()));
childFolder->ApplyRetentionSettings();
}
PRIntervalTime elapsedTime;
LL_SUB(elapsedTime, PR_IntervalNow(), startTime);
PRIntervalTime elapsedTime = PR_IntervalNow() - startTime;
// check if more than 500 milliseconds have elapsed in this purge process
if (PR_IntervalToMilliseconds(elapsedTime) > 500)
{

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

@ -26,9 +26,9 @@
#define MSGFEEDBACK_TIMER_INTERVAL 500
nsMsgStatusFeedback::nsMsgStatusFeedback() :
m_lastPercent(0)
m_lastPercent(0),
m_lastProgressTime(0)
{
LL_I2L(m_lastProgressTime, 0);
nsresult rv;
nsCOMPtr<nsIStringBundleService> bundleService =
@ -215,18 +215,11 @@ nsMsgStatusFeedback::ShowProgress(PRInt32 aPercentage)
m_lastPercent = aPercentage;
PRInt64 nowMS;
LL_I2L(nowMS, 0);
PRInt64 nowMS = 0;
if (aPercentage < 100) // always need to do 100%
{
int64 minIntervalBetweenProgress;
LL_I2L(minIntervalBetweenProgress, 250);
int64 diffSinceLastProgress;
LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow()));
LL_SUB(diffSinceLastProgress, nowMS, m_lastProgressTime); // r = a - b
LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b
if (!LL_GE_ZERO(diffSinceLastProgress))
nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
if (nowMS < m_lastProgressTime + 250)
return NS_OK;
}

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

@ -260,7 +260,7 @@ nsresult nsMsgXFViewThread::AddHdr(nsIMsgDBHdr *newHdr,
// if (NS_SUCCEEDED(rv) && topLevelHdr)
// {
// topLevelHdr->GetDate(&topLevelHdrDate);
// if (LL_CMP(newHdrDate, <, topLevelHdrDate))
// if (newHdrDate < topLevelHdrDate)
// }
// }

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

@ -218,10 +218,8 @@ nsSpamSettings::GetLogStream(nsIOutputStream **aLogStream)
rv = mLogFile->GetFileSize(&fileSize);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 fileLen;
LL_L2UI(fileLen, fileSize);
// write the header at the start
if (fileLen == 0)
if (fileSize == 0)
{
PRUint32 writeCount;

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

@ -151,7 +151,7 @@ nsMsgDBFolder::nsMsgDBFolder(void)
#endif
initializeStrings();
createCollationKeyGenerator();
LL_I2L(gtimeOfLastPurgeCheck, 0);
gtimeOfLastPurgeCheck = 0;
}
mProcessingFlag[0].bit = nsMsgProcessingFlags::ClassifyJunk;

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

@ -1294,29 +1294,17 @@ NS_MSG_BASE nsresult NS_GetLocalizedUnicharPreferenceWithDefault(nsIPrefBranch *
void PRTime2Seconds(PRTime prTime, PRUint32 *seconds)
{
PRInt64 microSecondsPerSecond, intermediateResult;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_DIV(intermediateResult, prTime, microSecondsPerSecond);
LL_L2UI((*seconds), intermediateResult);
*seconds = (PRUint32)(prTime / PR_USEC_PER_SEC);
}
void PRTime2Seconds(PRTime prTime, PRInt32 *seconds)
{
PRInt64 microSecondsPerSecond, intermediateResult;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_DIV(intermediateResult, prTime, microSecondsPerSecond);
LL_L2I((*seconds), intermediateResult);
*seconds = (PRInt32)(prTime / PR_USEC_PER_SEC);
}
void Seconds2PRTime(PRUint32 seconds, PRTime *prTime)
{
PRInt64 microSecondsPerSecond, intermediateResult;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_UI2L(intermediateResult, seconds);
LL_MUL((*prTime), intermediateResult, microSecondsPerSecond);
*prTime = (PRTime)seconds * PR_USEC_PER_SEC;
}
nsresult GetSummaryFileLocation(nsIFile* fileLocation, nsIFile** summaryLocation)
@ -2141,12 +2129,9 @@ NS_MSG_BASE nsresult MsgPromptLoginFailed(nsIMsgWindow *aMsgWindow,
NS_MSG_BASE PRTime MsgConvertAgeInDaysToCutoffDate(PRInt32 ageInDays)
{
PRInt64 secondsInDays, microSecondsInDay;
PRTime now = PR_Now();
secondsInDays = 60 * 60 * 24 * ageInDays;
microSecondsInDay = secondsInDays * PR_USEC_PER_SEC;
return now - microSecondsInDay;
return now - PR_USEC_PER_DAY * ageInDays;
}
NS_MSG_BASE nsresult MsgTermListToString(nsISupportsArray *aTermList, nsCString &aOutString)

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

@ -709,9 +709,7 @@ GenerateGlobalRandomBytes(unsigned char *buf, PRInt32 len)
{
// Seed the random-number generator with current time so that
// the numbers will be different every time we run.
PRInt32 aTime;
LL_L2I(aTime, PR_Now());
srand( (unsigned)aTime );
srand( (unsigned)PR_Now() );
firstTime = false;
}
@ -1085,13 +1083,7 @@ static bool isValidHost( const char* host )
char *
msg_generate_message_id (nsIMsgIdentity *identity)
{
PRUint32 now;
PRTime prNow = PR_Now();
PRInt64 microSecondsPerSecond, intermediateResult;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_DIV(intermediateResult, prNow, microSecondsPerSecond);
LL_L2UI(now, intermediateResult);
PRUint32 now = (PRUint32)(PR_Now() / PR_USEC_PER_SEC);
PRUint32 salt = 0;
const char *host = 0;

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

@ -274,9 +274,7 @@ nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * ctxt, nsresult aS
/* In case of multipart/x-mixed-replace, we need to truncate the file to the current part size */
if (MsgLowerCaseEqualsLiteral(mConverterContentType, MULTIPART_MIXED_REPLACE))
{
PRInt64 fileSize;
LL_I2L(fileSize, mTotalWritten);
mLocalFile->SetFileSize(fileSize);
mLocalFile->SetFileSize(mTotalWritten);
}
}

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

@ -5233,16 +5233,8 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
return rv;
bool hasMore = false;
PRTime now = PR_Now();
PRTime cutOffDay;
PRTime cutOffDay = PR_Now() - daysToKeepHdrs * PR_USEC_PER_DAY;
PRInt64 microSecondsPerSecond, secondsInDays, microSecondsInDay;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_UI2L(secondsInDays, 60 * 60 * 24 * daysToKeepHdrs);
LL_MUL(microSecondsInDay, secondsInDays, microSecondsPerSecond);
LL_SUB(cutOffDay, now, microSecondsInDay); // = now - term->m_value.u.age * 60 * 60 * 24;
// so now cutOffDay is the PRTime cut-off point. Any msg with a date less than that will get purged.
while (NS_SUCCEEDED(rv = hdrs->HasMoreElements(&hasMore)) && hasMore)
{
@ -5273,7 +5265,7 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
{
PRTime date;
pHeader->GetDate(&date);
if (LL_CMP(date, <, cutOffDay))
if (date < cutOffDay)
purgeHdr = true;
}
if (purgeHdr)

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

@ -42,7 +42,7 @@ void nsMsgHdr::Init()
m_statusOffset = 0xffffffff;
m_messageKey = nsMsgKey_None;
m_messageSize = 0;
m_date = LL_ZERO;
m_date = 0;
m_flags = 0;
m_mdbRow = NULL;
m_threadId = nsMsgKey_None;

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

@ -329,7 +329,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
PRTime curHdrDate;
curHdr->GetDate(&curHdrDate);
if (LL_CMP(newHdrDate, <, curHdrDate))
if (newHdrDate < curHdrDate)
moveIndex = childIndex;
}
}
@ -348,7 +348,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
if (NS_SUCCEEDED(rv) && topLevelHdr)
{
topLevelHdr->GetDate(&topLevelHdrDate);
if (LL_CMP(newHdrDate, <, topLevelHdrDate))
if (newHdrDate < topLevelHdrDate)
{
RerootThread(child, topLevelHdr, announcer);
mdb_pos outPos;

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

@ -87,9 +87,7 @@ GenerateGlobalRandomBytes(unsigned char *buf, PRInt32 len)
{
// Seed the random-number generator with current time so that
// the numbers will be different every time we run.
PRInt32 aTime;
LL_L2I(aTime, PR_Now());
srand( (unsigned)aTime );
srand( (unsigned)PR_Now() );
firstTime = false;
}

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

@ -662,18 +662,11 @@ nsImapIncomingServer::ConnectionTimeOut(nsIImapProtocol* aConnection)
SetTimeOutLimits(timeoutInMinutes);
}
PRTime cacheTimeoutLimits;
LL_I2L(cacheTimeoutLimits, timeoutInMinutes * 60 * 1000000); // in
// microseconds
PRTime cacheTimeoutLimits = timeoutInMinutes * 60 * PR_USEC_PER_SEC;
PRTime lastActiveTimeStamp;
rv = aConnection->GetLastActiveTimeStamp(&lastActiveTimeStamp);
PRTime elapsedTime;
LL_SUB(elapsedTime, PR_Now(), lastActiveTimeStamp);
PRTime t;
LL_SUB(t, elapsedTime, cacheTimeoutLimits);
if (LL_GE_ZERO(t))
if (PR_Now() - lastActiveTimeStamp < cacheTimeoutLimits)
{
nsCOMPtr<nsIImapProtocol> aProtocol(do_QueryInterface(aConnection,
&rv));

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

@ -411,10 +411,10 @@ nsImapProtocol::nsImapProtocol() : nsMsgProtocol(nsnull),
m_nextUrlReadyToRun = false;
m_trackingTime = false;
m_curFetchSize = 0;
LL_I2L(m_startTime, 0);
LL_I2L(m_endTime, 0);
LL_I2L(m_lastActiveTime, 0);
LL_I2L(m_lastProgressTime, 0);
m_startTime = 0;
m_endTime = 0;
m_lastActiveTime = 0;
m_lastProgressTime = 0;
ResetProgressInfo();
m_tooFastTime = 0;
@ -3079,12 +3079,8 @@ nsImapProtocol::GetArbitraryHeadersToDownload(nsCString &aResult)
void
nsImapProtocol::AdjustChunkSize()
{
PRTime deltaTime;
PRInt32 deltaInSeconds;
m_endTime = PR_Now();
LL_SUB(deltaTime, m_endTime, m_startTime);
PRTime2Seconds(deltaTime, &deltaInSeconds);
PRTime2Seconds(m_endTime - m_startTime, &deltaInSeconds);
m_trackingTime = false;
if (deltaInSeconds < 0)
return; // bogus for some reason
@ -4999,7 +4995,7 @@ nsImapProtocol::AlertUserEventFromServer(const char * aServerEvent)
void nsImapProtocol::ResetProgressInfo()
{
LL_I2L(m_lastProgressTime, 0);
m_lastProgressTime = 0;
m_lastPercent = -1;
m_lastProgressStringId = (PRUint32) -1;
}
@ -5062,21 +5058,15 @@ nsImapProtocol::ProgressEventFunctionUsingIdWithString(PRUint32 aMsgId, const
void
nsImapProtocol::PercentProgressUpdateEvent(PRUnichar *message, PRInt64 currentProgress, PRInt64 maxProgress)
{
PRInt64 nowMS = LL_ZERO;
PRInt64 nowMS = 0;
PRInt32 percent = (100 * currentProgress) / maxProgress;
if (percent == m_lastPercent)
return; // hasn't changed, right? So just return. Do we need to clear this anywhere?
if (percent < 100) // always need to do 100%
{
int64 minIntervalBetweenProgress;
LL_I2L(minIntervalBetweenProgress, 750);
int64 diffSinceLastProgress;
LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow()));
LL_SUB(diffSinceLastProgress, nowMS, m_lastProgressTime); // r = a - b
LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b
if (!LL_GE_ZERO(diffSinceLastProgress))
nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
if (nowMS - m_lastProgressTime < 750)
return;
}
@ -8481,8 +8471,7 @@ bool nsImapProtocol::CheckNeeded()
PRTime deltaTime;
PRInt32 deltaInSeconds;
LL_SUB(deltaTime, PR_Now(), m_lastCheckTime);
PRTime2Seconds(deltaTime, &deltaInSeconds);
PRTime2Seconds(PR_Now() - m_lastCheckTime, &deltaInSeconds);
return (deltaInSeconds >= kMaxSecondsBeforeCheck);
}

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

@ -75,6 +75,7 @@
nsLocalMailCopyState::nsLocalMailCopyState() :
m_flags(0),
m_lastProgressTime(PR_IntervalToMilliseconds(PR_IntervalNow())),
m_curDstKey(0xffffffff),
m_curCopyIndex(0),
m_totalMsgCount(0),
@ -86,7 +87,6 @@ nsLocalMailCopyState::nsLocalMailCopyState() :
m_writeFailed(false),
m_notifyFolderLoaded(false)
{
LL_I2L(m_lastProgressTime, PR_IntervalToMilliseconds(PR_IntervalNow()));
}
nsLocalMailCopyState::~nsLocalMailCopyState()
@ -3187,16 +3187,11 @@ nsresult nsMsgLocalMailFolder::DisplayMoveCopyStatusMsg()
const PRUnichar * stringArray[] = { numMsgSoFarString.get(), totalMessagesString.get(), folderName.get() };
rv = mCopyState->m_stringBundle->FormatStringFromID(statusMsgId, stringArray, 3,
getter_Copies(finalString));
PRInt64 minIntervalBetweenProgress;
PRInt64 nowMS = LL_ZERO;
PRInt64 nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
// only update status/progress every half second
LL_I2L(minIntervalBetweenProgress, 500);
PRInt64 diffSinceLastProgress;
LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow()));
LL_SUB(diffSinceLastProgress, nowMS, mCopyState->m_lastProgressTime); // r = a - b
LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b
if (!LL_GE_ZERO(diffSinceLastProgress) && mCopyState->m_curCopyIndex < mCopyState->m_totalMsgCount)
if (nowMS - mCopyState->m_lastProgressTime < 500 &&
mCopyState->m_curCopyIndex < mCopyState->m_totalMsgCount)
return NS_OK;
mCopyState->m_lastProgressTime = nowMS;

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

@ -600,7 +600,7 @@ NS_IMETHODIMP nsParseMailMessageState::Clear()
ClearAggregateHeader (m_ccList);
m_headers.ResetWritePos();
m_envelope.ResetWritePos();
m_receivedTime = LL_ZERO;
m_receivedTime = 0;
for (PRUint32 i = 0; i < m_customDBHeaders.Length(); i++)
m_customDBHeaderValues[i].length = 0;
@ -1118,7 +1118,7 @@ SEARCH_NEWLINE:
while (header->length > 0 &&
IS_SPACE (header->value [header->length - 1]))
((char *) header->value) [--header->length] = 0;
if (header == &receivedBy && LL_IS_ZERO(m_receivedTime))
if (header == &receivedBy && m_receivedTime == 0)
{
// parse Received: header for date.
// We trust the first header as that is closest to recipient,
@ -1580,7 +1580,7 @@ int nsParseMailMessageState::FinalizeHeaders()
PRTime resultTime = PR_Now();
m_newMsgHdr->SetDate(resultTime);
}
if (!LL_IS_ZERO(m_receivedTime))
if (m_receivedTime != 0)
{ // Upgrade 'Received' to Received: ?
PRTime2Seconds(m_receivedTime, &rcvTimeSecs);
}

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

@ -63,13 +63,7 @@ net_pop3_remove_messages_marked_delete(PLHashEntry* he,
PRUint32 TimeInSecondsFromPRTime(PRTime prTime)
{
PRUint32 retTimeInSeconds;
PRInt64 microSecondsPerSecond, intermediateResult;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_DIV(intermediateResult, prTime, microSecondsPerSecond);
LL_L2UI(retTimeInSeconds, intermediateResult);
return retTimeInSeconds;
return (PRUint32)(prTime / PR_USEC_PER_SEC);
}
static void
@ -2973,7 +2967,7 @@ PRInt32 nsPop3Protocol::GetMsg()
if (m_totalDownloadSize > 0) // skip all this if there aren't any messages
{
nsresult rv;
PRInt64 mailboxSpaceLeft = LL_Zero();
PRInt64 mailboxSpaceLeft = 0;
nsCOMPtr <nsIMsgFolder> folder;
nsCOMPtr <nsIFile> path;
@ -3015,14 +3009,7 @@ PRInt32 nsPop3Protocol::GetMsg()
* etc. The space "available" may be greater than the actual space
* usable. */
PRInt64 llResult;
PRInt64 llExtraSafetySpace;
PRInt64 llTotalDownloadSize;
LL_I2L(llExtraSafetySpace, EXTRA_SAFETY_SPACE);
LL_I2L(llTotalDownloadSize, m_totalDownloadSize);
LL_ADD(llResult, llTotalDownloadSize, llExtraSafetySpace);
if (LL_CMP(llResult, >, mailboxSpaceLeft))
if (m_totalDownloadSize + PRInt64(EXTRA_SAFETY_SPACE) > mailboxSpaceLeft)
{
// Not enough disk space!
#ifdef DEBUG

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

@ -73,6 +73,7 @@ nsNNTPNewsgroupList::nsNNTPNewsgroupList()
m_downloadAll(false),
m_maxArticles(0),
m_lastPercent(-1),
m_lastStatusUpdate(0),
m_lastProcessedNumber(0),
m_firstMsgNumber(0),
m_lastMsgNumber(0),
@ -81,7 +82,6 @@ nsNNTPNewsgroupList::nsNNTPNewsgroupList()
m_set(nsnull)
{
memset(&m_knownArts, 0, sizeof(m_knownArts));
m_lastStatusUpdate = LL_Zero();
}
nsNNTPNewsgroupList::~nsNNTPNewsgroupList()

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

@ -292,7 +292,7 @@ nsNNTPProtocol::nsNNTPProtocol(nsINntpIncomingServer *aServer, nsIURI *aURL,
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) creating",this));
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) initializing, so unset m_currentGroup",this));
m_currentGroup.Truncate();
LL_I2L(m_lastActiveTimeStamp, 0);
m_lastActiveTimeStamp = 0;
}
nsNNTPProtocol::~nsNNTPProtocol()
@ -1764,10 +1764,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
{
char small_buf[64];
PRExplodedTime expandedTime;
PRTime t_usec, usec_per_sec;
LL_I2L(t_usec, last_update);
LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
LL_MUL(t_usec, t_usec, usec_per_sec);
PRTime t_usec = (PRTime)last_update * PR_USEC_PER_SEC;
PR_ExplodeTime(t_usec, PR_LocalTimeParameters, &expandedTime);
PR_FormatTimeUSEnglish(small_buf, sizeof(small_buf),
"NEWGROUPS %y%m%d %H%M%S", &expandedTime);
@ -2727,13 +2724,7 @@ static void ComputeRate(PRInt32 bytes, PRTime startTime, float *rate)
// rate = (bytes / USECS since start) * RATE_CONSTANT
// compute usecs since we started.
PRTime timeSinceStart;
PRTime now = PR_Now();
LL_SUB(timeSinceStart, now, startTime);
// convert PRTime to PRInt32
PRInt32 delta;
LL_L2I(delta, timeSinceStart);
PRInt32 delta = (PRInt32)(PR_Now() - startTime);
// compute rate
if (delta > 0) {

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

@ -62,7 +62,7 @@ nsNewsDownloader::nsNewsDownloader(nsIMsgWindow *window, nsIMsgDatabase *msgDB,
m_listener = listener;
m_window = window;
m_lastPercent = -1;
LL_I2L(m_lastProgressTime, 0);
m_lastProgressTime = 0;
// not the perfect place for this, but I think it will work.
if (m_window)
m_window->SetStopped(false);
@ -168,17 +168,11 @@ bool nsNewsDownloader::GetNextHdrToRetrieve()
PRInt32 percent;
percent = (100 * m_numwrote) / (PRInt32) m_keysToDownload.Length();
PRInt64 nowMS = LL_ZERO;
PRInt64 nowMS = 0;
if (percent < 100) // always need to do 100%
{
int64 minIntervalBetweenProgress;
LL_I2L(minIntervalBetweenProgress, 750);
int64 diffSinceLastProgress;
LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow()));
LL_SUB(diffSinceLastProgress, nowMS, m_lastProgressTime); // r = a - b
LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b
if (!LL_GE_ZERO(diffSinceLastProgress))
nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
if (nowMS - m_lastProgressTime < 750)
return true;
}

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

@ -452,17 +452,10 @@ nsNntpIncomingServer::ConnectionTimeOut(nsINNTPProtocol* aConnection)
if (!aConnection) return retVal;
nsresult rv;
PRTime cacheTimeoutLimits;
LL_I2L(cacheTimeoutLimits, 170 * 1000000); // 170 seconds in microseconds
PRTime lastActiveTimeStamp;
rv = aConnection->GetLastActiveTimeStamp(&lastActiveTimeStamp);
PRTime elapsedTime;
LL_SUB(elapsedTime, PR_Now(), lastActiveTimeStamp);
PRTime t;
LL_SUB(t, elapsedTime, cacheTimeoutLimits);
if (LL_GE_ZERO(t))
if (PR_Now() - lastActiveTimeStamp >= PRTime(170) * PR_USEC_PER_SEC)
{
#ifdef DEBUG_seth
printf("XXX connection timed out, close it, and remove it from the connection cache\n");
@ -790,9 +783,7 @@ nsNntpIncomingServer::WriteHostInfoFile()
{
if (!mHostInfoHasChanged)
return NS_OK;
PRInt32 firstnewdate;
LL_L2I(firstnewdate, mFirstNewDate);
PRInt32 firstnewdate = (PRInt32)mFirstNewDate;
mLastUpdatedTime = PRUint32(PR_Now() / PR_USEC_PER_SEC);
@ -1243,8 +1234,7 @@ nsNntpIncomingServer::HandleLine(const char* line, PRUint32 line_size)
if (PL_strcmp(line, "lastgroupdate") == 0) {
mLastUpdatedTime = strtoul(equalPos, nsnull, 10);
} else if (PL_strcmp(line, "firstnewdate") == 0) {
PRInt32 firstnewdate = strtol(equalPos, nsnull, 16);
LL_I2L(mFirstNewDate, firstnewdate);
mFirstNewDate = strtol(equalPos, nsnull, 16);
} else if (PL_strcmp(line, "uniqueid") == 0) {
mUniqueId = strtol(equalPos, nsnull, 16);
} else if (PL_strcmp(line, "version") == 0) {