minor trivial code optimization

This commit is contained in:
Alden Torres 2017-08-14 15:50:19 -04:00 committed by Arvid Norberg
parent b03b7417dd
commit 6a3be6cfd3
2 changed files with 4 additions and 4 deletions

View File

@ -170,7 +170,7 @@ namespace libtorrent {
request += "?info_hash=";
request += escape_string({t->torrent_file().info_hash().data(), 20});
request += "&piece=";
request += to_string(r.piece).data();
request += to_string(r.piece);
// if we're requesting less than an entire piece we need to
// add ranges

View File

@ -172,7 +172,7 @@ namespace libtorrent {
#endif
if (!settings.get_bool(settings_pack::anonymous_mode))
{
std::string announce_ip = settings.get_str(settings_pack::announce_ip);
std::string const& announce_ip = settings.get_str(settings_pack::announce_ip);
if (!announce_ip.empty())
{
url += "&ip=" + escape_string(announce_ip);
@ -586,10 +586,10 @@ namespace libtorrent {
if (ip_ent)
{
char const* p = ip_ent.string_ptr();
if (ip_ent.string_length() == int(address_v4::bytes_type().size()))
if (ip_ent.string_length() == std::tuple_size<address_v4::bytes_type>::value)
resp.external_ip = detail::read_v4_address(p);
#if TORRENT_USE_IPV6
else if (ip_ent.string_length() == int(address_v6::bytes_type().size()))
else if (ip_ent.string_length() == std::tuple_size<address_v6::bytes_type>::value)
resp.external_ip = detail::read_v6_address(p);
#endif
}