fixed compilation warnings with newer versions of clang (#2047)

This commit is contained in:
Alden Torres 2017-06-01 04:12:02 -04:00 committed by Arvid Norberg
parent d0ff2200f9
commit c5cdd381da
9 changed files with 24 additions and 16 deletions

View File

@ -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 <typename U = underlying_index, typename Cond
@ -109,7 +112,8 @@ namespace libtorrent { namespace aux {
{
TORRENT_ASSERT(offset >= 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

View File

@ -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;

View File

@ -84,7 +84,6 @@ namespace libtorrent {
virtual void on_timeout(error_code const&) {}
tracker_manager& m_man;
std::shared_ptr<http_connection> m_tracker_connection;
address m_tracker_ip;
#if TORRENT_USE_I2P

View File

@ -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
{

View File

@ -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<std::uint8_t, file_index_t> const& prio

View File

@ -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; }

View File

@ -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;
};

View File

@ -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)
{

View File

@ -66,7 +66,6 @@ namespace libtorrent {
, tracker_request const& req
, std::weak_ptr<request_callback> c)
: tracker_connection(man, req, ios, c)
, m_man(man)
#if TORRENT_USE_I2P
, m_i2p_conn(nullptr)
#endif