diff --git a/src/bench/base58.cpp b/src/bench/base58.cpp index 65e27a615d934..c74a958c8b179 100644 --- a/src/bench/base58.cpp +++ b/src/bench/base58.cpp @@ -22,7 +22,7 @@ static void Base58Encode(benchmark::State& state) } }; while (state.KeepRunning()) { - EncodeBase58(buff.begin(), buff.end()); + EncodeBase58(buff.data(), buff.data() + buff.size()); } } diff --git a/src/bench/checkqueue.cpp b/src/bench/checkqueue.cpp index b7ae5c2d572d4..94064c9ca67c9 100644 --- a/src/bench/checkqueue.cpp +++ b/src/bench/checkqueue.cpp @@ -19,7 +19,7 @@ static const int MIN_CORES = 2; static const size_t BATCHES = 101; static const size_t BATCH_SIZE = 30; static const int PREVECTOR_SIZE = 28; -static const int QUEUE_BATCH_SIZE = 128; +static const unsigned int QUEUE_BATCH_SIZE = 128; static void CCheckQueueSpeed(benchmark::State& state) { struct FakeJobNoWork { diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 299a3795ce43f..70e7fdf9d05ab 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -404,7 +404,7 @@ class CMainParams : public CChainParams { nMinSporkKeys = 1; fBIP9CheckMasternodesUpgraded = true; - checkpointData = (CCheckpointData) { + checkpointData = { { {1500, uint256S("0x000000aaf0300f59f49bc3e970bad15c11f961fe2347accffff19d96ec9778e3")}, {4991, uint256S("0x000000003b01809551952460744d5dbb8fcbd6cbae3c220267bf7fa43f837367")}, @@ -580,7 +580,7 @@ class CTestNetParams : public CChainParams { nMinSporkKeys = 1; fBIP9CheckMasternodesUpgraded = true; - checkpointData = (CCheckpointData) { + checkpointData = { { {261, uint256S("0x00000c26026d0815a7e2ce4fa270775f61403c040647ff2c3091f99e894a4618")}, {1999, uint256S("0x00000052e538d27fa53693efe6fb6892a0c1d26c0235f599171c48a3cce553b1")}, @@ -848,7 +848,7 @@ class CRegTestParams : public CChainParams { // regtest usually has no masternodes in most tests, so don't check for upgraged MNs fBIP9CheckMasternodesUpgraded = false; - checkpointData = (CCheckpointData) { + checkpointData = { { {0, uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e")}, } diff --git a/src/compat.h b/src/compat.h index bc59357435c2d..799aff55709ab 100644 --- a/src/compat.h +++ b/src/compat.h @@ -41,6 +41,7 @@ #include #include #include +#include #else #include #include @@ -81,6 +82,15 @@ typedef unsigned int SOCKET; #else #define MAX_PATH 1024 #endif +#ifdef _MSC_VER +#if !defined(ssize_t) +#ifdef _WIN64 +typedef int64_t ssize_t; +#else +typedef int32_t ssize_t; +#endif +#endif +#endif #if HAVE_DECL_STRNLEN == 0 size_t strnlen( const char *start, size_t max_len); diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 1042ba6a9a5f9..553d2c74813c7 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -64,7 +64,7 @@ std::atomic nTimeBestReceived(0); // Used only to inform the wallet of struct IteratorComparator { template - bool operator()(const I& a, const I& b) + bool operator()(const I& a, const I& b) const { return &(*a) < &(*b); } diff --git a/src/random.h b/src/random.h index 60fa404758c37..059a552803505 100644 --- a/src/random.h +++ b/src/random.h @@ -138,7 +138,7 @@ class FastRandomContext { * sure that the underlying OS APIs for all platforms support the number. * (many cap out at 256 bytes). */ -static const ssize_t NUM_OS_RANDOM_BYTES = 32; +static const int NUM_OS_RANDOM_BYTES = 32; /** Get 32 bytes of system entropy. Do not use this in application code: use * GetStrongRandBytes instead. diff --git a/src/support/cleanse.cpp b/src/support/cleanse.cpp index 95899c9f02d96..eb6e0a73a2082 100644 --- a/src/support/cleanse.cpp +++ b/src/support/cleanse.cpp @@ -7,6 +7,10 @@ #include +#if defined(_MSC_VER) +#include // For SecureZeroMemory. +#endif + /* Compilers have a bad habit of removing "superfluous" memset calls that * are trying to zero memory. For example, when memset()ing a buffer and * then free()ing it, the compiler might decide that the memset is @@ -32,7 +36,7 @@ void memory_cleanse(void *ptr, size_t len) might try to eliminate "superfluous" memsets. If there's an easy way to detect memset_s, it would be better to use that. */ #if defined(_MSC_VER) - __asm; + SecureZeroMemory(ptr, len); #else __asm__ __volatile__("" : : "r"(ptr) : "memory"); #endif diff --git a/src/test/checkqueue_tests.cpp b/src/test/checkqueue_tests.cpp index 185c5bd3973d6..0ada66a3b5575 100644 --- a/src/test/checkqueue_tests.cpp +++ b/src/test/checkqueue_tests.cpp @@ -24,7 +24,7 @@ // otherwise. BOOST_FIXTURE_TEST_SUITE(checkqueue_tests, TestingSetup) -static const int QUEUE_BATCH_SIZE = 128; +static const unsigned int QUEUE_BATCH_SIZE = 128; struct FakeCheck { bool operator()()