Last Comment Bug 773782 - LL_* macros are deprecated
: LL_* macros are deprecated
Status: RESOLVED FIXED
:
Product: MailNews Core
Classification: Components
Component: Backend (show other bugs)
: unspecified
: All All
: -- normal (vote)
: Thunderbird 17.0
Assigned To: Joshua Cranmer [:jcranmer]
:
Mentors:
Depends on:
Blocks: 960097
  Show dependency treegraph
 
Reported: 2012-07-13 13:20 PDT by Joshua Cranmer [:jcranmer]
Modified: 2014-01-15 08:17 PST (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Kill all the macros (52.85 KB, patch)
2012-07-13 13:20 PDT, Joshua Cranmer [:jcranmer]
neil: review-
Details | Diff | Splinter Review
It's a patch! (52.81 KB, patch)
2012-07-16 06:53 PDT, Joshua Cranmer [:jcranmer]
neil: review+
Details | Diff | Splinter Review

Description Joshua Cranmer [:jcranmer] 2012-07-13 13:20:47 PDT
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.
Comment 1 neil@parkwaycc.co.uk 2012-07-15 13:29:29 PDT
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...)
Comment 2 Joshua Cranmer [:jcranmer] 2012-07-16 06:53:23 PDT
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.
Comment 3 Joshua Cranmer [:jcranmer] 2012-07-16 16:04:13 PDT
https://hg.mozilla.org/comm-central/rev/31da1d3a11c3

Note You need to log in before you can comment on or make changes to this bug.