Bug 530300: Replace PR_MIN/PR_MAX with NS_MIN/NS_MAX in /dom r=peterv
authorJae-Seong Lee-Russo <lusian@gmail.com>
Sat, 20 Feb 2010 08:59:07 -0500
changeset 38330 f8a43ae32718a6610f004bcfd133504f8f5c752c
parent 38329 a537a070dbf40081e1d32321924b6589b271574e
child 38331 5729dd173cab6808a264f6889588df6918cf1e63
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerspeterv
bugs530300
milestone1.9.3a2pre
Bug 530300: Replace PR_MIN/PR_MAX with NS_MIN/NS_MAX in /dom r=peterv
dom/base/nsDOMWindowUtils.cpp
dom/base/nsFocusManager.cpp
dom/base/nsGlobalWindow.cpp
dom/src/geolocation/nsGeolocation.cpp
dom/src/json/nsJSON.cpp
dom/src/threads/nsDOMWorkerTimeout.cpp
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -697,20 +697,20 @@ nsDOMWindowUtils::CompareCanvases(nsIDOM
     v = memcmp(p1, p2, stride);
 
     if (v) {
       for (int i = 0; i < size.width; i++) {
         if (*(PRUint32*) p1 != *(PRUint32*) p2) {
 
           different++;
 
-          dc = PR_MAX(abs(p1[0] - p2[0]), dc);
-          dc = PR_MAX(abs(p1[1] - p2[1]), dc);
-          dc = PR_MAX(abs(p1[2] - p2[2]), dc);
-          dc = PR_MAX(abs(p1[3] - p2[3]), dc);
+          dc = NS_MAX((PRUint32)abs(p1[0] - p2[0]), dc);
+          dc = NS_MAX((PRUint32)abs(p1[1] - p2[1]), dc);
+          dc = NS_MAX((PRUint32)abs(p1[2] - p2[2]), dc);
+          dc = NS_MAX((PRUint32)abs(p1[3] - p2[3]), dc);
         }
 
         p1 += 4;
         p2 += 4;
       }
     }
   }
 
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -1197,17 +1197,17 @@ nsFocusManager::GetCommonAncestor(nsPIDO
     dsti2->GetParent(getter_AddRefs(parentDsti2));
     dsti2.swap(parentDsti2);
   } while (dsti2);
 
   PRUint32 pos1 = parents1.Length();
   PRUint32 pos2 = parents2.Length();
   nsIDocShellTreeItem* parent = nsnull;
   PRUint32 len;
