fixing sign-conversion warnings, part 2

This commit is contained in:
Alden Torres 2017-01-09 09:32:52 -05:00 committed by Arvid Norberg
parent 3ef7e85496
commit 3b4867046f
8 changed files with 15 additions and 13 deletions

View File

@ -90,7 +90,7 @@ namespace libtorrent
= typename std::enable_if<std::is_integral<In>::value>::type>
int write_integer(OutIt& out, In data)
{
entry::integer_type const val(data);
entry::integer_type const val = entry::integer_type(data);
TORRENT_ASSERT(data == In(val));
// the stack allocated buffer for keeping the
// decimal representation of the number can

View File

@ -315,7 +315,7 @@ namespace libtorrent
// if we're generating a merkle torrent, this is the
// merkle tree we got. This should be saved in fast-resume
// in order to start seeding the torrent
mutable std::vector<sha1_hash> m_merkle_tree;
mutable aux::vector<sha1_hash, int> m_merkle_tree;
// dht nodes to add to the routing table/bootstrap from
std::vector<std::pair<std::string, int>> m_nodes;

View File

@ -623,7 +623,7 @@ namespace libtorrent
// name for multi-file torrents. The m_name field need to be
// prepended to these paths, and the filename of a specific file
// entry appended, to form full file paths
std::vector<std::string> m_paths;
aux::vector<std::string, int> m_paths;
// name of torrent. For multi-file torrents
// this is always the root directory

View File

@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/time.hpp"
#include "libtorrent/debug.hpp"
#include "libtorrent/aux_/portmap.hpp"
#include "libtorrent/aux_/vector.hpp"
namespace libtorrent
{
@ -115,7 +116,7 @@ private:
aux::portmap_callback& m_callback;
std::vector<mapping_t> m_mappings;
aux::vector<mapping_t, int> m_mappings;
// the endpoint to the nat router
udp::endpoint m_nat_endpoint;

View File

@ -42,6 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/resolver.hpp"
#include "libtorrent/debug.hpp"
#include "libtorrent/aux_/portmap.hpp"
#include "libtorrent/aux_/vector.hpp"
#include <memory>
#include <functional>
@ -348,7 +349,7 @@ private:
std::set<rootdevice> devices;
};
std::vector<global_mapping_t> m_mappings;
aux::vector<global_mapping_t, int> m_mappings;
std::string m_user_agent;

View File

@ -276,12 +276,12 @@ namespace libtorrent
for (auto& s : m_unicast_sockets)
{
if (!s.socket) continue;
s.socket->send_to(boost::asio::buffer(buffer, size), m_multicast_endpoint, 0, e);
s.socket->send_to(boost::asio::buffer(buffer, std::size_t(size)), m_multicast_endpoint, 0, e);
// if the user specified the broadcast flag, send one to the broadcast
// address as well
if ((flags & broadcast_socket::flag_broadcast) && s.can_broadcast())
s.socket->send_to(boost::asio::buffer(buffer, size)
s.socket->send_to(boost::asio::buffer(buffer, std::size_t(size))
, udp::endpoint(s.broadcast_address(), m_multicast_endpoint.port()), 0, e);
if (e)
@ -298,7 +298,7 @@ namespace libtorrent
for (auto& s : m_sockets)
{
if (!s.socket) continue;
s.socket->send_to(boost::asio::buffer(buffer, size), m_multicast_endpoint, 0, e);
s.socket->send_to(boost::asio::buffer(buffer, std::size_t(size)), m_multicast_endpoint, 0, e);
if (e)
{
s.socket->close(e);

View File

@ -363,7 +363,7 @@ namespace libtorrent
m_files.set_num_pieces(static_cast<int>(
(m_files.total_size() + m_files.piece_length() - 1) / m_files.piece_length()));
m_piece_hash.resize(m_files.num_pieces());
m_piece_hash.resize(std::size_t(m_files.num_pieces()));
}
create_torrent::create_torrent(torrent_info const& ti)
@ -399,7 +399,7 @@ namespace libtorrent
add_http_seed(s.url);
}
m_piece_hash.resize(m_files.num_pieces());
m_piece_hash.resize(std::size_t(m_files.num_pieces()));
for (piece_index_t i(0); i != m_files.end_piece(); ++i)
set_hash(i, ti.hash_for_piece(i));
@ -614,7 +614,7 @@ namespace libtorrent
int const num_leafs = merkle_num_leafs(m_files.num_pieces());
int const num_nodes = merkle_num_nodes(num_leafs);
int const first_leaf = num_nodes - num_leafs;
m_merkle_tree.resize(num_nodes);
m_merkle_tree.resize(std::size_t(num_nodes));
int const num_pieces = int(m_piece_hash.size());
for (int i = 0; i < num_pieces; ++i)
m_merkle_tree[first_leaf + i] = m_piece_hash[piece_index_t(i)];
@ -695,7 +695,7 @@ namespace libtorrent
{
TORRENT_ASSERT(index >= file_index_t(0));
TORRENT_ASSERT(index < m_files.end_file());
if (m_filehashes.empty()) m_filehashes.resize(m_files.num_files());
if (m_filehashes.empty()) m_filehashes.resize(std::size_t(m_files.num_files()));
m_filehashes[index] = h;
}

View File

@ -1617,7 +1617,7 @@ void upnp::close()
continue;
}
j->act = mapping_t::action::del;
m_mappings[j - d.mapping.begin()].protocol = portmap_protocol::none;
m_mappings[int(j - d.mapping.begin())].protocol = portmap_protocol::none;
}
if (num_mappings() > 0) update_map(d, 0);
}