Browse Source

namespace: drop most boost namespaces and a few header cleanups

A few boost::asio were left around because they're very wordy otherwise.
0.13
Cory Fields 10 years ago
parent
commit
856e862f4a
  1. 3
      src/bitcoin-tx.cpp
  2. 21
      src/chainparams.cpp
  3. 4
      src/chainparamsbase.cpp
  4. 13
      src/core_read.cpp
  5. 1
      src/rpcmisc.cpp
  6. 1
      src/rpcprotocol.cpp
  7. 17
      src/rpcrawtransaction.cpp
  8. 7
      src/rpcwallet.cpp
  9. 1
      src/test/bloom_tests.cpp
  10. 7
      src/test/script_tests.cpp
  11. 3
      src/test/transaction_tests.cpp

3
src/bitcoin-tx.cpp

@ -22,7 +22,6 @@ @@ -22,7 +22,6 @@
#include <boost/algorithm/string.hpp>
#include <boost/assign/list_of.hpp>
using namespace boost::assign;
using namespace std;
static bool fCreateBlank;
@ -375,7 +374,7 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr) @@ -375,7 +374,7 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)
if (!prevOut.isObject())
throw runtime_error("expected prevtxs internal object");
map<string,UniValue::VType> types = map_list_of("txid", UniValue::VSTR)("vout",UniValue::VNUM)("scriptPubKey",UniValue::VSTR);
map<string,UniValue::VType> types = boost::assign::map_list_of("txid", UniValue::VSTR)("vout",UniValue::VNUM)("scriptPubKey",UniValue::VSTR);
if (!prevOut.checkObject(types))
throw runtime_error("prevtxs internal object typecheck fail");

21
src/chainparams.cpp

@ -14,7 +14,6 @@ @@ -14,7 +14,6 @@
#include <boost/assign/list_of.hpp>
using namespace std;
using namespace boost::assign;
struct SeedSpec6 {
uint8_t addr[16];
@ -158,11 +157,11 @@ public: @@ -158,11 +157,11 @@ public:
vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com"));
vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org"));
base58Prefixes[PUBKEY_ADDRESS] = list_of(0);
base58Prefixes[SCRIPT_ADDRESS] = list_of(5);
base58Prefixes[SECRET_KEY] = list_of(128);
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E);
base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4);
base58Prefixes[PUBKEY_ADDRESS] = boost::assign::list_of(0);
base58Prefixes[SCRIPT_ADDRESS] = boost::assign::list_of(5);
base58Prefixes[SECRET_KEY] = boost::assign::list_of(128);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E);
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4);
convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main));
@ -217,11 +216,11 @@ public: @@ -217,11 +216,11 @@ public:
vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me"));
vSeeds.push_back(CDNSSeedData("bitcoin.schildbach.de", "testnet-seed.bitcoin.schildbach.de"));
base58Prefixes[PUBKEY_ADDRESS] = list_of(111);
base58Prefixes[SCRIPT_ADDRESS] = list_of(196);
base58Prefixes[SECRET_KEY] = list_of(239);
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x35)(0x87)(0xCF);
base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x35)(0x83)(0x94);
base58Prefixes[PUBKEY_ADDRESS] = boost::assign::list_of(111);
base58Prefixes[SCRIPT_ADDRESS] = boost::assign::list_of(196);
base58Prefixes[SECRET_KEY] = boost::assign::list_of(239);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF);
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94);
convertSeed6(vFixedSeeds, pnSeed6_test, ARRAYLEN(pnSeed6_test));

4
src/chainparamsbase.cpp

@ -9,10 +9,6 @@ @@ -9,10 +9,6 @@
#include <assert.h>
#include <boost/assign/list_of.hpp>
using namespace boost::assign;
/**
* Main network
*/

13
src/core_read.cpp

