aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-10-10 15:47:08 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-11-14 16:56:10 +0000
commit383ff4f68943c5d998fba8caa20aee481583f214 (patch)
tree23eefe275400a75af13faa49af8198ba3ab1183c /src
parentMerge pull request #2720 (diff)
downloadmonero-383ff4f68943c5d998fba8caa20aee481583f214.tar.xz
remove "using namespace std" from headers
It's nasty, and actually breaks on Solaris, where if.h fails to build due to: struct map *if_memmap;
Diffstat (limited to '')
-rw-r--r--src/blockchain_db/blockchain_db.cpp2
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp1
-rw-r--r--src/blockchain_utilities/blockchain_import.cpp2
-rw-r--r--src/blockchain_utilities/bootstrap_file.cpp6
-rw-r--r--src/blockchain_utilities/bootstrap_file.h2
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.cpp2
-rw-r--r--src/cryptonote_core/blockchain.cpp2
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp4
-rw-r--r--src/cryptonote_core/cryptonote_tx_utils.cpp2
-rw-r--r--src/cryptonote_core/tx_pool.cpp2
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl4
-rw-r--r--src/daemon/rpc_command_executor.cpp2
-rw-r--r--src/p2p/connection_basic.cpp4
-rw-r--r--src/ringct/rctOps.h11
-rw-r--r--src/ringct/rctSigs.h14
-rw-r--r--src/ringct/rctTypes.h19
-rwxr-xr-xsrc/rpc/core_rpc_server.cpp2
-rw-r--r--src/simplewallet/simplewallet.cpp4
-rw-r--r--src/wallet/wallet2.cpp2
19 files changed, 42 insertions, 45 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index d62a250ff..c3f6e3d87 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -208,7 +208,7 @@ uint64_t BlockchainDB::add_block( const block& blk
time1 = epee::misc_utils::get_tick_count();
add_transaction(blk_hash, blk.miner_tx);
int tx_i = 0;
- crypto::hash tx_hash = null_hash;
+ crypto::hash tx_hash = crypto::null_hash;
for (const transaction& tx : txs)
{
tx_hash = blk.tx_hashes[tx_i];
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index 6ebb35639..6023b5ce1 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -48,6 +48,7 @@
#endif
using epee::string_tools::pod_to_hex;
+using namespace crypto;
// Increase when the DB changes in a non backward compatible way, and there
// is no automatic conversion, so that a full resync is needed.
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp
index 2a956dbdb..2153383bb 100644
--- a/src/blockchain_utilities/blockchain_import.cpp
+++ b/src/blockchain_utilities/blockchain_import.cpp
@@ -256,7 +256,7 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
seek_height = start_height;
BootstrapFile bootstrap;
- streampos pos;
+ std::streampos pos;
// BootstrapFile bootstrap(import_file_path);
uint64_t total_source_blocks = bootstrap.count_blocks(import_file_path, pos, seek_height);
MINFO("bootstrap file last block number: " << total_source_blocks-1 << " (zero-based height) total blocks: " << total_source_blocks);
diff --git a/src/blockchain_utilities/bootstrap_file.cpp b/src/blockchain_utilities/bootstrap_file.cpp
index a004d3547..2c993460a 100644
--- a/src/blockchain_utilities/bootstrap_file.cpp
+++ b/src/blockchain_utilities/bootstrap_file.cpp
@@ -221,7 +221,7 @@ void BootstrapFile::write_block(block& block)
// now add all regular transactions
for (const auto& tx_id : block.tx_hashes)
{
- if (tx_id == null_hash)
+ if (tx_id == crypto::null_hash)
{
throw std::runtime_error("Aborting: tx == null_hash");
}
@@ -433,7 +433,7 @@ uint64_t BootstrapFile::count_bytes(std::ifstream& import_file, uint64_t blocks,
uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
{
- streampos dummy_pos;
+ std::streampos dummy_pos;
uint64_t dummy_height = 0;
return count_blocks(import_file_path, dummy_pos, dummy_height);
}
@@ -441,7 +441,7 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
// If seek_height is non-zero on entry, return a stream position <= this height when finished.
// And return the actual height corresponding to this position. Allows the caller to locate its
// starting position without having to reread the entire file again.
-uint64_t BootstrapFile::count_blocks(const std::string& import_file_path, streampos &start_pos, uint64_t& seek_height)
+uint64_t BootstrapFile::count_blocks(const std::string& import_file_path, std::streampos &start_pos, uint64_t& seek_height)
{
boost::filesystem::path raw_file_path(import_file_path);
boost::system::error_code ec;
diff --git a/src/blockchain_utilities/bootstrap_file.h b/src/blockchain_utilities/bootstrap_file.h
index c3969a357..0926ee2e5 100644
--- a/src/blockchain_utilities/bootstrap_file.h
+++ b/src/blockchain_utilities/bootstrap_file.h
@@ -57,7 +57,7 @@ class BootstrapFile
public:
uint64_t count_bytes(std::ifstream& import_file, uint64_t blocks, uint64_t& h, bool& quit);
- uint64_t count_blocks(const std::string& dir_path, streampos& start_pos, uint64_t& seek_height);
+ uint64_t count_blocks(const std::string& dir_path, std::streampos& start_pos, uint64_t& seek_height);
uint64_t count_blocks(const std::string& dir_path);
uint64_t seek_to_first_chunk(std::ifstream& import_file);
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp
index d09f4c432..1c28ca4d8 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.cpp
+++ b/src/cryptonote_basic/cryptonote_format_utils.cpp
@@ -45,6 +45,8 @@ using namespace epee;
// #define ENABLE_HASH_CASH_INTEGRITY_CHECK
+using namespace crypto;
+
static const uint64_t valid_decomposed_outputs[] = {
(uint64_t)1, (uint64_t)2, (uint64_t)3, (uint64_t)4, (uint64_t)5, (uint64_t)6, (uint64_t)7, (uint64_t)8, (uint64_t)9, // 1 piconero
(uint64_t)10, (uint64_t)20, (uint64_t)30, (uint64_t)40, (uint64_t)50, (uint64_t)60, (uint64_t)70, (uint64_t)80, (uint64_t)90,
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 4e1ab8a48..3d586a704 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -61,6 +61,8 @@
#define FIND_BLOCKCHAIN_SUPPLEMENT_MAX_SIZE (100*1024*1024) // 100 MB
+using namespace crypto;
+
//#include "serialization/json_archive.h"
/* TODO:
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 3f56ffac7..a10692dad 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -498,8 +498,8 @@ namespace cryptonote
return false;
}
- tx_hash = null_hash;
- tx_prefixt_hash = null_hash;
+ tx_hash = crypto::null_hash;
+ tx_prefixt_hash = crypto::null_hash;
if(!parse_tx_from_blob(tx, tx_hash, tx_prefixt_hash, tx_blob))
{
diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp
index 9409a60a5..feefc1592 100644
--- a/src/cryptonote_core/cryptonote_tx_utils.cpp
+++ b/src/cryptonote_core/cryptonote_tx_utils.cpp
@@ -40,6 +40,8 @@ using namespace epee;
#include "crypto/hash.h"
#include "ringct/rctSigs.h"
+using namespace crypto;
+
namespace cryptonote
{
//---------------------------------------------------------------
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp
index 6bfcfe529..e6f217463 100644
--- a/src/cryptonote_core/tx_pool.cpp
+++ b/src/cryptonote_core/tx_pool.cpp
@@ -51,6 +51,8 @@
DISABLE_VS_WARNINGS(4244 4345 4503) //'boost::foreach_detail_::or_' : decorated name length exceeded, name was truncated
+using namespace crypto;
+
namespace cryptonote
{
namespace
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index e41491954..73433a8d8 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -297,9 +297,9 @@ namespace cryptonote
m_core.set_target_blockchain_height((hshd.current_height));
int64_t diff = static_cast<int64_t>(hshd.current_height) - static_cast<int64_t>(m_core.get_current_blockchain_height());
uint64_t abs_diff = std::abs(diff);
- uint64_t max_block_height = max(hshd.current_height,m_core.get_current_blockchain_height());
+ uint64_t max_block_height = std::max(hshd.current_height,m_core.get_current_blockchain_height());
uint64_t last_block_v1 = m_core.get_testnet() ? 624633 : 1009826;
- uint64_t diff_v2 = max_block_height > last_block_v1 ? min(abs_diff, max_block_height - last_block_v1) : 0;
+ uint64_t diff_v2 = max_block_height > last_block_v1 ? std::min(abs_diff, max_block_height - last_block_v1) : 0;
MCLOG(is_inital ? el::Level::Info : el::Level::Debug, "global", context << "Sync data returned a new top block candidate: " << m_core.get_current_blockchain_height() << " -> " << hshd.current_height
<< " [Your node is " << abs_diff << " blocks (" << ((abs_diff - diff_v2) / (24 * 60 * 60 / DIFFICULTY_TARGET_V1)) + (diff_v2 / (24 * 60 * 60 / DIFFICULTY_TARGET_V2)) << " days) "
<< (0 <= diff ? std::string("behind") : std::string("ahead"))
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index 83b04bff5..230b9f090 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -1011,7 +1011,7 @@ bool t_rpc_command_executor::print_transaction_pool_stats() {
tools::msg_writer() << " Age Txes Bytes";
for (i=0; i<n; i++)
{
- tools::msg_writer() << get_time_hms(times[i]) << setw(8) << res.pool_stats.histo[i].txs << setw(12) << res.pool_stats.histo[i].bytes;
+ tools::msg_writer() << get_time_hms(times[i]) << std::setw(8) << res.pool_stats.histo[i].txs << std::setw(12) << res.pool_stats.histo[i].bytes;
}
}
tools::msg_writer();
diff --git a/src/p2p/connection_basic.cpp b/src/p2p/connection_basic.cpp
index b95f36b99..8edd75b3e 100644
--- a/src/p2p/connection_basic.cpp
+++ b/src/p2p/connection_basic.cpp
@@ -158,7 +158,7 @@ connection_basic::connection_basic(boost::asio::io_service& io_service, std::ato
++ref_sock_count; // increase the global counter
mI->m_peer_number = sock_number.fetch_add(1); // use, and increase the generated number
- string remote_addr_str = "?";
+ std::string remote_addr_str = "?";
try { boost::system::error_code e; remote_addr_str = socket_.remote_endpoint(e).address().to_string(); } catch(...){} ;
_note("Spawned connection p2p#"<<mI->m_peer_number<<" to " << remote_addr_str << " currently we have sockets count:" << m_ref_sock_count);
@@ -166,7 +166,7 @@ connection_basic::connection_basic(boost::asio::io_service& io_service, std::ato
}
connection_basic::~connection_basic() noexcept(false) {
- string remote_addr_str = "?";
+ std::string remote_addr_str = "?";
m_ref_sock_count--;
try { boost::system::error_code e; remote_addr_str = socket_.remote_endpoint(e).address().to_string(); } catch(...){} ;
_note("Destructing connection p2p#"<<mI->m_peer_number << " to " << remote_addr_str);
diff --git a/src/ringct/rctOps.h b/src/ringct/rctOps.h
index cb19bbbd6..412450c18 100644
--- a/src/ringct/rctOps.h
+++ b/src/ringct/rctOps.h
@@ -35,8 +35,6 @@
#define RCTOPS_H
#include <cstddef>
-#include <mutex>
-#include <vector>
#include <tuple>
#include "crypto/generic-ops.h"
@@ -57,9 +55,6 @@ extern "C" {
#define DP(x)
#endif
-using namespace std;
-using namespace crypto;
-
namespace rct {
//Various key initialization functions
@@ -99,13 +94,13 @@ namespace rct {
key pkGen();
//generates a random secret and corresponding public key
void skpkGen(key &sk, key &pk);
- tuple<key, key> skpkGen();
+ std::tuple<key, key> skpkGen();
//generates a <secret , public> / Pedersen commitment to the amount
- tuple<ctkey, ctkey> ctskpkGen(xmr_amount amount);
+ std::tuple<ctkey, ctkey> ctskpkGen(xmr_amount amount);
//generates C =aG + bH from b, a is random
void genC(key & C, const key & a, xmr_amount amount);
//this one is mainly for testing, can take arbitrary amounts..
- tuple<ctkey, ctkey> ctskpkGen(const key &bH);
+ std::tuple<ctkey, ctkey> ctskpkGen(const key &bH);
// make a pedersen commitment with given key
key commit(xmr_amount amount, const key &mask);
// make a pedersen commitment with zero key
diff --git a/src/ringct/rctSigs.h b/src/ringct/rctSigs.h
index ca40ddd85..d158f06f0 100644
--- a/src/ringct/rctSigs.h
+++ b/src/ringct/rctSigs.h
@@ -36,7 +36,6 @@
#define RCTSIGS_H
#include <cstddef>
-#include <mutex>
#include <vector>
#include <tuple>
@@ -61,9 +60,6 @@ extern "C" {
-using namespace std;
-using namespace crypto;
-
namespace rct {
boroSig genBorromean(const key64 x, const key64 P1, const key64 P2, const bits indices);
@@ -110,7 +106,7 @@ namespace rct {
//populateFromBlockchain creates a keymatrix with "mixin" columns and one of the columns is inPk
// the return value are the key matrix, and the index where inPk was put (random).
void getKeyFromBlockchain(ctkey & a, size_t reference_index);
- tuple<ctkeyM, xmr_amount> populateFromBlockchain(ctkeyV inPk, int mixin);
+ std::tuple<ctkeyM, xmr_amount> populateFromBlockchain(ctkeyV inPk, int mixin);
//RingCT protocol
//genRct:
@@ -122,10 +118,10 @@ namespace rct {
//decodeRct: (c.f. http://eprint.iacr.org/2015/1098 section 5.1.1)
// uses the attached ecdh info to find the amounts represented by each output commitment
// must know the destination private key to find the correct amount, else will return a random number
- rctSig genRct(const key &message, const ctkeyV & inSk, const keyV & destinations, const vector<xmr_amount> & amounts, const ctkeyM &mixRing, const keyV &amount_keys, unsigned int index, ctkeyV &outSk);
- rctSig genRct(const key &message, const ctkeyV & inSk, const ctkeyV & inPk, const keyV & destinations, const vector<xmr_amount> & amounts, const keyV &amount_keys, const int mixin);
- rctSig genRctSimple(const key & message, const ctkeyV & inSk, const ctkeyV & inPk, const keyV & destinations, const vector<xmr_amount> & inamounts, const vector<xmr_amount> & outamounts, const keyV &amount_keys, xmr_amount txnFee, unsigned int mixin);
- rctSig genRctSimple(const key & message, const ctkeyV & inSk, const keyV & destinations, const vector<xmr_amount> & inamounts, const vector<xmr_amount> & outamounts, xmr_amount txnFee, const ctkeyM & mixRing, const keyV &amount_keys, const std::vector<unsigned int> & index, ctkeyV &outSk);
+ rctSig genRct(const key &message, const ctkeyV & inSk, const keyV & destinations, const std::vector<xmr_amount> & amounts, const ctkeyM &mixRing, const keyV &amount_keys, unsigned int index, ctkeyV &outSk);
+ rctSig genRct(const key &message, const ctkeyV & inSk, const ctkeyV & inPk, const keyV & destinations, const std::vector<xmr_amount> & amounts, const keyV &amount_keys, const int mixin);
+ rctSig genRctSimple(const key & message, const ctkeyV & inSk, const ctkeyV & inPk, const keyV & destinations, const std::vector<xmr_amount> & inamounts, const std::vector<xmr_amount> & outamounts, const keyV &amount_keys, xmr_amount txnFee, unsigned int mixin);
+ rctSig genRctSimple(const key & message, const ctkeyV & inSk, const keyV & destinations, const std::vector<xmr_amount> & inamounts, const std::vector<xmr_amount> & outamounts, xmr_amount txnFee, const ctkeyM & mixRing, const keyV &amount_keys, const std::vector<unsigned int> & index, ctkeyV &outSk);
bool verRct(const rctSig & rv, bool semantics);
static inline bool verRct(const rctSig & rv) { return verRct(rv, true) && verRct(rv, false); }
bool verRctSimple(const rctSig & rv, bool semantics);
diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h
index cc0000ad6..8147cb602 100644
--- a/src/ringct/rctTypes.h
+++ b/src/ringct/rctTypes.h
@@ -33,9 +33,7 @@
#define RCT_TYPES_H
#include <cstddef>
-#include <mutex>
#include <vector>
-#include <tuple>
#include <iostream>
#include <cinttypes>
@@ -67,9 +65,6 @@ extern "C" {
//for printing large ints
-using namespace std;
-using namespace crypto;
-
//Namespace specifically for ring ct code
namespace rct {
//basic ops containers
@@ -89,8 +84,8 @@ namespace rct {
bool operator==(const key &k) const { return !memcmp(bytes, k.bytes, sizeof(bytes)); }
unsigned char bytes[32];
};
- typedef vector<key> keyV; //vector of keys
- typedef vector<keyV> keyM; //matrix of keys (indexed by column first)
+ typedef std::vector<key> keyV; //vector of keys
+ typedef std::vector<keyV> keyM; //matrix of keys (indexed by column first)
//containers For CT operations
//if it's representing a private ctkey then "dest" contains the secret key of the address
@@ -101,8 +96,8 @@ namespace rct {
key dest;
key mask; //C here if public
};
- typedef vector<ctkey> ctkeyV;
- typedef vector<ctkeyV> ctkeyM;
+ typedef std::vector<ctkey> ctkeyV;
+ typedef std::vector<ctkeyV> ctkeyM;
//data for passing the amount to the receiver secretly
// If the pedersen commitment to an amount is C = aG + bH,
@@ -184,7 +179,7 @@ namespace rct {
ctkeyM mixRing; //the set of all pubkeys / copy
//pairs that you mix with
keyV pseudoOuts; //C - for simple rct
- vector<ecdhTuple> ecdhInfo;
+ std::vector<ecdhTuple> ecdhInfo;
ctkeyV outPk;
xmr_amount txnFee; // contains b
@@ -245,8 +240,8 @@ namespace rct {
}
};
struct rctSigPrunable {
- vector<rangeSig> rangeSigs;
- vector<mgSig> MGs; // simple rct has N, full has 1
+ std::vector<rangeSig> rangeSigs;
+ std::vector<mgSig> MGs; // simple rct has N, full has 1
template<bool W, template <bool> class Archive>
bool serialize_rctsig_prunable(Archive<W> &ar, uint8_t type, size_t inputs, size_t outputs, size_t mixin)
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 9094ec732..4deaf029e 100755
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -995,7 +995,7 @@ namespace cryptonote
}
blobdata block_blob = t_serializable_object_to_blob(b);
crypto::public_key tx_pub_key = cryptonote::get_tx_pub_key_from_extra(b.miner_tx);
- if(tx_pub_key == null_pkey)
+ if(tx_pub_key == crypto::null_pkey)
{
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
error_resp.message = "Internal error: failed to create block template";
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 24e7d54dd..b55224560 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -4266,7 +4266,7 @@ bool simple_wallet::check_tx_proof(const std::vector<std::string> &args)
return true;
}
crypto::public_key tx_pub_key = get_tx_pub_key_from_extra(tx);
- if (tx_pub_key == null_pkey)
+ if (tx_pub_key == crypto::null_pkey)
{
fail_msg_writer() << tr("Tx pubkey was not found");
return true;
@@ -4993,7 +4993,7 @@ bool simple_wallet::address_book(const std::vector<std::string> &args/* = std::v
fail_msg_writer() << tr("failed to parse address");
return true;
}
- crypto::hash payment_id = null_hash;
+ crypto::hash payment_id = crypto::null_hash;
size_t description_start = 2;
if (info.has_payment_id)
{
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index ae4af99f6..84c4e9261 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -67,6 +67,8 @@ extern "C"
#include "crypto/keccak.h"
#include "crypto/crypto-ops.h"
}
+using namespace std;
+using namespace crypto;
using namespace cryptonote;
#undef MONERO_DEFAULT_LOG_CATEGORY