Bug 552329: Fix compile warnings in xpcshell test TestOOM.cpp. r=dougt, test-only change on CLOSED TREE to see if tinderbox still wants to be red UPDATE_PACKAGING_R10 UPDATE_PACKAGING_R11 UPDATE_PACKAGING_R11_1_MU UPDATE_PACKAGING_R12 UPDATE_PACKAGING_R13 UPDATE_PACKAGING_R9
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 16 Mar 2010 10:42:51 -0700
changeset 39480 138f593553b66c9f815e8f57870c19d6347f7702
parent 39479 050887c641832a1775d0f431bee86c6ee555c3c8
child 39481 666d585616edda8fefb91878772d4f097f851c97
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersdougt, test-only
bugs552329
milestone1.9.3a4pre
Bug 552329: Fix compile warnings in xpcshell test TestOOM.cpp. r=dougt, test-only change on CLOSED TREE to see if tinderbox still wants to be red
xpcom/tests/TestOOM.cpp
--- a/xpcom/tests/TestOOM.cpp
+++ b/xpcom/tests/TestOOM.cpp
@@ -57,47 +57,48 @@ int main(int argc, char **argv)
 
   // allocation note.  don't use nsIMemory to allocate,
   // because we want to test the isLowMemory predicate
   // without regard for the nsIMemory impelmentation (the
   // implementation might count bytes handed out.  however,
   // the predicate should work with out having to rely on
   // that.
   void *big_alloc = malloc(1024 * 1024 * 16);
+  (void)big_alloc; // Tell compiler we're not using big_alloc, to fix warning
 
   const int highpower = 500000;
   
   char* buffers[highpower];
   for (int i=0; i<highpower; i++)
     buffers[i] = nsnull;
   
   for (int i=0; i<highpower; i++)
   {
     PRBool lowMem = PR_FALSE;
     size_t s = 4096; //pow(2,i);
     buffers[i] = (char*) malloc(s);
     
     // You have to touch the buffer
     if (!buffers[i])
-      printf("Could not allocate a buffer of size %ld\n", s);
+      printf("Could not allocate a buffer of size %lu\n", (unsigned long)s);
     else
     {
-      for (int j=0; j<s; j++)
+      for (size_t j=0; j<s; j++)
         buffers[i][j] = 'a';
     }
    
     PRIntervalTime start = PR_IntervalNow();
     mem->IsLowMemory(&lowMem);
     PRIntervalTime cost = PR_IntervalNow() - start;
     
     
-    printf("Total Allocated: %ld. \tLow Memory now?  %s\t Took (%d)\n",
-           s*i,
-	   lowMem ? "Yes" : "No",
-	   PR_IntervalToMilliseconds(cost));
+    printf("Total Allocated: %lu. \tLow Memory now?  %s\t Took (%d)\n",
+           (unsigned long)s*i,
+           lowMem ? "Yes" : "No",
+           PR_IntervalToMilliseconds(cost));
   
     if (lowMem)
       break;
   }
 
   for(int i=0; i<highpower; i++)
   {
     if (buffers[i])