@ -20,7 +20,6 @@ @@ -20,7 +20,6 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/assign/list_of.hpp>
using namespace boost::algorithm;
using namespace std;
CScript ParseScript(std::string s)
@ -43,13 +42,13 @@ CScript ParseScript(std::string s) @@ -43,13 +42,13 @@ CScript ParseScript(std::string s)
string strName(name);
mapOpNames[strName] = (opcodetype)op;
// Convenience: OP_ADD and just ADD are both recognized:
replace_first(strName, "OP_", "");
boost::algorithm::replace_first(strName, "OP_", "");
mapOpNames[strName] = (opcodetype)op;
}
}
vector<string> words;
split(words, s, is_any_of(" \t\n"), token_compress_on);
boost::algorithm::split(words, s, boost::algorithm::is_any_of(" \t\n"), boost::algorithm::token_compress_on);
for (std::vector<std::string>::const_iterator w = words.begin(); w != words.end(); ++w)
{
@ -57,20 +56,20 @@ CScript ParseScript(std::string s) @@ -57,20 +56,20 @@ CScript ParseScript(std::string s)
{
// Empty string, ignore. (boost::split given '' will return one word)
}
else if (all(*w, is_digit()) ||
(starts_with(*w, "-") && all(string(w->begin()+1, w->end()), is_digit())))
else if (all(*w, boost::algorithm::is_digit()) ||
(boost::algorithm::starts_with(*w, "-") && all(string(w->begin()+1, w->end()), boost::algorithm::is_digit())))
{
// Number
int64_t n = atoi64(*w);
result << n;
}
else if (starts_with(*w, "0x") && (w->begin()+2 != w->end()) && IsHex(string(w->begin()+2, w->end())))
else if (boost::algorithm::starts_with(*w, "0x") && (w->begin()+2 != w->end()) && IsHex(string(w->begin()+2, w->end())))
{
// Raw hex data, inserted NOT pushed onto stack:
std::vector<unsigned char> raw = ParseHex(string(w->begin()+2, w->end()));
result.insert(result.end(), raw.begin(), raw.end());
}
else if (w->size() >= 2 && starts_with(*w, "'") && ends_with(*w, "'"))
else if (w->size() >= 2 && boost::algorithm::starts_with(*w, "'") && boost::algorithm::ends_with(*w, "'"))
{
// Single-quoted string, pushed as data. NOTE: this is poor-man's
// parsing, spaces/tabs/newlines in single-quoted strings won't work.

1
src/rpcmisc.cpp

@ -23,7 +23,6 @@ @@ -23,7 +23,6 @@
#include "json/json_spirit_utils.h"
#include "json/json_spirit_value.h"
using namespace boost::assign;
using namespace json_spirit;
using namespace std;

1
src/rpcprotocol.cpp

@ -26,7 +26,6 @@ @@ -26,7 +26,6 @@
#include "json/json_spirit_writer_template.h"
using namespace std;
using namespace boost::asio;
using namespace json_spirit;
//! Number of bytes to allocate and read at most at once in post data

17
src/rpcrawtransaction.cpp

@ -25,7 +25,6 @@ @@ -25,7 +25,6 @@
#include "json/json_spirit_utils.h"
#include "json/json_spirit_value.h"
using namespace boost::assign;
using namespace json_spirit;
using namespace std;
@ -231,7 +230,7 @@ Value listunspent(const Array& params, bool fHelp) @@ -231,7 +230,7 @@ Value listunspent(const Array& params, bool fHelp)
+ HelpExampleRpc("listunspent", "6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"")
);
RPCTypeCheck(params, list_of(int_type)(int_type)(array_type));
RPCTypeCheck(params, boost::assign::list_of(int_type)(int_type)(array_type));
int nMinDepth = 1;
if (params.size() > 0)
@ -335,7 +334,7 @@ Value createrawtransaction(const Array& params, bool fHelp) @@ -335,7 +334,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"")
);
RPCTypeCheck(params, list_of(array_type)(obj_type));
RPCTypeCheck(params, boost::assign::list_of(array_type)(obj_type));
Array inputs = params[0].get_array();
Object sendTo = params[1].get_obj();
@ -429,7 +428,7 @@ Value decoderawtransaction(const Array& params, bool fHelp) @@ -429,7 +428,7 @@ Value decoderawtransaction(const Array& params, bool fHelp)
+ HelpExampleRpc("decoderawtransaction", "\"hexstring\"")
);
RPCTypeCheck(params, list_of(str_type));
RPCTypeCheck(params, boost::assign::list_of(str_type));
CTransaction tx;
@ -467,7 +466,7 @@ Value decodescript(const Array& params, bool fHelp) @@ -467,7 +466,7 @@ Value decodescript(const Array& params, bool fHelp)
+ HelpExampleRpc("decodescript", "\"hexstring\"")
);
RPCTypeCheck(params, list_of(str_type));
RPCTypeCheck(params, boost::assign::list_of(str_type));
Object r;
CScript script;
@ -533,7 +532,7 @@ Value signrawtransaction(const Array& params, bool fHelp) @@ -533,7 +532,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
+ HelpExampleRpc("signrawtransaction", "\"myhex\"")
);
RPCTypeCheck(params, list_of(str_type)(array_type)(array_type)(str_type), true);
RPCTypeCheck(params, boost::assign::list_of(str_type)(array_type)(array_type)(str_type), true);
vector<unsigned char> txData(ParseHexV(params[0], "argument 1"));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
@ -605,7 +604,7 @@ Value signrawtransaction(const Array& params, bool fHelp) @@ -605,7 +604,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
Object prevOut = p.get_obj();
RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type));
RPCTypeCheck(prevOut, boost::assign::map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type));
uint256 txid = ParseHashO(prevOut, "txid");
@ -633,7 +632,7 @@ Value signrawtransaction(const Array& params, bool fHelp) @@ -633,7 +632,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
// if redeemScript given and not using the local wallet (private keys
// given), add redeemScript to the tempKeystore so it can be signed:
if (fGivenKeys && scriptPubKey.IsPayToScriptHash()) {
RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
RPCTypeCheck(prevOut, boost::assign::map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
Value v = find_value(prevOut, "redeemScript");
if (!(v == Value::null)) {
vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
@ -723,7 +722,7 @@ Value sendrawtransaction(const Array& params, bool fHelp) @@ -723,7 +722,7 @@ Value sendrawtransaction(const Array& params, bool fHelp)
+ HelpExampleRpc("sendrawtransaction", "\"signedhex\"")
);
RPCTypeCheck(params, list_of(str_type)(bool_type));
RPCTypeCheck(params, boost::assign::list_of(str_type)(bool_type));
// parse hex string from parameter
CTransaction tx;

7
src/rpcwallet.cpp

@ -23,7 +23,6 @@ @@ -23,7 +23,6 @@
#include "json/json_spirit_value.h"
using namespace std;
using namespace boost::assign;
using namespace json_spirit;
int64_t nWalletUnlockTime;
@ -1872,9 +1871,9 @@ Value lockunspent(const Array& params, bool fHelp) @@ -1872,9 +1871,9 @@ Value lockunspent(const Array& params, bool fHelp)
);
if (params.size() == 1)
RPCTypeCheck(params, list_of(bool_type));
RPCTypeCheck(params, boost::assign::list_of(bool_type));
else
RPCTypeCheck(params, list_of(bool_type)(array_type));
RPCTypeCheck(params, boost::assign::list_of(bool_type)(array_type));
bool fUnlock = params[0].get_bool();
@ -1891,7 +1890,7 @@ Value lockunspent(const Array& params, bool fHelp) @@ -1891,7 +1890,7 @@ Value lockunspent(const Array& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected object");
const Object& o = output.get_obj();
RPCTypeCheck(o, map_list_of("txid", str_type)("vout", int_type));
RPCTypeCheck(o, boost::assign::map_list_of("txid", str_type)("vout", int_type));
string txid = find_value(o, "txid").get_str();
if (!IsHex(txid))

1
src/test/bloom_tests.cpp

@ -20,7 +20,6 @@ @@ -20,7 +20,6 @@
#include <boost/tuple/tuple.hpp>
using namespace std;
using namespace boost::tuples;
BOOST_AUTO_TEST_SUITE(bloom_tests)

7
src/test/script_tests.cpp

@ -23,12 +23,6 @@ @@ -23,12 +23,6 @@
#include <string>
#include <vector>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
#include "json/json_spirit_reader_template.h"
@ -37,7 +31,6 @@ @@ -37,7 +31,6 @@
using namespace std;
using namespace json_spirit;
using namespace boost::algorithm;
// Uncomment if you want to output updated JSON tests.
// #define UPDATE_JSON_TESTS

3
src/test/transaction_tests.cpp

@ -24,7 +24,6 @@ @@ -24,7 +24,6 @@
using namespace std;
using namespace json_spirit;
using namespace boost::algorithm;
// In script_tests.cpp
extern Array read_json(const std::string& jsondata);
@ -47,7 +46,7 @@ unsigned int ParseScriptFlags(string strFlags) @@ -47,7 +46,7 @@ unsigned int ParseScriptFlags(string strFlags)
}
unsigned int flags = 0;
vector<string> words;
split(words, strFlags, is_any_of(","));
boost::algorithm::split(words, strFlags, boost::algorithm::is_any_of(","));
BOOST_FOREACH(string word, words)
{

Loading…
Cancel
Save