diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index d9272ab0d..777d11766 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -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); diff --git a/src/torrent.cpp b/src/torrent.cpp index 3f124f3a8..20aa170c2 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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 files = fs.map_block( + std::vector 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)