Cleared signed/unsigned warnings under Visual Studio.

This commit is contained in:
Jeffrey Walton 2015-07-20 01:15:35 -04:00
parent 8e51ab9623
commit 417994ca6a
4 changed files with 13 additions and 13 deletions

View File

@ -32,12 +32,12 @@ void ARC4_Base::UncheckedSetKey(const byte *key, unsigned int keyLen, const Name
unsigned int i;
for (i=0; i<256; i++)
m_state[i] = i;
m_state[i] = byte(i);
unsigned int keyIndex = 0, stateIndex = 0;
for (i=0; i<256; i++)
{
unsigned int a = m_state[i];
byte a = m_state[i];
stateIndex += key[keyIndex] + a;
stateIndex &= 0xff;
m_state[i] = m_state[stateIndex];
@ -53,9 +53,9 @@ void ARC4_Base::UncheckedSetKey(const byte *key, unsigned int keyLen, const Name
template <class T>
static inline unsigned int MakeByte(T &x, T &y, byte *s)
{
unsigned int a = s[x];
byte a = s[x];
y = (y+a) & 0xff;
unsigned int b = s[y];
byte b = s[y];
s[x] = b;
s[y] = a;
x = (x+1) & 0xff;
@ -65,7 +65,7 @@ static inline unsigned int MakeByte(T &x, T &y, byte *s)
void ARC4_Base::GenerateBlock(byte *output, size_t size)
{
while (size--)
*output++ = MakeByte(m_x, m_y, m_state);
*output++ = (byte)MakeByte(m_x, m_y, m_state);
}
void ARC4_Base::ProcessData(byte *outString, const byte *inString, size_t length)
@ -93,8 +93,8 @@ void ARC4_Base::ProcessData(byte *outString, const byte *inString, size_t length
while(--length);
}
m_x = x;
m_y = y;
m_x = byte(x);
m_y = byte(y);
}
void ARC4_Base::DiscardBytes(size_t length)
@ -112,8 +112,8 @@ void ARC4_Base::DiscardBytes(size_t length)
}
while(--length);
m_x = x;
m_y = y;
m_x = byte(x);
m_y = byte(y);
}
}

View File

@ -379,7 +379,7 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo
if (m_possiblePadding)
{
size_t len = find_if(begin, end, bind2nd(not_equal_to<byte>(), 0)) - begin;
size_t len = find_if(begin, end, bind2nd(not_equal_to<byte>(), byte(0))) - begin;
m_zeroCount += len;
begin += len;
if (begin == end)
@ -400,7 +400,7 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo
#else
typedef reverse_iterator<const byte *> RevIt;
#endif
const byte *x = find_if(RevIt(end), RevIt(begin), bind2nd(not_equal_to<byte>(), 0)).base();
const byte *x = find_if(RevIt(end), RevIt(begin), bind2nd(not_equal_to<byte>(), byte(0))).base();
if (x != begin && *(x-1) == 1)
{
AttachedTransformation()->Put(begin, x-begin-1);

View File

@ -81,7 +81,7 @@ DecodingResult OAEP_Base::Unpad(const byte *oaepBlock, size_t oaepBlockLen, byte
// DB = pHash' || 00 ... || 01 || M
byte *M = std::find(maskedDB+hLen, maskedDB+dbLen, 0x01);
invalid = (M == maskedDB+dbLen) || invalid;
invalid = (std::find_if(maskedDB+hLen, M, std::bind2nd(std::not_equal_to<byte>(), 0)) != M) || invalid;
invalid = (std::find_if(maskedDB+hLen, M, std::bind2nd(std::not_equal_to<byte>(), byte(0))) != M) || invalid;
invalid = !pHash->VerifyDigest(maskedDB, encodingParameters.begin(), encodingParameters.size()) || invalid;
if (invalid)

View File

@ -1287,7 +1287,7 @@ bool ValidateBaseCode()
bool pass = true, fail;
byte data[255];
for (unsigned int i=0; i<255; i++)
data[i] = i;
data[i] = byte(i);
static const char *hexEncoded =
"000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627"
"28292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F"