forked from premiere/premiere-libtorrent
add const (#1917)
This commit is contained in:
parent
969c0167d4
commit
7d09dba14e
|
@ -366,7 +366,7 @@ namespace libtorrent {
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
peer_log(peer_log_alert::outgoing_message, "HAVE_ALL");
|
peer_log(peer_log_alert::outgoing_message, "HAVE_ALL");
|
||||||
#endif
|
#endif
|
||||||
char msg[] = {0,0,0,1, msg_have_all};
|
static const char msg[] = {0,0,0,1, msg_have_all};
|
||||||
send_buffer(msg, sizeof(msg));
|
send_buffer(msg, sizeof(msg));
|
||||||
|
|
||||||
stats_counters().inc_stats_counter(counters::num_outgoing_have_all);
|
stats_counters().inc_stats_counter(counters::num_outgoing_have_all);
|
||||||
|
@ -380,7 +380,7 @@ namespace libtorrent {
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
peer_log(peer_log_alert::outgoing_message, "HAVE_NONE");
|
peer_log(peer_log_alert::outgoing_message, "HAVE_NONE");
|
||||||
#endif
|
#endif
|
||||||
char msg[] = {0,0,0,1, msg_have_none};
|
static const char msg[] = {0,0,0,1, msg_have_none};
|
||||||
send_buffer(msg, sizeof(msg));
|
send_buffer(msg, sizeof(msg));
|
||||||
|
|
||||||
stats_counters().inc_stats_counter(counters::num_outgoing_have_none);
|
stats_counters().inc_stats_counter(counters::num_outgoing_have_none);
|
||||||
|
@ -2026,7 +2026,7 @@ namespace libtorrent {
|
||||||
// for the metadata extension.
|
// for the metadata extension.
|
||||||
TORRENT_ASSERT(m_sent_handshake);
|
TORRENT_ASSERT(m_sent_handshake);
|
||||||
|
|
||||||
char msg[] = {0,0,0,0};
|
static const char msg[] = {0,0,0,0};
|
||||||
send_buffer(msg, sizeof(msg));
|
send_buffer(msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2306,7 +2306,7 @@ namespace libtorrent {
|
||||||
TORRENT_ASSERT(m_sent_bitfield);
|
TORRENT_ASSERT(m_sent_bitfield);
|
||||||
|
|
||||||
if (is_choked()) return;
|
if (is_choked()) return;
|
||||||
char msg[] = {0,0,0,1,msg_choke};
|
static const char msg[] = {0,0,0,1,msg_choke};
|
||||||
send_buffer(msg, sizeof(msg));
|
send_buffer(msg, sizeof(msg));
|
||||||
|
|
||||||
stats_counters().inc_stats_counter(counters::num_outgoing_choke);
|
stats_counters().inc_stats_counter(counters::num_outgoing_choke);
|
||||||
|
@ -2319,7 +2319,7 @@ namespace libtorrent {
|
||||||
TORRENT_ASSERT(m_sent_handshake);
|
TORRENT_ASSERT(m_sent_handshake);
|
||||||
TORRENT_ASSERT(m_sent_bitfield);
|
TORRENT_ASSERT(m_sent_bitfield);
|
||||||
|
|
||||||
char msg[] = {0,0,0,1,msg_unchoke};
|
static const char msg[] = {0,0,0,1,msg_unchoke};
|
||||||
send_buffer(msg, sizeof(msg));
|
send_buffer(msg, sizeof(msg));
|
||||||
|
|
||||||
stats_counters().inc_stats_counter(counters::num_outgoing_unchoke);
|
stats_counters().inc_stats_counter(counters::num_outgoing_unchoke);
|
||||||
|
@ -2339,7 +2339,7 @@ namespace libtorrent {
|
||||||
TORRENT_ASSERT(m_sent_handshake);
|
TORRENT_ASSERT(m_sent_handshake);
|
||||||
TORRENT_ASSERT(m_sent_bitfield);
|
TORRENT_ASSERT(m_sent_bitfield);
|
||||||
|
|
||||||
char msg[] = {0,0,0,1,msg_interested};
|
static const char msg[] = {0,0,0,1,msg_interested};
|
||||||
send_buffer(msg, sizeof(msg));
|
send_buffer(msg, sizeof(msg));
|
||||||
|
|
||||||
stats_counters().inc_stats_counter(counters::num_outgoing_interested);
|
stats_counters().inc_stats_counter(counters::num_outgoing_interested);
|
||||||
|
@ -2352,7 +2352,7 @@ namespace libtorrent {
|
||||||
TORRENT_ASSERT(m_sent_handshake);
|
TORRENT_ASSERT(m_sent_handshake);
|
||||||
TORRENT_ASSERT(m_sent_bitfield);
|
TORRENT_ASSERT(m_sent_bitfield);
|
||||||
|
|
||||||
char msg[] = {0,0,0,1,msg_not_interested};
|
static const char msg[] = {0,0,0,1,msg_not_interested};
|
||||||
send_buffer(msg, sizeof(msg));
|
send_buffer(msg, sizeof(msg));
|
||||||
|
|
||||||
stats_counters().inc_stats_counter(counters::num_outgoing_not_interested);
|
stats_counters().inc_stats_counter(counters::num_outgoing_not_interested);
|
||||||
|
|
|
@ -3379,11 +3379,11 @@ namespace libtorrent {
|
||||||
int torrent::block_bytes_wanted(piece_block const& p) const
|
int torrent::block_bytes_wanted(piece_block const& p) const
|
||||||
{
|
{
|
||||||
file_storage const& fs = m_torrent_file->files();
|
file_storage const& fs = m_torrent_file->files();
|
||||||
int piece_size = m_torrent_file->piece_size(p.piece_index);
|
int const piece_size = m_torrent_file->piece_size(p.piece_index);
|
||||||
int offset = p.block_index * block_size();
|
int const offset = p.block_index * block_size();
|
||||||
if (m_padding == 0) return (std::min)(piece_size - offset, block_size());
|
if (m_padding == 0) return (std::min)(piece_size - offset, block_size());
|
||||||
|
|
||||||
std::vector<file_slice> files = fs.map_block(
|
std::vector<file_slice> const files = fs.map_block(
|
||||||
p.piece_index, offset, (std::min)(piece_size - offset, block_size()));
|
p.piece_index, offset, (std::min)(piece_size - offset, block_size()));
|
||||||
std::int64_t ret = 0;
|
std::int64_t ret = 0;
|
||||||
for (auto const& i : files)
|
for (auto const& i : files)
|
||||||
|
|
Loading…
Reference in New Issue