From de369451b1d571af118a71a314d522eeb8acbd8f Mon Sep 17 00:00:00 2001 From: Pavel Pimenov Date: Sat, 10 Jun 2017 09:18:32 +0300 Subject: [PATCH] fix operator() ==, add const (#2063) --- include/libtorrent/block_cache.hpp | 2 +- include/libtorrent/peer_connection.hpp | 2 +- include/libtorrent/piece_picker.hpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/libtorrent/block_cache.hpp b/include/libtorrent/block_cache.hpp index d21502754..79790d10c 100644 --- a/include/libtorrent/block_cache.hpp +++ b/include/libtorrent/block_cache.hpp @@ -199,7 +199,7 @@ namespace aux { void* get_storage() const { return storage.get(); } bool operator==(cached_piece_entry const& rhs) const - { return storage.get() == rhs.storage.get() && piece == rhs.piece; } + { return piece == rhs.piece && storage.get() == rhs.storage.get(); } // if this is set, we'll be calculating the hash // for this piece. This member stores the interim diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index f8ef80697..e63340c71 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -124,7 +124,7 @@ namespace aux { // busy request at a time in each peer's queue std::uint32_t busy:1; - bool operator==(pending_block const& b) + bool operator==(pending_block const& b) const { return b.block == block && b.not_wanted == not_wanted diff --git a/include/libtorrent/piece_picker.hpp b/include/libtorrent/piece_picker.hpp index 83235b477..0a45aae82 100644 --- a/include/libtorrent/piece_picker.hpp +++ b/include/libtorrent/piece_picker.hpp @@ -643,10 +643,10 @@ namespace libtorrent { * prio_factor + adjustment; } - bool operator!=(piece_pos p) const + bool operator!=(piece_pos const& p) const { return index != p.index || peer_count != p.peer_count; } - bool operator==(piece_pos p) const + bool operator==(piece_pos const& p) const { return index == p.index && peer_count == p.peer_count; } };