forked from premiere/premiere-libtorrent
minor code cleanup, std:: prefix, consts, typos
This commit is contained in:
parent
45bea967c2
commit
0132221031
|
@ -71,4 +71,3 @@ private:
|
|||
|
||||
}}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ namespace libtorrent
|
|||
++in; // 'e'
|
||||
ret = entry(entry::int_t);
|
||||
char* end_pointer;
|
||||
ret.integer() = strtoll(val.c_str(), &end_pointer, 10);
|
||||
ret.integer() = std::strtoll(val.c_str(), &end_pointer, 10);
|
||||
#if TORRENT_USE_ASSERTS
|
||||
ret.m_type_queried = false;
|
||||
#endif
|
||||
|
|
|
@ -63,8 +63,7 @@ namespace libtorrent
|
|||
std::string const& header(char const* key) const
|
||||
{
|
||||
static std::string empty;
|
||||
std::multimap<std::string, std::string>::const_iterator i
|
||||
= m_header.find(key);
|
||||
auto const i = m_header.find(key);
|
||||
if (i == m_header.end()) return empty;
|
||||
return i->second;
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
m_read_timeout = seconds(5);
|
||||
if (m_read_timeout < timeout / 5) m_read_timeout = timeout / 5;
|
||||
error_code ec;
|
||||
m_timer.expires_from_now((std::min)(
|
||||
m_timer.expires_from_now(std::min(
|
||||
m_read_timeout, m_completion_timeout), ec);
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_timeout");
|
||||
m_timer.async_wait(std::bind(&http_connection::on_timeout
|
||||
|
@ -449,7 +449,7 @@ void http_connection::on_timeout(std::weak_ptr<http_connection> p
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_timeout");
|
||||
error_code ec;
|
||||
c->m_timer.expires_at((std::min)(
|
||||
c->m_timer.expires_at(std::min(
|
||||
c->m_last_receive + c->m_read_timeout
|
||||
, c->m_start_time + c->m_completion_timeout), ec);
|
||||
c->m_timer.async_wait(std::bind(&http_connection::on_timeout, p, _1));
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace libtorrent
|
|||
// however, we may still need to insert a '/' in case neither side
|
||||
// has one. We know the location doesn't start with a / already.
|
||||
// so, if the referrer doesn't end with one, add it.
|
||||
if ((url.empty() || url[url.size()-1] != '/'))
|
||||
if (url.empty() || url[url.size() - 1] != '/')
|
||||
url += '/';
|
||||
url += location;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ restart_response:
|
|||
|
||||
if (name == "content-length")
|
||||
{
|
||||
m_content_length = strtoll(value.c_str(), nullptr, 10);
|
||||
m_content_length = std::strtoll(value.c_str(), nullptr, 10);
|
||||
if (m_content_length < 0)
|
||||
{
|
||||
m_state = error_state;
|
||||
|
@ -285,7 +285,7 @@ restart_response:
|
|||
// start immediately
|
||||
if (string_begins_no_case("bytes ", ptr)) ptr += 6;
|
||||
char* end;
|
||||
m_range_start = strtoll(ptr, &end, 10);
|
||||
m_range_start = std::strtoll(ptr, &end, 10);
|
||||
if (m_range_start < 0)
|
||||
{
|
||||
m_state = error_state;
|
||||
|
@ -297,7 +297,7 @@ restart_response:
|
|||
else
|
||||
{
|
||||
ptr = end + 1;
|
||||
m_range_end = strtoll(ptr, &end, 10);
|
||||
m_range_end = std::strtoll(ptr, &end, 10);
|
||||
if (m_range_end < 0)
|
||||
{
|
||||
m_state = error_state;
|
||||
|
@ -454,7 +454,7 @@ restart_response:
|
|||
// empty line
|
||||
|
||||
// first, read the chunk length
|
||||
*chunk_size = strtoll(pos, nullptr, 16);
|
||||
*chunk_size = std::strtoll(pos, nullptr, 16);
|
||||
if (*chunk_size < 0) return true;
|
||||
|
||||
if (*chunk_size != 0)
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
void http_seed_connection::disconnect(error_code const& ec
|
||||
, operation_t op, int error)
|
||||
, operation_t const op, int const error)
|
||||
{
|
||||
if (is_disconnecting()) return;
|
||||
|
||||
|
@ -155,7 +155,7 @@ namespace libtorrent
|
|||
{
|
||||
int request_offset = r.start + r.length - size;
|
||||
pr.start = request_offset % piece_size;
|
||||
pr.length = (std::min)(block_size, size);
|
||||
pr.length = std::min(block_size, size);
|
||||
pr.piece = piece_index_t(static_cast<int>(r.piece) + request_offset / piece_size);
|
||||
m_requests.push_back(pr);
|
||||
size -= pr.length;
|
||||
|
|
|
@ -8177,7 +8177,7 @@ namespace libtorrent
|
|||
// TODO: add a flag to ignore stats, and only care about resume data for
|
||||
// content. For unchanged files, don't trigger a load of the metadata
|
||||
// just to save an empty resume data file
|
||||
void torrent::save_resume_data(int flags)
|
||||
void torrent::save_resume_data(int const flags)
|
||||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
INVARIANT_CHECK;
|
||||
|
|
|
@ -158,7 +158,7 @@ enum
|
|||
// into account. if lhs is close to UINT_MAX and rhs
|
||||
// is close to 0, lhs is assumed to have wrapped and
|
||||
// considered smaller
|
||||
TORRENT_EXTRA_EXPORT bool compare_less_wrap(std::uint32_t lhs
|
||||
bool compare_less_wrap(std::uint32_t lhs
|
||||
, std::uint32_t rhs, std::uint32_t mask)
|
||||
{
|
||||
// distance walking from lhs to rhs, downwards
|
||||
|
|
|
@ -60,10 +60,9 @@ void print_http_header(http_parser const& p)
|
|||
{
|
||||
std::cout << time_now_string() << " < " << p.status_code() << " " << p.message() << std::endl;
|
||||
|
||||
for (std::multimap<std::string, std::string>::const_iterator i
|
||||
= p.headers().begin(), end(p.headers().end()); i != end; ++i)
|
||||
for (auto const& i : p.headers())
|
||||
{
|
||||
std::cout << time_now_string() << " < " << i->first << ": " << i->second << std::endl;
|
||||
std::cout << time_now_string() << " < " << i.first << ": " << i.second << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ TORRENT_TEST(parse_invalid_ipv4_endpoint)
|
|||
ec.clear();
|
||||
|
||||
#ifndef TORRENT_WINDOWS
|
||||
// it appears windows siliently accepts truncated IP addresses
|
||||
// it appears windows silently accepts truncated IP addresses
|
||||
endp = parse_endpoint("127.0.0:123", ec);
|
||||
TEST_CHECK(ec);
|
||||
ec.clear();
|
||||
|
|
Loading…
Reference in New Issue