Bug 792581 - part 15: Replace LL_L2I macro with int32_t cast. r=ehsan
authorAndrew Quartey <andrew.quartey@gmail.com>
Fri, 12 Oct 2012 13:29:10 -0400
changeset 110118 6857ec16567d206eba481cd8e907da16f9a23c7d
parent 110117 7a7fbacd886cc7fe9bd240d3ea0c7309b2ef2722
child 110119 14cef04d0b3455b4337d286683f7ebe291de26d1
push id23671
push userryanvm@gmail.com
push dateSat, 13 Oct 2012 08:36:40 +0000
treeherdermozilla-central@0be7bfea4744 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs792581
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 792581 - part 15: Replace LL_L2I macro with int32_t cast. r=ehsan
content/base/src/nsContentSink.cpp
docshell/base/nsDocShell.h
layout/xul/base/src/nsListBoxBodyFrame.cpp
rdf/base/src/nsRDFService.cpp
rdf/datasource/src/nsFileSystemDataSource.cpp
tools/trace-malloc/spacetrace.c
uriloader/prefetch/nsPrefetchService.cpp
xpcom/glue/nsTextFormatter.cpp
xpcom/io/nsLocalFileOS2.cpp
xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
xpfe/components/directory/nsDirectoryViewer.cpp
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -1220,25 +1220,20 @@ nsContentSink::Notify(nsITimer *timer)
     // We shouldn't interfere with our normal DidProcessAToken logic
     mDroppedTimer = true;
     return NS_OK;
   }
   
 #ifdef MOZ_DEBUG
   {
     PRTime now = PR_Now();
-    int64_t diff, interval;
-    int32_t delay;
+    int64_t interval;
 
     LL_I2L(interval, GetNotificationInterval());
-    diff = now - mLastNotificationTime;
-
-    diff -= interval;
-    LL_L2I(delay, diff);
-    delay /= PR_USEC_PER_MSEC;
+    delay = int32_t(now - mLastNotificationTime - interval) / PR_USEC_PER_MSEC;
 
     mBackoffCount--;
     SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_REFLOW,
                ("nsContentSink::Notify: reflow on a timer: %d milliseconds "
                 "late, backoff count: %d", delay, mBackoffCount));
   }
 #endif
 
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -528,21 +528,19 @@ protected:
     bool IsPrintingOrPP(bool aDisplayErrorDialog = true);
 
     nsresult SetBaseUrlForWyciwyg(nsIContentViewer * aContentViewer);
 
     static  inline  uint32_t
     PRTimeToSeconds(PRTime t_usec)
     {
       PRTime usec_per_sec;
-      uint32_t t_sec;
       LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
       t_usec /= usec_per_sec;
-      LL_L2I(t_sec, t_usec);
-      return t_sec;
+      return  uint32_t(t_usec);
     }
 
     bool IsFrame();
 
     //
     // Helper method that is called when a new document (including any
     // sub-documents - ie. frames) has been completely loaded.
     //
--- a/layout/xul/base/src/nsListBoxBodyFrame.cpp
+++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp
@@ -902,21 +902,17 @@ nsListBoxBodyFrame::DoInternalPositionCh
   }
 
   mScrolling = false;
   
   VerticalScroll(mYPosition);
 
   PRTime end = PR_Now();
 
-  PRTime difTime = end - start;
-
-  int32_t newTime;
-  LL_L2I(newTime, difTime);
-  newTime /= aDelta;
+  int32_t newTime = int32_t(end - start) / aDelta;
 
   // average old and new
   mTimePerRow = (newTime + mTimePerRow)/2;
   
   return NS_OK;
 }
 
 nsListScrollSmoother* 
--- a/rdf/base/src/nsRDFService.cpp
+++ b/rdf/base/src/nsRDFService.cpp
@@ -239,19 +239,18 @@ struct DateHashEntry : public PLDHashEnt
     HashKey(PLDHashTable *table, const void *key)
     {
         // xor the low 32 bits with the high 32 bits.
         PRTime t = *static_cast<const PRTime *>(key);
         int64_t h64, l64;
         h64 = t >> 32;
         l64 = LL_INIT(0, 0xffffffff);
         l64 &= t;
-        int32_t h32, l32;
-        LL_L2I(h32, h64);
-        LL_L2I(l32, l64);
+        int32_t h32 = int32_t(h64);
+        int32_t l32 = int32_t(l64);
         return PLDHashNumber(l32 ^ h32);
     }
 
     static bool
     MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
                const void *key)
     {
         const DateHashEntry *entry =
--- a/rdf/datasource/src/nsFileSystemDataSource.cpp
+++ b/rdf/datasource/src/nsFileSystemDataSource.cpp
@@ -1187,19 +1187,17 @@ FileSystemDataSource::GetFileSize(nsIRDF
     if (isDir)
         return(NS_RDF_NO_VALUE);
 
     int64_t     aFileSize64;
     if (NS_FAILED(rv = aFile->GetFileSize(&aFileSize64)))
         return(rv);
 
     // convert 64bits to 32bits
-    int32_t     aFileSize32 = 0;
-    LL_L2I(aFileSize32, aFileSize64);
-
+    int32_t aFileSize32 = int32_t(aFileSize64);
     mRDFService->GetIntLiteral(aFileSize32, aResult);
 
     return(NS_OK);
 }
 
 
 
 nsresult
--- a/tools/trace-malloc/spacetrace.c
+++ b/tools/trace-malloc/spacetrace.c
@@ -3872,17 +3872,17 @@ graphFootprint(STRequest * inRequest, ST
                          ** Need to do this math in 64 bits.
                          */
                         LL_I2L(ydata64, YData[traverse]);
                         LL_I2L(spacey64, STGD_SPACE_Y);
                         LL_I2L(mem64, (maxMemory - minMemory));
 
                         in64 = ydata64 * spacey64;
                         in64 /= mem64;
-                        LL_L2I(in32, in64);
+                        in32 = int32_t(in64);
 
                         x2 = x1;
                         y2 = y1 - in32;
 
                         gdImageLine(graph, x1, y1, x2, y2, red);
                     }
                 }
 
