LL_* macros are deprecated

RESOLVED FIXED in Thunderbird 17.0

Status

MailNews Core
Backend
RESOLVED FIXED
5 years ago
3 years ago

People

(Reporter: jcranmer, Assigned: jcranmer)

Tracking

unspecified
Thunderbird 17.0

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

52.81 KB, patch
neil@parkwaycc.co.uk
: review+
Details | Diff | Splinter Review
(Assignee)

Description

5 years ago
Created attachment 642019 [details] [diff] [review]
Kill all the macros

So let's remove them.

Hey, we can also clean up a lot of logic now that we don't need to make every binary operation a separate statement. Or being able to compare values other than 0.
Attachment #642019 - Flags: review?(neil)

Comment 1

5 years ago
Comment on attachment 642019 [details] [diff] [review]
Kill all the macros

>+    PRUint32 percentage = (PRUint32)(mCurrentProgress * 100 / mMaxProgress));
Did you compile this? Looks like you have too many )s.

>+#define PR_USEC_PER_DAY ((PRTime)PR_USEC_PER_SEC * 60 * 60 * 24)
PRTime(PR_USEC_PER_SEC) ?

> 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;
> }
[Followup to make these inline?]

> 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 got lost :-(

>-      PRInt64 fileSize;
>-      LL_I2L(fileSize, mTotalWritten);
>-      mLocalFile->SetFileSize(fileSize);
>+      mLocalFile->SetFileSize(mTotalWritten);
Nice fix :-)

> 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);
> }
[Another one. Sigh...]

>+    PRTime cacheTimeoutLimits = 170 * PR_USEC_PER_SEC;
> 
>     PRTime lastActiveTimeStamp;
>     rv = aConnection->GetLastActiveTimeStamp(&lastActiveTimeStamp);
> 
>+    if (PR_Now() - lastActiveTimeStamp >= (PRTime)170 * PR_USEC_PER_SEC)
cacheTimeoutLimits is unused. (Probably lost in the other warnings...)
Attachment #642019 - Flags: review?(neil) → review-
(Assignee)

Comment 2

5 years ago
Created attachment 642570 [details] [diff] [review]
It's a patch!

This one compiles for me on tip-of-trunk, and it should fix all of the previous comments.
Attachment #642019 - Attachment is obsolete: true
Attachment #642570 - Flags: review?(neil)

Updated

5 years ago
Attachment #642570 - Flags: review?(neil) → review+
(Assignee)

Comment 3

5 years ago
https://hg.mozilla.org/comm-central/rev/31da1d3a11c3
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 17.0

Updated

3 years ago
Blocks: 960097
You need to log in before you can comment on or make changes to this bug.