mirror of
https://github.com/monero-project/monero.git
synced 2024-12-26 01:49:23 -05:00
pass large parameters by const ref, not value
Coverity 136394 136397 136409 136526 136529 136533 175302
This commit is contained in:
parent
61defd89e3
commit
2e3e90acbe
@ -207,7 +207,7 @@ namespace net_utils
|
|||||||
|
|
||||||
bool connect(const std::string& adr, const std::string& port, uint32_t conn_timeot, t_connection_context& cn, const std::string& bind_ip = "0.0.0.0");
|
bool connect(const std::string& adr, const std::string& port, uint32_t conn_timeot, t_connection_context& cn, const std::string& bind_ip = "0.0.0.0");
|
||||||
template<class t_callback>
|
template<class t_callback>
|
||||||
bool connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeot, t_callback cb, const std::string& bind_ip = "0.0.0.0");
|
bool connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeot, const t_callback &cb, const std::string& bind_ip = "0.0.0.0");
|
||||||
|
|
||||||
typename t_protocol_handler::config_type& get_config_object(){return m_config;}
|
typename t_protocol_handler::config_type& get_config_object(){return m_config;}
|
||||||
|
|
||||||
|
@ -1055,7 +1055,7 @@ POP_WARNINGS
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
template<class t_protocol_handler> template<class t_callback>
|
template<class t_protocol_handler> template<class t_callback>
|
||||||
bool boosted_tcp_server<t_protocol_handler>::connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeout, t_callback cb, const std::string& bind_ip)
|
bool boosted_tcp_server<t_protocol_handler>::connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeout, const t_callback &cb, const std::string& bind_ip)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
connection_ptr new_connection_l(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type) );
|
connection_ptr new_connection_l(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type) );
|
||||||
|
@ -84,16 +84,16 @@ public:
|
|||||||
|
|
||||||
int invoke(int command, const std::string& in_buff, std::string& buff_out, boost::uuids::uuid connection_id);
|
int invoke(int command, const std::string& in_buff, std::string& buff_out, boost::uuids::uuid connection_id);
|
||||||
template<class callback_t>
|
template<class callback_t>
|
||||||
int invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, callback_t cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED);
|
int invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, const callback_t &cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED);
|
||||||
|
|
||||||
int notify(int command, const std::string& in_buff, boost::uuids::uuid connection_id);
|
int notify(int command, const std::string& in_buff, boost::uuids::uuid connection_id);
|
||||||
bool close(boost::uuids::uuid connection_id);
|
bool close(boost::uuids::uuid connection_id);
|
||||||
bool update_connection_context(const t_connection_context& contxt);
|
bool update_connection_context(const t_connection_context& contxt);
|
||||||
bool request_callback(boost::uuids::uuid connection_id);
|
bool request_callback(boost::uuids::uuid connection_id);
|
||||||
template<class callback_t>
|
template<class callback_t>
|
||||||
bool foreach_connection(callback_t cb);
|
bool foreach_connection(const callback_t &cb);
|
||||||
template<class callback_t>
|
template<class callback_t>
|
||||||
bool for_connection(const boost::uuids::uuid &connection_id, callback_t cb);
|
bool for_connection(const boost::uuids::uuid &connection_id, const callback_t &cb);
|
||||||
size_t get_connections_count();
|
size_t get_connections_count();
|
||||||
void set_handler(levin_commands_handler<t_connection_context>* handler, void (*destroy)(levin_commands_handler<t_connection_context>*) = NULL);
|
void set_handler(levin_commands_handler<t_connection_context>* handler, void (*destroy)(levin_commands_handler<t_connection_context>*) = NULL);
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ public:
|
|||||||
std::list<boost::shared_ptr<invoke_response_handler_base> > m_invoke_response_handlers;
|
std::list<boost::shared_ptr<invoke_response_handler_base> > m_invoke_response_handlers;
|
||||||
|
|
||||||
template<class callback_t>
|
template<class callback_t>
|
||||||
bool add_invoke_response_handler(callback_t cb, uint64_t timeout, async_protocol_handler& con, int command)
|
bool add_invoke_response_handler(const callback_t &cb, uint64_t timeout, async_protocol_handler& con, int command)
|
||||||
{
|
{
|
||||||
CRITICAL_REGION_LOCAL(m_invoke_response_handlers_lock);
|
CRITICAL_REGION_LOCAL(m_invoke_response_handlers_lock);
|
||||||
boost::shared_ptr<invoke_response_handler_base> handler(boost::make_shared<anvoke_handler<callback_t>>(cb, timeout, con, command));
|
boost::shared_ptr<invoke_response_handler_base> handler(boost::make_shared<anvoke_handler<callback_t>>(cb, timeout, con, command));
|
||||||
@ -529,7 +529,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class callback_t>
|
template<class callback_t>
|
||||||
bool async_invoke(int command, const std::string& in_buff, callback_t cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
|
bool async_invoke(int command, const std::string& in_buff, const callback_t &cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
|
||||||
{
|
{
|
||||||
misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler(
|
misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler(
|
||||||
boost::bind(&async_protocol_handler::finish_outer_call, this));
|
boost::bind(&async_protocol_handler::finish_outer_call, this));
|
||||||
@ -805,7 +805,7 @@ int async_protocol_handler_config<t_connection_context>::invoke(int command, con
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
template<class t_connection_context> template<class callback_t>
|
template<class t_connection_context> template<class callback_t>
|
||||||
int async_protocol_handler_config<t_connection_context>::invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, callback_t cb, size_t timeout)
|
int async_protocol_handler_config<t_connection_context>::invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, const callback_t &cb, size_t timeout)
|
||||||
{
|
{
|
||||||
async_protocol_handler<t_connection_context>* aph;
|
async_protocol_handler<t_connection_context>* aph;
|
||||||
int r = find_and_lock_connection(connection_id, aph);
|
int r = find_and_lock_connection(connection_id, aph);
|
||||||
@ -813,7 +813,7 @@ int async_protocol_handler_config<t_connection_context>::invoke_async(int comman
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
template<class t_connection_context> template<class callback_t>
|
template<class t_connection_context> template<class callback_t>
|
||||||
bool async_protocol_handler_config<t_connection_context>::foreach_connection(callback_t cb)
|
bool async_protocol_handler_config<t_connection_context>::foreach_connection(const callback_t &cb)
|
||||||
{
|
{
|
||||||
CRITICAL_REGION_LOCAL(m_connects_lock);
|
CRITICAL_REGION_LOCAL(m_connects_lock);
|
||||||
for(auto& c: m_connects)
|
for(auto& c: m_connects)
|
||||||
@ -826,7 +826,7 @@ bool async_protocol_handler_config<t_connection_context>::foreach_connection(cal
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
template<class t_connection_context> template<class callback_t>
|
template<class t_connection_context> template<class callback_t>
|
||||||
bool async_protocol_handler_config<t_connection_context>::for_connection(const boost::uuids::uuid &connection_id, callback_t cb)
|
bool async_protocol_handler_config<t_connection_context>::for_connection(const boost::uuids::uuid &connection_id, const callback_t &cb)
|
||||||
{
|
{
|
||||||
CRITICAL_REGION_LOCAL(m_connects_lock);
|
CRITICAL_REGION_LOCAL(m_connects_lock);
|
||||||
async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
|
async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
|
||||||
|
@ -108,7 +108,7 @@ namespace epee
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class t_result, class t_arg, class callback_t, class t_transport>
|
template<class t_result, class t_arg, class callback_t, class t_transport>
|
||||||
bool async_invoke_remote_command2(boost::uuids::uuid conn_id, int command, const t_arg& out_struct, t_transport& transport, callback_t cb, size_t inv_timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
|
bool async_invoke_remote_command2(boost::uuids::uuid conn_id, int command, const t_arg& out_struct, t_transport& transport, const callback_t &cb, size_t inv_timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
|
||||||
{
|
{
|
||||||
typename serialization::portable_storage stg;
|
typename serialization::portable_storage stg;
|
||||||
const_cast<t_arg&>(out_struct).store(stg);//TODO: add true const support to searilzation
|
const_cast<t_arg&>(out_struct).store(stg);//TODO: add true const support to searilzation
|
||||||
|
@ -214,7 +214,7 @@ namespace nodetool
|
|||||||
void add_upnp_port_mapping(uint32_t port);
|
void add_upnp_port_mapping(uint32_t port);
|
||||||
void delete_upnp_port_mapping(uint32_t port);
|
void delete_upnp_port_mapping(uint32_t port);
|
||||||
template<class t_callback>
|
template<class t_callback>
|
||||||
bool try_ping(basic_node_data& node_data, p2p_connection_context& context, t_callback cb);
|
bool try_ping(basic_node_data& node_data, p2p_connection_context& context, const t_callback &cb);
|
||||||
bool try_get_support_flags(const p2p_connection_context& context, std::function<void(p2p_connection_context&, const uint32_t&)> f);
|
bool try_get_support_flags(const p2p_connection_context& context, std::function<void(p2p_connection_context&, const uint32_t&)> f);
|
||||||
bool make_expected_connections_count(PeerType peer_type, size_t expected_connections);
|
bool make_expected_connections_count(PeerType peer_type, size_t expected_connections);
|
||||||
void cache_connect_fail_info(const epee::net_utils::network_address& addr);
|
void cache_connect_fail_info(const epee::net_utils::network_address& addr);
|
||||||
|
@ -1477,7 +1477,7 @@ namespace nodetool
|
|||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
template<class t_payload_net_handler> template<class t_callback>
|
template<class t_payload_net_handler> template<class t_callback>
|
||||||
bool node_server<t_payload_net_handler>::try_ping(basic_node_data& node_data, p2p_connection_context& context, t_callback cb)
|
bool node_server<t_payload_net_handler>::try_ping(basic_node_data& node_data, p2p_connection_context& context, const t_callback &cb)
|
||||||
{
|
{
|
||||||
if(!node_data.my_port)
|
if(!node_data.my_port)
|
||||||
return false;
|
return false;
|
||||||
|
@ -38,7 +38,7 @@ namespace
|
|||||||
{
|
{
|
||||||
bool lift_up_difficulty(std::vector<test_event_entry>& events, std::vector<uint64_t>& timestamps,
|
bool lift_up_difficulty(std::vector<test_event_entry>& events, std::vector<uint64_t>& timestamps,
|
||||||
std::vector<difficulty_type>& cummulative_difficulties, test_generator& generator,
|
std::vector<difficulty_type>& cummulative_difficulties, test_generator& generator,
|
||||||
size_t new_block_count, const block blk_last, const account_base& miner_account)
|
size_t new_block_count, const block &blk_last, const account_base& miner_account)
|
||||||
{
|
{
|
||||||
difficulty_type commulative_diffic = cummulative_difficulties.empty() ? 0 : cummulative_difficulties.back();
|
difficulty_type commulative_diffic = cummulative_difficulties.empty() ? 0 : cummulative_difficulties.back();
|
||||||
block blk_prev = blk_last;
|
block blk_prev = blk_last;
|
||||||
|
Loading…
Reference in New Issue
Block a user