From db61d9cc2026d01d9b3c9cafaf9c5eaaf09c9285 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Thu, 7 Dec 2017 01:51:55 -0500 Subject: [PATCH] minor cleanup, refactor and typos (#2593) --- include/libtorrent/aux_/session_settings.hpp | 2 +- include/libtorrent/aux_/session_udp_sockets.hpp | 4 ++-- include/libtorrent/gzip.hpp | 1 - src/gzip.cpp | 5 +---- src/stat_cache.cpp | 4 ++-- src/storage_utils.cpp | 4 ++-- src/xml_parse.cpp | 3 +-- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/include/libtorrent/aux_/session_settings.hpp b/include/libtorrent/aux_/session_settings.hpp index b912263f9..ddcff312b 100644 --- a/include/libtorrent/aux_/session_settings.hpp +++ b/include/libtorrent/aux_/session_settings.hpp @@ -68,7 +68,7 @@ namespace libtorrent { namespace aux { { return get(m_bools, name, settings_pack::bool_type_base); } session_settings(); - session_settings(settings_pack const&); + explicit session_settings(settings_pack const&); private: diff --git a/include/libtorrent/aux_/session_udp_sockets.hpp b/include/libtorrent/aux_/session_udp_sockets.hpp index 54a3b02d9..9c03e89b1 100644 --- a/include/libtorrent/aux_/session_udp_sockets.hpp +++ b/include/libtorrent/aux_/session_udp_sockets.hpp @@ -74,7 +74,7 @@ namespace libtorrent { namespace aux { transport const ssl; }; - // sockets used for outoing utp connections + // sockets used for outgoing utp connections struct TORRENT_EXTRA_EXPORT outgoing_sockets { // partitions sockets based on whether they match one of the given endpoints @@ -94,7 +94,7 @@ namespace libtorrent { namespace aux { std::vector> sockets; private: // round-robin index into sockets - // one dimention for IPv4/IPv6 and a second for SSL/non-SSL + // one dimension for IPv4/IPv6 and a second for SSL/non-SSL mutable std::array, 2> index = {{ {{0, 0}}, {{0, 0}} }}; }; diff --git a/include/libtorrent/gzip.hpp b/include/libtorrent/gzip.hpp index a2473ec1f..621d29b60 100644 --- a/include/libtorrent/gzip.hpp +++ b/include/libtorrent/gzip.hpp @@ -134,4 +134,3 @@ struct is_error_condition_enum } } #endif - diff --git a/src/gzip.cpp b/src/gzip.cpp index f2b2ba9ca..29e45d1f5 100644 --- a/src/gzip.cpp +++ b/src/gzip.cpp @@ -34,7 +34,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/puff.hpp" #include "libtorrent/gzip.hpp" -#include #include namespace { @@ -180,8 +179,7 @@ namespace { } } // anonymous namespace - TORRENT_EXTRA_EXPORT void inflate_gzip( - span in + void inflate_gzip(span in , std::vector& buffer , int maximum_size , error_code& ec) @@ -264,4 +262,3 @@ namespace { } } - diff --git a/src/stat_cache.cpp b/src/stat_cache.cpp index 42998d505..14a937cc9 100644 --- a/src/stat_cache.cpp +++ b/src/stat_cache.cpp @@ -37,10 +37,10 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { - stat_cache::stat_cache() {} + stat_cache::stat_cache() = default; stat_cache::~stat_cache() = default; - void stat_cache::set_cache(file_index_t const i, std::int64_t size) + void stat_cache::set_cache(file_index_t const i, std::int64_t const size) { if (i >= m_stat_cache.end_index()) m_stat_cache.resize(static_cast(i) + 1, not_in_cache); diff --git a/src/storage_utils.cpp b/src/storage_utils.cpp index a11784175..298409bfd 100644 --- a/src/storage_utils.cpp +++ b/src/storage_utils.cpp @@ -152,7 +152,7 @@ namespace libtorrent { namespace aux { { file_bytes_left = bytes_left; if (file_offset + file_bytes_left > files.file_size(file_index)) - file_bytes_left = (std::max)(static_cast(files.file_size(file_index) - file_offset), 0); + file_bytes_left = std::max(static_cast(files.file_size(file_index) - file_offset), 0); // there are no bytes left in this file, move to the next one // this loop skips over empty files @@ -168,7 +168,7 @@ namespace libtorrent { namespace aux { file_bytes_left = bytes_left; if (file_offset + file_bytes_left > files.file_size(file_index)) - file_bytes_left = (std::max)(static_cast(files.file_size(file_index) - file_offset), 0); + file_bytes_left = std::max(static_cast(files.file_size(file_index) - file_offset), 0); } // make a copy of the iovec array that _just_ covers the next diff --git a/src/xml_parse.cpp b/src/xml_parse.cpp index 6af9838e2..d2f4ea5d3 100644 --- a/src/xml_parse.cpp +++ b/src/xml_parse.cpp @@ -34,11 +34,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/xml_parse.hpp" #include "libtorrent/string_util.hpp" -#include "libtorrent/string_view.hpp" namespace libtorrent { - TORRENT_EXTRA_EXPORT void xml_parse(string_view input + void xml_parse(string_view input , std::function callback) { char const* p = input.data();