Skip to content

Commit 3fb81a8

Browse files
Use list initialization (C++11) for maps/vectors instead of boost::assign::map_list_of/list_of
1 parent 1b708f2 commit 3fb81a8

16 files changed

+108
-124
lines changed

src/bitcoin-tx.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <stdio.h>
2525

2626
#include <boost/algorithm/string.hpp>
27-
#include <boost/assign/list_of.hpp>
2827

2928
static bool fCreateBlank;
3029
static std::map<std::string,UniValue> registers;
@@ -546,7 +545,11 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
546545
if (!prevOut.isObject())
547546
throw std::runtime_error("expected prevtxs internal object");
548547

549-
std::map<std::string,UniValue::VType> types = boost::assign::map_list_of("txid", UniValue::VSTR)("vout",UniValue::VNUM)("scriptPubKey",UniValue::VSTR);
548+
std::map<std::string, UniValue::VType> types = {
549+
{"txid", UniValue::VSTR},
550+
{"vout", UniValue::VNUM},
551+
{"scriptPubKey", UniValue::VSTR},
552+
};
550553
if (!prevOut.checkObject(types))
551554
throw std::runtime_error("prevtxs internal object typecheck fail");
552555

src/chainparams.cpp

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
#include <assert.h>
1414

15-
#include <boost/assign/list_of.hpp>
16-
1715
#include "chainparamsseeds.h"
1816

1917
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
@@ -136,8 +134,8 @@ class CMainParams : public CChainParams {
136134
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
137135
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
138136
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128);
139-
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >();
140-
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >();
137+
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
138+
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};
141139

142140
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
143141

