diff --git a/include/libtorrent/aux_/typed_span.hpp b/include/libtorrent/aux_/typed_span.hpp index 6c3ca45c3..dba1db401 100644 --- a/include/libtorrent/aux_/typed_span.hpp +++ b/include/libtorrent/aux_/typed_span.hpp @@ -72,7 +72,8 @@ namespace libtorrent { namespace aux { typed_span first(underlying_index n) const { TORRENT_ASSERT(n >= 0); - return this->base::first(std::size_t(n)); + auto s = this->base::first(std::size_t(n)); + return {s.data(), s.size()}; } typed_span first(std::size_t n) const @@ -86,7 +87,8 @@ namespace libtorrent { namespace aux { typed_span last(underlying_index n) const { TORRENT_ASSERT(n >= 0); - return this->base::last(std::size_t(n)); + auto s = this->base::last(std::size_t(n)); + return {s.data(), s.size()}; } typed_span last(std::size_t n) const @@ -100,7 +102,8 @@ namespace libtorrent { namespace aux { typed_span subspan(underlying_index offset) const { TORRENT_ASSERT(offset >= 0); - return this->base::subspan(std::size_t(offset)); + auto s = this->base::subspan(std::size_t(offset)); + return {s.data(), s.size()}; } template = 0); TORRENT_ASSERT(count >= 0); - return this->base::subspan(std::size_t(offset), std::size_t(count)); + auto s = this->base::subspan(std::size_t(offset), std::size_t(count)); + return {s.data(), s.size()}; } typed_span subspan(std::size_t offset) const diff --git a/include/libtorrent/bt_peer_connection.hpp b/include/libtorrent/bt_peer_connection.hpp index 96d8e3cde..cb98557ff 100644 --- a/include/libtorrent/bt_peer_connection.hpp +++ b/include/libtorrent/bt_peer_connection.hpp @@ -107,7 +107,7 @@ namespace libtorrent { share_mode_msg = 8 }; - ~bt_peer_connection(); + ~bt_peer_connection() override; #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) bool supports_encryption() const @@ -413,7 +413,18 @@ namespace libtorrent { // true if rc4, false if plaintext bool m_rc4_encrypted:1; +// this is a legitimate use of a shadow field +#ifdef __clang__ +#pragma clang diagnostic push +// macOS clang doesn't have -Wshadow-field +#pragma clang diagnostic ignored "-Wunknown-pragmas" +#pragma clang diagnostic ignored "-Wshadow-field" +#endif crypto_receive_buffer m_recv_buffer; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #endif std::string m_client_version; diff --git a/include/libtorrent/http_tracker_connection.hpp b/include/libtorrent/http_tracker_connection.hpp index cfe12c0c7..12fc9a37e 100644 --- a/include/libtorrent/http_tracker_connection.hpp +++ b/include/libtorrent/http_tracker_connection.hpp @@ -84,7 +84,6 @@ namespace libtorrent { virtual void on_timeout(error_code const&) {} - tracker_manager& m_man; std::shared_ptr m_tracker_connection; address m_tracker_ip; #if TORRENT_USE_I2P diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 54a348e02..f8ef80697 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -274,7 +274,7 @@ namespace aux { // do in the constructor). virtual void start(); - virtual ~peer_connection(); + virtual ~peer_connection() override; void set_peer_info(torrent_peer* pi) override { diff --git a/include/libtorrent/storage.hpp b/include/libtorrent/storage.hpp index 8fc9b6413..9e741c0f8 100644 --- a/include/libtorrent/storage.hpp +++ b/include/libtorrent/storage.hpp @@ -380,7 +380,7 @@ namespace libtorrent { explicit default_storage(storage_params const& params, file_pool&); // hidden - ~default_storage(); + ~default_storage() override; virtual bool has_any_file(storage_error& ec) override; virtual void set_file_priority(aux::vector const& prio diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 3a6867773..ce9bd91dd 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -319,7 +319,7 @@ namespace libtorrent { torrent(aux::session_interface& ses, int block_size , bool session_paused, add_torrent_params const& p , sha1_hash const& info_hash); - ~torrent(); + ~torrent() override; // This may be called from multiple threads sha1_hash const& info_hash() const { return m_info_hash; } diff --git a/include/libtorrent/upnp.hpp b/include/libtorrent/upnp.hpp index 497ecb65c..db237ba68 100644 --- a/include/libtorrent/upnp.hpp +++ b/include/libtorrent/upnp.hpp @@ -258,11 +258,6 @@ private: // to 0, the mapping is not in use tcp::endpoint local_ep; - // the external (on the NAT router) port - // for the mapping. This is the port we - // should announce to others - int external_port = 0; - // the number of times this mapping has failed int failcount = 0; }; diff --git a/src/disk_io_thread_pool.cpp b/src/disk_io_thread_pool.cpp index a3b58935d..83604e048 100644 --- a/src/disk_io_thread_pool.cpp +++ b/src/disk_io_thread_pool.cpp @@ -112,7 +112,7 @@ namespace libtorrent { if (!m_abort) { auto new_end = std::remove_if(m_threads.begin(), m_threads.end() - , [id, &l](std::thread& t) + , [id](std::thread& t) { if (t.get_id() == id) { diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index ebda77ecf..58ef6eee5 100644 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -66,7 +66,6 @@ namespace libtorrent { , tracker_request const& req , std::weak_ptr c) : tracker_connection(man, req, ios, c) - , m_man(man) #if TORRENT_USE_I2P , m_i2p_conn(nullptr) #endif