enable /W4 warnings for msvc

This commit is contained in:
Alden Torres 2016-12-13 10:30:36 -05:00 committed by Arvid Norberg
parent 63df1a26b6
commit 22b596945e
23 changed files with 75 additions and 86 deletions

12
Jamfile
View File

@ -265,19 +265,11 @@ rule warnings ( properties * )
if <toolset>msvc in $(properties)
{
# disable warning C4503: decorated name length exceeded, name was truncated
result += <cflags>/wd4503 ;
# on msvc this resolves to /W4
result += <warnings>all ;
# enable these warnings again, once the other ones are dealt with
# disable warning C4389: signed/unsigned mismatch
result += <cflags>/wd4389 ;
result += <cflags>/wd4245 ;
result += <cflags>/wd4018 ;
# disable warning C4244: 'argument' : conversion from 'int' to 'unsigned short', possible loss of data
result += <cflags>/wd4244 ;
# disable warning C4512: assignment operator could not be generated
result += <cflags>/wd4512 ;
# disable warning C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
result += <cflags>/wd4251 ;
# disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'

View File

@ -1978,7 +1978,7 @@ namespace libtorrent
{
dht_mutable_item_alert(aux::stack_allocator& alloc
, std::array<char, 32> k, std::array<char, 64> sig
, std::uint64_t sequence, string_view s, entry const& i, bool a);
, std::int64_t sequence, string_view s, entry const& i, bool a);
TORRENT_DEFINE_ALERT_PRIO(dht_mutable_item_alert, 75)
@ -1996,7 +1996,7 @@ namespace libtorrent
std::array<char, 64> const signature;
// the sequence number of this item
std::uint64_t const seq;
std::int64_t const seq;
// the salt, if any, used to lookup and store this item. If no
// salt was used, this is an empty string
@ -2018,7 +2018,7 @@ namespace libtorrent
dht_put_alert(aux::stack_allocator& alloc, std::array<char, 32> key
, std::array<char, 64> sig
, std::string s
, std::uint64_t sequence_number
, std::int64_t sequence_number
, int n);
TORRENT_DEFINE_ALERT(dht_put_alert, 76)
@ -2035,7 +2035,7 @@ namespace libtorrent
std::array<char, 32> const public_key;
std::array<char, 64> const signature;
std::string const salt;
std::uint64_t const seq;
std::int64_t const seq;
// DHT put operation usually writes item to k nodes, maybe the node
// is stale so no response, or the node doesn't support 'put', or the

View File

@ -41,4 +41,3 @@ POSSIBILITY OF SUCH DAMAGE.
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

View File

@ -93,4 +93,6 @@ POSSIBILITY OF SUCH DAMAGE.
#pragma warning(disable : 4005)
// expression before comma has no effect; expected expression with side-effect
#pragma warning(disable : 4548)
// 'conversion' conversion from 'type1' to 'type2', possible loss of data
#pragma warning(disable : 4244)
#endif

View File

@ -147,8 +147,8 @@ enum utp_extensions_t
struct utp_header
{
unsigned char type_ver;
unsigned char extension;
std::uint8_t type_ver;
std::uint8_t extension;
be_uint16 connection_id;
be_uint32 timestamp_microseconds;
be_uint32 timestamp_difference_microseconds;

View File

@ -1564,7 +1564,7 @@ namespace libtorrent {
dht_mutable_item_alert::dht_mutable_item_alert(aux::stack_allocator&
, std::array<char, 32> k
, std::array<char, 64> sig
, std::uint64_t sequence
, std::int64_t sequence
, string_view s
, entry const& i
, bool a)
@ -1596,7 +1596,7 @@ namespace libtorrent {
, std::array<char, 32> key
, std::array<char, 64> sig
, std::string s
, std::uint64_t sequence_number
, std::int64_t sequence_number
, int n)
: target(nullptr)
, public_key(key)
@ -1969,15 +1969,14 @@ namespace libtorrent {
, m_num_peers(int(peers.size()))
{
std::size_t total_size = peers.size(); // num bytes for sizes
for (int i = 0; i < m_num_peers; i++) {
total_size += peers[i].size();
for (auto const& endp : peers) {
total_size += endp.size();
}
m_peers_idx = alloc.allocate(int(total_size));
char *ptr = alloc.ptr(m_peers_idx);
for (int i = 0; i < m_num_peers; i++) {
tcp::endpoint const& endp = peers[i];
for (auto const& endp : peers) {
std::size_t const size = endp.size();
TORRENT_ASSERT(size < 0x100);
detail::write_uint8(size, ptr);
@ -2083,7 +2082,7 @@ namespace libtorrent {
std::vector<piece_block> ret(m_num_blocks);
char const* start = m_alloc.get().ptr(m_array_idx);
std::memcpy(&ret[0], start, m_num_blocks * sizeof(piece_block));
std::memcpy(ret.data(), start, m_num_blocks * sizeof(piece_block));
return ret;
}
@ -2124,11 +2123,11 @@ namespace libtorrent {
std::vector<piece_block> b = blocks();
for (int i = 0; i < int(b.size()); ++i)
for (auto const& p : b)
{
char buf[50];
std::snprintf(buf, sizeof(buf), "(%d,%d) "
, b[i].piece_index, b[i].block_index);
, p.piece_index, p.block_index);
ret += buf;
}
return ret;

View File

@ -244,7 +244,7 @@ TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth
if (has_line)
{
ret = std::snprintf(out, len, " %s:%d"
, line.FileName, line.LineNumber);
, line.FileName, int(line.LineNumber));
out += ret; len -= ret; if (len <= 0) break;
}

View File

@ -554,7 +554,7 @@ void block_cache::try_evict_one_volatile()
// some blocks are pinned in this piece, skip it
if (pe->pinned > 0) continue;
TORRENT_ALLOCA(to_delete, char*, pe->blocks_in_piece);
TORRENT_ALLOCA(to_delete, char*, std::size_t(pe->blocks_in_piece));
int num_to_delete = 0;
// go through the blocks and evict the ones that are not dirty and not
@ -861,7 +861,7 @@ bool block_cache::evict_piece(cached_piece_entry* pe, tailqueue<disk_io_job>& jo
TORRENT_PIECE_ASSERT(pe->in_use, pe);
TORRENT_ALLOCA(to_delete, char*, pe->blocks_in_piece);
TORRENT_ALLOCA(to_delete, char*, std::size_t(pe->blocks_in_piece));
int num_to_delete = 0;
for (int i = 0; i < pe->blocks_in_piece; ++i)
{
@ -1347,7 +1347,7 @@ bool block_cache::inc_block_refcount(cached_piece_entry* pe, int block, int reas
case ref_reading: ++pe->blocks[block].reading_count; break;
case ref_flushing: ++pe->blocks[block].flushing_count; break;
};
TORRENT_ASSERT(pe->blocks[block].refcount >= pe->blocks[block].hashing_count
TORRENT_ASSERT(int(pe->blocks[block].refcount) >= pe->blocks[block].hashing_count
+ pe->blocks[block].reading_count + pe->blocks[block].flushing_count);
#else
TORRENT_UNUSED(reason);
@ -1380,7 +1380,7 @@ void block_cache::dec_block_refcount(cached_piece_entry* pe, int block, int reas
case ref_reading: --pe->blocks[block].reading_count; break;
case ref_flushing: --pe->blocks[block].flushing_count; break;
};
TORRENT_PIECE_ASSERT(pe->blocks[block].refcount >= pe->blocks[block].hashing_count
TORRENT_PIECE_ASSERT(int(pe->blocks[block].refcount) >= pe->blocks[block].hashing_count
+ pe->blocks[block].reading_count + pe->blocks[block].flushing_count, pe);
#else
TORRENT_UNUSED(reason);
@ -1393,7 +1393,7 @@ void block_cache::abort_dirty(cached_piece_entry* pe)
TORRENT_PIECE_ASSERT(pe->in_use, pe);
TORRENT_ALLOCA(to_delete, char*, pe->blocks_in_piece);
TORRENT_ALLOCA(to_delete, char*, std::size_t(pe->blocks_in_piece));
int num_to_delete = 0;
for (int i = 0; i < pe->blocks_in_piece; ++i)
{
@ -1432,7 +1432,7 @@ void block_cache::free_piece(cached_piece_entry* pe)
// build a vector of all the buffers we need to free
// and free them all in one go
TORRENT_ALLOCA(to_delete, char*, pe->blocks_in_piece);
TORRENT_ALLOCA(to_delete, char*, std::size_t(pe->blocks_in_piece));
int num_to_delete = 0;
int removed_clean = 0;
for (int i = 0; i < pe->blocks_in_piece; ++i)
@ -1664,7 +1664,7 @@ void block_cache::check_invariant() const
if (p.blocks[k].pending) ++num_pending;
if (p.blocks[k].refcount > 0) ++num_pinned;
TORRENT_PIECE_ASSERT(p.blocks[k].refcount >=
TORRENT_PIECE_ASSERT(int(p.blocks[k].refcount) >=
p.blocks[k].hashing_count
+ p.blocks[k].reading_count
+ p.blocks[k].flushing_count, &p);
@ -1846,7 +1846,7 @@ cached_piece_entry* block_cache::find_piece(storage_interface* st, int piece)
for (tailqueue_iterator<const disk_io_job> j = i->jobs.iterate(); j.get(); j.next())
{
disk_io_job const* job = static_cast<disk_io_job const*>(j.get());
TORRENT_PIECE_ASSERT(job->piece == piece, &*i);
TORRENT_PIECE_ASSERT(int(job->piece) == piece, &*i);
}
#endif

View File

@ -308,7 +308,7 @@ namespace libtorrent
// round offset up to include the last block, which might
// have an odd size
int const block_size = m_disk_cache.block_size();
int end = p->hashing_done ? p->blocks_in_piece : (p->hash->offset + block_size - 1) / block_size;
int end = p->hashing_done ? int(p->blocks_in_piece) : (p->hash->offset + block_size - 1) / block_size;
// nothing has been hashed yet, don't flush anything
if (end == 0 && !p->need_readback) return 0;
@ -344,7 +344,7 @@ namespace libtorrent
// if the cache line size is larger than a whole piece, hold
// off flushing this piece until enough adjacent pieces are
// full as well.
int cont_pieces = cont_block / p->blocks_in_piece;
int cont_pieces = int(cont_block / p->blocks_in_piece);
// at this point, we may enforce flushing full cache stripes even when
// they span multiple pieces. This won't necessarily work in the general
@ -361,7 +361,7 @@ namespace libtorrent
}
// piece range
int range_start = (p->piece / cont_pieces) * cont_pieces;
int range_start = int((p->piece / cont_pieces) * cont_pieces);
int range_end = (std::min)(range_start + cont_pieces, p->storage->files()->num_pieces());
// look through all the pieces in this range to see if
@ -442,7 +442,7 @@ namespace libtorrent
// we keep the indices in the iovec_offset array
cont_pieces = range_end - range_start;
int blocks_to_flush = p->blocks_in_piece * cont_pieces;
int blocks_to_flush = int(p->blocks_in_piece * cont_pieces);
TORRENT_ALLOCA(iov, file::iovec_t, blocks_to_flush);
TORRENT_ALLOCA(flushing, int, blocks_to_flush);
// this is the offset into iov and flushing for each piece
@ -463,7 +463,7 @@ namespace libtorrent
{
refcount_pieces[i] = 0;
iovec_offset[i] = iov_len;
block_start += p->blocks_in_piece;
block_start += int(p->blocks_in_piece);
continue;
}
@ -478,7 +478,7 @@ namespace libtorrent
iov_len += build_iovec(pe, 0, p->blocks_in_piece
, iov.subspan(iov_len), flushing.subspan(iov_len), block_start);
block_start += p->blocks_in_piece;
block_start += int(p->blocks_in_piece);
}
iovec_offset[cont_pieces] = iov_len;
@ -514,7 +514,7 @@ namespace libtorrent
{
DLOG("iovec_flushed: piece %d gone!\n", range_start + i);
TORRENT_PIECE_ASSERT(refcount_pieces[i] == 0, pe);
block_start += p->blocks_in_piece;
block_start += int(p->blocks_in_piece);
continue;
}
if (refcount_pieces[i])
@ -526,7 +526,7 @@ namespace libtorrent
const int block_diff = iovec_offset[i+1] - iovec_offset[i];
iovec_flushed(pe, flushing.subspan(iovec_offset[i]).data(), block_diff
, block_start, error, completed_jobs);
block_start += p->blocks_in_piece;
block_start += int(p->blocks_in_piece);
}
// if the cache is under high pressure, we need to evict
@ -740,8 +740,8 @@ namespace libtorrent
TORRENT_PIECE_ASSERT(start >= 0, pe);
TORRENT_PIECE_ASSERT(start < end, pe);
TORRENT_ALLOCA(iov, file::iovec_t, pe->blocks_in_piece);
TORRENT_ALLOCA(flushing, int, pe->blocks_in_piece);
TORRENT_ALLOCA(iov, file::iovec_t, std::size_t(pe->blocks_in_piece));
TORRENT_ALLOCA(flushing, int, std::size_t(pe->blocks_in_piece));
int iov_len = build_iovec(pe, start, end, iov, flushing, 0);
if (iov_len == 0) return 0;
@ -2191,9 +2191,9 @@ namespace libtorrent
if (pe == nullptr)
{
std::uint16_t const cache_state = (j->flags & disk_interface::volatile_read)
std::uint16_t const cache_state = std::uint16_t((j->flags & disk_interface::volatile_read)
? cached_piece_entry::volatile_read_lru
: cached_piece_entry::read_lru1;
: cached_piece_entry::read_lru1);
pe = m_disk_cache.allocate_piece(j, cache_state);
}
if (pe == nullptr)
@ -3389,7 +3389,7 @@ namespace libtorrent
j->call_callback();
to_delete[cnt++] = j;
j = next;
if (cnt == to_delete.size())
if (cnt == int(to_delete.size()))
{
cnt = 0;
free_jobs(to_delete.data(), int(to_delete.size()));

View File

@ -1009,7 +1009,7 @@ namespace libtorrent
*write_cur++ = *read_cur++;
continue;
}
int element_len = read_cur - last_read_sep;
int element_len = int(read_cur - last_read_sep);
if (element_len == 1 && std::memcmp(last_read_sep, ".", 1) == 0)
{
--write_cur;
@ -1305,7 +1305,7 @@ namespace libtorrent
return -1;
}
DWORD ret = -1;
DWORD ret;
if (GetOverlappedResult(file, &ol, &ret, false) == 0)
{
DWORD last_error = GetLastError();
@ -1854,7 +1854,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
#if TORRENT_USE_PREADV
TORRENT_UNUSED(flags);
int ret = iov(&::preadv, native_handle(), file_offset, bufs, ec);
std::int64_t ret = iov(&::preadv, native_handle(), file_offset, bufs, ec);
#else
// there's no point in coalescing single buffer writes
@ -1910,7 +1910,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
#if TORRENT_USE_PREADV
TORRENT_UNUSED(flags);
int ret = iov(&::pwritev, native_handle(), file_offset, bufs, ec);
std::int64_t ret = iov(&::pwritev, native_handle(), file_offset, bufs, ec);
#else
// there's no point in coalescing single buffer writes

View File

@ -348,7 +348,7 @@ restart_response:
incoming -= int(payload);
}
auto const buf = span<char const>(recv_buffer)
.subspan(m_cur_chunk_end);
.subspan(std::size_t(m_cur_chunk_end));
std::int64_t chunk_size;
int header_size;
if (parse_chunk_header(buf, &chunk_size, &header_size))
@ -525,7 +525,7 @@ restart_response:
? (std::min)(m_chunked_ranges.back().second - m_body_start_pos, received)
: m_content_length < 0 ? received : (std::min)(m_content_length, received);
return m_recv_buffer.subspan(m_body_start_pos, body_length);
return m_recv_buffer.subspan(m_body_start_pos, std::size_t(body_length));
}
void http_parser::reset()

View File

@ -359,7 +359,7 @@ namespace libtorrent
{
int header_size = 0;
std::int64_t chunk_size = 0;
span<char const> chunk_start(recv_buffer.begin() + m_chunk_pos, int(recv_buffer.size()) - m_chunk_pos);
span<char const> chunk_start(recv_buffer.begin() + m_chunk_pos, std::size_t(int(recv_buffer.size()) - m_chunk_pos));
TORRENT_ASSERT(chunk_start[0] == '\r'
|| aux::is_hex(chunk_start[0]));
bool ret = m_parser.parse_chunk_header(chunk_start, &chunk_size, &header_size);

View File

@ -526,7 +526,7 @@ namespace
return e.added + minutes(int(announce_interval * 3 / 2)) < now;
});
m_counters.peers -= std::distance(new_end, peers.end());
m_counters.peers -= std::int32_t(std::distance(new_end, peers.end()));
peers.erase(new_end, peers.end());
// if we're using less than 1/4 of the capacity free up the excess
if (!peers.empty() && peers.capacity() / peers.size() >= 4u)

View File

@ -594,8 +594,8 @@ namespace libtorrent { namespace dht
m_last_tick = now;
// add any new quota we've accrued since last time
m_send_quota += std::uint64_t(m_settings.upload_rate_limit)
* total_microseconds(delta) / 1000000;
m_send_quota += int(std::uint64_t(m_settings.upload_rate_limit)
* total_microseconds(delta) / 1000000);
// allow 3 seconds worth of burst
if (m_send_quota > 3 * m_settings.upload_rate_limit)

View File

@ -252,7 +252,7 @@ namespace libtorrent
lazy_entry* lazy_entry::dict_append(char const* name)
{
TORRENT_ASSERT(m_type == dict_t);
TORRENT_ASSERT(m_size <= this->capacity());
TORRENT_ASSERT(int(m_size) <= this->capacity());
if (m_data.dict == nullptr)
{
int capacity = lazy_entry_dict_init;
@ -260,7 +260,7 @@ namespace libtorrent
if (m_data.dict == nullptr) return nullptr;
m_data.dict[0].val.m_len = capacity;
}
else if (m_size == this->capacity())
else if (int(m_size) == this->capacity())
{
int capacity = this->capacity() * lazy_entry_grow_factor / 100;
lazy_dict_entry* tmp = new (std::nothrow) lazy_dict_entry[capacity+1];
@ -273,7 +273,7 @@ namespace libtorrent
m_data.dict[0].val.m_len = capacity;
}
TORRENT_ASSERT(m_size < this->capacity());
TORRENT_ASSERT(int(m_size) < this->capacity());
lazy_dict_entry& ret = m_data.dict[1+m_size++];
ret.name = name;
return &ret.val;
@ -421,7 +421,7 @@ namespace libtorrent
lazy_entry* lazy_entry::list_append()
{
TORRENT_ASSERT(m_type == list_t);
TORRENT_ASSERT(m_size <= this->capacity());
TORRENT_ASSERT(int(m_size) <= this->capacity());
if (m_data.start == nullptr)
{
int capacity = lazy_entry_list_init;
@ -429,7 +429,7 @@ namespace libtorrent
if (m_data.list == nullptr) return nullptr;
m_data.list[0].m_len = capacity;
}
else if (m_size == this->capacity())
else if (int(m_size) == this->capacity())
{
int capacity = this->capacity() * lazy_entry_grow_factor / 100;
lazy_entry* tmp = new (std::nothrow) lazy_entry[capacity+1];
@ -442,7 +442,7 @@ namespace libtorrent
m_data.list[0].m_len = capacity;
}
TORRENT_ASSERT(m_size < this->capacity());
TORRENT_ASSERT(int(m_size) < this->capacity());
return &m_data.list[1 + (m_size++)];
}

View File

@ -327,7 +327,7 @@ namespace libtorrent
l.unlock();
file::iovec_t v = {buf.get(), std::size_t(block_to_copy)};
v.iov_len = m_file.readv(slot_offset + piece_offset, v, ec);
v.iov_len = std::size_t(m_file.readv(slot_offset + piece_offset, v, ec));
TORRENT_ASSERT(!ec);
if (ec || v.iov_len == 0) return;

View File

@ -337,7 +337,7 @@ namespace libtorrent
int erase_candidate = -1;
int force_erase_candidate = -1;
if (m_finished != state->is_finished)
if (bool(m_finished) != state->is_finished)
recalculate_connect_candidates(state);
int round_robin = random(std::uint32_t(m_peers.size()-1));
@ -476,7 +476,7 @@ namespace libtorrent
int erase_candidate = -1;
if (m_finished != state->is_finished)
if (bool(m_finished) != state->is_finished)
recalculate_connect_candidates(state);
external_ip const& external = state->ip;
@ -1144,7 +1144,7 @@ namespace libtorrent
TORRENT_ASSERT(is_single_thread());
INVARIANT_CHECK;
if (m_finished != state->is_finished)
if (bool(m_finished) != state->is_finished)
recalculate_connect_candidates(state);
// clear out any peers from the cache that no longer
@ -1174,7 +1174,7 @@ namespace libtorrent
TORRENT_ASSERT(p->connectable);
// this should hold because find_connect_candidates should have done this
TORRENT_ASSERT(m_finished == state->is_finished);
TORRENT_ASSERT(bool(m_finished) == state->is_finished);
TORRENT_ASSERT(is_connect_candidate(*p));
return p;
@ -1390,4 +1390,3 @@ namespace libtorrent
return false;
}
}

View File

@ -414,7 +414,7 @@ namespace libtorrent
for (int i = 0; i < num_pieces; ++i)
{
bool h = have[i];
TORRENT_ASSERT(m_piece_map[std::size_t(i)].have_peers.count(p) == (h ? 1 : 0));
TORRENT_ASSERT(int(m_piece_map[i].have_peers.count(p)) == (h ? 1 : 0));
}
#else
TORRENT_UNUSED(have);

View File

@ -77,7 +77,7 @@ namespace libtorrent
std::int64_t sz = m_stat_cache[i].file_size;
if (sz < not_in_cache)
{
ec = m_errors[-sz + file_error];
ec = m_errors[std::size_t(-sz + file_error)];
return file_error;
}
else if (sz == not_in_cache)

View File

@ -35,10 +35,8 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
enum
{
TIME_MASK = 0xffffffff
};
constexpr std::uint32_t TIME_MASK = 0xffffffff;
// defined in utp_stream.cpp
bool compare_less_wrap(std::uint32_t lhs, std::uint32_t rhs
, std::uint32_t mask);

View File

@ -631,7 +631,7 @@ namespace libtorrent
: url(url_)
, auth(auth_)
, extra_headers(extra_headers_)
, type(type_)
, type(std::uint8_t(type_))
{
}

View File

@ -1066,7 +1066,7 @@ size_t utp_stream::read_some(bool clear_buffers)
m_impl->m_receive_buffer_size -= to_copy;
TORRENT_ASSERT(m_impl->m_read_buffer_size >= to_copy);
m_impl->m_read_buffer_size -= to_copy;
p->header_size += to_copy;
p->header_size += std::uint16_t(to_copy);
if (target->len == 0) target = m_impl->m_read_buffer.erase(target);
m_impl->check_receive_buffers();
@ -1670,8 +1670,8 @@ void utp_socket_impl::remove_sack_header(packet* p)
TORRENT_ASSERT(p->size >= p->header_size);
TORRENT_ASSERT(p->header_size >= sizeof(utp_header) + sack_size + 2);
memmove(ptr, ptr + sack_size + 2, p->size - p->header_size);
p->header_size -= sack_size + 2;
p->size -= sack_size + 2;
p->header_size -= std::uint16_t(sack_size + 2);
p->size -= std::uint16_t(sack_size + 2);
}
struct holder
@ -1884,8 +1884,8 @@ bool utp_socket_impl::send_pkt(int const flags)
h = reinterpret_cast<utp_header*>(ptr);
ptr += sizeof(utp_header);
h->extension = sack ? utp_sack
: close_reason ? utp_close_reason : utp_no_extension;
h->extension = std::uint8_t(sack ? utp_sack
: close_reason ? utp_close_reason : utp_no_extension);
h->connection_id = m_send_id;
// seq_nr is ignored for ST_STATE packets, so it doesn't
// matter that we say this is a sequence number we haven't
@ -1925,7 +1925,7 @@ bool utp_socket_impl::send_pkt(int const flags)
, m_write_buffer_size);
write_payload(p->buf + p->size, size_left);
p->size += size_left;
p->size += std::uint16_t(size_left);
UTP_LOGV("%8p: NAGLE appending %d bytes to nagle packet. new size: %d allocated: %d\n"
, static_cast<void*>(this), size_left, p->size, p->allocated);
@ -1951,7 +1951,7 @@ bool utp_socket_impl::send_pkt(int const flags)
if (sack)
{
*ptr++ = close_reason ? utp_close_reason : utp_no_extension;
*ptr++ = std::uint8_t(close_reason ? utp_close_reason : utp_no_extension);
*ptr++ = std::uint8_t(sack); // bytes for SACK bitfield
write_sack(ptr, sack);
ptr += sack;
@ -2428,7 +2428,7 @@ void utp_socket_impl::incoming(std::uint8_t const* buf, int size, packet* p
if (target->len == 0) m_read_buffer.erase(m_read_buffer.begin());
if (p)
{
p->header_size += to_copy;
p->header_size += std::uint16_t(to_copy);
TORRENT_ASSERT(p->header_size <= p->size);
}

View File

@ -914,7 +914,7 @@ void web_peer_connection::on_receive(error_code const& error
TORRENT_ASSERT(chunk_size != 0
|| int(chunk_start.size()) <= header_size || chunk_start[header_size] == 'H');
TORRENT_ASSERT(m_body_start + m_chunk_pos < INT_MAX);
m_chunk_pos += chunk_size;
m_chunk_pos += int(chunk_size);
recv_buffer = recv_buffer.subspan(header_size);
// a chunk size of zero means the request is complete. Make sure the