From 192d87cd244fbada6159795a80b4f0d403f7612f Mon Sep 17 00:00:00 2001 From: jeffro256 Date: Tue, 18 Jul 2023 22:46:43 -0500 Subject: [PATCH] remove more 'using namespace' statements from headers --- .../storages/portable_storage_from_json.h | 21 +++++++++---------- .../blockchain_export.cpp | 1 + src/blockchain_utilities/blocksdat_file.h | 6 +----- src/blockchain_utilities/bootstrap_file.h | 10 +++------ .../cryptonote_protocol_handler.inl | 7 ------- 5 files changed, 15 insertions(+), 30 deletions(-) diff --git a/contrib/epee/include/storages/portable_storage_from_json.h b/contrib/epee/include/storages/portable_storage_from_json.h index 69192ca6b..95507328d 100644 --- a/contrib/epee/include/storages/portable_storage_from_json.h +++ b/contrib/epee/include/storages/portable_storage_from_json.h @@ -35,7 +35,6 @@ namespace epee { - using namespace misc_utils::parse; namespace serialization { namespace json @@ -91,7 +90,7 @@ namespace epee switch(*it) { case '"': - match_string2(it, buf_end, name); + misc_utils::parse::match_string2(it, buf_end, name); state = match_state_waiting_separator; break; case '}': @@ -112,7 +111,7 @@ namespace epee if(*it == '"') {//just a named string value started std::string val; - match_string2(it, buf_end, val); + misc_utils::parse::match_string2(it, buf_end, val); //insert text value stg.set_value(name, std::move(val), current_section); state = match_state_wonder_after_value; @@ -120,7 +119,7 @@ namespace epee {//just a named number value started boost::string_ref val; bool is_v_float = false;bool is_signed = false; - match_number2(it, buf_end, val, is_v_float, is_signed); + misc_utils::parse::match_number2(it, buf_end, val, is_v_float, is_signed); if(!is_v_float) { if(is_signed) @@ -147,7 +146,7 @@ namespace epee }else if(isalpha(*it) ) {// could be null, true or false boost::string_ref word; - match_word2(it, buf_end, word); + misc_utils::parse::match_word2(it, buf_end, word); if(boost::iequals(word, "null")) { state = match_state_wonder_after_value; @@ -202,7 +201,7 @@ namespace epee { //mean array of strings std::string val; - match_string2(it, buf_end, val); + misc_utils::parse::match_string2(it, buf_end, val); h_array = stg.insert_first_value(name, std::move(val), current_section); CHECK_AND_ASSERT_THROW_MES(h_array, " failed to insert values entry"); state = match_state_array_after_value; @@ -211,7 +210,7 @@ namespace epee {//array of numbers value started boost::string_ref val; bool is_v_float = false;bool is_signed_val = false; - match_number2(it, buf_end, val, is_v_float, is_signed_val); + misc_utils::parse::match_number2(it, buf_end, val, is_v_float, is_signed_val); if(!is_v_float) { if (is_signed_val) @@ -246,7 +245,7 @@ namespace epee }else if(isalpha(*it) ) {// array of booleans boost::string_ref word; - match_word2(it, buf_end, word); + misc_utils::parse::match_word2(it, buf_end, word); if(boost::iequals(word, "true")) { h_array = stg.insert_first_value(name, true, current_section); @@ -290,7 +289,7 @@ namespace epee if(*it == '"') { std::string val; - match_string2(it, buf_end, val); + misc_utils::parse::match_string2(it, buf_end, val); bool res = stg.insert_next_value(h_array, std::move(val)); CHECK_AND_ASSERT_THROW_MES(res, "failed to insert values"); state = match_state_array_after_value; @@ -301,7 +300,7 @@ namespace epee {//array of numbers value started boost::string_ref val; bool is_v_float = false;bool is_signed_val = false; - match_number2(it, buf_end, val, is_v_float, is_signed_val); + misc_utils::parse::match_number2(it, buf_end, val, is_v_float, is_signed_val); bool insert_res = false; if(!is_v_float) { @@ -334,7 +333,7 @@ namespace epee if(isalpha(*it) ) {// array of booleans boost::string_ref word; - match_word2(it, buf_end, word); + misc_utils::parse::match_word2(it, buf_end, word); if(boost::iequals(word, "true")) { bool r = stg.insert_next_value(h_array, true); diff --git a/src/blockchain_utilities/blockchain_export.cpp b/src/blockchain_utilities/blockchain_export.cpp index 3d7b3f61a..fe475a5d2 100644 --- a/src/blockchain_utilities/blockchain_export.cpp +++ b/src/blockchain_utilities/blockchain_export.cpp @@ -38,6 +38,7 @@ #define MONERO_DEFAULT_LOG_CATEGORY "bcutil" namespace po = boost::program_options; +using namespace cryptonote; using namespace epee; int main(int argc, char* argv[]) diff --git a/src/blockchain_utilities/blocksdat_file.h b/src/blockchain_utilities/blocksdat_file.h index 557b395a4..b80440880 100644 --- a/src/blockchain_utilities/blocksdat_file.h +++ b/src/blockchain_utilities/blocksdat_file.h @@ -50,10 +50,6 @@ #include "blockchain_utilities.h" - -using namespace cryptonote; - - class BlocksdatFile { public: @@ -63,7 +59,7 @@ public: protected: - Blockchain* m_blockchain_storage; + cryptonote::Blockchain* m_blockchain_storage; std::ofstream * m_raw_data_file; diff --git a/src/blockchain_utilities/bootstrap_file.h b/src/blockchain_utilities/bootstrap_file.h index 7a1085a56..808ed00bb 100644 --- a/src/blockchain_utilities/bootstrap_file.h +++ b/src/blockchain_utilities/bootstrap_file.h @@ -48,10 +48,6 @@ #include "blockchain_utilities.h" - -using namespace cryptonote; - - class BootstrapFile { public: @@ -66,9 +62,9 @@ public: protected: - Blockchain* m_blockchain_storage; + cryptonote::Blockchain* m_blockchain_storage; - tx_memory_pool* m_tx_pool; + cryptonote::tx_memory_pool* m_tx_pool; typedef std::vector buffer_type; std::ofstream * m_raw_data_file; buffer_type m_buffer; @@ -78,7 +74,7 @@ protected: bool open_writer(const boost::filesystem::path& file_path, uint64_t start_block, uint64_t stop_block); bool initialize_file(uint64_t start_block, uint64_t stop_block); bool close(); - void write_block(block& block); + void write_block(cryptonote::block& block); void flush_chunk(); private: diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index af667dc0c..385c3e5c3 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -1167,13 +1167,6 @@ namespace cryptonote m_sync_download_objects_size += size; MDEBUG(context << " downloaded " << size << " bytes worth of blocks"); - /*using namespace boost::chrono; - auto point = steady_clock::now(); - auto time_from_epoh = point.time_since_epoch(); - auto sec = duration_cast< seconds >( time_from_epoh ).count();*/ - - //epee::net_utils::network_throttle_manager::get_global_throttle_inreq().logger_handle_net("log/dr-monero/net/req-all.data", sec, get_avg_block_size()); - if(arg.blocks.empty()) { LOG_ERROR_CCONTEXT("sent wrong NOTIFY_HAVE_OBJECTS: no blocks");