fixing sign-conversion warnings, part 22
This commit is contained in:
parent
081365fbcf
commit
de9d777c9c
|
@ -45,11 +45,11 @@ namespace libtorrent {
|
|||
void packet_buffer::check_invariant() const
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < int(m_capacity); ++i)
|
||||
for (int i = 0; i < m_capacity; ++i)
|
||||
{
|
||||
count += m_storage[i] ? 1 : 0;
|
||||
}
|
||||
TORRENT_ASSERT(count == int(m_size));
|
||||
TORRENT_ASSERT(count == m_size);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -192,4 +192,3 @@ namespace libtorrent {
|
|||
return old_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2618,7 +2618,7 @@ namespace aux {
|
|||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
// add the current time to the PRNG, to add more unpredictability
|
||||
std::uint64_t now = clock_type::now().time_since_epoch().count();
|
||||
std::int64_t now = clock_type::now().time_since_epoch().count();
|
||||
// assume 12 bits of entropy (i.e. about 8 milliseconds)
|
||||
RAND_add(&now, 8, 1.5);
|
||||
#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO
|
||||
|
|
|
@ -1421,14 +1421,14 @@ namespace libtorrent
|
|||
ASN1_IA5STRING* domain = gen->d.dNSName;
|
||||
if (domain->type != V_ASN1_IA5STRING || !domain->data || !domain->length) continue;
|
||||
const char* torrent_name = reinterpret_cast<const char*>(domain->data);
|
||||
std::size_t name_length = domain->length;
|
||||
std::size_t name_length = aux::numeric_cast<std::size_t>(domain->length);
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
if (i > 1) names += " | n: ";
|
||||
names.append(torrent_name, name_length);
|
||||
#endif
|
||||
if (strncmp(torrent_name, "*", name_length) == 0
|
||||
|| strncmp(torrent_name, m_torrent_file->name().c_str(), name_length) == 0)
|
||||
if (std::strncmp(torrent_name, "*", name_length) == 0
|
||||
|| std::strncmp(torrent_name, m_torrent_file->name().c_str(), name_length) == 0)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
match = true;
|
||||
|
@ -1454,7 +1454,7 @@ namespace libtorrent
|
|||
if (common_name && common_name->data && common_name->length)
|
||||
{
|
||||
const char* torrent_name = reinterpret_cast<const char*>(common_name->data);
|
||||
std::size_t name_length = common_name->length;
|
||||
std::size_t name_length = aux::numeric_cast<std::size_t>(common_name->length);
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
if (!names.empty()) names += " | n: ";
|
||||
|
@ -1488,7 +1488,7 @@ namespace libtorrent
|
|||
// this is needed for openssl < 1.0 to decrypt keys created by openssl 1.0+
|
||||
OpenSSL_add_all_algorithms();
|
||||
|
||||
std::uint64_t const now = clock_type::now().time_since_epoch().count();
|
||||
std::int64_t const now = clock_type::now().time_since_epoch().count();
|
||||
// assume 9 bits of entropy (i.e. about 1 millisecond)
|
||||
RAND_add(&now, 8, 1.125);
|
||||
RAND_add(&info_hash()[0], 20, 3);
|
||||
|
|
|
@ -299,7 +299,7 @@ struct utp_socket_impl
|
|||
bool consume_incoming_data(
|
||||
utp_header const* ph, std::uint8_t const* ptr, int payload_size, time_point now);
|
||||
void update_mtu_limits();
|
||||
void experienced_loss(int seq_nr);
|
||||
void experienced_loss(std::uint32_t seq_nr);
|
||||
|
||||
void set_state(int s);
|
||||
|
||||
|
@ -1439,7 +1439,7 @@ std::pair<std::uint32_t, int> utp_socket_impl::parse_sack(std::uint16_t const pa
|
|||
if (size == 0) return { 0u, 0 };
|
||||
|
||||
// this is the sequence number the current bit represents
|
||||
int ack_nr = (packet_ack + 2) & ACK_MASK;
|
||||
std::uint32_t ack_nr = (packet_ack + 2) & ACK_MASK;
|
||||
|
||||
#if TORRENT_VERBOSE_UTP_LOG
|
||||
std::string bitmask;
|
||||
|
@ -1464,7 +1464,7 @@ std::pair<std::uint32_t, int> utp_socket_impl::parse_sack(std::uint16_t const pa
|
|||
int dups = 0;
|
||||
|
||||
// the sequence number of the last ACKed packet
|
||||
int last_ack = packet_ack;
|
||||
std::uint32_t last_ack = packet_ack;
|
||||
|
||||
int acked_bytes = 0;
|
||||
std::uint32_t min_rtt = std::numeric_limits<std::uint32_t>::max();
|
||||
|
@ -2181,7 +2181,7 @@ bool utp_socket_impl::resend_packet(packet* p, bool fast_resend)
|
|||
return !m_stalled;
|
||||
}
|
||||
|
||||
void utp_socket_impl::experienced_loss(int const seq_nr)
|
||||
void utp_socket_impl::experienced_loss(std::uint32_t const seq_nr)
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
|
@ -2828,7 +2828,7 @@ bool utp_socket_impl::incoming_packet(span<std::uint8_t const> buf
|
|||
int const size = int(buf.size());
|
||||
ptr += sizeof(utp_header);
|
||||
|
||||
unsigned int extension = ph->extension;
|
||||
std::uint8_t extension = ph->extension;
|
||||
while (extension)
|
||||
{
|
||||
// invalid packet. It says it has an extension header
|
||||
|
@ -2839,7 +2839,7 @@ bool utp_socket_impl::incoming_packet(span<std::uint8_t const> buf
|
|||
m_sm.inc_stats_counter(counters::utp_invalid_pkts_in);
|
||||
return true;
|
||||
}
|
||||
int next_extension = *ptr++;
|
||||
std::uint8_t const next_extension = *ptr++;
|
||||
int len = *ptr++;
|
||||
if (len < 0)
|
||||
{
|
||||
|
@ -2848,7 +2848,7 @@ bool utp_socket_impl::incoming_packet(span<std::uint8_t const> buf
|
|||
m_sm.inc_stats_counter(counters::utp_invalid_pkts_in);
|
||||
return true;
|
||||
}
|
||||
if (ptr - buf.data() + len > ptrdiff_t(size))
|
||||
if (ptr - buf.data() + len > size)
|
||||
{
|
||||
UTP_LOG("%8p: ERROR: invalid extension header size:%d packet:%d\n"
|
||||
, static_cast<void*>(this), len, int(ptr - buf.data()));
|
||||
|
|
Loading…
Reference in New Issue