diff --git a/security/manager/boot/src/nsEntropyCollector.cpp b/security/manager/boot/src/nsEntropyCollector.cpp index fae8f69083fd..292510420646 100644 --- a/security/manager/boot/src/nsEntropyCollector.cpp +++ b/security/manager/boot/src/nsEntropyCollector.cpp @@ -40,6 +40,7 @@ #include "prlog.h" #include "nsEntropyCollector.h" #include "nsMemory.h" +#include "nsAlgorithm.h" nsEntropyCollector::nsEntropyCollector() :mBytesCollected(0), mWritePointer(mEntropyCache) @@ -72,10 +73,11 @@ nsEntropyCollector::RandomUpdate(void *new_entropy, PRInt32 bufLen) const unsigned char *PastEndPointer = mEntropyCache + entropy_buffer_size; // if the input is large, we only take as much as we can store - PRInt32 bytes_wanted = PR_MIN(bufLen, entropy_buffer_size); + PRInt32 bytes_wanted = NS_MIN(bufLen, PRInt32(entropy_buffer_size)); // remember the number of bytes we will have after storing new_entropy - mBytesCollected = PR_MIN(entropy_buffer_size, mBytesCollected + bytes_wanted); + mBytesCollected = NS_MIN(PRInt32(entropy_buffer_size), + mBytesCollected + bytes_wanted); // as the above statements limit bytes_wanted to the entropy_buffer_size, // this loop will iterate at most twice. @@ -85,7 +87,7 @@ nsEntropyCollector::RandomUpdate(void *new_entropy, PRInt32 bufLen) const PRInt32 space_to_end = PastEndPointer - mWritePointer; // how many bytes can we copy, not reaching the end of the buffer? - const PRInt32 this_time = PR_MIN(space_to_end, bytes_wanted); + const PRInt32 this_time = NS_MIN(space_to_end, bytes_wanted); // copy at most to the end of the cyclic buffer for (PRInt32 i = 0; i < this_time; ++i) { diff --git a/security/manager/ssl/src/nsNSSCertHelper.cpp b/security/manager/ssl/src/nsNSSCertHelper.cpp index 52bfcb050a19..108af3197d51 100644 --- a/security/manager/ssl/src/nsNSSCertHelper.cpp +++ b/security/manager/ssl/src/nsNSSCertHelper.cpp @@ -247,7 +247,7 @@ GetDefaultOIDFormat(SECItem *oid, if (!invalid) { if (first) { - unsigned long one = PR_MIN(val/40, 2); // never > 2 + unsigned long one = NS_MIN(val/40, 2UL); // never > 2 unsigned long two = val - (one * 40); written = PR_snprintf(&buf[len], sizeof(buf)-len, "%lu%c%lu", diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp index 775e5109f713..cd924bdd3709 100644 --- a/security/manager/ssl/src/nsNSSComponent.cpp +++ b/security/manager/ssl/src/nsNSSComponent.cpp @@ -2771,7 +2771,7 @@ nsCryptoHash::UpdateFromStream(nsIInputStream *data, PRUint32 len) while(NS_SUCCEEDED(rv) && len>0) { - readLimit = PR_MIN(NS_CRYPTO_HASH_BUFFER_SIZE, len); + readLimit = NS_MIN(PRUint32(NS_CRYPTO_HASH_BUFFER_SIZE), len); rv = data->Read(buffer, readLimit, &read); @@ -2963,7 +2963,7 @@ NS_IMETHODIMP nsCryptoHMAC::UpdateFromStream(nsIInputStream *aStream, PRUint32 a while(NS_SUCCEEDED(rv) && aLen > 0) { - readLimit = PR_MIN(NS_CRYPTO_HASH_BUFFER_SIZE, aLen); + readLimit = NS_MIN(PRUint32(NS_CRYPTO_HASH_BUFFER_SIZE), aLen); rv = aStream->Read(buffer, readLimit, &read); if (read == 0)