Bug 792581 - part 18: Replace LL_L2D macro with double cast. r=ehsan
authorAndrew Quartey <andrew.quartey@gmail.com>
Fri, 12 Oct 2012 13:29:11 -0400
changeset 110253 2aef09336e782afc706117e4882a556724ee3ff7
parent 110252 7ed2340f0df6ad4f1f53a453c15134d46b38e379
child 110254 4b8338085eed328b163b46715f91ecd76e450ad6
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersehsan
bugs792581
milestone19.0a1
Bug 792581 - part 18: Replace LL_L2D macro with double cast. r=ehsan
dom/plugins/base/nsPluginStreamListenerPeer.cpp
netwerk/cache/nsCacheService.cpp
toolkit/profile/nsToolkitProfileService.cpp
uriloader/exthandler/os2/nsMIMEInfoOS2.cpp
xpcom/ds/nsVariant.cpp
xpcom/glue/nsCRTGlue.cpp
--- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp
+++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp
@@ -1178,18 +1178,17 @@ nsresult nsPluginStreamListenerPeer::Set
     // get Last-Modified header for plugin info
     nsAutoCString lastModified;
     if (NS_SUCCEEDED(httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("last-modified"), lastModified)) &&
         !lastModified.IsEmpty()) {
       PRTime time64;
       PR_ParseTimeString(lastModified.get(), true, &time64);  //convert string time to integer time
       
       // Convert PRTime to unix-style time_t, i.e. seconds since the epoch
-      double fpTime;
-      LL_L2D(fpTime, time64);
+      double fpTime = double(time64);
       mModified = (uint32_t)(fpTime * 1e-6 + 0.5);
     }
   }
   
   rv = mPStreamListener->OnStartBinding(this);
   
   mStartBinding = true;
   
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -943,18 +943,17 @@ nsCacheProfilePrefObserver::MemoryCacheC
     // Conversion from unsigned int64 to double doesn't work on all platforms.
     // We need to truncate the value at INT64_MAX to make sure we don't
     // overflow.
     if (bytes > INT64_MAX)
         bytes = INT64_MAX;
 
     uint64_t kbytes = bytes >> 10;
 
-    double kBytesD;
-    LL_L2D(kBytesD, (int64_t) kbytes);
+    double kBytesD = double(kbytes);
 
     double x = log(kBytesD)/log(2.0) - 14;
     if (x > 0) {
         capacity = (int32_t)(x * x / 3.0 + x + 2.0 / 3 + 0.1); // 0.1 for rounding
         if (capacity > 32)
             capacity = 32;
         capacity   *= 1024;
     } else {
--- a/toolkit/profile/nsToolkitProfileService.cpp
+++ b/toolkit/profile/nsToolkitProfileService.cpp
@@ -601,18 +601,17 @@ NS_LockProfilePath(nsIFile* aPath, nsIFi
 
 static const char kTable[] =
     { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
       'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
       '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
 
 static void SaltProfileName(nsACString& aName)
 {
-    double fpTime;
-    LL_L2D(fpTime, PR_Now());
+    double fpTime = double(PR_Now());
 
     // use 1e-6, granularity of PR_Now() on the mac is seconds
     srand((uint)(fpTime * 1e-6 + 0.5));
 
     char salt[9];
 
     int i;
     for (i = 0; i < 8; ++i)
--- a/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp
+++ b/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp
@@ -65,18 +65,17 @@ static nsresult Make8Dot3Name(nsIFile *a
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoString saltedTempLeafName;
   do {
     saltedTempLeafName.Truncate();
 
     // this salting code was ripped directly from the profile manager.
     // turn PR_Now() into milliseconds since epoch 1058 & salt rand with that
-    double fpTime;
-    LL_L2D(fpTime, PR_Now());
+    double fpTime = double(PR_Now());
     srand((uint)(fpTime * 1e-6 + 0.5));
 
     for (int32_t i=0; i < SALT_SIZE; i++)
       saltedTempLeafName.Append(table[(rand()%TABLE_SIZE)]);
 
     AppendASCIItoUTF16(suffix, saltedTempLeafName);
     rv = aFile->CopyTo(tempPath, saltedTempLeafName);
   } while (NS_FAILED(rv));
--- a/xpcom/ds/nsVariant.cpp
+++ b/xpcom/ds/nsVariant.cpp
@@ -83,17 +83,17 @@ static nsresult ToManageableNumber(const
         return NS_OK;
 
     // This group results in a double...
 
     case nsIDataType::VTYPE_INT64:
     case nsIDataType::VTYPE_UINT64:
         // XXX Need boundary checking here.
         // We may need to return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA
-        LL_L2D(outData->u.mDoubleValue, inData.u.mInt64Value);
+        outData->u.mDoubleValue = double(inData.u.mInt64Value);
         outData->mType = nsIDataType::VTYPE_DOUBLE;
         return NS_OK;
     case nsIDataType::VTYPE_FLOAT:
         outData->u.mDoubleValue = inData.u.mFloatValue;
         outData->mType = nsIDataType::VTYPE_DOUBLE;
         return NS_OK;
     case nsIDataType::VTYPE_DOUBLE:
         outData->u.mDoubleValue = inData.u.mDoubleValue;
--- a/xpcom/glue/nsCRTGlue.cpp
+++ b/xpcom/glue/nsCRTGlue.cpp
@@ -246,18 +246,17 @@ static const char table[] = {
   'u','v','w','x','y','z','0','1','2','3',
   '4','5','6','7','8','9'
 };
 
 void NS_MakeRandomString(char *aBuf, int32_t aBufLen)
 {
   // turn PR_Now() into milliseconds since epoch
   // and salt rand with that.
-  double fpTime;
-  LL_L2D(fpTime, PR_Now());
+  double fpTime = double(PR_Now());
   srand((uint)(fpTime * 1e-6 + 0.5));   // use 1e-6, granularity of PR_Now() on the mac is seconds
 
   int32_t i;
   for (i=0;i<aBufLen;i++) {
     *aBuf++ = table[rand()%TABLE_SIZE];
   }
   *aBuf = 0;
 }