Clear uninitialized variable warnings under xlC

pull/489/head
Jeffrey Walton 2017-09-01 20:37:23 -04:00
parent 602fa05825
commit d2ad6751d5
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
4 changed files with 13 additions and 11 deletions

View File

@ -76,7 +76,7 @@ bool BERLengthDecode(BufferedTransformation &bt, lword &length, bool &definiteLe
bool BERLengthDecode(BufferedTransformation &bt, size_t &length) bool BERLengthDecode(BufferedTransformation &bt, size_t &length)
{ {
lword lw = 0; lword lw = 0;
bool definiteLength; bool definiteLength = false;
if (!BERLengthDecode(bt, lw, definiteLength)) if (!BERLengthDecode(bt, lw, definiteLength))
BERDecodeError(); BERDecodeError();
if (!SafeConvert(lw, length)) if (!SafeConvert(lw, length))
@ -343,7 +343,7 @@ void EncodedObjectFilter::Put(const byte *inString, size_t length)
break; break;
} }
ByteQueue::Walker walker(m_queue); ByteQueue::Walker walker(m_queue);
bool definiteLength; bool definiteLength = false;
if (!BERLengthDecode(walker, m_lengthRemaining, definiteLength)) if (!BERLengthDecode(walker, m_lengthRemaining, definiteLength))
return; return;
m_queue.TransferTo(CurrentTarget(), walker.GetCurrentPosition()); m_queue.TransferTo(CurrentTarget(), walker.GetCurrentPosition());

View File

@ -100,7 +100,7 @@ void CAST128::Base::UncheckedSetKey(const byte *userKey, unsigned int keylength,
reduced = (keylength <= 10); reduced = (keylength <= 10);
word32 X[4], Z[4]; word32 X[4], Z[4]={0};
GetUserKey(BIG_ENDIAN_ORDER, X, 4, userKey, keylength); GetUserKey(BIG_ENDIAN_ORDER, X, 4, userKey, keylength);
#define x(i) GETBYTE(X[i/4], 3-i%4) #define x(i) GETBYTE(X[i/4], 3-i%4)

View File

@ -261,7 +261,7 @@ ANONYMOUS_NAMESPACE_BEGIN
void SHA256_HashBlock_CXX(word32 *state, const word32 *data) void SHA256_HashBlock_CXX(word32 *state, const word32 *data)
{ {
word32 W[16], T[8]; word32 W[16]={0}, T[8];
/* Copy context->state[] to working vars */ /* Copy context->state[] to working vars */
memcpy(T, state, sizeof(T)); memcpy(T, state, sizeof(T));
/* 64 operations, partially loop unrolled */ /* 64 operations, partially loop unrolled */
@ -1043,8 +1043,7 @@ void SHA512_HashBlock_CXX(word64 *state, const word64 *data)
CRYPTOPP_ASSERT(state); CRYPTOPP_ASSERT(state);
CRYPTOPP_ASSERT(data); CRYPTOPP_ASSERT(data);
word64 W[16]; word64 W[16]={0}, T[8];
word64 T[8];
/* Copy context->state[] to working vars */ /* Copy context->state[] to working vars */
memcpy(T, state, sizeof(T)); memcpy(T, state, sizeof(T));
/* 80 operations, partially loop unrolled */ /* 80 operations, partially loop unrolled */

View File

@ -377,6 +377,7 @@ void Inflator::DecodeHeader()
throw UnexpectedEndErr(); throw UnexpectedEndErr();
m_eof = m_reader.GetBits(1) != 0; m_eof = m_reader.GetBits(1) != 0;
m_blockType = (byte)m_reader.GetBits(2); m_blockType = (byte)m_reader.GetBits(2);
switch (m_blockType) switch (m_blockType)
{ {
case 0: // stored case 0: // stored
@ -400,13 +401,13 @@ void Inflator::DecodeHeader()
unsigned int hlit = m_reader.GetBits(5); unsigned int hlit = m_reader.GetBits(5);
unsigned int hdist = m_reader.GetBits(5); unsigned int hdist = m_reader.GetBits(5);
unsigned int hclen = m_reader.GetBits(4); unsigned int hclen = m_reader.GetBits(4);
unsigned int i = 0;
FixedSizeSecBlock<unsigned int, 286+32> codeLengths; FixedSizeSecBlock<unsigned int, 286+32> codeLengths;
unsigned int i;
static const unsigned int border[] = { // Order of the bit length code lengths static const unsigned int border[] = { // Order of the bit length code lengths
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
std::fill(codeLengths.begin(), codeLengths+19, 0); std::fill(codeLengths.begin(), codeLengths+19, 0);
for (i=0; i<hclen+4; i++) for (i=0; i<hclen+4; ++i)
{ {
CRYPTOPP_ASSERT(border[i] < codeLengths.size()); CRYPTOPP_ASSERT(border[i] < codeLengths.size());
codeLengths[border[i]] = m_reader.GetBits(3); codeLengths[border[i]] = m_reader.GetBits(3);
@ -414,11 +415,13 @@ void Inflator::DecodeHeader()
try try
{ {
bool result = false;
unsigned int k=0, count=0, repeater=0;
HuffmanDecoder codeLengthDecoder(codeLengths, 19); HuffmanDecoder codeLengthDecoder(codeLengths, 19);
for (i = 0; i < hlit+257+hdist+1; ) for (i=0; i < hlit+257+hdist+1; )
{ {
unsigned int k = 0, count = 0, repeater = 0; k = 0, count = 0, repeater = 0;
bool result = codeLengthDecoder.Decode(m_reader, k); result = codeLengthDecoder.Decode(m_reader, k);
if (!result) if (!result)
throw UnexpectedEndErr(); throw UnexpectedEndErr();
if (k <= 15) if (k <= 15)