From d483617a2b821292277a8ef486f05bc4f0daecec Mon Sep 17 00:00:00 2001 From: Alan Westbrook Date: Sat, 5 Apr 2014 17:42:26 -0700 Subject: [PATCH] Change sanitizing Sanitize the type fix changes Add a couple more while we are in there, really, int is not a size type. --- src/chainparams.cpp | 4 ++-- src/core.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index da1fb48fa..77e84ed71 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -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 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())); diff --git a/src/core.cpp b/src/core.cpp index 1818c0305..7c0172f2d 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -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 CBlock::GetMerkleBranch(int nIndex) const BuildMerkleTree(); std::vector 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;