@@ -4088,17 +4088,17 @@ graphTimeval(STRequest * inRequest, STRu
                          ** Need to do this math in 64 bits.
                          */
                         LL_I2L(ydata64, YData[traverse]);
                         LL_I2L(spacey64, STGD_SPACE_Y);
                         LL_I2L(mem64, (maxMemory - minMemory));
 
                         in64 = ydata64 * spacey64;
                         in64 /= mem64;
-                        LL_L2I(in32, in64);
+                        in32 = int32_t(in64);
 
                         x2 = x1;
                         y2 = y1 - in32;
 
                         gdImageLine(graph, x1, y1, x2, y2, red);
                     }
                 }
 
@@ -4306,17 +4306,17 @@ graphLifespan(STRequest * inRequest, STR
                          ** Need to do this math in 64 bits.
                          */
                         LL_I2L(ydata64, YData[traverse]);
                         LL_I2L(spacey64, STGD_SPACE_Y);
                         LL_I2L(mem64, (maxMemory - minMemory));
 
                         in64 = ydata64 * spacey64;
                         in64 /= mem64;
-                        LL_L2I(in32, in64);
+                        in32 = int32_t(in64);
 
                         x2 = x1;
                         y2 = y1 - in32;
 
                         gdImageLine(graph, x1, y1, x2, y2, red);
                     }
                 }
 
@@ -4538,17 +4538,17 @@ graphWeight(STRequest * inRequest, STRun
                         /*
                          ** Need to do this math in 64 bits.
                          */
                         LL_I2L(spacey64, STGD_SPACE_Y);
                         weight64 = maxWeight64 - minWeight64;
 
                         in64 = YData64[traverse] * spacey64;
                         in64 /= weight64;
-                        LL_L2I(in32, in64);
+                        in32 = int32_t(in64);
 
                         x2 = x1;
                         y2 = y1 - in32;
 
                         gdImageLine(graph, x1, y1, x2, y2, red);
                     }
                 }
 
--- a/uriloader/prefetch/nsPrefetchService.cpp
+++ b/uriloader/prefetch/nsPrefetchService.cpp
@@ -53,21 +53,19 @@ static PRLogModuleInfo *gPrefetchLog;
 //-----------------------------------------------------------------------------
 // helpers
 //-----------------------------------------------------------------------------
 
 static inline uint32_t
 PRTimeToSeconds(PRTime t_usec)
 {
     PRTime usec_per_sec;
-    uint32_t t_sec;
     LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
     t_usec /= usec_per_sec;
-    LL_L2I(t_sec, t_usec);
-    return t_sec;
+    return uint32_t(t_usec);
 }
 
 #define NowInSeconds() PRTimeToSeconds(PR_Now())
 
 //-----------------------------------------------------------------------------
 // nsPrefetchQueueEnumerator
 //-----------------------------------------------------------------------------
 class nsPrefetchQueueEnumerator MOZ_FINAL : public nsISimpleEnumerator
