Cleared signed/unsigned warning on IncrementCounterByOne

reviewable/pr7/r1
Jeffrey Walton 2015-07-12 18:32:10 -04:00
parent 02dff96e97
commit 12931b3301
1 changed files with 3 additions and 3 deletions

6
misc.h
View File

@ -464,16 +464,16 @@ CRYPTOPP_DLL void CRYPTOPP_API CallNewHandler();
inline void IncrementCounterByOne(byte *inout, unsigned int s) inline void IncrementCounterByOne(byte *inout, unsigned int s)
{ {
for (int i=s-1, carry=1; i>=0 && carry; i--) for (int i=static_cast<int>(s)-1, carry=1; i>=0 && carry; i--)
carry = !++inout[i]; carry = !++inout[i];
} }
inline void IncrementCounterByOne(byte *output, const byte *input, unsigned int s) inline void IncrementCounterByOne(byte *output, const byte *input, unsigned int s)
{ {
int i, carry; int i, carry;
for (i=s-1, carry=1; i>=0 && carry; i--) for (i=static_cast<int>(s)-1, carry=1; i>=0 && carry; i--)
carry = ((output[i] = input[i]+1) == 0); carry = ((output[i] = input[i]+1) == 0);
memcpy_s(output, s, input, i+1); memcpy_s(output, s, input, static_cast<size_t>(i)+1);
} }
template <class T> template <class T>