fixing sign-conversion warnings, part 6
This commit is contained in:
parent
a2b3248f5d
commit
ef9d1ecd7f
|
@ -42,13 +42,12 @@ namespace libtorrent { namespace aux {
|
|||
{
|
||||
// if the cookie is set to this value, it doesn't refer to anything in the
|
||||
// cache (and the buffer is mutable)
|
||||
static std::uint32_t const none = 0xffffffffu;
|
||||
constexpr static std::int32_t none = 0x7fffffff;
|
||||
|
||||
storage_index_t storage{0};
|
||||
std::uint32_t cookie = none;
|
||||
std::int32_t cookie = none;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ namespace libtorrent { namespace aux {
|
|||
|
||||
void read(span<char> buffer)
|
||||
{
|
||||
std::size_t const ret = ::read(m_fd, buffer.data(), buffer.size());
|
||||
if (ret != buffer.size())
|
||||
std::int64_t const ret = ::read(m_fd, buffer.data(), buffer.size());
|
||||
if (ret != int(buffer.size()))
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
throw system_error(errors::no_entropy);
|
||||
|
|
|
@ -474,7 +474,7 @@ namespace libtorrent
|
|||
// used for asserts and only applies for fence jobs
|
||||
flush_expect_clear = 8
|
||||
};
|
||||
void flush_cache(storage_interface* storage, std::uint32_t flags, jobqueue_t& completed_jobs, std::unique_lock<std::mutex>& l);
|
||||
void flush_cache(storage_interface* storage, int flags, jobqueue_t& completed_jobs, std::unique_lock<std::mutex>& l);
|
||||
void flush_expired_write_blocks(jobqueue_t& completed_jobs, std::unique_lock<std::mutex>& l);
|
||||
void flush_piece(cached_piece_entry* pe, int flags, jobqueue_t& completed_jobs, std::unique_lock<std::mutex>& l);
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ private:
|
|||
time_point m_last_self_refresh;
|
||||
|
||||
// secret random numbers used to create write tokens
|
||||
int m_secret[2];
|
||||
std::uint32_t m_secret[2];
|
||||
|
||||
udp_socket_interface* m_sock;
|
||||
counters& m_counters;
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_CFG();
|
||||
settings_pack pack;
|
||||
pack.set_int(settings_pack::alert_mask, alert_mask);
|
||||
pack.set_int(settings_pack::alert_mask, int(alert_mask));
|
||||
pack.set_str(settings_pack::peer_fingerprint, print.to_string());
|
||||
if ((flags & start_default_features) == 0)
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(listen_port_range.first <= listen_port_range.second);
|
||||
|
||||
settings_pack pack;
|
||||
pack.set_int(settings_pack::alert_mask, alert_mask);
|
||||
pack.set_int(settings_pack::alert_mask, int(alert_mask));
|
||||
pack.set_int(settings_pack::max_retry_port_bind, listen_port_range.second - listen_port_range.first);
|
||||
pack.set_str(settings_pack::peer_fingerprint, print.to_string());
|
||||
char if_string[100];
|
||||
|
|
|
@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/span.hpp"
|
||||
#include "libtorrent/string_view.hpp"
|
||||
#include "libtorrent/aux_/vector.hpp"
|
||||
|
||||
#include <cstdio> // for vsnprintf
|
||||
#include <cstring>
|
||||
|
@ -71,7 +72,7 @@ namespace libtorrent { namespace aux
|
|||
int const ret = int(m_storage.size());
|
||||
m_storage.resize(ret + str.size() + 1);
|
||||
std::memcpy(&m_storage[ret], str.data(), str.size());
|
||||
m_storage[ret + str.length()] = '\0';
|
||||
m_storage[ret + int(str.length())] = '\0';
|
||||
return allocation_slot(ret);
|
||||
}
|
||||
|
||||
|
@ -154,7 +155,7 @@ namespace libtorrent { namespace aux
|
|||
|
||||
private:
|
||||
|
||||
std::vector<char> m_storage;
|
||||
vector<char> m_storage;
|
||||
};
|
||||
|
||||
} }
|
||||
|
|
|
@ -844,7 +844,7 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
void disk_io_thread::flush_cache(storage_interface* storage, std::uint32_t const flags
|
||||
void disk_io_thread::flush_cache(storage_interface* storage, int const flags
|
||||
, jobqueue_t& completed_jobs, std::unique_lock<std::mutex>& l)
|
||||
{
|
||||
if (storage)
|
||||
|
|
|
@ -41,14 +41,14 @@ bool verify_message_impl(bdecode_node const& message, span<key_desc_t const> des
|
|||
{
|
||||
TORRENT_ASSERT(desc.size() == ret.size());
|
||||
|
||||
int const size = int(ret.size());
|
||||
std::size_t const size = ret.size();
|
||||
|
||||
// get a non-root bdecode_node that still
|
||||
// points to the root. message should not be copied
|
||||
bdecode_node msg = message.non_owning();
|
||||
|
||||
// clear the return buffer
|
||||
for (int i = 0; i < size; ++i)
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
ret[i].clear();
|
||||
|
||||
// when parsing child nodes, this is the stack
|
||||
|
@ -63,7 +63,7 @@ bool verify_message_impl(bdecode_node const& message, span<key_desc_t const> des
|
|||
}
|
||||
++stack_ptr;
|
||||
stack[stack_ptr] = msg;
|
||||
for (int i = 0; i < size; ++i)
|
||||
for (std::size_t i = 0; i < size; ++i)
|
||||
{
|
||||
key_desc_t const& k = desc[i];
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ namespace libtorrent {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const int mask = int(m_capacity - 1);
|
||||
std::size_t const mask = m_capacity - 1;
|
||||
return m_storage[idx & mask];
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ namespace libtorrent {
|
|||
if (compare_less_wrap(idx, m_first, 0xffff))
|
||||
return nullptr;
|
||||
|
||||
const int mask = int(m_capacity - 1);
|
||||
std::size_t const mask = m_capacity - 1;
|
||||
void* old_value = m_storage[idx & mask];
|
||||
m_storage[idx & mask] = nullptr;
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ namespace
|
|||
// Since the CRC function that is used is not a one way function
|
||||
// the salt is required to avoid attacks where bad data is sent
|
||||
// that is forged to match the CRC of the good data.
|
||||
int m_salt;
|
||||
std::uint32_t const m_salt;
|
||||
|
||||
// explicitly disallow assignment, to silence msvc warning
|
||||
smart_ban_plugin& operator=(smart_ban_plugin const&);
|
||||
|
|
Loading…
Reference in New Issue