Add const peer_request p -> peer_request const& p (#1705)

Add const peer_request p -> peer_request const& p
This commit is contained in:
Pavel Pimenov 2017-02-14 08:17:02 +03:00 committed by Arvid Norberg
parent 49254e5663
commit 7f4c8aaf75
6 changed files with 15 additions and 13 deletions

View File

@ -753,9 +753,9 @@ namespace libtorrent
void do_update_interest();
void fill_send_buffer();
void on_disk_read_complete(disk_buffer_holder disk_block, int flags
, storage_error const& error, peer_request r, time_point issue_time);
, storage_error const& error, peer_request const& r, time_point issue_time);
void on_disk_write_complete(storage_error const& error
, peer_request r, std::shared_ptr<torrent> t);
, peer_request const &r, std::shared_ptr<torrent> t);
void on_seed_mode_hashed(piece_index_t piece
, sha1_hash const& piece_hash, storage_error const& error);
int request_timeout() const;

View File

@ -383,7 +383,7 @@ namespace libtorrent
enum flags_t { overwrite_existing = 1 };
void add_piece(piece_index_t piece, char const* data, int flags = 0);
void on_disk_write_complete(storage_error const& error
, peer_request p);
, peer_request const& p);
void set_progress_ppm(int p) { m_progress_ppm = std::uint32_t(p); }
struct read_piece_struct
@ -395,7 +395,7 @@ namespace libtorrent
};
void read_piece(piece_index_t piece);
void on_disk_read_complete(disk_buffer_holder block, int flags, storage_error const& se
, peer_request r, std::shared_ptr<read_piece_struct> rp);
, peer_request const& r, std::shared_ptr<read_piece_struct> rp);
storage_mode_t storage_mode() const;

View File

@ -290,7 +290,9 @@ namespace
|| ((lhs.id[0] == rhs.id[0]) && (lhs.id[1] < rhs.id[1]));
}
std::string lookup(fingerprint const& f)
namespace
{
static std::string lookup(fingerprint const& f)
{
char identity[200];
@ -334,7 +336,7 @@ namespace
return identity;
}
}
bool find_string(char const* id, char const* search)
{
return std::equal(search, search + std::strlen(search), id);

View File

@ -2947,7 +2947,7 @@ namespace libtorrent
}
void peer_connection::on_disk_write_complete(storage_error const& error
, peer_request p, std::shared_ptr<torrent> t)
, peer_request const& p, std::shared_ptr<torrent> t)
{
TORRENT_ASSERT(is_single_thread());
#ifndef TORRENT_DISABLE_LOGGING
@ -5199,7 +5199,7 @@ namespace libtorrent
void peer_connection::on_disk_read_complete(disk_buffer_holder buffer
, int const flags, storage_error const& error
, peer_request r, time_point issue_time)
, peer_request const& r, time_point issue_time)
{
TORRENT_ASSERT(is_single_thread());
// return value:

View File

@ -1119,7 +1119,7 @@ namespace libtorrent
void torrent::on_disk_read_complete(disk_buffer_holder buffer
, int, storage_error const& se
, peer_request r, std::shared_ptr<read_piece_struct> rp) try
, peer_request const& r, std::shared_ptr<read_piece_struct> rp) try
{
// hold a reference until this function returns
TORRENT_ASSERT(is_single_thread());
@ -1261,7 +1261,7 @@ namespace libtorrent
, std::bind(&torrent::on_disk_write_complete
, shared_from_this(), _1, p));
piece_block block(piece, i);
piece_block const block(piece, i);
bool const was_finished = picker().is_piece_finished(p.piece);
bool const multi = picker().num_peers(block) > 1;
@ -1281,7 +1281,7 @@ namespace libtorrent
}
void torrent::on_disk_write_complete(storage_error const& error
, peer_request p) try
, peer_request const& p) try
{
TORRENT_ASSERT(is_single_thread());
@ -1292,7 +1292,7 @@ namespace libtorrent
INVARIANT_CHECK;
if (m_abort) return;
piece_block block_finished(p.piece, p.start / block_size());
piece_block const block_finished(p.piece, p.start / block_size());
if (error)
{

View File

@ -407,7 +407,7 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
bool non_router = false;
if (m_ignore_non_routers)
{
std::vector<ip_route> routes = enum_routes(m_io_service, ec);
std::vector<ip_route> const routes = enum_routes(m_io_service, ec);
if (std::none_of(routes.begin(), routes.end()
, [from] (ip_route const& rt) { return rt.gateway == from.address(); }))
{