minor cleanup, refactor and typos (#2593)

This commit is contained in:
Alden Torres 2017-12-07 01:51:55 -05:00 committed by Arvid Norberg
parent c16eb32b94
commit db61d9cc20
7 changed files with 9 additions and 14 deletions

View File

@ -68,7 +68,7 @@ namespace libtorrent { namespace aux {
{ return get<bool>(m_bools, name, settings_pack::bool_type_base); } { return get<bool>(m_bools, name, settings_pack::bool_type_base); }
session_settings(); session_settings();
session_settings(settings_pack const&); explicit session_settings(settings_pack const&);
private: private:

View File

@ -74,7 +74,7 @@ namespace libtorrent { namespace aux {
transport const ssl; transport const ssl;
}; };
// sockets used for outoing utp connections // sockets used for outgoing utp connections
struct TORRENT_EXTRA_EXPORT outgoing_sockets struct TORRENT_EXTRA_EXPORT outgoing_sockets
{ {
// partitions sockets based on whether they match one of the given endpoints // partitions sockets based on whether they match one of the given endpoints
@ -94,7 +94,7 @@ namespace libtorrent { namespace aux {
std::vector<std::shared_ptr<outgoing_udp_socket>> sockets; std::vector<std::shared_ptr<outgoing_udp_socket>> sockets;
private: private:
// round-robin index into sockets // 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<std::array<std::uint8_t, 2>, 2> index = {{ {{0, 0}}, {{0, 0}} }}; mutable std::array<std::array<std::uint8_t, 2>, 2> index = {{ {{0, 0}}, {{0, 0}} }};
}; };

View File

@ -134,4 +134,3 @@ struct is_error_condition_enum<libtorrent::gzip_errors::error_code_enum>
} } } }
#endif #endif

View File

@ -34,7 +34,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/puff.hpp" #include "libtorrent/puff.hpp"
#include "libtorrent/gzip.hpp" #include "libtorrent/gzip.hpp"
#include <vector>
#include <string> #include <string>
namespace { namespace {
@ -180,8 +179,7 @@ namespace {
} }
} // anonymous namespace } // anonymous namespace
TORRENT_EXTRA_EXPORT void inflate_gzip( void inflate_gzip(span<char const> in
span<char const> in
, std::vector<char>& buffer , std::vector<char>& buffer
, int maximum_size , int maximum_size
, error_code& ec) , error_code& ec)
@ -264,4 +262,3 @@ namespace {
} }
} }

View File

@ -37,10 +37,10 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent { namespace libtorrent {
stat_cache::stat_cache() {} stat_cache::stat_cache() = default;
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()) if (i >= m_stat_cache.end_index())
m_stat_cache.resize(static_cast<int>(i) + 1, not_in_cache); m_stat_cache.resize(static_cast<int>(i) + 1, not_in_cache);

View File

@ -152,7 +152,7 @@ namespace libtorrent { namespace aux {
{ {
file_bytes_left = bytes_left; file_bytes_left = bytes_left;
if (file_offset + file_bytes_left > files.file_size(file_index)) if (file_offset + file_bytes_left > files.file_size(file_index))
file_bytes_left = (std::max)(static_cast<int>(files.file_size(file_index) - file_offset), 0); file_bytes_left = std::max(static_cast<int>(files.file_size(file_index) - file_offset), 0);
// there are no bytes left in this file, move to the next one // there are no bytes left in this file, move to the next one
// this loop skips over empty files // this loop skips over empty files
@ -168,7 +168,7 @@ namespace libtorrent { namespace aux {
file_bytes_left = bytes_left; file_bytes_left = bytes_left;
if (file_offset + file_bytes_left > files.file_size(file_index)) if (file_offset + file_bytes_left > files.file_size(file_index))
file_bytes_left = (std::max)(static_cast<int>(files.file_size(file_index) - file_offset), 0); file_bytes_left = std::max(static_cast<int>(files.file_size(file_index) - file_offset), 0);
} }
// make a copy of the iovec array that _just_ covers the next // make a copy of the iovec array that _just_ covers the next

View File

@ -34,11 +34,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/xml_parse.hpp" #include "libtorrent/xml_parse.hpp"
#include "libtorrent/string_util.hpp" #include "libtorrent/string_util.hpp"
#include "libtorrent/string_view.hpp"
namespace libtorrent { namespace libtorrent {
TORRENT_EXTRA_EXPORT void xml_parse(string_view input void xml_parse(string_view input
, std::function<void(int, string_view, string_view)> callback) , std::function<void(int, string_view, string_view)> callback)
{ {
char const* p = input.data(); char const* p = input.data();