Bug 530389 - Replace PR_MIN/PR_MAX with NS_MIN/NS_MAX in /modules/plugin/, r=joshmoz
authorJae-Seong Lee-Russo <lusian@gmail.com>
Sun, 13 Dec 2009 09:32:10 -0800
changeset 35671 763b42a826498be2c917f787b283e37c8ae13af7
parent 35670 f952995d5044bd144fe27bad7084b41cb4a9b0b1
child 35672 a795d222898aacc84fcaf4b7e21f56b961669575
push id10672
push userphilringnalda@gmail.com
push dateSun, 13 Dec 2009 17:32:43 +0000
treeherdermozilla-central@e89ef920772f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoshmoz
bugs530389
milestone1.9.3a1pre
Bug 530389 - Replace PR_MIN/PR_MAX with NS_MIN/NS_MAX in /modules/plugin/, r=joshmoz
modules/plugin/base/src/nsNPAPIPluginInstance.cpp
--- a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp
+++ b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp
@@ -492,22 +492,23 @@ nsNPAPIPluginStreamListener::OnDataAvail
     // mStreamBuffer here in first ODA when length of data available
     // in input stream is known.  mStreamBuffer will be freed in DTOR.
     // we also have to remember the size of that buff to make safe
     // consecutive Read() calls form input stream into our buff.
 
     PRUint32 contentLength;
     pluginInfo->GetLength(&contentLength);
 
-    mStreamBufferSize = PR_MAX(length, contentLength);
+    mStreamBufferSize = NS_MAX(length, contentLength);
 
     // Limit the size of the initial buffer to MAX_PLUGIN_NECKO_BUFFER
     // (16k). This buffer will grow if needed, as in the case where
     // we're getting data faster than the plugin can process it.
-    mStreamBufferSize = PR_MIN(mStreamBufferSize, MAX_PLUGIN_NECKO_BUFFER);
+    mStreamBufferSize = NS_MIN(mStreamBufferSize,
+                               PRUint32(MAX_PLUGIN_NECKO_BUFFER));
 
     mStreamBuffer = (char*) PR_Malloc(mStreamBufferSize);
     if (!mStreamBuffer)
       return NS_ERROR_OUT_OF_MEMORY;
   }
   
   // prepare NPP_ calls params
   NPP npp;
@@ -552,17 +553,17 @@ nsNPAPIPluginStreamListener::OnDataAvail
         char *buf = (char*)PR_Realloc(mStreamBuffer, mStreamBufferSize);
         if (!buf)
           return NS_ERROR_OUT_OF_MEMORY;
 
         mStreamBuffer = buf;
       }
 
       PRUint32 bytesToRead =
-        PR_MIN(length, mStreamBufferSize - mStreamBufferByteCount);
+        NS_MIN(length, mStreamBufferSize - mStreamBufferByteCount);
 
       PRUint32 amountRead = 0;
       rv = input->Read(mStreamBuffer + mStreamBufferByteCount, bytesToRead,
                        &amountRead);
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (amountRead == 0) {
         NS_NOTREACHED("input->Read() returns no data, it's almost impossible "
@@ -629,17 +630,17 @@ nsNPAPIPluginStreamListener::OnDataAvail
 
           // Break out of the inner loop, but keep going through the
           // outer loop in case there's more data to read from the
           // input stream.
 
           break;
         }
 
-        numtowrite = PR_MIN(numtowrite, mStreamBufferByteCount);
+        numtowrite = NS_MIN(numtowrite, mStreamBufferByteCount);
       } else {
         // if WriteReady is not supported by the plugin, just write
         // the whole buffer
         numtowrite = mStreamBufferByteCount;
       }
 
       PRInt32 writeCount = 0; // bytes consumed by plugin instance
       NS_TRY_SAFE_CALL_RETURN(writeCount, (*callbacks->write)(npp, &mNPStream, streamPosition, numtowrite, ptrStreamBuffer), mInst->mLibrary, mInst);
@@ -655,17 +656,17 @@ nsNPAPIPluginStreamListener::OnDataAvail
         // NPP_Write(), kill the stream.
         return NS_BINDING_ABORTED;
       }
 
       if (writeCount > 0) {
         NS_ASSERTION(writeCount <= mStreamBufferByteCount,
                      "Plugin read past the end of the available data!");
 
-        writeCount = PR_MIN(writeCount, mStreamBufferByteCount);
+        writeCount = NS_MIN(writeCount, mStreamBufferByteCount);
         mStreamBufferByteCount -= writeCount;
 
         streamPosition += writeCount;
 
         zeroBytesWriteCount = 0;
 
         if (mStreamBufferByteCount > 0) {
           // This alignment code is most likely bogus, but we'll leave