diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-01-31 17:28:23 +0100 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-01-31 17:35:01 +0100 |
commit | 365539c84691d470b44d35df374d8c049f8c1192 (patch) | |
tree | 5f2644692ed3076d35347bc79cef5790681165e6 /src | |
parent | 63d4ee1968144cc3d115f92baef95785abf813ac (diff) | |
download | bitcoin-365539c84691d470b44d35df374d8c049f8c1192.tar.xz |
refactor: init vectors via std::{begin,end} to avoid pointer arithmetic
Diffstat (limited to 'src')
-rw-r--r-- | src/bench/data.cpp | 2 | ||||
-rw-r--r-- | src/chainparams.cpp | 5 | ||||
-rw-r--r-- | src/protocol.cpp | 3 |
3 files changed, 4 insertions, 6 deletions
diff --git a/src/bench/data.cpp b/src/bench/data.cpp index 0ae4c7cad4..481e372105 100644 --- a/src/bench/data.cpp +++ b/src/bench/data.cpp @@ -8,7 +8,7 @@ namespace benchmark { namespace data { #include <bench/data/block413567.raw.h> -const std::vector<uint8_t> block413567{block413567_raw, block413567_raw + sizeof(block413567_raw) / sizeof(block413567_raw[0])}; +const std::vector<uint8_t> block413567{std::begin(block413567_raw), std::end(block413567_raw)}; } // namespace data } // namespace benchmark diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 88cf5ef0a8..a991922d58 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -10,7 +10,6 @@ #include <hash.h> // for signet block challenge hash #include <tinyformat.h> #include <util/system.h> -#include <util/strencodings.h> #include <versionbitsinfo.h> #include <assert.h> @@ -136,7 +135,7 @@ public: bech32_hrp = "bc"; - vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); + vFixedSeeds = std::vector<SeedSpec6>(std::begin(pnSeed6_main), std::end(pnSeed6_main)); fDefaultConsistencyChecks = false; fRequireStandard = true; @@ -237,7 +236,7 @@ public: bech32_hrp = "tb"; - vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test)); + vFixedSeeds = std::vector<SeedSpec6>(std::begin(pnSeed6_test), std::end(pnSeed6_test)); fDefaultConsistencyChecks = false; fRequireStandard = false; diff --git a/src/protocol.cpp b/src/protocol.cpp index 56e738eaa8..0b893b9272 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -5,7 +5,6 @@ #include <protocol.h> -#include <util/strencodings.h> #include <util/system.h> static std::atomic<bool> g_initial_block_download_completed(false); @@ -86,7 +85,7 @@ const static std::string allNetMessageTypes[] = { NetMsgType::CFCHECKPT, NetMsgType::WTXIDRELAY, }; -const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes+ARRAYLEN(allNetMessageTypes)); +const static std::vector<std::string> allNetMessageTypesVec(std::begin(allNetMessageTypes), std::end(allNetMessageTypes)); CMessageHeader::CMessageHeader() { |