This commit is contained in:
Pavel Pimenov 2017-04-16 14:27:47 +03:00 committed by Arvid Norberg
parent 969c0167d4
commit 7d09dba14e
2 changed files with 10 additions and 10 deletions

View File

@ -366,7 +366,7 @@ namespace libtorrent {
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing_message, "HAVE_ALL");
#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));
stats_counters().inc_stats_counter(counters::num_outgoing_have_all);
@ -380,7 +380,7 @@ namespace libtorrent {
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing_message, "HAVE_NONE");
#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));
stats_counters().inc_stats_counter(counters::num_outgoing_have_none);
@ -2026,7 +2026,7 @@ namespace libtorrent {
// for the metadata extension.
TORRENT_ASSERT(m_sent_handshake);
char msg[] = {0,0,0,0};
static const char msg[] = {0,0,0,0};
send_buffer(msg, sizeof(msg));
}
@ -2306,7 +2306,7 @@ namespace libtorrent {
TORRENT_ASSERT(m_sent_bitfield);
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));
stats_counters().inc_stats_counter(counters::num_outgoing_choke);
@ -2319,7 +2319,7 @@ namespace libtorrent {
TORRENT_ASSERT(m_sent_handshake);
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));
stats_counters().inc_stats_counter(counters::num_outgoing_unchoke);
@ -2339,7 +2339,7 @@ namespace libtorrent {
TORRENT_ASSERT(m_sent_handshake);
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));
stats_counters().inc_stats_counter(counters::num_outgoing_interested);
@ -2352,7 +2352,7 @@ namespace libtorrent {
TORRENT_ASSERT(m_sent_handshake);
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));
stats_counters().inc_stats_counter(counters::num_outgoing_not_interested);

View File

@ -3379,11 +3379,11 @@ namespace libtorrent {
int torrent::block_bytes_wanted(piece_block const& p) const
{
file_storage const& fs = m_torrent_file->files();
int piece_size = m_torrent_file->piece_size(p.piece_index);
int offset = p.block_index * block_size();
int const piece_size = m_torrent_file->piece_size(p.piece_index);
int const offset = p.block_index * 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()));
std::int64_t ret = 0;
for (auto const& i : files)