X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fuint256.h;h=6215b9630e900ddd411231f315d22ff905009792;hb=66116c3847eeb3f0619bc084d96f5add41a156c8;hp=cfc2eb128eba49aaf5cdba3c3fb5b5be0f3d3ca2;hpb=6b8de05d0a6696dff4b7dccec5b74889f3cdc486;p=novacoin.git diff --git a/src/uint256.h b/src/uint256.h index cfc2eb1..6215b96 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -8,6 +8,7 @@ #include "serialize.h" #include +#include #include #include @@ -287,7 +288,7 @@ public: std::string GetHex() const { char psz[sizeof(pn)*2 + 1]; - for (int i = 0; i < sizeof(pn); i++) + for (unsigned int i = 0; i < sizeof(pn); i++) sprintf(psz + i*2, "%02x", ((unsigned char*)pn)[sizeof(pn) - i - 1]); return std::string(psz, psz + sizeof(pn)*2); } @@ -306,9 +307,9 @@ public: psz += 2; // 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 }; + static unsigned 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;