fix some compile warnings

This commit is contained in:
Arvid Norberg 2015-01-16 20:51:39 +00:00
parent 1ab8d2fa5c
commit f914943e58
3 changed files with 6 additions and 4 deletions

View File

@ -453,7 +453,7 @@ namespace libtorrent
bool preemptive_unchoke() const; bool preemptive_unchoke() const;
int num_uploads() const int num_uploads() const
{ return m_stats_counters[counters::num_peers_up_unchoked]; } { return int(m_stats_counters[counters::num_peers_up_unchoked]); }
int num_connections() const int num_connections() const
{ return m_connections.size(); } { return m_connections.size(); }
@ -594,7 +594,7 @@ namespace libtorrent
virtual bool verify_bound_address(address const& addr, bool utp virtual bool verify_bound_address(address const& addr, bool utp
, error_code& ec); , error_code& ec);
bool has_lsd() const { return m_lsd.get(); } bool has_lsd() const { return m_lsd.get() != NULL; }
std::vector<block_info>& block_info_storage() { return m_block_info_storage; } std::vector<block_info>& block_info_storage() { return m_block_info_storage; }

View File

@ -323,7 +323,7 @@ namespace libtorrent
inline std::size_t hash_value(cached_piece_entry const& p) inline std::size_t hash_value(cached_piece_entry const& p)
{ {
return std::size_t(p.storage.get()) + p.piece; return std::size_t(p.storage.get()) + std::size_t(p.piece);
} }
struct TORRENT_EXTRA_EXPORT block_cache : disk_buffer_pool struct TORRENT_EXTRA_EXPORT block_cache : disk_buffer_pool

View File

@ -188,7 +188,9 @@ public:
return; return;
} }
std::memmove(b, e, m_begin + m_size - e); std::memmove(b, e, m_begin + m_size - e);
TORRENT_ASSERT(e - b <= m_size); TORRENT_ASSERT(e >= b);
TORRENT_ASSERT(e - b <= std::numeric_limits<boost::uint32_t>::max());
TORRENT_ASSERT(boost::uint32_t(e - b) <= m_size);
m_size -= e - b; m_size -= e - b;
} }