-  for (len = PR_MIN(pos1, pos2); len > 0; --len) {
+  for (len = NS_MIN(pos1, pos2); len > 0; --len) {
     nsIDocShellTreeItem* child1 = parents1.ElementAt(--pos1);
     nsIDocShellTreeItem* child2 = parents2.ElementAt(--pos2);
     if (child1 != child2) {
       break;
     }
     parent = child1;
   }
 
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -3743,20 +3743,20 @@ nsGlobalWindow::GetScrollMaxXY(PRInt32* 
   FlushPendingNotifications(Flush_Layout);
   nsIScrollableFrame *sf = GetScrollFrame();
   if (!sf)
     return NS_OK;
 
   nsRect scrollRange = sf->GetScrollRange();
 
   if (aScrollMaxX)
-    *aScrollMaxX = PR_MAX(0,
+    *aScrollMaxX = NS_MAX(0,
       (PRInt32)floor(nsPresContext::AppUnitsToFloatCSSPixels(scrollRange.XMost())));
   if (aScrollMaxY)
-    *aScrollMaxY = PR_MAX(0,
+    *aScrollMaxY = NS_MAX(0,
       (PRInt32)floor(nsPresContext::AppUnitsToFloatCSSPixels(scrollRange.YMost())));
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScrollMaxX(PRInt32* aScrollMaxX)
 {
@@ -9091,18 +9091,18 @@ nsGlobalWindow::ResumeTimeouts(PRBool aT
       }
 
       // Make sure to cast the unsigned PR_USEC_PER_MSEC to signed
       // PRTime to make the division do the right thing on 64-bit
       // platforms whether t->mWhen is positive or negative (which is
       // likely to always be positive here, but cast anyways for
       // consistency).
       PRUint32 delay =
-        PR_MAX(((PRUint32)(t->mWhen / (PRTime)PR_USEC_PER_MSEC)),
-                DOM_MIN_TIMEOUT_VALUE);
+        NS_MAX(((PRUint32)(t->mWhen / (PRTime)PR_USEC_PER_MSEC)),
+               (PRUint32)DOM_MIN_TIMEOUT_VALUE);
 
       // Set mWhen back to the time when the timer is supposed to
       // fire.
       t->mWhen += now;
 
       t->mTimer = do_CreateInstance("@mozilla.org/timer;1");
       NS_ENSURE_TRUE(t->mTimer, NS_ERROR_OUT_OF_MEMORY);
 
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -543,17 +543,17 @@ nsGeolocationService::IsBetterPosition(n
   double rOldLat = oldLat * radsInDeg;
   double rOldLon = oldLon * radsInDeg;
 
   // WGS84 equatorial radius of earth = 6378137m
   double delta = acos( (sin(rNewLat) * sin(rOldLat)) + (cos(rNewLat) * cos(rOldLat) * cos(rOldLon - rNewLon)) ) * 6378137; 
 
   // The threshold is when the distance between the two positions exceeds the
   // worse (larger value) of the two accuracies.
-  double max_accuracy = PR_MAX(oldAccuracy, newAccuracy);
+  double max_accuracy = NS_MAX(oldAccuracy, newAccuracy);
   if (delta > max_accuracy)
     return PR_TRUE;
 
   // check to see if the aSomewhere position is more accurate
   if (oldAccuracy >= newAccuracy)
     return PR_TRUE;
 
   return PR_FALSE;
--- a/dom/src/json/nsJSON.cpp
+++ b/dom/src/json/nsJSON.cpp
@@ -602,17 +602,17 @@ nsJSONListener::OnDataAvailable(nsIReque
       return NS_OK;
   }
   
   char buffer[JSON_STREAM_BUFSIZE];
   unsigned long bytesRemaining = aLength - mSniffBuffer.Length();
   while (bytesRemaining) {
     unsigned int bytesRead;
     rv = aStream->Read(buffer,
-                       PR_MIN(sizeof(buffer), bytesRemaining),
+                       NS_MIN((unsigned long)sizeof(buffer), bytesRemaining),
                        &bytesRead);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = ProcessBytes(buffer, bytesRead);
     NS_ENSURE_SUCCESS(rv, rv);
     bytesRemaining -= bytesRead;
   }
 
   return rv;
--- a/dom/src/threads/nsDOMWorkerTimeout.cpp
+++ b/dom/src/threads/nsDOMWorkerTimeout.cpp
@@ -114,17 +114,17 @@ nsDOMWorkerTimeout::FunctionCallback::~F
 {
   MOZ_COUNT_DTOR(nsDOMWorkerTimeout::FunctionCallback);
 }
 
 nsresult
 nsDOMWorkerTimeout::FunctionCallback::Run(nsDOMWorkerTimeout* aTimeout,
                                           JSContext* aCx)
 {
-  PRInt32 lateness = PR_MAX(0, PRInt32(PR_Now() - aTimeout->mTargetTime)) /
+  PRInt32 lateness = NS_MAX(0, PRInt32(PR_Now() - aTimeout->mTargetTime)) /
                      (PRTime)PR_USEC_PER_MSEC;
   mCallbackArgs[mCallbackArgsLength - 1] = INT_TO_JSVAL(lateness);
 
   JSObject* global = JS_GetGlobalObject(aCx);
   NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
 
   nsTArray<jsval> argv;
   PRBool success = argv.SetCapacity(mCallbackArgsLength);
@@ -378,17 +378,17 @@ nsDOMWorkerTimeout::Suspend()
 
   if (!mStarted) {
     mSuspendedBeforeStart = PR_TRUE;
     return;
   }
 
   mTimer->Cancel();
 
-  mSuspendInterval = PR_MAX(0, PRInt32(mTargetTime - PR_Now())) /
+  mSuspendInterval = NS_MAX(0, PRInt32(mTargetTime - PR_Now())) /
                      (PRTime)PR_USEC_PER_MSEC;
 
   LOG(("Worker [0x%p] suspending timeout [0x%p] with id %u (interval = %u)",
        static_cast<void*>(mWorker.get()), static_cast<void*>(this), mId,
        mSuspendInterval));
 }
 
 void