Bug 530384 - Replace PR_MIN/PR_MAX with NS_MIN/NS_MAX in security/manager. r=kaie

This commit is contained in:
Marco Bonardo 2010-06-17 21:46:24 +02:00
Родитель ea13bb5f1d
Коммит 64d6e856c2
3 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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",

Просмотреть файл

@ -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)