diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 2ebe9ba67..2d4e62b6e 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -453,7 +453,7 @@ namespace libtorrent bool preemptive_unchoke() 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 { return m_connections.size(); } @@ -594,7 +594,7 @@ namespace libtorrent virtual bool verify_bound_address(address const& addr, bool utp , error_code& ec); - bool has_lsd() const { return m_lsd.get(); } + bool has_lsd() const { return m_lsd.get() != NULL; } std::vector& block_info_storage() { return m_block_info_storage; } diff --git a/include/libtorrent/block_cache.hpp b/include/libtorrent/block_cache.hpp index 5a9529167..d0b734cb1 100644 --- a/include/libtorrent/block_cache.hpp +++ b/include/libtorrent/block_cache.hpp @@ -323,7 +323,7 @@ namespace libtorrent 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 diff --git a/include/libtorrent/buffer.hpp b/include/libtorrent/buffer.hpp index ee3049635..16217e5ae 100644 --- a/include/libtorrent/buffer.hpp +++ b/include/libtorrent/buffer.hpp @@ -188,7 +188,9 @@ public: return; } 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::max()); + TORRENT_ASSERT(boost::uint32_t(e - b) <= m_size); m_size -= e - b; }