@@ -146,20 +144,21 @@ class CMainParams : public CChainParams {
146144
fMineBlocksOnDemand = false;
147145

148146
checkpointData = (CCheckpointData) {
149-
boost::assign::map_list_of
150-
( 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
151-
( 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))
152-
( 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20"))
153-
(105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97"))
154-
(134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))
155-
(168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))
156-
(193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))
157-
(210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e"))
158-
(216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e"))
159-
(225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))
160-
(250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214"))
161-
(279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40"))
162-
(295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983"))
147+
{
148+
{ 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")},
149+
{ 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")},
150+
{ 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")},
151+
{105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")},
152+
{134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")},
153+
{168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")},
154+
{193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317")},
155+
{210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e")},
156+
{216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e")},
157+
{225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932")},
158+
{250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214")},
159+
{279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40")},
160+
{295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")},
161+
}
163162
};
164163

165164
chainTxData = ChainTxData{
@@ -234,8 +233,8 @@ class CTestNetParams : public CChainParams {
234233
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
235234
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
236235
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
237-
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
238-
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
236+
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
237+
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
239238

240239
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
241240

@@ -245,8 +244,9 @@ class CTestNetParams : public CChainParams {
245244

246245

247246
checkpointData = (CCheckpointData) {
248-
boost::assign::map_list_of
249-
( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")),
247+
{
248+
{546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")},
249+
}
250250
};
251251

252252
chainTxData = ChainTxData{
@@ -313,9 +313,10 @@ class CRegTestParams : public CChainParams {
313313
fRequireStandard = false;
314314
fMineBlocksOnDemand = true;
315315

316-
checkpointData = (CCheckpointData){
317-
boost::assign::map_list_of
318-
( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"))
316+
checkpointData = (CCheckpointData) {
317+
{
318+
{0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")},
319+
}
319320
};
320321

321322
chainTxData = ChainTxData{
@@ -327,8 +328,8 @@ class CRegTestParams : public CChainParams {
327328
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
328329
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
329330
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
330-
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
331-
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
331+
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
332+
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
332333
}
333334
};
334335

src/core_read.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <boost/algorithm/string/predicate.hpp>
1919
#include <boost/algorithm/string/replace.hpp>
2020
#include <boost/algorithm/string/split.hpp>
21-
#include <boost/assign/list_of.hpp>
2221

2322
CScript ParseScript(const std::string& s)
2423
{

src/core_write.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "utilmoneystr.h"
1616
#include "utilstrencodings.h"
1717

18-
#include <boost/assign/list_of.hpp>
1918
#include <boost/foreach.hpp>
2019

2120
std::string FormatScript(const CScript& script)
@@ -53,15 +52,14 @@ std::string FormatScript(const CScript& script)
5352
return ret.substr(0, ret.size() - 1);
5453
}
5554

56-
const std::map<unsigned char, std::string> mapSigHashTypes =
57-
boost::assign::map_list_of
58-
(static_cast<unsigned char>(SIGHASH_ALL), std::string("ALL"))
59-
(static_cast<unsigned char>(SIGHASH_ALL|SIGHASH_ANYONECANPAY), std::string("ALL|ANYONECANPAY"))
60-
(static_cast<unsigned char>(SIGHASH_NONE), std::string("NONE"))
61-
(static_cast<unsigned char>(SIGHASH_NONE|SIGHASH_ANYONECANPAY), std::string("NONE|ANYONECANPAY"))
62-
(static_cast<unsigned char>(SIGHASH_SINGLE), std::string("SINGLE"))
63-
(static_cast<unsigned char>(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY), std::string("SINGLE|ANYONECANPAY"))
64-
;
55+
const std::map<unsigned char, std::string> mapSigHashTypes = {
56+
{static_cast<unsigned char>(SIGHASH_ALL), std::string("ALL")},
57+
{static_cast<unsigned char>(SIGHASH_ALL|SIGHASH_ANYONECANPAY), std::string("ALL|ANYONECANPAY")},
58+
{static_cast<unsigned char>(SIGHASH_NONE), std::string("NONE")},
59+
{static_cast<unsigned char>(SIGHASH_NONE|SIGHASH_ANYONECANPAY), std::string("NONE|ANYONECANPAY")},
60+
{static_cast<unsigned char>(SIGHASH_SINGLE), std::string("SINGLE")},
61+
{static_cast<unsigned char>(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY), std::string("SINGLE|ANYONECANPAY")},
62+
};
6563

6664
/**
6765
* Create the assembly string representation of a CScript object.

src/qt/coincontroldialog.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#include "validation.h" // For mempool
2121
#include "wallet/wallet.h"
2222

23-
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
24-
2523
#include <QApplication>
2624
#include <QCheckBox>
2725
#include <QCursor>

src/rpc/mining.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include <memory>
2828
#include <stdint.h>
2929

30-
#include <boost/assign/list_of.hpp>
31-
3230
#include <univalue.h>
3331

3432
/**
@@ -819,7 +817,7 @@ UniValue estimatefee(const JSONRPCRequest& request)
819817
+ HelpExampleCli("estimatefee", "6")
820818
);
821819

822-
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM));
820+
RPCTypeCheck(request.params, {UniValue::VNUM});
823821

824822
int nBlocks = request.params[0].get_int();
825823
if (nBlocks < 1)
@@ -860,7 +858,7 @@ UniValue estimatesmartfee(const JSONRPCRequest& request)
860858
+ HelpExampleCli("estimatesmartfee", "6")
861859
);
862860

863-
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM));
861+
RPCTypeCheck(request.params, {UniValue::VNUM});
864862

865863
int nBlocks = request.params[0].get_int();
866864
bool conservative = true;
@@ -917,7 +915,7 @@ UniValue estimaterawfee(const JSONRPCRequest& request)
917915
+ HelpExampleCli("estimaterawfee", "6 0.9 1")
918916
);
919917

920-
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM)(UniValue::VNUM)(UniValue::VNUM), true);
918+
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VNUM, UniValue::VNUM}, true);
921919
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
922920
int nBlocks = request.params[0].get_int();
923921
double threshold = 0.95;

src/rpc/misc.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include <malloc.h>
2828
#endif
2929

30-
#include <boost/assign/list_of.hpp>
31-
3230
#include <univalue.h>
3331

3432
/**
@@ -472,7 +470,7 @@ UniValue setmocktime(const JSONRPCRequest& request)
472470
// ensure all call sites of GetTime() are accessing this safely.
473471
LOCK(cs_main);
474472

475-
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM));
473+
RPCTypeCheck(request.params, {UniValue::VNUM});
476474
SetMockTime(request.params[0].get_int64());
477475

478476
return NullUniValue;

src/rpc/rawtransaction.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
#include <stdint.h>
3232

33-
#include <boost/assign/list_of.hpp>
34-
3533
#include <univalue.h>
3634

3735

@@ -325,7 +323,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
325323
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"")
326324
);
327325

328-
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VARR)(UniValue::VOBJ)(UniValue::VNUM), true);
326+
RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VOBJ, UniValue::VNUM}, true);
329327
if (request.params[0].isNull() || request.params[1].isNull())
330328
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, arguments 1 and 2 must be non-null");
331329

@@ -456,7 +454,7 @@ UniValue decoderawtransaction(const JSONRPCRequest& request)
456454
);
457455

458456
LOCK(cs_main);
459-
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR));
457+
RPCTypeCheck(request.params, {UniValue::VSTR});
460458

461459
CMutableTransaction mtx;
462460

@@ -494,7 +492,7 @@ UniValue decodescript(const JSONRPCRequest& request)
494492
+ HelpExampleRpc("decodescript", "\"hexstring\"")
495493
);
496494

497-
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR));
495+
RPCTypeCheck(request.params, {UniValue::VSTR});
498496

499497
UniValue r(UniValue::VOBJ);
500498
CScript script;
@@ -605,7 +603,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
605603
#else
606604
LOCK(cs_main);
607605
#endif
608-
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)(UniValue::VARR)(UniValue::VARR)(UniValue::VSTR), true);
606+
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VARR, UniValue::VSTR}, true);
609607

610608
std::vector<unsigned char> txData(ParseHexV(request.params[0], "argument 1"));
611609
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
@@ -740,15 +738,14 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
740738

741739
int nHashType = SIGHASH_ALL;
742740
if (request.params.size() > 3 && !request.params[3].isNull()) {
743-
static std::map<std::string, int> mapSigHashValues =
744-
boost::assign::map_list_of
745-
(std::string("ALL"), int(SIGHASH_ALL))
746-
(std::string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY))
747-
(std::string("NONE"), int(SIGHASH_NONE))
748-
(std::string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY))
749-
(std::string("SINGLE"), int(SIGHASH_SINGLE))
750-
(std::string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY))
751-
;
741+
static std::map<std::string, int> mapSigHashValues = {
742+
{std::string("ALL"), int(SIGHASH_ALL)},
743+
{std::string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY)},
744+
{std::string("NONE"), int(SIGHASH_NONE)},
745+
{std::string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY)},
746+
{std::string("SINGLE"), int(SIGHASH_SINGLE)},
747+
{std::string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY)},
748+
};
752749
std::string strHashType = request.params[3].get_str();
753750
if (mapSigHashValues.count(strHashType))
754751
nHashType = mapSigHashValues[strHashType];
@@ -830,7 +827,7 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
830827
);
831828

832829
LOCK(cs_main);
833-
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)(UniValue::VBOOL));
830+
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL});
834831

835832
// parse hex string from parameter
836833
CMutableTransaction mtx;

src/test/DoS_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include <stdint.h>
2020

21-
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
2221
#include <boost/date_time/posix_time/posix_time_types.hpp>
2322
#include <boost/foreach.hpp>
2423
#include <boost/test/unit_test.hpp>

src/test/crypto_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include <vector>
1919

20-
#include <boost/assign/list_of.hpp>
2120
#include <boost/test/unit_test.hpp>
2221
#include <openssl/aes.h>
2322
#include <openssl/evp.h>

0 commit comments

Comments
 (0)