From b863306c8b7134920a7e5b6723030549e8eba3e3 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Sat, 22 Apr 2017 21:33:38 -0400 Subject: [PATCH] minor code cleanup (#1933) --- include/libtorrent/bitfield.hpp | 6 +++--- include/libtorrent/bt_peer_connection.hpp | 2 -- include/libtorrent/buffer.hpp | 2 +- include/libtorrent/copy_ptr.hpp | 1 - include/libtorrent/fingerprint.hpp | 1 - include/libtorrent/operations.hpp | 1 - src/peer_connection.cpp | 2 -- src/storage.cpp | 1 + 8 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/libtorrent/bitfield.hpp b/include/libtorrent/bitfield.hpp index dfa3bd233..59e28c02f 100644 --- a/include/libtorrent/bitfield.hpp +++ b/include/libtorrent/bitfield.hpp @@ -70,7 +70,7 @@ namespace libtorrent { resize(bits); if (bits > 0) { - std::memcpy(buf(), b, size_t((bits + 7) / 8)); + std::memcpy(buf(), b, std::size_t((bits + 7) / 8)); clear_trailing_bits(); } } @@ -229,13 +229,13 @@ namespace libtorrent { void set_all() { if (size() == 0) return; - std::memset(buf(), 0xff, size_t(num_words() * 4)); + std::memset(buf(), 0xff, std::size_t(num_words() * 4)); clear_trailing_bits(); } void clear_all() { if (size() == 0) return; - std::memset(buf(), 0x00, size_t(num_words() * 4)); + std::memset(buf(), 0x00, std::size_t(num_words() * 4)); } // make the bitfield empty, of zero size. diff --git a/include/libtorrent/bt_peer_connection.hpp b/include/libtorrent/bt_peer_connection.hpp index 92729aaa5..1378c897f 100644 --- a/include/libtorrent/bt_peer_connection.hpp +++ b/include/libtorrent/bt_peer_connection.hpp @@ -57,8 +57,6 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { - class torrent; - #ifndef TORRENT_DISABLE_EXTENSIONS struct TORRENT_EXTRA_EXPORT ut_pex_peer_store { diff --git a/include/libtorrent/buffer.hpp b/include/libtorrent/buffer.hpp index 71da7fe2f..36ec2098f 100644 --- a/include/libtorrent/buffer.hpp +++ b/include/libtorrent/buffer.hpp @@ -157,4 +157,4 @@ private: } -#endif // BTORRENT_BUFFER_HPP_INCLUDED +#endif // TORRENT_BUFFER_HPP_INCLUDED diff --git a/include/libtorrent/copy_ptr.hpp b/include/libtorrent/copy_ptr.hpp index 73e73552c..c17ce3d5d 100644 --- a/include/libtorrent/copy_ptr.hpp +++ b/include/libtorrent/copy_ptr.hpp @@ -67,4 +67,3 @@ namespace libtorrent { } #endif // TORRENT_COPY_PTR - diff --git a/include/libtorrent/fingerprint.hpp b/include/libtorrent/fingerprint.hpp index dad5b34d4..9b14748dc 100644 --- a/include/libtorrent/fingerprint.hpp +++ b/include/libtorrent/fingerprint.hpp @@ -97,4 +97,3 @@ namespace libtorrent { } #endif // TORRENT_FINGERPRINT_HPP_INCLUDED - diff --git a/include/libtorrent/operations.hpp b/include/libtorrent/operations.hpp index 943fa5e55..363a52bc8 100644 --- a/include/libtorrent/operations.hpp +++ b/include/libtorrent/operations.hpp @@ -105,4 +105,3 @@ namespace libtorrent { } #endif // TORRENT_OPERATIONS_HPP_INCLUDED - diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index b0e6de133..8e7f17e73 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -5675,7 +5675,6 @@ namespace libtorrent { } if (size <= 0) return; - int i = 0; while (size > 0) { aux::ses_buffer_holder session_buf = m_ses.allocate_buffer(); @@ -5686,7 +5685,6 @@ namespace libtorrent { buf += buf_size; size -= buf_size; m_send_buffer.append_buffer(std::move(session_buf), alloc_buf_size, buf_size); - ++i; } setup_send(); } diff --git a/src/storage.cpp b/src/storage.cpp index cb706160f..7f364e129 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -302,6 +302,7 @@ namespace libtorrent { { iovec_t const v = {buf.data(), buf.size()}; std::int64_t const ret = f->writev(file_offset, v, ec.ec); + TORRENT_UNUSED(ret); TORRENT_ASSERT(ec || ret == std::int64_t(v.iov_len)); }, fs.file_offset(i), fs.file_size(i), ec.ec);