зеркало из https://github.com/mozilla/gecko-dev.git
backout changeset 9a0a17e18b72 - wrong commit info
This commit is contained in:
Родитель
f0d566b42c
Коммит
5ebad349f1
|
@ -40,7 +40,6 @@
|
|||
#include "prlog.h"
|
||||
#include "nsEntropyCollector.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsAlgorithm.h"
|
||||
|
||||
nsEntropyCollector::nsEntropyCollector()
|
||||
:mBytesCollected(0), mWritePointer(mEntropyCache)
|
||||
|
@ -73,11 +72,10 @@ 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 = NS_MIN(bufLen, PRInt32(entropy_buffer_size));
|
||||
PRInt32 bytes_wanted = PR_MIN(bufLen, entropy_buffer_size);
|
||||
|
||||
// remember the number of bytes we will have after storing new_entropy
|
||||
mBytesCollected = NS_MIN(PRInt32(entropy_buffer_size),
|
||||
mBytesCollected + bytes_wanted);
|
||||
mBytesCollected = PR_MIN(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.
|
||||
|
@ -87,7 +85,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 = NS_MIN(space_to_end, bytes_wanted);
|
||||
const PRInt32 this_time = PR_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 = NS_MIN(val/40, 2UL); // never > 2
|
||||
unsigned long one = PR_MIN(val/40, 2); // 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 = NS_MIN(PRUint32(NS_CRYPTO_HASH_BUFFER_SIZE), len);
|
||||
readLimit = PR_MIN(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 = NS_MIN(PRUint32(NS_CRYPTO_HASH_BUFFER_SIZE), aLen);
|
||||
readLimit = PR_MIN(NS_CRYPTO_HASH_BUFFER_SIZE, aLen);
|
||||
|
||||
rv = aStream->Read(buffer, readLimit, &read);
|
||||
if (read == 0)
|
||||
|
|
Загрузка…
Ссылка в новой задаче