From: Wladimir J. van der Laan Date: Sun, 15 Apr 2012 10:22:30 +0000 (+0200) Subject: fix warnings: array subscript is of type 'char' [-Wchar-subscripts] X-Git-Tag: v0.4.0-unstable~129^2~72^2~6 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=8add7822cef7d39cb761f59e6b837159a4968982 fix warnings: array subscript is of type 'char' [-Wchar-subscripts] --- diff --git a/src/bignum.h b/src/bignum.h index 95e2197..daf5f68 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -301,7 +301,7 @@ public: while (isxdigit(*psz)) { *this <<= 4; - int n = phexdigit[*psz++]; + int n = phexdigit[(unsigned char)*psz++]; *this += n; } if (fNegative) diff --git a/src/uint256.h b/src/uint256.h index cfc2eb1..0947816 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -308,7 +308,7 @@ public: // hex string to uint static char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 }; const char* pbegin = psz; - while (phexdigit[*psz] || *psz == '0') + while (phexdigit[(unsigned char)*psz] || *psz == '0') psz++; psz--; unsigned char* p1 = (unsigned char*)pn; diff --git a/src/util.cpp b/src/util.cpp index 1eda59b..a5427c0 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -636,7 +636,7 @@ vector DecodeBase64(const char* p, bool* pfInvalid) while (1) { - int dec = decode64_table[*p]; + int dec = decode64_table[(unsigned char)*p]; if (dec == -1) break; p++; switch (mode) @@ -676,12 +676,12 @@ vector DecodeBase64(const char* p, bool* pfInvalid) break; case 2: // 4n+2 base64 characters processed: require '==' - if (left || p[0] != '=' || p[1] != '=' || decode64_table[p[2]] != -1) + if (left || p[0] != '=' || p[1] != '=' || decode64_table[(unsigned char)p[2]] != -1) *pfInvalid = true; break; case 3: // 4n+3 base64 characters processed: require '=' - if (left || p[0] != '=' || decode64_table[p[1]] != -1) + if (left || p[0] != '=' || decode64_table[(unsigned char)p[1]] != -1) *pfInvalid = true; break; }