Change sanitizing

Sanitize the type fix changes
Add a couple more while we are in there, really, int is not a size type.
This commit is contained in:
Alan Westbrook 2014-04-05 17:42:26 -07:00
parent 056bf29ce3
commit d483617a2b
2 changed files with 8 additions and 8 deletions

View file

@ -147,7 +147,7 @@ public:
vSeeds.push_back(CDNSSeedData("dglibrary.org", "seed.dglibrary.org"));
vSeeds.push_back(CDNSSeedData("dogechain.info", "seed.dogechain.info"));
// Boost sucks, and should not be used. Workaround for Boost not being compatible with C++11;
// Workaround for Boost not being quite compatible with C++11;
std::vector<unsigned char> pka = list_of(30);
base58Prefixes[PUBKEY_ADDRESS] = pka;
@ -170,7 +170,7 @@ public:
// it'll get a pile of addresses with newer timestamps.
// Seed nodes are given a random 'last seen time' of between one and two
// weeks ago.
const int64_t nOneWeek = 7*24*60*60;
const uint64_t nOneWeek = 7*24*60*60;
struct in_addr ip;
memcpy(&ip, &pnSeed[i], sizeof(ip));
CAddress addr(CService(ip, GetDefaultPort()));

View file

@ -223,11 +223,11 @@ uint256 CBlock::BuildMerkleTree() const
BOOST_FOREACH(const CTransaction& tx, vtx)
vMerkleTree.push_back(tx.GetHash());
int j = 0;
for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
for (size_t nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
{
for (int i = 0; i < nSize; i += 2)
for (size_t i = 0; i < nSize; i += 2)
{
int i2 = std::min(i+1, nSize-1);
size_t i2 = std::min(i+1, nSize-1);
vMerkleTree.push_back(Hash(BEGIN(vMerkleTree[j+i]), END(vMerkleTree[j+i]),
BEGIN(vMerkleTree[j+i2]), END(vMerkleTree[j+i2])));
}
@ -242,12 +242,12 @@ std::vector<uint256> CBlock::GetMerkleBranch(int nIndex) const
BuildMerkleTree();
std::vector<uint256> vMerkleBranch;
int j = 0;
size_t iH8cpp = nIndex;
size_t sizeIndex = (size_t)nIndex;
for (size_t nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
{
int i = std::min(iH8cpp^1, nSize-1);
size_t i = std::min(sizeIndex^1, nSize-1);
vMerkleBranch.push_back(vMerkleTree[j+i]);
iH8cpp >>= 1;
sizeIndex >>= 1;
j += nSize;
}
return vMerkleBranch;