Bug 792581 - part 5: Replace LL_CMP macro with standard comparison. r=ehsan
authorAndrew Quartey <andrew.quartey@gmail.com>
Wed, 03 Oct 2012 10:13:19 -0400
changeset 109179 586070a8d3f1001aa5173574102cdc4f49e88480
parent 109178 bb806f6be5d0d995d910ecae9bb9690fa77d513a
child 109180 066fea4aa2855a092e6479058329ae8cff01550e
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersehsan
bugs792581
milestone18.0a1
Bug 792581 - part 5: Replace LL_CMP macro with standard comparison. r=ehsan
content/base/src/nsContentSink.cpp
docshell/shistory/src/nsSHistory.cpp
dom/plugins/base/nsPluginHost.cpp
js/xpconnect/loader/mozJSComponentLoader.cpp
netwerk/cache/nsCacheService.cpp
netwerk/protocol/http/nsHttpResponseHead.cpp
security/manager/ssl/src/TransportSecurityInfo.cpp
security/manager/ssl/src/nsCRLManager.cpp
toolkit/components/filepicker/nsFileView.cpp
toolkit/components/places/nsNavHistoryResult.cpp
widget/xpwidgets/nsTransferable.cpp
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -1270,17 +1270,17 @@ nsContentSink::IsTimeToNotify()
   }
 
   PRTime now = PR_Now();
   int64_t interval, diff;
 
   LL_I2L(interval, GetNotificationInterval());
   LL_SUB(diff, now, mLastNotificationTime);
 
-  if (LL_CMP(diff, >, interval)) {
+  if (diff > interval) {
     mBackoffCount--;
     return true;
   }
 
   return false;
 }
 
 nsresult
--- a/docshell/shistory/src/nsSHistory.cpp
+++ b/docshell/shistory/src/nsSHistory.cpp
@@ -285,17 +285,17 @@ nsSHistory::CalcMaxTotalViewers()
   uint64_t bytes = PR_GetPhysicalMemorySize();
 
   if (bytes == 0)
     return 0;
 
   // 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 (LL_CMP(bytes, >, INT64_MAX))
