From b8c3e63f1b5c8d9a741aacba610dae540c3a7792 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Fri, 21 Aug 2020 15:23:12 -0500 Subject: [PATCH] More fixes Fix errors and warnings and generally coax it to build --- libraries/wallet/wallet.cpp | 28 ++++++++++---------- programs/build_helpers/member_enumerator.cpp | 8 +++--- programs/debug_node/main.cpp | 2 +- tests/cli/main.cpp | 2 +- tests/tests/database_tests.cpp | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index e5d4ed66..b8cf8c46 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -374,7 +374,7 @@ private: // return true if any of my_accounts are players in this tournament bool tournament_is_relevant_to_my_accounts(const tournament_object& tournament_obj) { - tournament_details_object tournament_details = get_object(tournament_obj.tournament_details_id); + tournament_details_object tournament_details = get_object(tournament_obj.tournament_details_id); for (const account_object& account_obj : _wallet.my_accounts) if (tournament_details.registered_players.find(account_obj.id) != tournament_details.registered_players.end()) return true; @@ -967,7 +967,7 @@ public: ("match", match_obj.id)("account", get_account(account_id).name)); for (const game_id_type& game_id : match_obj.games) { - game_object game_obj = get_object(game_id); + game_object game_obj = get_object(game_id); auto insert_result = game_cache.insert(game_obj); if (insert_result.second) game_in_new_state(game_obj); @@ -981,10 +981,10 @@ public: // updates on those matches void monitor_matches_in_tournament(const tournament_object& tournament_obj) { try { - tournament_details_object tournament_details = get_object(tournament_obj.tournament_details_id); + tournament_details_object tournament_details = get_object(tournament_obj.tournament_details_id); for (const match_id_type& match_id : tournament_details.matches) { - match_object match_obj = get_object(match_id); + match_object match_obj = get_object(match_id); auto insert_result = match_cache.insert(match_obj); if (insert_result.second) match_in_new_state(match_obj); @@ -1006,7 +1006,7 @@ public: { try { - tournament_object tournament = get_object(tournament_id); + tournament_object tournament = get_object(tournament_id); auto insert_result = tournament_cache.insert(tournament); if (insert_result.second) { @@ -2118,7 +2118,7 @@ public: FC_THROW("Account ${account} has no core Token ${TOKEN} vested and thus its not allowed to withdraw.", ("account", witness_name)("TOKEN", GRAPHENE_SYMBOL)); } - vesting_balance_object vbo = get_object< vesting_balance_object >( *vbid ); + vesting_balance_object vbo = get_object( *vbid ); if(vbo.balance_type != vesting_balance_type::normal) FC_THROW("Allowed to withdraw only Normal type vest balances with this method"); @@ -2163,7 +2163,7 @@ public: //whether it is a witness or user, keep it in a container and iterate over to process all vesting balances and types if(!vbos.size()) - vbos.emplace_back( get_object(*vbid) ); + vbos.emplace_back( get_object(*vbid) ); for (const vesting_balance_object& vesting_balance_obj: vbos) { if(vesting_balance_obj.balance_type == vesting_balance_type::gpos) @@ -2924,7 +2924,7 @@ public: std::string player_name; if (round == num_rounds) { - match_object match = get_object(tournament_details.matches[num_matches - 1]); + match_object match = get_object(tournament_details.matches[num_matches - 1]); if (match.get_state() == match_state::match_complete && !match.match_winners.empty()) { @@ -2934,7 +2934,7 @@ public: } else { - match_object match = get_object(tournament_details.matches[match_number]); + match_object match = get_object(tournament_details.matches[match_number]); if (!match.players.empty()) { if (player_in_match < match.players.size()) @@ -2972,7 +2972,7 @@ public: return ss.str(); }; - m["get_order_book"] = [this](variant result, const fc::variants& a) + m["get_order_book"] = [](variant result, const fc::variants&) { auto orders = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); auto bids = orders.bids; @@ -4773,7 +4773,7 @@ string wallet_api::help()const { std::vector method_names = my->method_documentation.get_method_names(); std::stringstream ss; - for (const std::string method_name : method_names) + for (const std::string& method_name : method_names) { try { @@ -6296,9 +6296,9 @@ signed_transaction wallet_api::rps_throw(game_id_type game_id, FC_ASSERT( !is_locked() ); // check whether the gesture is appropriate for the game we're playing - graphene::chain::game_object game_obj = my->get_object(game_id); - graphene::chain::match_object match_obj = my->get_object(game_obj.match_id); - graphene::chain::tournament_object tournament_obj = my->get_object(match_obj.tournament_id); + graphene::chain::game_object game_obj = my->get_object(game_id); + graphene::chain::match_object match_obj = my->get_object(game_obj.match_id); + graphene::chain::tournament_object tournament_obj = my->get_object(match_obj.tournament_id); graphene::chain::rock_paper_scissors_game_options game_options = tournament_obj.options.game_options.get(); if ((int)gesture >= game_options.number_of_gestures) diff --git a/programs/build_helpers/member_enumerator.cpp b/programs/build_helpers/member_enumerator.cpp index 44e8cfac..e7c44301 100644 --- a/programs/build_helpers/member_enumerator.cpp +++ b/programs/build_helpers/member_enumerator.cpp @@ -109,7 +109,7 @@ void class_processor::process_class( const static_variant< T... >* dummy ) } } -template +template struct if_enum { template< typename T > @@ -130,7 +130,7 @@ struct if_enum }; template<> -struct if_enum +struct if_enum { template< typename T > static void process_class( class_processor* proc, const T* dummy ) @@ -157,7 +157,7 @@ struct if_reflected template< typename T > static void process_class( class_processor* proc, const T* dummy ) { - if_enum< typename fc::reflector::is_enum >::process_class(proc, dummy); + if_enum< std::is_enum::value >::process_class(proc, dummy); } }; @@ -216,7 +216,7 @@ int main( int argc, char** argv ) graphene::member_enumerator::class_processor::process_class(result); fc::mutable_variant_object mvo; - for( const std::pair< std::string, std::vector< std::string > >& e : result ) + for( const auto& e : result ) { variant v; to_variant( e.second, v , 1); diff --git a/programs/debug_node/main.cpp b/programs/debug_node/main.cpp index c94d3fd2..c93909b6 100644 --- a/programs/debug_node/main.cpp +++ b/programs/debug_node/main.cpp @@ -164,7 +164,7 @@ int main(int argc, char** argv) { node->startup(); node->startup_plugins(); - fc::promise::ptr exit_promise = new fc::promise("UNIX Signal Handler"); + fc::promise::ptr exit_promise = fc::promise::create("UNIX Signal Handler"); fc::set_signal_handler([&exit_promise](int signal) { elog( "Caught SIGINT attempting to exit cleanly" ); diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index 9c9fcd1a..f1b5065b 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -224,7 +224,7 @@ public: wallet_data.ws_password = ""; websocket_connection = websocket_client.connect( wallet_data.ws_server ); - api_connection = std::make_shared(*websocket_connection, GRAPHENE_MAX_NESTED_OBJECTS); + api_connection = std::make_shared(websocket_connection, GRAPHENE_MAX_NESTED_OBJECTS); remote_login_api = api_connection->get_remote_api< graphene::app::login_api >(1); BOOST_CHECK(remote_login_api->login( wallet_data.ws_user, wallet_data.ws_password ) ); diff --git a/tests/tests/database_tests.cpp b/tests/tests/database_tests.cpp index 9585d4a1..443d2dae 100644 --- a/tests/tests/database_tests.cpp +++ b/tests/tests/database_tests.cpp @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE( flat_index_test ) price_feed current_feed; current_feed.settlement_price = bitusd.amount(100) / asset(100); publish_feed(bitusd, sam, current_feed); - FC_ASSERT( bitusd.bitasset_data_id->instance == 0 ); + FC_ASSERT( bitusd.bitasset_data_id->instance.value == 0 ); FC_ASSERT( !(*bitusd.bitasset_data_id)(db).current_feed.settlement_price.is_null() ); try { auto ses = db._undo_db.start_undo_session();