diff --git a/simulation/test_dht_rate_limit.cpp b/simulation/test_dht_rate_limit.cpp index 15f854200..568b763df 100644 --- a/simulation/test_dht_rate_limit.cpp +++ b/simulation/test_dht_rate_limit.cpp @@ -54,22 +54,22 @@ using namespace std::placeholders; struct obs : dht::dht_observer { - virtual void set_external_address(address const& /* addr */ + void set_external_address(address const& /* addr */ , address const& /* source */) override {} - virtual address external_address(udp proto) override + address external_address(udp proto) override { if (proto == udp::v4()) return address_v4::from_string("40.30.20.10"); else return address_v6(); } - virtual void get_peers(sha1_hash const&) override {} - virtual void outgoing_get_peers(sha1_hash const& /* target */ + void get_peers(sha1_hash const&) override {} + void outgoing_get_peers(sha1_hash const& /* target */ , sha1_hash const& /* sent_target */, udp::endpoint const& /* ep */) override {} - virtual void announce(sha1_hash const& /* ih */ + void announce(sha1_hash const& /* ih */ , address const& /* addr */, int /* port */) override {} - virtual void log(dht_logger::module_t l, char const* fmt, ...) override + void log(dht_logger::module_t l, char const* fmt, ...) override { va_list v; va_start(v, fmt); @@ -77,10 +77,10 @@ struct obs : dht::dht_observer va_end(v); puts("\n"); } - virtual void log_packet(message_direction_t /* dir */ + void log_packet(message_direction_t /* dir */ , char const* /* pkt */, int /* len */ , udp::endpoint /* node */) override {} - virtual bool on_dht_request(char const* /* query */, int /* query_len */ + bool on_dht_request(char const* /* query */, int /* query_len */ , dht::msg const& /* request */, entry& /* response */) override { return false; } }; diff --git a/simulation/test_http_connection.cpp b/simulation/test_http_connection.cpp index 23c259694..c4da8d297 100644 --- a/simulation/test_http_connection.cpp +++ b/simulation/test_http_connection.cpp @@ -63,7 +63,7 @@ struct sim_config : sim::default_config asio::ip::address const& requestor , std::string hostname , std::vector& result - , boost::system::error_code& ec) + , boost::system::error_code& ec) override { if (hostname == "try-next.com") { diff --git a/simulation/test_thread_pool.cpp b/simulation/test_thread_pool.cpp index 58168b781..26b0c4230 100644 --- a/simulation/test_thread_pool.cpp +++ b/simulation/test_thread_pool.cpp @@ -41,8 +41,8 @@ struct test_threads : lt::pool_thread_interface { test_threads() {} - virtual void notify_all() override { m_cond.notify_all(); } - virtual void thread_fun(lt::io_service::work w) override + void notify_all() override { m_cond.notify_all(); } + void thread_fun(lt::io_service::work w) override { std::unique_lock l(m_mutex); for (;;) diff --git a/simulation/test_tracker.cpp b/simulation/test_tracker.cpp index 21a078ded..0c9f97a6d 100644 --- a/simulation/test_tracker.cpp +++ b/simulation/test_tracker.cpp @@ -247,7 +247,7 @@ struct sim_config : sim::default_config asio::ip::address const& requestor , std::string hostname , std::vector& result - , boost::system::error_code& ec) + , boost::system::error_code& ec) override { if (hostname == "tracker.com") { diff --git a/src/bdecode.cpp b/src/bdecode.cpp index c2b568feb..145a663c9 100644 --- a/src/bdecode.cpp +++ b/src/bdecode.cpp @@ -165,10 +165,10 @@ namespace libtorrent struct bdecode_error_category : boost::system::error_category { - virtual const char* name() const BOOST_SYSTEM_NOEXCEPT; - virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT; - virtual boost::system::error_condition default_error_condition( - int ev) const BOOST_SYSTEM_NOEXCEPT + const char* name() const BOOST_SYSTEM_NOEXCEPT override; + std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override; + boost::system::error_condition default_error_condition( + int ev) const BOOST_SYSTEM_NOEXCEPT override { return boost::system::error_condition(ev, *this); } }; diff --git a/src/error_code.cpp b/src/error_code.cpp index b06e88469..646e44618 100644 --- a/src/error_code.cpp +++ b/src/error_code.cpp @@ -41,9 +41,9 @@ namespace libtorrent { struct libtorrent_error_category : boost::system::error_category { - virtual const char* name() const BOOST_SYSTEM_NOEXCEPT; - virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT; - virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT + const char* name() const BOOST_SYSTEM_NOEXCEPT override; + std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override; + boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT override { return boost::system::error_condition(ev, *this); } }; @@ -281,9 +281,9 @@ namespace libtorrent struct TORRENT_EXPORT http_error_category : boost::system::error_category { - virtual const char* name() const BOOST_SYSTEM_NOEXCEPT + const char* name() const BOOST_SYSTEM_NOEXCEPT override { return "http error"; } - virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT + std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override { std::string ret; ret += to_string(ev).data(); @@ -311,8 +311,8 @@ namespace libtorrent } return ret; } - virtual boost::system::error_condition default_error_condition( - int ev) const BOOST_SYSTEM_NOEXCEPT + boost::system::error_condition default_error_condition( + int ev) const BOOST_SYSTEM_NOEXCEPT override { return boost::system::error_condition(ev, *this); } }; diff --git a/src/gzip.cpp b/src/gzip.cpp index be00e6374..062824285 100644 --- a/src/gzip.cpp +++ b/src/gzip.cpp @@ -58,9 +58,9 @@ namespace libtorrent { struct gzip_error_category : boost::system::error_category { - virtual const char* name() const BOOST_SYSTEM_NOEXCEPT; - virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT; - virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT + const char* name() const BOOST_SYSTEM_NOEXCEPT override; + std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override; + boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT override { return boost::system::error_condition(ev, *this); } }; diff --git a/src/i2p_stream.cpp b/src/i2p_stream.cpp index 89487f383..36d895dba 100644 --- a/src/i2p_stream.cpp +++ b/src/i2p_stream.cpp @@ -51,9 +51,9 @@ namespace libtorrent struct i2p_error_category : boost::system::error_category { - virtual const char* name() const BOOST_SYSTEM_NOEXCEPT + const char* name() const BOOST_SYSTEM_NOEXCEPT override { return "i2p error"; } - virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT + std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override { static char const* messages[] = { @@ -71,8 +71,8 @@ namespace libtorrent if (ev < 0 || ev >= i2p_error::num_errors) return "unknown error"; return messages[ev]; } - virtual boost::system::error_condition default_error_condition( - int ev) const BOOST_SYSTEM_NOEXCEPT + boost::system::error_condition default_error_condition( + int ev) const BOOST_SYSTEM_NOEXCEPT override { return boost::system::error_condition(ev, *this); } }; diff --git a/src/kademlia/dht_storage.cpp b/src/kademlia/dht_storage.cpp index af4ab83b9..6eb15d280 100644 --- a/src/kademlia/dht_storage.cpp +++ b/src/kademlia/dht_storage.cpp @@ -200,7 +200,7 @@ namespace m_counters.reset(); } - ~dht_default_storage() {} + ~dht_default_storage() override {} #ifndef TORRENT_NO_DEPRECATE size_t num_torrents() const override { return m_map.size(); } @@ -537,7 +537,7 @@ namespace } } - virtual dht_storage_counters counters() const override + dht_storage_counters counters() const override { return m_counters; } diff --git a/src/kademlia/node.cpp b/src/kademlia/node.cpp index 79e49a4e4..92b852d5b 100644 --- a/src/kademlia/node.cpp +++ b/src/kademlia/node.cpp @@ -590,7 +590,7 @@ struct ping_observer : observer {} // parses out "nodes" - virtual void reply(msg const& m) + void reply(msg const& m) override { flags |= flag_done; diff --git a/src/lt_trackers.cpp b/src/lt_trackers.cpp index 477580d8b..250e79612 100644 --- a/src/lt_trackers.cpp +++ b/src/lt_trackers.cpp @@ -83,10 +83,10 @@ namespace libtorrent { namespace update_list_hash(); } - virtual boost::shared_ptr new_connection( - peer_connection_handle const& pc); + boost::shared_ptr new_connection( + peer_connection_handle const& pc) override; - virtual void tick() + void tick() override { if (m_2_minutes++ < 120) return; m_2_minutes = 0; @@ -159,7 +159,7 @@ namespace libtorrent { namespace {} // can add entries to the extension handshake - virtual void add_handshake(entry& h) + void add_handshake(entry& h) override { entry& messages = h["m"]; messages["lt_tex"] = 19; @@ -167,7 +167,7 @@ namespace libtorrent { namespace } // called when the extension handshake from the other end is received - virtual bool on_extension_handshake(bdecode_node const& h) + bool on_extension_handshake(bdecode_node const& h) override { m_message_index = 0; if (h.type() != bdecode_node::dict_t) return false; @@ -189,8 +189,8 @@ namespace libtorrent { namespace return true; } - virtual bool on_extended(int /* length */ - , int extended_msg, buffer::const_interval body) + bool on_extended(int /* length */ + , int extended_msg, buffer::const_interval body) override { if (extended_msg != 19) return false; if (m_message_index == 0) return false; @@ -273,7 +273,7 @@ namespace libtorrent { namespace return true; } - virtual void tick() + void tick() override { // no handshake yet if (!m_message_index) return; diff --git a/src/metadata_transfer.cpp b/src/metadata_transfer.cpp index e96b1b6cc..9b83ae0fa 100644 --- a/src/metadata_transfer.cpp +++ b/src/metadata_transfer.cpp @@ -111,26 +111,26 @@ namespace libtorrent { namespace bool need_loaded() { return m_torrent.need_loaded(); } */ - virtual void on_unload() override + void on_unload() override { m_metadata.reset(); } - virtual void on_load() override + void on_load() override { // initialize m_metadata_size TORRENT_ASSERT(m_torrent.is_loaded()); metadata(); } - virtual void on_files_checked() override + void on_files_checked() override { // if the torrent is a seed, make a reference to // the metadata from the torrent before it is deallocated if (m_torrent.is_seed()) metadata(); } - virtual boost::shared_ptr new_connection( + boost::shared_ptr new_connection( peer_connection_handle const& pc) override; buffer::const_interval metadata() const @@ -271,17 +271,17 @@ namespace libtorrent { namespace , m_tp(tp) {} - virtual char const* type() const override { return "LT_metadata"; } + char const* type() const override { return "LT_metadata"; } // can add entries to the extension handshake - virtual void add_handshake(entry& h) override + void add_handshake(entry& h) override { entry& messages = h["m"]; messages["LT_metadata"] = 14; } // called when the extension handshake from the other end is received - virtual bool on_extension_handshake(bdecode_node const& h) override + bool on_extension_handshake(bdecode_node const& h) override { m_message_index = 0; if (h.type() != bdecode_node::dict_t) return false; @@ -387,7 +387,7 @@ namespace libtorrent { namespace m_pc.setup_send(); } - virtual bool on_extended(int length + bool on_extended(int length , int msg, buffer::const_interval body) override { if (msg != 14) return false; @@ -490,7 +490,7 @@ namespace libtorrent { namespace return true; } - virtual void tick() override + void tick() override { if (m_pc.is_disconnecting()) return; diff --git a/src/session_impl.cpp b/src/session_impl.cpp index bec965dcb..b58dc0064 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -778,7 +778,7 @@ namespace aux { { session_plugin_wrapper(ext_function_t const& f) : m_f(f) {} - virtual boost::shared_ptr new_torrent(torrent_handle const& t, void* user) + boost::shared_ptr new_torrent(torrent_handle const& t, void* user) override { return m_f(t, user); } ext_function_t m_f; }; diff --git a/src/smart_ban.cpp b/src/smart_ban.cpp index ce6d3ee42..2e3a8ae79 100644 --- a/src/smart_ban.cpp +++ b/src/smart_ban.cpp @@ -81,7 +81,7 @@ namespace , m_salt(random()) {} - virtual void on_piece_pass(int p) override + void on_piece_pass(int p) override { #ifndef TORRENT_DISABLE_LOGGING m_torrent.debug_log(" PIECE PASS [ p: %d | block_hash_size: %d ]" @@ -133,7 +133,7 @@ namespace } } - virtual void on_piece_failed(int p) override + void on_piece_failed(int p) override { // The piece failed the hash check. Record // the CRC and origin peer of every block diff --git a/src/socks5_stream.cpp b/src/socks5_stream.cpp index 7cfa09b5a..5683bcabd 100644 --- a/src/socks5_stream.cpp +++ b/src/socks5_stream.cpp @@ -51,9 +51,9 @@ namespace libtorrent struct socks_error_category : boost::system::error_category { - virtual const char* name() const BOOST_SYSTEM_NOEXCEPT + const char* name() const BOOST_SYSTEM_NOEXCEPT override { return "socks error"; } - virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT + std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override { static char const* messages[] = { @@ -72,8 +72,8 @@ namespace libtorrent if (ev < 0 || ev >= socks_error::num_errors) return "unknown error"; return messages[ev]; } - virtual boost::system::error_condition default_error_condition( - int ev) const BOOST_SYSTEM_NOEXCEPT + boost::system::error_condition default_error_condition( + int ev) const BOOST_SYSTEM_NOEXCEPT override { return boost::system::error_condition(ev, *this); } }; diff --git a/src/storage.cpp b/src/storage.cpp index 84eb90616..184af6e8a 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -229,7 +229,7 @@ namespace libtorrent , std::int64_t const file_offset , int const size , file::iovec_t const* bufs, storage_error& ec) - override final + final { if (m_storage.files().pad_file_at(file_index)) { @@ -320,7 +320,7 @@ namespace libtorrent , std::int64_t const file_offset , int const size , file::iovec_t const* bufs, storage_error& ec) - override final + final { int num_bufs = count_bufs(bufs, size); @@ -1365,27 +1365,27 @@ namespace libtorrent class disabled_storage final : public storage_interface, boost::noncopyable { public: - virtual bool has_any_file(storage_error&) override { return false; } - virtual void set_file_priority(std::vector const& + bool has_any_file(storage_error&) override { return false; } + void set_file_priority(std::vector const& , storage_error&) override {} - virtual void rename_file(int, std::string const&, storage_error&) override {} - virtual void release_files(storage_error&) override {} - virtual void delete_files(int, storage_error&) override {} - virtual void initialize(storage_error&) override {} - virtual int move_storage(std::string const&, int, storage_error&) override { return 0; } + void rename_file(int, std::string const&, storage_error&) override {} + void release_files(storage_error&) override {} + void delete_files(int, storage_error&) override {} + void initialize(storage_error&) override {} + int move_storage(std::string const&, int, storage_error&) override { return 0; } - virtual int readv(file::iovec_t const* bufs, int num_bufs + int readv(file::iovec_t const* bufs, int num_bufs , int, int, int, storage_error&) override { return bufs_size(bufs, num_bufs); } - virtual int writev(file::iovec_t const* bufs, int num_bufs + int writev(file::iovec_t const* bufs, int num_bufs , int, int, int, storage_error&) override { return bufs_size(bufs, num_bufs); } - virtual bool verify_resume_data(add_torrent_params const& + bool verify_resume_data(add_torrent_params const& , std::vector const* , storage_error&) override { return false; } }; @@ -1405,9 +1405,9 @@ namespace libtorrent // anything written to it struct zero_storage final : storage_interface { - virtual void initialize(storage_error&) override {} + void initialize(storage_error&) override {} - virtual int readv(file::iovec_t const* bufs, int num_bufs + int readv(file::iovec_t const* bufs, int num_bufs , int, int, int, storage_error&) override { int ret = 0; @@ -1418,7 +1418,7 @@ namespace libtorrent } return 0; } - virtual int writev(file::iovec_t const* bufs, int num_bufs + int writev(file::iovec_t const* bufs, int num_bufs , int, int, int, storage_error&) override { int ret = 0; @@ -1427,19 +1427,19 @@ namespace libtorrent return 0; } - virtual bool has_any_file(storage_error&) override { return false; } - virtual void set_file_priority(std::vector const& /* prio */ + bool has_any_file(storage_error&) override { return false; } + void set_file_priority(std::vector const& /* prio */ , storage_error&) override {} - virtual int move_storage(std::string const& /* save_path */ + int move_storage(std::string const& /* save_path */ , int /* flags */, storage_error&) override { return 0; } - virtual bool verify_resume_data(add_torrent_params const& /* rd */ + bool verify_resume_data(add_torrent_params const& /* rd */ , std::vector const* /* links */ , storage_error&) override { return false; } - virtual void release_files(storage_error&) override {} - virtual void rename_file(int /* index */ + void release_files(storage_error&) override {} + void rename_file(int /* index */ , std::string const& /* new_filenamem */, storage_error&) override {} - virtual void delete_files(int, storage_error&) override {} + void delete_files(int, storage_error&) override {} }; } diff --git a/src/upnp.cpp b/src/upnp.cpp index e21227bdb..4ba3ae9f4 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -1143,12 +1143,12 @@ namespace struct upnp_error_category : boost::system::error_category { - virtual const char* name() const BOOST_SYSTEM_NOEXCEPT + const char* name() const BOOST_SYSTEM_NOEXCEPT override { return "UPnP error"; } - virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT + std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override { int num_errors = sizeof(error_codes) / sizeof(error_codes[0]); error_code_t* end = error_codes + num_errors; @@ -1165,8 +1165,8 @@ struct upnp_error_category : boost::system::error_category return msg; } - virtual boost::system::error_condition default_error_condition( - int ev) const BOOST_SYSTEM_NOEXCEPT + boost::system::error_condition default_error_condition( + int ev) const BOOST_SYSTEM_NOEXCEPT override { return boost::system::error_condition(ev, *this); } diff --git a/src/ut_metadata.cpp b/src/ut_metadata.cpp index 1eae6ec25..68b8d5d00 100644 --- a/src/ut_metadata.cpp +++ b/src/ut_metadata.cpp @@ -108,19 +108,19 @@ namespace libtorrent { namespace bool need_loaded() { return m_torrent.need_loaded(); } - virtual void on_unload() override + void on_unload() override { m_metadata.reset(); } - virtual void on_load() override + void on_load() override { // initialize m_metadata_size TORRENT_ASSERT(m_torrent.is_loaded()); metadata(); } - virtual void on_files_checked() override + void on_files_checked() override { // TODO: 2 if we were to initialize m_metadata_size lazily instead, // we would probably be more efficient @@ -128,7 +128,7 @@ namespace libtorrent { namespace metadata(); } - virtual boost::shared_ptr new_connection( + boost::shared_ptr new_connection( peer_connection_handle const& pc) override; int get_metadata_size() const @@ -231,10 +231,10 @@ namespace libtorrent { namespace , m_tp(tp) {} - virtual char const* type() const override { return "ut_metadata"; } + char const* type() const override { return "ut_metadata"; } // can add entries to the extension handshake - virtual void add_handshake(entry& h) override + void add_handshake(entry& h) override { entry& messages = h["m"]; messages["ut_metadata"] = 2; @@ -243,7 +243,7 @@ namespace libtorrent { namespace } // called when the extension handshake from the other end is received - virtual bool on_extension_handshake(bdecode_node const& h) override + bool on_extension_handshake(bdecode_node const& h) override { m_message_index = 0; if (h.type() != bdecode_node::dict_t) return false; @@ -328,7 +328,7 @@ namespace libtorrent { namespace m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_metadata); } - virtual bool on_extended(int length + bool on_extended(int length , int extended_msg, buffer::const_interval body) override { if (extended_msg != 2) return false; @@ -445,7 +445,7 @@ namespace libtorrent { namespace return true; } - virtual void tick() override + void tick() override { maybe_send_request(); while (!m_incoming_requests.empty() diff --git a/src/ut_pex.cpp b/src/ut_pex.cpp index e52731d5d..82a515d71 100644 --- a/src/ut_pex.cpp +++ b/src/ut_pex.cpp @@ -93,7 +93,7 @@ namespace libtorrent { namespace , m_last_msg(min_time()) , m_peers_in_message(0) {} - virtual boost::shared_ptr new_connection( + boost::shared_ptr new_connection( peer_connection_handle const& pc) override; std::vector& get_ut_pex_msg() @@ -111,7 +111,7 @@ namespace libtorrent { namespace // are calculated here and the pex message is created // each peer connection will use this message // max_peer_entries limits the packet size - virtual void tick() override + void tick() override { time_point now = aux::time_now(); if (now - seconds(60) < m_last_msg) return; @@ -259,15 +259,15 @@ namespace libtorrent { namespace } } - virtual char const* type() const override { return "ut_pex"; } + char const* type() const override { return "ut_pex"; } - virtual void add_handshake(entry& h) override + void add_handshake(entry& h) override { entry& messages = h["m"]; messages[extension_name] = extension_index; } - virtual bool on_extension_handshake(bdecode_node const& h) override + bool on_extension_handshake(bdecode_node const& h) override { m_message_index = 0; if (h.type() != bdecode_node::dict_t) return false; @@ -280,7 +280,7 @@ namespace libtorrent { namespace return true; } - virtual bool on_extended(int length, int msg, buffer::const_interval body) override + bool on_extended(int length, int msg, buffer::const_interval body) override { if (msg != extension_index) return false; if (m_message_index == 0) return false; @@ -433,7 +433,7 @@ namespace libtorrent { namespace // the peers second tick // every minute we send a pex message - virtual void tick() override + void tick() override { // no handshake yet if (!m_message_index) return; diff --git a/test/test_alert_manager.cpp b/test/test_alert_manager.cpp index cc0a4b713..9e774d22b 100644 --- a/test/test_alert_manager.cpp +++ b/test/test_alert_manager.cpp @@ -157,7 +157,7 @@ int plugin_alerts[3] = { 0, 0, 0 }; struct test_plugin : libtorrent::plugin { test_plugin(int index) : m_index(index) {} - virtual void on_alert(alert const* a) + void on_alert(alert const* a) override { ++plugin_alerts[m_index]; } diff --git a/test/test_bandwidth_limiter.cpp b/test/test_bandwidth_limiter.cpp index 6e4e8ea27..26fc96fcd 100644 --- a/test/test_bandwidth_limiter.cpp +++ b/test/test_bandwidth_limiter.cpp @@ -73,9 +73,9 @@ struct peer_connection: bandwidth_socket, boost::enable_shared_from_this const& prio + bool has_any_file(storage_error& ec) override { return false; } + void set_file_priority(std::vector const& prio , storage_error& ec) override {} - virtual int move_storage(std::string const& save_path, int flags + int move_storage(std::string const& save_path, int flags , storage_error& ec) override { return 0; } - virtual bool verify_resume_data(add_torrent_params const& rd + bool verify_resume_data(add_torrent_params const& rd , std::vector const* links , storage_error& ec) override { return true; } - virtual void release_files(storage_error& ec) override {} - virtual void rename_file(int index, std::string const& new_filenamem + void release_files(storage_error& ec) override {} + void rename_file(int index, std::string const& new_filenamem , storage_error& ec) override {} - virtual void delete_files(int, storage_error& ec) override {} + void delete_files(int, storage_error& ec) override {} #ifndef TORRENT_NO_DEPRECATE - virtual void finalize_file(int, storage_error&) override {} + void finalize_file(int, storage_error&) override {} #endif }; diff --git a/test/test_dht.cpp b/test/test_dht.cpp index cc65b04c9..36fe3ef2c 100644 --- a/test/test_dht.cpp +++ b/test/test_dht.cpp @@ -458,20 +458,20 @@ void put_immutable_item_cb(int num, int expect) struct obs : dht::dht_observer { - virtual void set_external_address(address const& addr + void set_external_address(address const& addr , address const& source) override {} - virtual address external_address(udp proto) override + address external_address(udp proto) override { return address_v4::from_string("236.0.0.1"); } - virtual void get_peers(sha1_hash const& ih) override {} - virtual void outgoing_get_peers(sha1_hash const& target + void get_peers(sha1_hash const& ih) override {} + void outgoing_get_peers(sha1_hash const& target , sha1_hash const& sent_target, udp::endpoint const& ep) override {} - virtual void announce(sha1_hash const& ih, address const& addr, int port) override {} + void announce(sha1_hash const& ih, address const& addr, int port) override {} #ifndef TORRENT_DISABLE_LOGGING - virtual void log(dht_logger::module_t l, char const* fmt, ...) override + void log(dht_logger::module_t l, char const* fmt, ...) override { va_list v; va_start(v, fmt); @@ -480,10 +480,10 @@ struct obs : dht::dht_observer va_end(v); m_log.push_back(buf); } - virtual void log_packet(message_direction_t dir, char const* pkt, int len + void log_packet(message_direction_t dir, char const* pkt, int len , udp::endpoint node) override {} #endif - virtual bool on_dht_request(char const* query, int query_len + bool on_dht_request(char const* query, int query_len , dht::msg const& request, entry& response) override { return false; } #ifndef TORRENT_DISABLE_LOGGING diff --git a/test/test_direct_dht.cpp b/test/test_direct_dht.cpp index a35e925c5..c89cd505e 100644 --- a/test/test_direct_dht.cpp +++ b/test/test_direct_dht.cpp @@ -47,14 +47,14 @@ namespace struct test_plugin : plugin { - virtual std::uint32_t implemented_features() + std::uint32_t implemented_features() override { return plugin::dht_request_feature; } - virtual bool on_dht_request(char const* /* query */, int const /* query_len */ + bool on_dht_request(char const* /* query */, int const /* query_len */ , udp::endpoint const& /* source */, bdecode_node const& message - , entry& response) + , entry& response) override { if (message.dict_find_string_value("q") == "test_good") { diff --git a/test/test_dos_blocker.cpp b/test/test_dos_blocker.cpp index 4906026f9..df8b6c7b1 100644 --- a/test/test_dos_blocker.cpp +++ b/test/test_dos_blocker.cpp @@ -45,7 +45,7 @@ using namespace libtorrent; #ifndef TORRENT_DISABLE_LOGGING struct log_t : libtorrent::dht::dht_logger { - virtual void log(dht_logger::module_t m, char const* fmt, ...) + void log(dht_logger::module_t m, char const* fmt, ...) override TORRENT_FORMAT(3, 4) { va_list v; @@ -54,7 +54,7 @@ struct log_t : libtorrent::dht::dht_logger va_end(v); } - virtual void log_packet(message_direction_t dir, char const* pkt, int len + void log_packet(message_direction_t dir, char const* pkt, int len , udp::endpoint node) override { libtorrent::bdecode_node print; diff --git a/test/test_heterogeneous_queue.cpp b/test/test_heterogeneous_queue.cpp index 588049a31..e402b2133 100644 --- a/test/test_heterogeneous_queue.cpp +++ b/test/test_heterogeneous_queue.cpp @@ -45,7 +45,7 @@ struct B : A { int b; explicit B(int a_, int b_) : A(a_), b(b_) {} - virtual int type() { return 1; } + int type() override { return 1; } }; struct C : A @@ -55,7 +55,7 @@ struct C : A { memset(c, c_, sizeof(c)); } - virtual int type() { return 2; } + int type() override { return 2; } }; struct D diff --git a/test/test_peer_list.cpp b/test/test_peer_list.cpp index fba204f81..0a732c056 100644 --- a/test/test_peer_list.cpp +++ b/test/test_peer_list.cpp @@ -70,7 +70,7 @@ struct mock_peer_connection virtual ~mock_peer_connection() {} #if !defined TORRENT_DISABLE_LOGGING - virtual void peer_log(peer_log_alert::direction_t dir, char const* event + void peer_log(peer_log_alert::direction_t dir, char const* event , char const* fmt, ...) const override { va_list v; @@ -93,22 +93,22 @@ struct mock_peer_connection bool m_disconnect_called; mock_torrent& m_torrent; - virtual void get_peer_info(peer_info& p) const override {} - virtual tcp::endpoint const& remote() const override { return m_remote; } - virtual tcp::endpoint local_endpoint() const override { return m_local; } - virtual void disconnect(error_code const& ec + void get_peer_info(peer_info& p) const override {} + tcp::endpoint const& remote() const override { return m_remote; } + tcp::endpoint local_endpoint() const override { return m_local; } + void disconnect(error_code const& ec , operation_t op, int error = 0) override; - virtual peer_id const& pid() const override { return m_id; } - virtual void set_holepunch_mode() override {} - virtual torrent_peer* peer_info_struct() const override { return m_tp; } - virtual void set_peer_info(torrent_peer* pi) override { m_tp = pi; } - virtual bool is_outgoing() const override { return m_outgoing; } - virtual void add_stat(std::int64_t downloaded, std::int64_t uploaded) override + peer_id const& pid() const override { return m_id; } + void set_holepunch_mode() override {} + torrent_peer* peer_info_struct() const override { return m_tp; } + void set_peer_info(torrent_peer* pi) override { m_tp = pi; } + bool is_outgoing() const override { return m_outgoing; } + void add_stat(std::int64_t downloaded, std::int64_t uploaded) override { m_stat.add_stat(downloaded, uploaded); } - virtual bool fast_reconnect() const override { return true; } - virtual bool is_choked() const override { return m_choked; } - virtual bool failed() const override { return false; } - virtual libtorrent::stat const& statistics() const override { return m_stat; } + bool fast_reconnect() const override { return true; } + bool is_choked() const override { return m_choked; } + bool failed() const override { return false; } + libtorrent::stat const& statistics() const override { return m_stat; } }; struct mock_torrent diff --git a/test/test_storage.cpp b/test/test_storage.cpp index 016c89fe7..eaf6c2966 100644 --- a/test/test_storage.cpp +++ b/test/test_storage.cpp @@ -1025,7 +1025,7 @@ struct test_fileop : fileop test_fileop(int stripe_size) : m_stripe_size(stripe_size) {} int file_op(int const file_index, std::int64_t const file_offset, int const size - , file::iovec_t const* bufs, storage_error& ec) + , file::iovec_t const* bufs, storage_error& ec) override { size_t offset = size_t(file_offset); if (file_index >= int(m_file_data.size())) @@ -1064,7 +1064,7 @@ struct test_read_fileop : fileop test_read_fileop(int size) : m_size(size), m_counter(0) {} int file_op(int const file_index, std::int64_t const file_offset, int const size - , file::iovec_t const* bufs, storage_error& ec) + , file::iovec_t const* bufs, storage_error& ec) override { int local_size = (std::min)(m_size, size); const int read = local_size; @@ -1095,7 +1095,7 @@ struct test_error_fileop : fileop : m_error_file(error_file) {} int file_op(int const file_index, std::int64_t const file_offset, int const size - , file::iovec_t const* bufs, storage_error& ec) + , file::iovec_t const* bufs, storage_error& ec) override { if (m_error_file == file_index) { diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 00241d012..c124e3750 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -77,8 +77,8 @@ struct test_storage : default_storage , m_limit(16 * 1024 * 2) {} - virtual void set_file_priority(std::vector const& p - , storage_error& ec) {} + void set_file_priority(std::vector const& p + , storage_error& ec) override {} void set_limit(int lim) { @@ -92,7 +92,7 @@ struct test_storage : default_storage , int piece_index , int offset , int flags - , storage_error& se) + , storage_error& se) override { std::unique_lock l(m_mutex); if (m_written >= m_limit) @@ -110,7 +110,7 @@ struct test_storage : default_storage return default_storage::writev(bufs, num_bufs, piece_index, offset, flags, se); } - virtual ~test_storage() {} + ~test_storage() override {} int m_written; int m_limit;