+  if (bytes > INT64_MAX)
     bytes = INT64_MAX;
 
   uint64_t kbytes;
   LL_SHR(kbytes, bytes, 10);
 
   double kBytesD;
   LL_L2D(kBytesD, (int64_t) kbytes);
 
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1978,17 +1978,17 @@ int64_t GetPluginLastModifiedTime(const 
   return fileModTime;
 }
 
 struct CompareFilesByTime 
 {
   bool 
   LessThan(const nsCOMPtr<nsIFile>& a, const nsCOMPtr<nsIFile>& b) const 
   {
-    return LL_CMP(GetPluginLastModifiedTime(a), <, GetPluginLastModifiedTime(b));
+    return GetPluginLastModifiedTime(a) < GetPluginLastModifiedTime(b);
   }
 
   bool
   Equals(const nsCOMPtr<nsIFile>& a, const nsCOMPtr<nsIFile>& b) const
   {
     return GetPluginLastModifiedTime(a) == GetPluginLastModifiedTime(b);
   }
 };
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -739,17 +739,17 @@ mozJSComponentLoader::GlobalForLocation(
             rv = aComponentFile->GetFileSize(&fileSize);
             if (NS_FAILED(rv)) {
                 JS_SetOptions(cx, oldopts);
                 return rv;
             }
 
             int64_t maxSize;
             LL_UI2L(maxSize, UINT32_MAX);
-            if (LL_CMP(fileSize, >, maxSize)) {
+            if (fileSize > maxSize) {
                 NS_ERROR("file too large");
                 JS_SetOptions(cx, oldopts);
                 return NS_ERROR_FAILURE;
             }
 
             PRFileDesc *fileHandle;
             rv = aComponentFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fileHandle);
             if (NS_FAILED(rv)) {
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -937,17 +937,17 @@ nsCacheProfilePrefObserver::MemoryCacheC
     // 32 MB of RAM. We use a low default to have a reasonable
     // size on all the devices we support.
     if (bytes == 0)
         bytes = 32 * 1024 * 1024;
 
     // 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 (LL_CMP(bytes, >, INT64_MAX))
+    if (bytes > INT64_MAX)
         bytes = INT64_MAX;
 
     uint64_t kbytes;
     LL_SHR(kbytes, bytes, 10);
 
     double kBytesD;
     LL_L2D(kBytesD, (int64_t) kbytes);
 
--- a/netwerk/protocol/http/nsHttpResponseHead.cpp
+++ b/netwerk/protocol/http/nsHttpResponseHead.cpp
@@ -530,17 +530,17 @@ nsHttpResponseHead::GetExpiresValue(uint
     PRStatus st = PR_ParseTimeString(val, true, &time);
     if (st != PR_SUCCESS) {
         // parsing failed... RFC 2616 section 14.21 says we should treat this
         // as an expiration time in the past.
         *result = 0;
         return NS_OK;
     }
 
-    if (LL_CMP(time, <, LL_Zero()))
+    if (time < LL_Zero())
         *result = 0;
     else
         *result = PRTimeToSeconds(time); 
     return NS_OK;
 }
 
 int64_t
 nsHttpResponseHead::TotalEntitySize() const
--- a/security/manager/ssl/src/TransportSecurityInfo.cpp
+++ b/security/manager/ssl/src/TransportSecurityInfo.cpp
@@ -925,17 +925,17 @@ GetDateBoundary(nsIX509Cert* ix509,
   if (NS_FAILED(rv))
     return;
 
   rv = validity->GetNotBefore(&notBefore);
   if (NS_FAILED(rv))
     return;
 
   PRTime now = PR_Now();
-  if (LL_CMP(now, >, notAfter)) {
+  if (now > notAfter) {
     timeToUse = notAfter;
   } else {
     timeToUse = notBefore;
     trueExpired_falseNotYetValid = false;
   }
 
   nsCOMPtr<nsIDateTimeFormat> dateTimeFormat(do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &rv));
   if (NS_FAILED(rv))
--- a/security/manager/ssl/src/nsCRLManager.cpp
+++ b/security/manager/ssl/src/nsCRLManager.cpp
@@ -226,17 +226,17 @@ done:
       if(NS_SUCCEEDED(ComputeNextAutoUpdateTime(crlData, timingTypePref, dayCnt, &updateTime))){
         updateTimeStr.AssignWithConversion(updateTime);
         pref->SetCharPref(updateTimePrefStr.get(),updateTimeStr.get());
         //Now, check if this update time is already in the past. This would
         //imply we have downloaded the same crl, or there is something wrong
         //with the next update date. We will not reschedule this crl in this
         //session anymore - or else, we land into a loop. It would anyway be
         //imported once the browser is restarted.
-        if(LL_CMP(updateTime, > , PR_Now())){
+        if(int64_t(updateTime) > int64_t(PR_Now())){
           toBeRescheduled = true;
         }
         nsMemory::Free(updateTime);
       }
       
       //Update the url to download from, next time
       crlData->GetLastFetchURL(updateURL);
       pref->SetCharPref(updateUrlPrefStr.get(),updateURL.get());
@@ -428,18 +428,18 @@ nsCRLManager::ComputeNextAutoUpdateTime(
     LL_SUB(tempTime, nextUpdate, microsecInDayCnt);
     break;
   default:
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   //Now, a basic constraing is that the next auto update date can never be after
   //next update, if one is defined
-  if(LL_CMP(nextUpdate , > , 0 )) {
-    if(LL_CMP(tempTime , > , nextUpdate)) {
+  if(nextUpdate > 0) {
+    if(tempTime > nextUpdate) {
       tempTime = nextUpdate;
     }
   }
 
   // Return value as string; no pref type for Int64/PRTime
   char *tempTimeStr = PR_smprintf("%lli", tempTime);
   *nextAutoUpdate = ToNewUnicode(nsDependentCString(tempTimeStr));
   PR_smprintf_free(tempTimeStr);
--- a/toolkit/components/filepicker/nsFileView.cpp
+++ b/toolkit/components/filepicker/nsFileView.cpp
@@ -932,33 +932,33 @@ SortSizeCallback(const void* aElement1, 
 
   int64_t size1, size2;
   file1->GetFileSize(&size1);
   file2->GetFileSize(&size2);
 
   if (size1 == size2)
     return 0;
 
-  return (LL_CMP(size1, <, size2) ? -1 : 1);
+  return size1 < size2 ? -1 : 1;
 }
 
 static int
 SortDateCallback(const void* aElement1, const void* aElement2, void* aContext)
 {
   nsIFile* file1 = *static_cast<nsIFile* const *>(aElement1);
   nsIFile* file2 = *static_cast<nsIFile* const *>(aElement2);
 
   PRTime time1, time2;
   file1->GetLastModifiedTime(&time1);
   file2->GetLastModifiedTime(&time2);
 
   if (time1 == time2)
     return 0;
 
-  return (LL_CMP(time1, <, time2) ? -1 : 1);
+  return time1 < time2 ? -1 : 1;
 }
 
 void
 nsFileView::SortArray(nsISupportsArray* aArray)
 {
   // We assume the array to be in filesystem order, which
   // for our purposes, is completely unordered.
 
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -53,19 +53,19 @@
 
 // Number of changes to handle separately in a batch.  If more changes are
 // requested the node will switch to full refresh mode.
 #define MAX_BATCH_CHANGES_BEFORE_REFRESH 5
 
 // Emulate string comparison (used for sorting) for PRTime and int.
 inline int32_t ComparePRTime(PRTime a, PRTime b)
 {
-  if (LL_CMP(a, <, b))
+  if (a < b)
     return -1;
-  else if (LL_CMP(a, >, b))
+  else if (a > b)
     return 1;
   return 0;
 }
 inline int32_t CompareIntegers(uint32_t a, uint32_t b)
 {
   return a - b;
 }
 
--- a/widget/xpwidgets/nsTransferable.cpp
+++ b/widget/xpwidgets/nsTransferable.cpp
@@ -173,17 +173,17 @@ DataStruct::ReadCache(nsISupports** aDat
   // get the path and file name
   nsCOMPtr<nsIFile> cacheFile ( getter_AddRefs(GetFileSpec(mCacheFileName)) );
   bool exists;
   if ( cacheFile && NS_SUCCEEDED(cacheFile->Exists(&exists)) && exists ) {
     // get the size of the file
     int64_t fileSize;
     int64_t max32(LL_INIT(0, 0xFFFFFFFF));
     cacheFile->GetFileSize(&fileSize);
-    if (LL_CMP(fileSize, >, max32))
+    if (fileSize > max32)
       return NS_ERROR_OUT_OF_MEMORY;
     uint32_t size;
     LL_L2UI(size, fileSize);
 
     // create new memory for the large clipboard data
     nsAutoArrayPtr<char> data(new char[size]);
     if ( !data )
       return NS_ERROR_OUT_OF_MEMORY;