--- a/xpcom/glue/nsTextFormatter.cpp
+++ b/xpcom/glue/nsTextFormatter.cpp
@@ -286,20 +286,19 @@ static int cvt_ll(SprintfState *ss, int6
     ** Converting decimal is a little tricky. In the unsigned case we
     ** need to stop when we hit 10 digits. In the signed case, we can
     ** stop when the number is zero.
     */
     LL_I2L(rad, radix);
     cvt = &cvtbuf[0] + ELEMENTS_OF(cvtbuf);
     digits = 0;
     while (num != 0) {
-	int32_t digit;
 	int64_t quot, rem;
 	LL_UDIVMOD(&quot, &rem, num, rad);
-	LL_L2I(digit, rem);
+	int32_t digit = int32_t(rem);
 	*--cvt = hexp[digit & 0xf];
 	digits++;
 	num = quot;
     }
     if (digits == 0) {
 	*--cvt = '0';
 	digits++;
     }
--- a/xpcom/io/nsLocalFileOS2.cpp
+++ b/xpcom/io/nsLocalFileOS2.cpp
@@ -84,22 +84,22 @@ static void
 myLL_L2II(int64_t result, int32_t *hi, int32_t *lo )
 {
     int64_t a64, b64;  // probably could have been done with
                        // only one int64_t, but these are macros,
                        // and I am a wimp.
 
     // shift the hi word to the low word, then push it into a long.
     a64 = result >> 32;
-    LL_L2I(*hi, a64);
+    *hi = int32_t(a64);
 
     // shift the low word to the hi word first, then shift it back.
     b64 = result << 32;
     a64 = b64 >> 32;
-    LL_L2I(*lo, a64);
+    *lo = int32_t(a64);
 }
 
 // Locates the first occurrence of charToSearchFor in the stringToSearch
 static unsigned char*
 _mbschr(const unsigned char* stringToSearch, int charToSearchFor)
 {
     const unsigned char* p = stringToSearch;
 
--- a/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
+++ b/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
@@ -323,29 +323,29 @@ int main()
         printf("\t1 + 1 = %d\n", out);
     else
         printf("\tFAILED");
     int64_t one, two;
     LL_I2L(one, 1);
     LL_I2L(two, 2);
     if(NS_SUCCEEDED(test->AddTwoLLs(one,one,&out64)))
     {
-        LL_L2I(tmp32, out64);
-        printf("\t1L + 1L = %d\n", (int)tmp32);
+        tmp32 = (int)out64;
+        printf("\t1L + 1L = %d\n", tmp32);
     }
     else
         printf("\tFAILED");
     if(NS_SUCCEEDED(test->MultTwoInts(2,2,&out)))
         printf("\t2 * 2 = %d\n", out);
     else
         printf("\tFAILED");
     if(NS_SUCCEEDED(test->MultTwoLLs(two,two,&out64)))
     {
-        LL_L2I(tmp32, out64);
-        printf("\t2L * 2L = %d\n", (int)tmp32);
+        tmp32 = (int)out64;
+        printf("\t2L * 2L = %d\n", tmp32);
     }
     else
         printf("\tFAILED");
 
     double outD;
     float outF;
     int32_t outI;
     char *outS;
@@ -372,34 +372,34 @@ int main()
 
     if(NS_SUCCEEDED(test->AddManyManyFloats(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,&outF)))
         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 +1 15 + 16 + 17 + 18 + 19 + 20 = %ff\n", (double)outF);
     else
         printf("\tFAILED");
 
     if(NS_SUCCEEDED(test->AddMixedInts(1,2,3,4,5,6,7,8,9,10,&out64)))
      {
-         LL_L2I(tmp32, out64);
-         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)tmp32);
+         tmp32 = (int)out64;
+         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", tmp32);
      }
      else
          printf("\tFAILED");
  
      if(NS_SUCCEEDED(test->AddMixedInts2(1,2,3,4,5,6,7,8,9,10,&out64)))
      {
-          LL_L2I(tmp32, out64);
-         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)tmp32);
+         tmp32 = (int)out64;
+         printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", tmp32);
      }
      else
          printf("\tFAILED");
 
      if(NS_SUCCEEDED(test->AddMixedInts3(3,5,7,11,13,17,19,23,29,31,&out64)))
      {
-          LL_L2I(tmp32, out64);
-         printf("\t3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 = %d\n", (int)tmp32);
+         tmp32 = (int)out64;
+         printf("\t3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 = %d\n", tmp32);
      }
      else
          printf("\tFAILED");
 
      if(NS_SUCCEEDED(test->AddMixedFloats(1,2,3,4,5,6,7,8,9,10,11,&outD)))
          printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 = %f\n", (double)outD);
      else
          printf("\tFAILED");
--- a/xpfe/components/directory/nsDirectoryViewer.cpp
+++ b/xpfe/components/directory/nsDirectoryViewer.cpp
@@ -431,18 +431,17 @@ nsHTTPIndex::OnIndexAvailable(nsIRequest
       if (NS_FAILED(rv)) return rv;
       
       // contentlength
       int64_t size;
       rv = aIndex->GetSize(&size);
       if (NS_FAILED(rv)) return rv;
       int64_t minus1 = UINT64_MAX;
       if (size != minus1) {
-        int32_t intSize;
-        LL_L2I(intSize, size);
+        int32_t intSize = int32_t(size);
         // XXX RDF should support 64 bit integers (bug 240160)
         nsCOMPtr<nsIRDFInt> val;
         rv = mDirRDF->GetIntLiteral(intSize, getter_AddRefs(val));
         if (NS_FAILED(rv)) return rv;
         rv = Assert(entry, kNC_ContentLength, val, true);
         if (NS_FAILED(rv)) return rv;
       }