1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Correct -Wsign-compare warnings

Corrected -Wsign-compare warnings on ESP8266 under platformio.

/home/travis/.platformio/lib/Crypto_ID1168/RNG.cpp: In member function 'void RNGClass::rand(uint8_t*, size_t)':
/home/travis/.platformio/lib/Crypto_ID1168/RNG.cpp:574:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (len > (credits / 8))
^
/home/travis/.platformio/lib/Crypto_ID1168/RNG.cpp: In member function 'bool RNGClass::available(size_t) const':
/home/travis/.platformio/lib/Crypto_ID1168/RNG.cpp:665:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
return len <= (credits / 8);
^
/home/travis/.platformio/lib/Crypto_ID1168/RNG.cpp: In member function 'void RNGClass::stir(const uint8_t*, size_t, unsigned int)':
/home/travis/.platformio/lib/Crypto_ID1168/RNG.cpp:698:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((RNG_MAX_CREDITS - credits) > credit)
^
This commit is contained in:
Chris 2018-04-23 13:41:37 -05:00 committed by GitHub
parent c0d7de6d49
commit a707bc36b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,7 +173,7 @@ RNGClass RNG;
#define RNG_REKEY_BLOCKS 16
// Maximum entropy credit that can be contained in the pool.
#define RNG_MAX_CREDITS 384
#define RNG_MAX_CREDITS 384u
/** @cond */
@ -571,7 +571,7 @@ void RNGClass::rand(uint8_t *data, size_t len)
begin(0);
// Decrease the amount of entropy in the pool.
if (len > (credits / 8))
if (len > (credits / 8u))
credits = 0;
else
credits -= len * 8;
@ -662,7 +662,7 @@ bool RNGClass::available(size_t len) const
if (len >= (RNG_MAX_CREDITS / 8))
return credits >= RNG_MAX_CREDITS;
else
return len <= (credits / 8);
return len <= (credits / 8u);
}
/**