mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 05:34:57 +01:00
Merge #9644: [refactor] Remove using namespace <xxx> from src/
b7b48c8 Refactor: Remove using namespace <xxx> from src/*.cpp. (Karl-Johan Alm)
This commit is contained in:
29
src/init.cpp
29
src/init.cpp
@@ -65,8 +65,6 @@
|
||||
#include "zmq/zmqnotificationinterface.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool fFeeEstimatesInitialized = false;
|
||||
static const bool DEFAULT_PROXYRANDOMIZE = true;
|
||||
static const bool DEFAULT_REST_ENABLE = false;
|
||||
@@ -310,10 +308,10 @@ void OnRPCStopped()
|
||||
void OnRPCPreCommand(const CRPCCommand& cmd)
|
||||
{
|
||||
// Observe safe mode
|
||||
string strWarning = GetWarnings("rpc");
|
||||
std::string strWarning = GetWarnings("rpc");
|
||||
if (strWarning != "" && !GetBoolArg("-disablesafemode", DEFAULT_DISABLE_SAFEMODE) &&
|
||||
!cmd.okSafeMode)
|
||||
throw JSONRPCError(RPC_FORBIDDEN_BY_SAFE_MODE, string("Safe mode: ") + strWarning);
|
||||
throw JSONRPCError(RPC_FORBIDDEN_BY_SAFE_MODE, std::string("Safe mode: ") + strWarning);
|
||||
}
|
||||
|
||||
std::string HelpMessage(HelpMessageMode mode)
|
||||
@@ -322,7 +320,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
|
||||
// When adding new options to the categories, please keep and ensure alphabetical ordering.
|
||||
// Do not translate _(...) -help-debug options, Many technical terms, and only a very small audience, so is unnecessary stress to translators.
|
||||
string strUsage = HelpMessageGroup(_("Options:"));
|
||||
std::string strUsage = HelpMessageGroup(_("Options:"));
|
||||
strUsage += HelpMessageOpt("-?", _("Print this help message and exit"));
|
||||
strUsage += HelpMessageOpt("-version", _("Print version and exit"));
|
||||
strUsage += HelpMessageOpt("-alertnotify=<cmd>", _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)"));
|
||||
@@ -436,7 +434,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
|
||||
strUsage += HelpMessageOpt("-bip9params=deployment:start:end", "Use given start/end times for specified BIP9 deployment (regtest-only)");
|
||||
}
|
||||
string debugCategories = "addrman, alert, bench, cmpctblock, coindb, db, http, libevent, lock, mempool, mempoolrej, net, proxy, prune, rand, reindex, rpc, selectcoins, tor, zmq"; // Don't translate these and qt below
|
||||
std::string debugCategories = "addrman, alert, bench, cmpctblock, coindb, db, http, libevent, lock, mempool, mempoolrej, net, proxy, prune, rand, reindex, rpc, selectcoins, tor, zmq"; // Don't translate these and qt below
|
||||
if (mode == HMM_BITCOIN_QT)
|
||||
debugCategories += ", qt";
|
||||
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
|
||||
@@ -576,15 +574,14 @@ struct CImportingNow
|
||||
// works correctly.
|
||||
void CleanupBlockRevFiles()
|
||||
{
|
||||
using namespace boost::filesystem;
|
||||
map<string, path> mapBlockFiles;
|
||||
std::map<std::string, boost::filesystem::path> mapBlockFiles;
|
||||
|
||||
// Glob all blk?????.dat and rev?????.dat files from the blocks directory.
|
||||
// Remove the rev files immediately and insert the blk file paths into an
|
||||
// ordered map keyed by block file index.
|
||||
LogPrintf("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune\n");
|
||||
path blocksdir = GetDataDir() / "blocks";
|
||||
for (directory_iterator it(blocksdir); it != directory_iterator(); it++) {
|
||||
boost::filesystem::path blocksdir = GetDataDir() / "blocks";
|
||||
for (boost::filesystem::directory_iterator it(blocksdir); it != boost::filesystem::directory_iterator(); it++) {
|
||||
if (is_regular_file(*it) &&
|
||||
it->path().filename().string().length() == 12 &&
|
||||
it->path().filename().string().substr(8,4) == ".dat")
|
||||
@@ -601,7 +598,7 @@ void CleanupBlockRevFiles()
|
||||
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
|
||||
// start removing block files.
|
||||
int nContigCounter = 0;
|
||||
BOOST_FOREACH(const PAIRTYPE(string, path)& item, mapBlockFiles) {
|
||||
BOOST_FOREACH(const PAIRTYPE(std::string, boost::filesystem::path)& item, mapBlockFiles) {
|
||||
if (atoi(item.first) == nContigCounter) {
|
||||
nContigCounter++;
|
||||
continue;
|
||||
@@ -894,8 +891,8 @@ bool AppInitParameterInteraction()
|
||||
fDebug = mapMultiArgs.count("-debug");
|
||||
// Special-case: if -debug=0/-nodebug is set, turn off debugging messages
|
||||
if (fDebug) {
|
||||
const vector<string>& categories = mapMultiArgs.at("-debug");
|
||||
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end())
|
||||
const std::vector<std::string>& categories = mapMultiArgs.at("-debug");
|
||||
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), std::string("0")) != categories.end())
|
||||
fDebug = false;
|
||||
}
|
||||
|
||||
@@ -1063,7 +1060,7 @@ bool AppInitParameterInteraction()
|
||||
if (!chainparams.MineBlocksOnDemand()) {
|
||||
return InitError("BIP9 parameters may only be overridden on regtest.");
|
||||
}
|
||||
const vector<string>& deployments = mapMultiArgs.at("-bip9params");
|
||||
const std::vector<std::string>& deployments = mapMultiArgs.at("-bip9params");
|
||||
for (auto i : deployments) {
|
||||
std::vector<std::string> vDeploymentParams;
|
||||
boost::split(vDeploymentParams, i, boost::is_any_of(":"));
|
||||
@@ -1208,9 +1205,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
RegisterNodeSignals(GetNodeSignals());
|
||||
|
||||
// sanitize comments per BIP-0014, format user agent and check total size
|
||||
std::vector<string> uacomments;
|
||||
std::vector<std::string> uacomments;
|
||||
if (mapMultiArgs.count("-uacomment")) {
|
||||
BOOST_FOREACH(string cmt, mapMultiArgs.at("-uacomment"))
|
||||
BOOST_FOREACH(std::string cmt, mapMultiArgs.at("-uacomment"))
|
||||
{
|
||||
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
|
||||
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
|
||||
|
||||
Reference in New Issue
Block a user