From a14d595eac3f56794c20384590e3928219d62f2c Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Mon, 14 May 2018 09:03:43 -0400 Subject: [PATCH] minor code cleanup in torrent.cpp --- src/torrent.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index 09ebac37e..c7050d677 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -2759,16 +2759,14 @@ bool is_downloading_state(int const st) // amount to exceed the total size of the torrent which upsets some trackers if (is_seed()) { - for (peer_iterator i = m_connections.begin(); - i != m_connections.end(); ++i) + for (auto c : m_connections) { TORRENT_INCREMENT(m_iterating_connections); - peer_connection* p = *i; - boost::optional pbp = p->downloading_piece_progress(); - if (pbp && pbp->bytes_downloaded > 0) + auto const pbp = c->downloading_piece_progress(); + if (pbp.bytes_downloaded > 0) { - req.downloaded -= pbp->bytes_downloaded; - req.redundant += pbp->bytes_downloaded; + req.downloaded -= pbp.bytes_downloaded; + req.redundant += pbp.bytes_downloaded; } } } @@ -5519,7 +5517,7 @@ bool is_downloading_state(int const st) else { auto const& pieces = p->get_bitfield(); - TORRENT_ASSERT(pieces.count() <= int(pieces.size())); + TORRENT_ASSERT(pieces.count() <= pieces.size()); m_picker->dec_refcount(pieces, pp); } }