fix x64 build with VS2015 UP2 compiler (#640)
fix VS2015 compiler warnings for: address-model=64, deprecated-functions=on, link=shared
This commit is contained in:
parent
bbf411800a
commit
62eb956c54
4
Jamfile
4
Jamfile
|
@ -286,6 +286,10 @@ rule warnings ( properties * )
|
|||
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'
|
||||
result += <cflags>/wd4275 ;
|
||||
}
|
||||
|
||||
return $(result) ;
|
||||
|
|
|
@ -13,6 +13,8 @@ project client_test
|
|||
: requirements
|
||||
<threading>multi <library>/torrent//torrent
|
||||
<toolset>darwin:<cflags>-Wno-unused-command-line-argument
|
||||
# disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
|
||||
<toolset>msvc:<cflags>/wd4275
|
||||
: default-build
|
||||
<link>static
|
||||
;
|
||||
|
|
|
@ -247,7 +247,7 @@ int load_file(std::string const& filename, std::vector<char>& v
|
|||
return 0;
|
||||
}
|
||||
|
||||
r = fread(&v[0], 1, v.size(), f);
|
||||
r = int(fread(&v[0], 1, v.size(), f));
|
||||
if (r < 0)
|
||||
{
|
||||
ec.assign(errno, boost::system::system_category());
|
||||
|
@ -383,7 +383,7 @@ int peer_index(libtorrent::tcp::endpoint addr, std::vector<libtorrent::peer_info
|
|||
, peers.end(), boost::bind(&peer_info::ip, _1) == addr);
|
||||
if (i == peers.end()) return -1;
|
||||
|
||||
return i - peers.begin();
|
||||
return int(i - peers.begin());
|
||||
}
|
||||
|
||||
// returns the number of lines printed
|
||||
|
@ -674,7 +674,7 @@ void add_torrent(libtorrent::session& ses
|
|||
load_file(filename, resume_data, ec);
|
||||
if (!ec)
|
||||
{
|
||||
p = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
p = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
if (ec) printf(" failed to load resume data: %s\n", ec.message().c_str());
|
||||
}
|
||||
ec.clear();
|
||||
|
@ -746,7 +746,7 @@ std::vector<std::string> list_dir(std::string path
|
|||
|
||||
bool filter_fun(std::string const& p)
|
||||
{
|
||||
for (int i = p.size() - 1; i >= 0; --i)
|
||||
for (int i = int(p.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
if (p[i] == '/') break;
|
||||
#ifdef TORRENT_WINDOWS
|
||||
|
@ -864,7 +864,7 @@ int save_file(std::string const& filename, std::vector<char>& v)
|
|||
if (f == NULL)
|
||||
return -1;
|
||||
|
||||
int w = fwrite(&v[0], 1, v.size(), f);
|
||||
int w = int(fwrite(&v[0], 1, v.size(), f));
|
||||
fclose(f);
|
||||
|
||||
if (w < 0) return -1;
|
||||
|
@ -1111,7 +1111,7 @@ void print_piece(libtorrent::partial_piece_info* pp
|
|||
char str[1024];
|
||||
assert(pp == 0 || cs == 0 || cs->piece == pp->piece_index);
|
||||
int piece = pp ? pp->piece_index : cs->piece;
|
||||
int num_blocks = pp ? pp->blocks_in_piece : cs->blocks.size();
|
||||
int num_blocks = pp ? pp->blocks_in_piece : int(cs->blocks.size());
|
||||
|
||||
snprintf(str, sizeof(str), "%5d:[", piece);
|
||||
out += str;
|
||||
|
@ -1481,7 +1481,7 @@ int main(int argc, char* argv[])
|
|||
load_file(filename, resume_data, ec);
|
||||
if (!ec)
|
||||
{
|
||||
p = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
p = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
if (ec) printf(" failed to load resume data: %s\n", ec.message().c_str());
|
||||
}
|
||||
ec.clear();
|
||||
|
@ -1628,7 +1628,7 @@ int main(int argc, char* argv[])
|
|||
load_file(filename, resume_data, ec);
|
||||
if (!ec)
|
||||
{
|
||||
p = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
p = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
if (ec) printf(" failed to load resume data: %s\n", ec.message().c_str());
|
||||
}
|
||||
ec.clear();
|
||||
|
@ -1989,7 +1989,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
print_piece(pp, &*i, peers, &s, out);
|
||||
|
||||
int num_blocks = pp ? pp->blocks_in_piece : i->blocks.size();
|
||||
int num_blocks = pp ? pp->blocks_in_piece : int(i->blocks.size());
|
||||
p += num_blocks + 8;
|
||||
bool continuous_mode = 8 + num_blocks > terminal_width;
|
||||
if (continuous_mode)
|
||||
|
|
|
@ -583,7 +583,7 @@ struct peer_conn
|
|||
{
|
||||
int piece = read_uint32(ptr);
|
||||
int start = read_uint32(ptr);
|
||||
int size = bytes_transferred - 9;
|
||||
int size = int(bytes_transferred) - 9;
|
||||
verify_piece(piece, start, ptr, size);
|
||||
}
|
||||
++blocks_received;
|
||||
|
|
|
@ -84,7 +84,7 @@ int load_file(std::string const& filename, std::vector<char>& v
|
|||
return 0;
|
||||
}
|
||||
|
||||
r = fread(&v[0], 1, v.size(), f);
|
||||
r = int(fread(&v[0], 1, v.size(), f));
|
||||
if (r < 0)
|
||||
{
|
||||
ec.assign(errno, boost::system::system_category());
|
||||
|
|
|
@ -95,7 +95,7 @@ int load_file(std::string const& filename, std::vector<char>& v, libtorrent::err
|
|||
return 0;
|
||||
}
|
||||
|
||||
r = fread(&v[0], 1, v.size(), f);
|
||||
r = int(fread(&v[0], 1, v.size(), f));
|
||||
if (r < 0)
|
||||
{
|
||||
ec.assign(errno, boost::system::system_category());
|
||||
|
@ -119,7 +119,7 @@ std::string branch_path(std::string const& f)
|
|||
#endif
|
||||
if (f == "/") return "";
|
||||
|
||||
int len = f.size();
|
||||
int len = int(f.size());
|
||||
// if the last character is / or \ ignore it
|
||||
if (f[len-1] == '/' || f[len-1] == '\\') --len;
|
||||
while (len > 0)
|
||||
|
@ -421,7 +421,7 @@ int main(int argc, char* argv[])
|
|||
, merklefile.c_str(), errno, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
int ret = fwrite(&t.merkle_tree()[0], 20, t.merkle_tree().size(), output);
|
||||
int ret = int(fwrite(&t.merkle_tree()[0], 20, t.merkle_tree().size(), output));
|
||||
if (ret != int(t.merkle_tree().size()))
|
||||
{
|
||||
fprintf(stderr, "failed to write %s: (%d) %s\n"
|
||||
|
|
|
@ -464,7 +464,7 @@ void print(char const* buf)
|
|||
{
|
||||
if (*buf == '\033' && buf[1] == '[')
|
||||
{
|
||||
WriteFile(out, start, buf - start, &written, NULL);
|
||||
WriteFile(out, start, DWORD(buf - start), &written, NULL);
|
||||
buf += 2; // skip escape and '['
|
||||
start = buf;
|
||||
if (*buf == 0) break;
|
||||
|
@ -533,7 +533,7 @@ one_more:
|
|||
++buf;
|
||||
}
|
||||
}
|
||||
WriteFile(out, start, buf - start, &written, NULL);
|
||||
WriteFile(out, start, DWORD(buf - start), &written, NULL);
|
||||
|
||||
#else
|
||||
fputs(buf, stdout);
|
||||
|
|
|
@ -376,7 +376,7 @@ void torrent_view::update_filtered_torrents()
|
|||
if (!show_torrent(*i)) continue;
|
||||
m_filtered_handles.push_back(&*i);
|
||||
}
|
||||
if (m_active_torrent >= int(m_filtered_handles.size())) m_active_torrent = m_filtered_handles.size() - 1;
|
||||
if (m_active_torrent >= int(m_filtered_handles.size())) m_active_torrent = int(m_filtered_handles.size()) - 1;
|
||||
if (m_active_torrent < 0) m_active_torrent = 0;
|
||||
TORRENT_ASSERT(m_active_torrent >= 0);
|
||||
std::sort(m_filtered_handles.begin(), m_filtered_handles.end(), &compare_torrent);
|
||||
|
|
|
@ -205,7 +205,7 @@ public:
|
|||
TORRENT_ASSERT(e >= b);
|
||||
TORRENT_ASSERT(e - b <= std::numeric_limits<boost::uint32_t>::max());
|
||||
TORRENT_ASSERT(boost::uint32_t(e - b) <= m_size);
|
||||
m_size -= e - b;
|
||||
m_size -= boost::uint32_t(e - b);
|
||||
}
|
||||
|
||||
void clear() { m_size = 0; }
|
||||
|
|
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_DEBUG_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
||||
#if TORRENT_USE_ASSERTS && defined BOOST_HAS_PTHREADS
|
||||
#include <pthread.h>
|
||||
|
@ -41,7 +42,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#if defined TORRENT_ASIO_DEBUGGING
|
||||
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
#include "libtorrent/time.hpp"
|
||||
|
||||
|
@ -169,8 +169,8 @@ namespace libtorrent
|
|||
|
||||
#else
|
||||
|
||||
#define ADD_OUTSTANDING_ASYNC(x) do {} while(0)
|
||||
#define COMPLETE_ASYNC(x) do {} while(0)
|
||||
#define ADD_OUTSTANDING_ASYNC(x) do {} TORRENT_WHILE_0
|
||||
#define COMPLETE_ASYNC(x) do {} TORRENT_WHILE_0
|
||||
|
||||
#endif // TORRENT_ASIO_DEBUGGING
|
||||
|
||||
|
|
|
@ -117,8 +117,8 @@ public:
|
|||
void incoming(msg const& m);
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
int num_torrents() const { return m_storage->num_torrents(); }
|
||||
int num_peers() const { return m_storage->num_peers(); }
|
||||
int num_torrents() const { return int(m_storage->num_torrents()); }
|
||||
int num_peers() const { return int(m_storage->num_peers()); }
|
||||
#endif
|
||||
|
||||
int bucket_size(int bucket);
|
||||
|
|
|
@ -163,7 +163,7 @@ public:
|
|||
|
||||
int bucket_size(int bucket) const
|
||||
{
|
||||
int num_buckets = m_buckets.size();
|
||||
int num_buckets = int(m_buckets.size());
|
||||
if (num_buckets == 0) return 0;
|
||||
if (bucket >= num_buckets) bucket = num_buckets - 1;
|
||||
table_t::const_iterator i = m_buckets.begin();
|
||||
|
@ -194,7 +194,7 @@ public:
|
|||
// we have
|
||||
int depth() const;
|
||||
|
||||
int num_active_buckets() const { return m_buckets.size(); }
|
||||
int num_active_buckets() const { return int(m_buckets.size()); }
|
||||
|
||||
void replacement_cache(bucket_t& nodes) const;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ struct TORRENT_EXTRA_EXPORT receive_buffer
|
|||
|
||||
bool packet_finished() const { return m_packet_size <= m_recv_pos; }
|
||||
int pos() const { return m_recv_pos; }
|
||||
int capacity() const { return m_recv_buffer.capacity() + m_disk_recv_buffer_size; }
|
||||
int capacity() const { return int(m_recv_buffer.capacity()) + m_disk_recv_buffer_size; }
|
||||
|
||||
int regular_buffer_size() const
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace libtorrent { namespace aux
|
|||
int copy_string(char const* str)
|
||||
{
|
||||
int ret = int(m_storage.size());
|
||||
int len = strlen(str);
|
||||
int len = int(strlen(str));
|
||||
m_storage.resize(ret + len + 1);
|
||||
strcpy(&m_storage[ret], str);
|
||||
return ret;
|
||||
|
|
|
@ -1880,14 +1880,14 @@ namespace libtorrent {
|
|||
, std::vector<tcp::endpoint> const& peers)
|
||||
: info_hash(ih)
|
||||
, m_alloc(alloc)
|
||||
, m_num_peers(peers.size())
|
||||
, m_num_peers(int(peers.size()))
|
||||
{
|
||||
std::size_t total_size = m_num_peers; // num bytes for sizes
|
||||
for (int i = 0; i < m_num_peers; i++) {
|
||||
total_size += peers[i].size();
|
||||
}
|
||||
|
||||
m_peers_idx = alloc.allocate(total_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++) {
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace libtorrent
|
|||
|
||||
int bandwidth_manager::queue_size() const
|
||||
{
|
||||
return m_queue.size();
|
||||
return int(m_queue.size());
|
||||
}
|
||||
|
||||
boost::int64_t bandwidth_manager::queued_bytes() const
|
||||
|
|
|
@ -750,7 +750,7 @@ namespace libtorrent
|
|||
switch (t)
|
||||
{
|
||||
case 'd':
|
||||
stack[sp++] = ret.m_tokens.size();
|
||||
stack[sp++] = int(ret.m_tokens.size());
|
||||
// we push it into the stack so that we know where to fill
|
||||
// in the next_node field once we pop this node off the stack.
|
||||
// i.e. get to the node following the dictionary in the buffer
|
||||
|
@ -759,7 +759,7 @@ namespace libtorrent
|
|||
++start;
|
||||
break;
|
||||
case 'l':
|
||||
stack[sp++] = ret.m_tokens.size();
|
||||
stack[sp++] = int(ret.m_tokens.size());
|
||||
// we push it into the stack so that we know where to fill
|
||||
// in the next_node field once we pop this node off the stack.
|
||||
// i.e. get to the node following the list in the buffer
|
||||
|
@ -933,7 +933,7 @@ done:
|
|||
if (line_len > limit) return -1;
|
||||
for (int i = 0; i < e.dict_size(); ++i)
|
||||
{
|
||||
line_len += 4 + e.dict_at(i).first.size();
|
||||
line_len += 4 + int(e.dict_at(i).first.size());
|
||||
if (line_len > limit) return -1;
|
||||
int ret = line_longer_than(e.dict_at(i).second, limit - line_len);
|
||||
if (ret == -1) return -1;
|
||||
|
@ -1070,7 +1070,7 @@ done:
|
|||
{
|
||||
if (i == 0 && one_liner) ret += " ";
|
||||
std::pair<std::string, bdecode_node> ent = e.dict_at(i);
|
||||
print_string(ret, ent.first.c_str(), ent.first.size(), true);
|
||||
print_string(ret, ent.first.c_str(), int(ent.first.size()), true);
|
||||
ret += ": ";
|
||||
ret += print_entry(ent.second, single_line, indent + 2);
|
||||
if (i < e.dict_size() - 1) ret += (one_liner?", ":indent_str);
|
||||
|
|
|
@ -1243,7 +1243,7 @@ void block_cache::clear(tailqueue<disk_io_job>& jobs)
|
|||
drain_piece_bufs(pe, bufs);
|
||||
}
|
||||
|
||||
if (!bufs.empty()) free_multiple_buffers(&bufs[0], bufs.size());
|
||||
if (!bufs.empty()) free_multiple_buffers(&bufs[0], int(bufs.size()));
|
||||
|
||||
// clear lru lists
|
||||
for (int i = 0; i < cached_piece_entry::num_lrus; ++i)
|
||||
|
|
|
@ -190,8 +190,8 @@ namespace libtorrent
|
|||
// both are v4
|
||||
address_v4::bytes_type b1 = a1.to_v4().to_bytes();
|
||||
address_v4::bytes_type b2 = a2.to_v4().to_bytes();
|
||||
return address_v4::bytes_type().size() * 8
|
||||
- common_bits(b1.data(), b2.data(), b1.size());
|
||||
return int(address_v4::bytes_type().size()) * 8
|
||||
- common_bits(b1.data(), b2.data(), int(b1.size()));
|
||||
#if TORRENT_USE_IPV6
|
||||
}
|
||||
|
||||
|
@ -201,8 +201,8 @@ namespace libtorrent
|
|||
else b1 = a1.to_v6().to_bytes();
|
||||
if (a2.is_v4()) b2 = address_v6::v4_mapped(a2.to_v4()).to_bytes();
|
||||
else b2 = a2.to_v6().to_bytes();
|
||||
return address_v6::bytes_type().size() * 8
|
||||
- common_bits(b1.data(), b2.data(), b1.size());
|
||||
return int(address_v6::bytes_type().size()) * 8
|
||||
- common_bits(b1.data(), b2.data(), int(b1.size()));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,7 @@ namespace libtorrent
|
|||
maybe_abort();
|
||||
return;
|
||||
}
|
||||
m_on_receive(s->remote, s->buffer, bytes_transferred);
|
||||
m_on_receive(s->remote, s->buffer, int(bytes_transferred));
|
||||
|
||||
if (maybe_abort()) return;
|
||||
if (!s->socket) return;
|
||||
|
|
|
@ -2377,7 +2377,7 @@ namespace libtorrent
|
|||
// signal handshake message
|
||||
detail::write_uint8(0, ptr);
|
||||
send_buffer(msg, sizeof(msg));
|
||||
send_buffer(&dict_msg[0], dict_msg.size());
|
||||
send_buffer(&dict_msg[0], int(dict_msg.size()));
|
||||
|
||||
stats_counters().inc_stats_counter(counters::num_outgoing_ext_handshake);
|
||||
|
||||
|
@ -2555,15 +2555,15 @@ namespace libtorrent
|
|||
l.back().list().push_back(i->second.to_string());
|
||||
}
|
||||
bencode(std::back_inserter(piece_list_buf), piece_list);
|
||||
detail::write_int32(piece_list_buf.size(), ptr);
|
||||
detail::write_int32(int(piece_list_buf.size()), ptr);
|
||||
|
||||
// back-patch the length field
|
||||
char* ptr2 = msg;
|
||||
detail::write_int32(r.length + 1 + 4 + 4 + 4 + piece_list_buf.size()
|
||||
detail::write_int32(int(r.length + 1 + 4 + 4 + 4 + piece_list_buf.size())
|
||||
, ptr2);
|
||||
|
||||
send_buffer(msg, 17);
|
||||
send_buffer(&piece_list_buf[0], piece_list_buf.size());
|
||||
send_buffer(&piece_list_buf[0], int(piece_list_buf.size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2599,7 +2599,7 @@ namespace libtorrent
|
|||
|
||||
if (error)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2625,7 +2625,7 @@ namespace libtorrent
|
|||
|
||||
int sub_transferred = 0;
|
||||
while (bytes_transferred > 0 &&
|
||||
((sub_transferred = m_recv_buffer.advance_pos(bytes_transferred)) > 0))
|
||||
((sub_transferred = int(m_recv_buffer.advance_pos(int(bytes_transferred)))) > 0))
|
||||
{
|
||||
#if TORRENT_USE_ASSERTS
|
||||
boost::int64_t cur_payload_dl = m_statistics.last_payload_downloaded();
|
||||
|
@ -2663,7 +2663,7 @@ namespace libtorrent
|
|||
// for outgoing
|
||||
if (m_state == read_pe_dhkey)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
|
||||
TORRENT_ASSERT(!m_encrypted);
|
||||
TORRENT_ASSERT(!m_rc4_encrypted);
|
||||
|
@ -2732,7 +2732,7 @@ namespace libtorrent
|
|||
|
||||
if (recv_buffer.left() < 20)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
|
||||
if (m_recv_buffer.packet_finished())
|
||||
disconnect(errors::sync_hash_not_found, op_bittorrent, 1);
|
||||
|
@ -2751,7 +2751,7 @@ namespace libtorrent
|
|||
m_sync_hash.reset(new (std::nothrow) sha1_hash(h.final()));
|
||||
if (!m_sync_hash)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
disconnect(errors::no_memory, op_encryption);
|
||||
return;
|
||||
}
|
||||
|
@ -2763,17 +2763,17 @@ namespace libtorrent
|
|||
// No sync
|
||||
if (syncoffset == -1)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
|
||||
std::size_t bytes_processed = recv_buffer.left() - 20;
|
||||
m_sync_bytes_read += bytes_processed;
|
||||
m_sync_bytes_read += int(bytes_processed);
|
||||
if (m_sync_bytes_read >= 512)
|
||||
{
|
||||
disconnect(errors::sync_hash_not_found, op_encryption, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
m_recv_buffer.cut(bytes_processed, (std::min)(m_recv_buffer.packet_size()
|
||||
m_recv_buffer.cut(int(bytes_processed), (std::min)(m_recv_buffer.packet_size()
|
||||
, (512+20) - m_sync_bytes_read));
|
||||
|
||||
TORRENT_ASSERT(!m_recv_buffer.packet_finished());
|
||||
|
@ -2791,17 +2791,17 @@ namespace libtorrent
|
|||
m_state = read_pe_skey_vc;
|
||||
// skey,vc - 28 bytes
|
||||
m_sync_hash.reset();
|
||||
int transferred_used = bytes_processed - recv_buffer.left() + bytes_transferred;
|
||||
int transferred_used = int(bytes_processed - recv_buffer.left() + bytes_transferred);
|
||||
TORRENT_ASSERT(transferred_used <= int(bytes_transferred));
|
||||
received_bytes(0, transferred_used);
|
||||
bytes_transferred -= transferred_used;
|
||||
m_recv_buffer.cut(bytes_processed, 28);
|
||||
m_recv_buffer.cut(int(bytes_processed), 28);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_state == read_pe_skey_vc)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
bytes_transferred = 0;
|
||||
|
||||
TORRENT_ASSERT(!m_encrypted);
|
||||
|
@ -2873,7 +2873,7 @@ namespace libtorrent
|
|||
|
||||
if (recv_buffer.left() < 8)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
if (m_recv_buffer.packet_finished())
|
||||
disconnect(errors::invalid_encryption_constant, op_encryption, 2);
|
||||
return;
|
||||
|
@ -2902,8 +2902,8 @@ namespace libtorrent
|
|||
if (syncoffset == -1)
|
||||
{
|
||||
std::size_t bytes_processed = recv_buffer.left() - 8;
|
||||
m_sync_bytes_read += bytes_processed;
|
||||
received_bytes(0, bytes_transferred);
|
||||
m_sync_bytes_read += int(bytes_processed);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
|
||||
if (m_sync_bytes_read >= 512)
|
||||
{
|
||||
|
@ -2911,7 +2911,7 @@ namespace libtorrent
|
|||
return;
|
||||
}
|
||||
|
||||
m_recv_buffer.cut(bytes_processed, (std::min)(m_recv_buffer.packet_size()
|
||||
m_recv_buffer.cut(int(bytes_processed), (std::min)(m_recv_buffer.packet_size()
|
||||
, (512+8) - m_sync_bytes_read));
|
||||
|
||||
TORRENT_ASSERT(!m_recv_buffer.packet_finished());
|
||||
|
@ -2925,12 +2925,12 @@ namespace libtorrent
|
|||
, "sync point (verification constant) found at offset %d"
|
||||
, int(m_sync_bytes_read + bytes_processed - 8));
|
||||
#endif
|
||||
int transferred_used = bytes_processed - recv_buffer.left() + bytes_transferred;
|
||||
int transferred_used = int(bytes_processed - recv_buffer.left() + bytes_transferred);
|
||||
TORRENT_ASSERT(transferred_used <= int(bytes_transferred));
|
||||
received_bytes(0, transferred_used);
|
||||
bytes_transferred -= transferred_used;
|
||||
|
||||
m_recv_buffer.cut(bytes_processed, 4 + 2);
|
||||
m_recv_buffer.cut(int(bytes_processed), 4 + 2);
|
||||
|
||||
// delete verification constant
|
||||
m_sync_vc.reset();
|
||||
|
@ -2944,7 +2944,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(!m_encrypted);
|
||||
TORRENT_ASSERT(!m_rc4_encrypted);
|
||||
TORRENT_ASSERT(m_recv_buffer.packet_size() == 4+2);
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
bytes_transferred = 0;
|
||||
|
||||
if (!m_recv_buffer.packet_finished()) return;
|
||||
|
@ -3048,7 +3048,7 @@ namespace libtorrent
|
|||
if (m_state == read_pe_pad)
|
||||
{
|
||||
TORRENT_ASSERT(!m_encrypted);
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
bytes_transferred = 0;
|
||||
if (!m_recv_buffer.packet_finished()) return;
|
||||
|
||||
|
@ -3105,7 +3105,7 @@ namespace libtorrent
|
|||
|
||||
if (m_state == read_pe_ia)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
bytes_transferred = 0;
|
||||
TORRENT_ASSERT(!is_outgoing());
|
||||
TORRENT_ASSERT(!m_encrypted);
|
||||
|
@ -3136,7 +3136,7 @@ namespace libtorrent
|
|||
|
||||
if (m_state == init_bt_handshake)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
bytes_transferred = 0;
|
||||
TORRENT_ASSERT(m_encrypted);
|
||||
|
||||
|
@ -3194,7 +3194,7 @@ namespace libtorrent
|
|||
|
||||
if (m_state == read_protocol_identifier)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
bytes_transferred = 0;
|
||||
TORRENT_ASSERT(m_recv_buffer.packet_size() == 20);
|
||||
|
||||
|
@ -3283,7 +3283,7 @@ namespace libtorrent
|
|||
// fall through
|
||||
if (m_state == read_info_hash)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
bytes_transferred = 0;
|
||||
TORRENT_ASSERT(m_recv_buffer.packet_size() == 28);
|
||||
|
||||
|
@ -3370,7 +3370,7 @@ namespace libtorrent
|
|||
if (m_state == read_peer_id)
|
||||
{
|
||||
TORRENT_ASSERT(m_sent_handshake);
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
|
||||
t = associated_torrent().lock();
|
||||
if (!t)
|
||||
|
@ -3506,7 +3506,7 @@ namespace libtorrent
|
|||
// byte here, instead it's counted in the message
|
||||
// handler itself, for the specific message
|
||||
TORRENT_ASSERT(bytes_transferred <= 5);
|
||||
int used_bytes = recv_buffer.left() > 4 ? bytes_transferred - 1: bytes_transferred;
|
||||
int used_bytes = recv_buffer.left() > 4 ? int(bytes_transferred) - 1: int(bytes_transferred);
|
||||
received_bytes(0, used_bytes);
|
||||
bytes_transferred -= used_bytes;
|
||||
if (recv_buffer.left() < 4) return;
|
||||
|
@ -3520,7 +3520,7 @@ namespace libtorrent
|
|||
if (packet_size > 1024*1024 || packet_size < 0)
|
||||
{
|
||||
// packet too large
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
disconnect(errors::packet_too_large, op_bittorrent, 2);
|
||||
return;
|
||||
}
|
||||
|
@ -3528,7 +3528,7 @@ namespace libtorrent
|
|||
if (packet_size == 0)
|
||||
{
|
||||
TORRENT_ASSERT(bytes_transferred <= 1);
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
incoming_keepalive();
|
||||
if (is_disconnecting()) return;
|
||||
// keepalive message
|
||||
|
@ -3550,7 +3550,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(recv_buffer == m_recv_buffer.get());
|
||||
if (!t)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
disconnect(errors::torrent_removed, op_bittorrent, 1);
|
||||
return;
|
||||
}
|
||||
|
@ -3558,7 +3558,7 @@ namespace libtorrent
|
|||
boost::int64_t cur_payload_dl = statistics().last_payload_downloaded();
|
||||
boost::int64_t cur_protocol_dl = statistics().last_protocol_downloaded();
|
||||
#endif
|
||||
if (dispatch_message(bytes_transferred))
|
||||
if (dispatch_message(int(bytes_transferred)))
|
||||
{
|
||||
m_state = read_packet_size;
|
||||
m_recv_buffer.reset(5);
|
||||
|
@ -3602,7 +3602,7 @@ namespace libtorrent
|
|||
|
||||
if (error)
|
||||
{
|
||||
sent_bytes(0, bytes_transferred);
|
||||
sent_bytes(0, int(bytes_transferred));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3618,7 +3618,7 @@ namespace libtorrent
|
|||
for (std::vector<range>::iterator i = m_payloads.begin();
|
||||
i != m_payloads.end(); ++i)
|
||||
{
|
||||
i->start -= bytes_transferred;
|
||||
i->start -= int(bytes_transferred);
|
||||
if (i->start < 0)
|
||||
{
|
||||
if (i->start + i->length <= 0)
|
||||
|
@ -3641,7 +3641,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
TORRENT_ASSERT(amount_payload <= int(bytes_transferred));
|
||||
sent_bytes(amount_payload, bytes_transferred - amount_payload);
|
||||
sent_bytes(amount_payload, int(bytes_transferred) - amount_payload);
|
||||
|
||||
if (amount_payload > 0)
|
||||
{
|
||||
|
|
|
@ -628,7 +628,7 @@ namespace libtorrent
|
|||
int num_nodes = merkle_num_nodes(num_leafs);
|
||||
int first_leaf = num_nodes - num_leafs;
|
||||
m_merkle_tree.resize(num_nodes);
|
||||
int num_pieces = m_piece_hash.size();
|
||||
int num_pieces = int(m_piece_hash.size());
|
||||
for (int i = 0; i < num_pieces; ++i)
|
||||
m_merkle_tree[first_leaf + i] = m_piece_hash[i];
|
||||
sha1_hash filler(0);
|
||||
|
@ -669,7 +669,7 @@ namespace libtorrent
|
|||
|
||||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), info);
|
||||
m_info_hash = hasher(&buf[0], buf.size()).final();
|
||||
m_info_hash = hasher(&buf[0], int(buf.size())).final();
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
|
|
@ -2250,7 +2250,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
offset += block_size;
|
||||
h.update(static_cast<char const*>(iov.iov_base), iov.iov_len);
|
||||
h.update(static_cast<char const*>(iov.iov_base), int(iov.iov_len));
|
||||
}
|
||||
|
||||
m_disk_cache.free_buffer(static_cast<char*>(iov.iov_base));
|
||||
|
@ -2389,8 +2389,8 @@ namespace libtorrent
|
|||
++next_locked_block;
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[i].buf, pe);
|
||||
TORRENT_PIECE_ASSERT(ph->offset == i * block_size, pe);
|
||||
ph->offset += iov.iov_len;
|
||||
ph->h.update(pe->blocks[i].buf, iov.iov_len);
|
||||
ph->offset += int(iov.iov_len);
|
||||
ph->h.update(pe->blocks[i].buf, int(iov.iov_len));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2461,8 +2461,8 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
TORRENT_PIECE_ASSERT(ph->offset == i * block_size, pe);
|
||||
ph->offset += iov.iov_len;
|
||||
ph->h.update(static_cast<char const*>(iov.iov_base), iov.iov_len);
|
||||
ph->offset += int(iov.iov_len);
|
||||
ph->h.update(static_cast<char const*>(iov.iov_base), int(iov.iov_len));
|
||||
|
||||
l.lock();
|
||||
m_disk_cache.insert_blocks(pe, i, &iov, 1, j);
|
||||
|
@ -3542,7 +3542,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
if (!to_delete.empty())
|
||||
free_jobs(&to_delete[0], to_delete.size());
|
||||
free_jobs(&to_delete[0], int(to_delete.size()));
|
||||
|
||||
// uncork all peers who received a disk event. This is
|
||||
// to coalesce all the socket writes caused by the events.
|
||||
|
|
|
@ -374,7 +374,7 @@ namespace libtorrent
|
|||
typedef boost::asio::ip::address_v4::bytes_type bytes_t;
|
||||
bytes_t b;
|
||||
std::memset(&b[0], 0xff, b.size());
|
||||
for (int i = sizeof(bytes_t)/8-1; i > 0; --i)
|
||||
for (int i = int(sizeof(bytes_t)) / 8 - 1; i > 0; --i)
|
||||
{
|
||||
if (bits < 8)
|
||||
{
|
||||
|
@ -392,7 +392,7 @@ namespace libtorrent
|
|||
typedef boost::asio::ip::address_v6::bytes_type bytes_t;
|
||||
bytes_t b;
|
||||
std::memset(&b[0], 0xff, b.size());
|
||||
for (int i = sizeof(bytes_t)/8-1; i > 0; --i)
|
||||
for (int i = int(sizeof(bytes_t)) / 8 - 1; i > 0; --i)
|
||||
{
|
||||
if (bits < 8)
|
||||
{
|
||||
|
|
|
@ -231,7 +231,7 @@ namespace libtorrent
|
|||
if (ec) return url;
|
||||
|
||||
// first figure out if this url contains unencoded characters
|
||||
if (!need_encoding(path.c_str(), path.size()))
|
||||
if (!need_encoding(path.c_str(), int(path.size())))
|
||||
return url;
|
||||
|
||||
char msg[TORRENT_MAX_PATH*4];
|
||||
|
@ -239,7 +239,7 @@ namespace libtorrent
|
|||
, auth.empty()?"":"@", host.c_str()
|
||||
, port == -1 ? "" : ":"
|
||||
, port == -1 ? "" : to_string(port).elems
|
||||
, escape_path(path.c_str(), path.size()).c_str());
|
||||
, escape_path(path.c_str(), int(path.size())).c_str());
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,7 @@ namespace libtorrent
|
|||
libtorrent::utf8_wchar(s, ws);
|
||||
std::string ret;
|
||||
ret.resize(ws.size() * 4 + 1);
|
||||
std::size_t size = WideCharToMultiByte(CP_ACP, 0, ws.c_str(), -1, &ret[0], ret.size(), NULL, NULL);
|
||||
std::size_t size = WideCharToMultiByte(CP_ACP, 0, ws.c_str(), -1, &ret[0], int(ret.size()), NULL, NULL);
|
||||
if (size == std::size_t(-1)) return s;
|
||||
if (size != 0 && ret[size - 1] == '\0') --size;
|
||||
ret.resize(size);
|
||||
|
@ -581,7 +581,7 @@ namespace libtorrent
|
|||
{
|
||||
std::wstring ws;
|
||||
ws.resize(s.size() + 1);
|
||||
std::size_t size = MultiByteToWideChar(CP_ACP, 0, s.c_str(), -1, &ws[0], ws.size());
|
||||
std::size_t size = MultiByteToWideChar(CP_ACP, 0, s.c_str(), -1, &ws[0], int(ws.size()));
|
||||
if (size == std::size_t(-1)) return s;
|
||||
if (size != 0 && ws[size - 1] == '\0') --size;
|
||||
ws.resize(size);
|
||||
|
|
16
src/file.cpp
16
src/file.cpp
|
@ -197,7 +197,7 @@ namespace
|
|||
for (int i = 0; i < num_bufs; ++i)
|
||||
{
|
||||
DWORD num_read;
|
||||
if (ReadFile(fd, bufs[i].iov_base, bufs[i].iov_len, &num_read, &ol[i]) == FALSE
|
||||
if (ReadFile(fd, bufs[i].iov_base, DWORD(bufs[i].iov_len), &num_read, &ol[i]) == FALSE
|
||||
&& GetLastError() != ERROR_IO_PENDING
|
||||
#ifdef ERROR_CANT_WAIT
|
||||
&& GetLastError() != ERROR_CANT_WAIT
|
||||
|
@ -267,7 +267,7 @@ done:
|
|||
for (int i = 0; i < num_bufs; ++i)
|
||||
{
|
||||
DWORD num_written;
|
||||
if (WriteFile(fd, bufs[i].iov_base, bufs[i].iov_len, &num_written, &ol[i]) == FALSE
|
||||
if (WriteFile(fd, bufs[i].iov_base, DWORD(bufs[i].iov_len), &num_written, &ol[i]) == FALSE
|
||||
&& GetLastError() != ERROR_IO_PENDING
|
||||
#ifdef ERROR_CANT_WAIT
|
||||
&& GetLastError() != ERROR_CANT_WAIT
|
||||
|
@ -720,7 +720,7 @@ namespace libtorrent
|
|||
|
||||
std::string extension(std::string const& f)
|
||||
{
|
||||
for (int i = f.size() - 1; i >= 0; --i)
|
||||
for (int i = int(f.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
if (f[i] == '/') break;
|
||||
#ifdef TORRENT_WINDOWS
|
||||
|
@ -746,7 +746,7 @@ namespace libtorrent
|
|||
|
||||
void replace_extension(std::string& f, std::string const& ext)
|
||||
{
|
||||
for (int i = f.size() - 1; i >= 0; --i)
|
||||
for (int i = int(f.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
if (f[i] == '/') break;
|
||||
#ifdef TORRENT_WINDOWS
|
||||
|
@ -802,7 +802,7 @@ namespace libtorrent
|
|||
if (f.empty()) return false;
|
||||
if (is_root_path(f)) return false;
|
||||
|
||||
int len = f.size() - 1;
|
||||
int len = int(f.size()) - 1;
|
||||
// if the last character is / or \ ignore it
|
||||
if (f[len] == '/' || f[len] == '\\') --len;
|
||||
while (len >= 0)
|
||||
|
@ -824,7 +824,7 @@ namespace libtorrent
|
|||
#endif
|
||||
if (f == "/") return "";
|
||||
|
||||
int len = f.size();
|
||||
int len = int(f.size());
|
||||
// if the last character is / or \ ignore it
|
||||
if (f[len-1] == '/' || f[len-1] == '\\') --len;
|
||||
while (len > 0)
|
||||
|
@ -886,7 +886,7 @@ namespace libtorrent
|
|||
|
||||
void append_path(std::string& branch, std::string const& leaf)
|
||||
{
|
||||
append_path(branch, leaf.c_str(), leaf.size());
|
||||
append_path(branch, leaf.c_str(), int(leaf.size()));
|
||||
}
|
||||
|
||||
void append_path(std::string& branch
|
||||
|
@ -927,7 +927,7 @@ namespace libtorrent
|
|||
bool need_sep = lhs[lhs.size()-1] != '/';
|
||||
#endif
|
||||
std::string ret;
|
||||
int target_size = lhs.size() + rhs.size() + 2;
|
||||
int target_size = int(lhs.size() + rhs.size() + 2);
|
||||
ret.resize(target_size);
|
||||
target_size = snprintf(&ret[0], target_size, "%s%s%s", lhs.c_str()
|
||||
, (need_sep?TORRENT_SEPARATOR:""), rhs.c_str());
|
||||
|
|
|
@ -180,7 +180,7 @@ namespace libtorrent
|
|||
&& std::memcmp(branch_path, m_name.c_str(), m_name.size()) == 0)
|
||||
{
|
||||
// the +1 is to skip the trailing '/' (or '\')
|
||||
int offset = m_name.size()
|
||||
int offset = int(m_name.size())
|
||||
+ (m_name.size() == branch_len?0:1);
|
||||
branch_path += offset;
|
||||
branch_len -= offset;
|
||||
|
@ -199,7 +199,7 @@ namespace libtorrent
|
|||
if (p == m_paths.rend())
|
||||
{
|
||||
// no, we don't. add it
|
||||
e.path_index = m_paths.size();
|
||||
e.path_index = int(m_paths.size());
|
||||
TORRENT_ASSERT(branch_path[0] != '/');
|
||||
|
||||
// trim trailing slashes
|
||||
|
@ -659,7 +659,7 @@ namespace libtorrent
|
|||
|
||||
if (!m_name.empty())
|
||||
{
|
||||
process_string_lowercase(crc, m_name.c_str(), m_name.size());
|
||||
process_string_lowercase(crc, m_name.c_str(), int(m_name.size()));
|
||||
TORRENT_ASSERT(m_name[m_name.size()-1] != TORRENT_SEPARATOR);
|
||||
crc.process_byte(TORRENT_SEPARATOR);
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ namespace libtorrent
|
|||
for (int i = 0; i != int(m_paths.size()); ++i)
|
||||
{
|
||||
std::string const& p = m_paths[i];
|
||||
process_path_lowercase(table, crc, p.c_str(), p.size());
|
||||
process_path_lowercase(table, crc, p.c_str(), int(p.size()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -689,7 +689,7 @@ namespace libtorrent
|
|||
// -1 means no path
|
||||
if (!save_path.empty())
|
||||
{
|
||||
process_string_lowercase(crc, save_path.c_str(), save_path.size());
|
||||
process_string_lowercase(crc, save_path.c_str(), int(save_path.size()));
|
||||
TORRENT_ASSERT(save_path[save_path.size()-1] != TORRENT_SEPARATOR);
|
||||
crc.process_byte(TORRENT_SEPARATOR);
|
||||
}
|
||||
|
@ -699,14 +699,14 @@ namespace libtorrent
|
|||
{
|
||||
if (!save_path.empty())
|
||||
{
|
||||
process_string_lowercase(crc, save_path.c_str(), save_path.size());
|
||||
process_string_lowercase(crc, save_path.c_str(), int(save_path.size()));
|
||||
TORRENT_ASSERT(save_path[save_path.size()-1] != TORRENT_SEPARATOR);
|
||||
crc.process_byte(TORRENT_SEPARATOR);
|
||||
}
|
||||
std::string const& p = m_paths[fe.path_index];
|
||||
if (!p.empty())
|
||||
{
|
||||
process_string_lowercase(crc, p.c_str(), p.size());
|
||||
process_string_lowercase(crc, p.c_str(), int(p.size()));
|
||||
TORRENT_ASSERT(p[p.size()-1] != TORRENT_SEPARATOR);
|
||||
crc.process_byte(TORRENT_SEPARATOR);
|
||||
}
|
||||
|
@ -716,11 +716,11 @@ namespace libtorrent
|
|||
{
|
||||
if (!save_path.empty())
|
||||
{
|
||||
process_string_lowercase(crc, save_path.c_str(), save_path.size());
|
||||
process_string_lowercase(crc, save_path.c_str(), int(save_path.size()));
|
||||
TORRENT_ASSERT(save_path[save_path.size()-1] != TORRENT_SEPARATOR);
|
||||
crc.process_byte(TORRENT_SEPARATOR);
|
||||
}
|
||||
process_string_lowercase(crc, m_name.c_str(), m_name.size());
|
||||
process_string_lowercase(crc, m_name.c_str(), int(m_name.size()));
|
||||
TORRENT_ASSERT(m_name.size() > 0);
|
||||
TORRENT_ASSERT(m_name[m_name.size()-1] != TORRENT_SEPARATOR);
|
||||
crc.process_byte(TORRENT_SEPARATOR);
|
||||
|
@ -728,7 +728,7 @@ namespace libtorrent
|
|||
std::string const& p = m_paths[fe.path_index];
|
||||
if (!p.empty())
|
||||
{
|
||||
process_string_lowercase(crc, p.c_str(), p.size());
|
||||
process_string_lowercase(crc, p.c_str(), int(p.size()));
|
||||
TORRENT_ASSERT(p.size() > 0);
|
||||
TORRENT_ASSERT(p[p.size()-1] != TORRENT_SEPARATOR);
|
||||
crc.process_byte(TORRENT_SEPARATOR);
|
||||
|
@ -1049,7 +1049,7 @@ namespace libtorrent
|
|||
, int& pad_file_counter)
|
||||
{
|
||||
int cur_index = i - m_files.begin();
|
||||
int index = m_files.size();
|
||||
int index = int(m_files.size());
|
||||
m_files.push_back(internal_file_entry());
|
||||
++m_num_files;
|
||||
internal_file_entry& e = m_files.back();
|
||||
|
|
|
@ -680,7 +680,7 @@ void http_connection::on_write(error_code const& e)
|
|||
std::string().swap(m_sendbuffer);
|
||||
m_recvbuffer.resize(4096);
|
||||
|
||||
int amount_to_read = m_recvbuffer.size() - m_read_pos;
|
||||
int amount_to_read = int(m_recvbuffer.size()) - m_read_pos;
|
||||
if (m_rate_limit > 0 && amount_to_read > m_download_quota)
|
||||
{
|
||||
amount_to_read = m_download_quota;
|
||||
|
@ -708,7 +708,7 @@ void http_connection::on_read(error_code const& e
|
|||
|
||||
if (m_rate_limit)
|
||||
{
|
||||
m_download_quota -= bytes_transferred;
|
||||
m_download_quota -= int(bytes_transferred);
|
||||
TORRENT_ASSERT(m_download_quota >= 0);
|
||||
}
|
||||
|
||||
|
@ -733,7 +733,7 @@ void http_connection::on_read(error_code const& e
|
|||
data = &m_recvbuffer[0] + m_parser.body_start();
|
||||
size = m_parser.get_body().left();
|
||||
}
|
||||
callback(ec, data, size);
|
||||
callback(ec, data, int(size));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -744,7 +744,7 @@ void http_connection::on_read(error_code const& e
|
|||
return;
|
||||
}
|
||||
|
||||
m_read_pos += bytes_transferred;
|
||||
m_read_pos += int(bytes_transferred);
|
||||
TORRENT_ASSERT(m_read_pos <= int(m_recvbuffer.size()));
|
||||
|
||||
if (m_bottled || !m_parser.header_finished())
|
||||
|
@ -831,7 +831,7 @@ void http_connection::on_read(error_code const& e
|
|||
callback(error_code(boost::system::errc::file_too_large, generic_category()));
|
||||
return;
|
||||
}
|
||||
int amount_to_read = m_recvbuffer.size() - m_read_pos;
|
||||
int amount_to_read = int(m_recvbuffer.size()) - m_read_pos;
|
||||
if (m_rate_limit > 0 && amount_to_read > m_download_quota)
|
||||
{
|
||||
amount_to_read = m_download_quota;
|
||||
|
@ -869,7 +869,7 @@ void http_connection::on_assign_bandwidth(error_code const& e)
|
|||
|
||||
m_download_quota = m_rate_limit / 4;
|
||||
|
||||
int amount_to_read = m_recvbuffer.size() - m_read_pos;
|
||||
int amount_to_read = int(m_recvbuffer.size()) - m_read_pos;
|
||||
if (amount_to_read > m_download_quota)
|
||||
amount_to_read = m_download_quota;
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace libtorrent
|
|||
peer_log(peer_log_alert::outgoing_message, "REQUEST", "%s", request.c_str());
|
||||
#endif
|
||||
|
||||
send_buffer(request.c_str(), request.size(), message_type_request);
|
||||
send_buffer(request.c_str(), int(request.size()), message_type_request);
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
|
@ -218,7 +218,7 @@ namespace libtorrent
|
|||
|
||||
if (error)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
peer_log(peer_log_alert::info, "ERROR"
|
||||
, "http_seed_connection error: %s", error.message().c_str());
|
||||
|
@ -239,7 +239,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(!m_requests.empty());
|
||||
if (m_requests.empty())
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
disconnect(errors::http_error, op_bittorrent, 2);
|
||||
return;
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ namespace libtorrent
|
|||
|
||||
if (parse_error)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
disconnect(errors::http_parse_error, op_bittorrent, 2);
|
||||
return;
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ namespace libtorrent
|
|||
t->alerts().emplace_alert<url_seed_alert>(t->get_handle(), url()
|
||||
, error_msg);
|
||||
}
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
disconnect(error_code(m_parser.status_code(), get_http_category()), op_bittorrent, 1);
|
||||
return;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ namespace libtorrent
|
|||
// this means we got a redirection request
|
||||
// look for the location header
|
||||
std::string location = m_parser.header("location");
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
|
||||
if (location.empty())
|
||||
{
|
||||
|
@ -341,14 +341,14 @@ namespace libtorrent
|
|||
m_response_left = atol(m_parser.header("content-length").c_str());
|
||||
if (m_response_left == -1)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
// we should not try this server again.
|
||||
t->remove_web_seed(this, errors::no_content_length, op_bittorrent, 2);
|
||||
return;
|
||||
}
|
||||
if (m_response_left != front_request.length)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
// we should not try this server again.
|
||||
t->remove_web_seed(this, errors::invalid_range, op_bittorrent, 2);
|
||||
return;
|
||||
|
@ -410,7 +410,7 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
int payload = bytes_transferred;
|
||||
int payload = int(bytes_transferred);
|
||||
if (payload > m_response_left) payload = int(m_response_left);
|
||||
if (payload > front_request.length) payload = front_request.length;
|
||||
received_bytes(payload, 0);
|
||||
|
@ -427,7 +427,7 @@ namespace libtorrent
|
|||
peer_log(peer_log_alert::info, "CONNECT", "retrying in %d seconds", retry_time);
|
||||
#endif
|
||||
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
// temporarily unavailable, retry later
|
||||
t->retry_web_seed(this, retry_time);
|
||||
disconnect(error_code(m_parser.status_code(), get_http_category()), op_bittorrent, 1);
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace libtorrent
|
|||
{
|
||||
if (handle_error(e, h)) return;
|
||||
|
||||
int read_pos = m_buffer.size();
|
||||
int read_pos = int(m_buffer.size());
|
||||
// look for \n\n and \r\n\r\n
|
||||
// both of which means end of http response header
|
||||
bool found_end = false;
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace libtorrent
|
|||
{
|
||||
std::string id = tracker_req().trackerid;
|
||||
url += "&trackerid=";
|
||||
url += escape_string(id.c_str(), id.length());
|
||||
url += escape_string(id.c_str(), int(id.length()));
|
||||
}
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
|
@ -181,7 +181,7 @@ namespace libtorrent
|
|||
std::string announce_ip = settings.get_str(settings_pack::announce_ip);
|
||||
if (!announce_ip.empty())
|
||||
{
|
||||
url += "&ip=" + escape_string(announce_ip.c_str(), announce_ip.size());
|
||||
url += "&ip=" + escape_string(announce_ip.c_str(), int(announce_ip.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ namespace libtorrent
|
|||
);
|
||||
|
||||
// the url + 100 estimated header size
|
||||
sent_bytes(url.size() + 100);
|
||||
sent_bytes(int(url.size()) + 100);
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace libtorrent
|
|||
COMPLETE_ASYNC("i2p_stream::read_line");
|
||||
if (handle_error(e, h)) return;
|
||||
|
||||
int read_pos = m_buffer.size();
|
||||
int read_pos = int(m_buffer.size());
|
||||
|
||||
// look for \n which means end of the response
|
||||
if (m_buffer[read_pos - 1] != '\n')
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace
|
|||
void operator()(std::pair<libtorrent::sha1_hash
|
||||
, torrent_entry> const& t)
|
||||
{
|
||||
*count += t.second.peers.size();
|
||||
*count += int(t.second.peers.size());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
@ -276,14 +276,14 @@ namespace
|
|||
{
|
||||
// we need to remove some. Remove the ones with the
|
||||
// fewest peers
|
||||
int num_peers = m_map.begin()->second.peers.size();
|
||||
int num_peers = int(m_map.begin()->second.peers.size());
|
||||
table_t::iterator candidate = m_map.begin();
|
||||
for (table_t::iterator i = m_map.begin()
|
||||
, end(m_map.end()); i != end; ++i)
|
||||
{
|
||||
if (int(i->second.peers.size()) > num_peers) continue;
|
||||
if (i->first == info_hash) continue;
|
||||
num_peers = i->second.peers.size();
|
||||
num_peers = int(i->second.peers.size());
|
||||
candidate = i;
|
||||
}
|
||||
m_map.erase(candidate);
|
||||
|
|
|
@ -446,7 +446,7 @@ namespace libtorrent { namespace dht
|
|||
// update the quota. We won't prevent the packet to be sent if we exceed
|
||||
// the quota, we'll just (potentially) block the next incoming request.
|
||||
|
||||
m_send_quota -= m_send_buf.size();
|
||||
m_send_quota -= int(m_send_buf.size());
|
||||
|
||||
error_code ec;
|
||||
m_send_fun(addr, aux::array_view<char const>(&m_send_buf[0], m_send_buf.size()), ec, 0);
|
||||
|
@ -455,7 +455,7 @@ namespace libtorrent { namespace dht
|
|||
m_counters.inc_stats_counter(counters::dht_messages_out_dropped);
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
m_log->log_packet(dht_logger::outgoing_message, &m_send_buf[0]
|
||||
, m_send_buf.size(), addr);
|
||||
, int(m_send_buf.size()), addr);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ namespace libtorrent { namespace dht
|
|||
m_counters.inc_stats_counter(counters::dht_messages_out);
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
m_log->log_packet(dht_logger::outgoing_message, &m_send_buf[0]
|
||||
, m_send_buf.size(), addr);
|
||||
, int(m_send_buf.size()), addr);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ bool node::verify_token(std::string const& token, char const* info_hash
|
|||
error_code ec;
|
||||
std::string address = addr.address().to_string(ec);
|
||||
if (ec) return false;
|
||||
h1.update(&address[0], address.length());
|
||||
h1.update(&address[0], int(address.length()));
|
||||
h1.update(reinterpret_cast<char const*>(&m_secret[0]), sizeof(m_secret[0]));
|
||||
h1.update(reinterpret_cast<char const*>(info_hash), sha1_hash::size);
|
||||
|
||||
|
@ -167,7 +167,7 @@ bool node::verify_token(std::string const& token, char const* info_hash
|
|||
return true;
|
||||
|
||||
hasher h2;
|
||||
h2.update(&address[0], address.length());
|
||||
h2.update(&address[0], int(address.length()));
|
||||
h2.update(reinterpret_cast<char const*>(&m_secret[1]), sizeof(m_secret[1]));
|
||||
h2.update(info_hash, sha1_hash::size);
|
||||
h = h2.final();
|
||||
|
@ -184,7 +184,7 @@ std::string node::generate_token(udp::endpoint const& addr, char const* info_has
|
|||
error_code ec;
|
||||
std::string address = addr.address().to_string(ec);
|
||||
TORRENT_ASSERT(!ec);
|
||||
h.update(&address[0], address.length());
|
||||
h.update(&address[0], int(address.length()));
|
||||
h.update(reinterpret_cast<char*>(&m_secret[0]), sizeof(m_secret[0]));
|
||||
h.update(info_hash, sha1_hash::size);
|
||||
|
||||
|
|
|
@ -122,8 +122,8 @@ void routing_table::status(std::vector<dht_routing_bucket>& s) const
|
|||
, end(m_buckets.end()); i != end; ++i)
|
||||
{
|
||||
dht_routing_bucket b;
|
||||
b.num_nodes = i->live_nodes.size();
|
||||
b.num_replacements = i->replacements.size();
|
||||
b.num_nodes = int(i->live_nodes.size());
|
||||
b.num_replacements = int(i->replacements.size());
|
||||
s.push_back(b);
|
||||
}
|
||||
}
|
||||
|
@ -140,8 +140,8 @@ void routing_table::status(session_status& s) const
|
|||
, end(m_buckets.end()); i != end; ++i)
|
||||
{
|
||||
dht_routing_bucket b;
|
||||
b.num_nodes = i->live_nodes.size();
|
||||
b.num_replacements = i->replacements.size();
|
||||
b.num_nodes = int(i->live_nodes.size());
|
||||
b.num_replacements = int(i->replacements.size());
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
b.last_active = 0;
|
||||
#endif
|
||||
|
@ -158,14 +158,14 @@ boost::tuple<int, int, int> routing_table::size() const
|
|||
for (table_t::const_iterator i = m_buckets.begin()
|
||||
, end(m_buckets.end()); i != end; ++i)
|
||||
{
|
||||
nodes += i->live_nodes.size();
|
||||
nodes += int(i->live_nodes.size());
|
||||
for (bucket_t::const_iterator k = i->live_nodes.begin()
|
||||
, end2(i->live_nodes.end()); k != end2; ++k)
|
||||
{
|
||||
if (k->confirmed()) ++confirmed;
|
||||
}
|
||||
|
||||
replacements += i->replacements.size();
|
||||
replacements += int(i->replacements.size());
|
||||
}
|
||||
return boost::make_tuple(nodes, replacements, confirmed);
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ boost::int64_t routing_table::num_global_nodes() const
|
|||
for (table_t::const_iterator i = m_buckets.begin()
|
||||
, end(m_buckets.end()); i != end; ++i)
|
||||
{
|
||||
deepest_size = i->live_nodes.size(); // + i->replacements.size();
|
||||
deepest_size = int(i->live_nodes.size()); // + i->replacements.size();
|
||||
if (deepest_size < m_bucket_size) break;
|
||||
// this bucket is full
|
||||
++deepest_bucket;
|
||||
|
@ -192,7 +192,7 @@ boost::int64_t routing_table::num_global_nodes() const
|
|||
int routing_table::depth() const
|
||||
{
|
||||
if (m_depth >= int(m_buckets.size()))
|
||||
m_depth = m_buckets.size() - 1;
|
||||
m_depth = int(m_buckets.size()) - 1;
|
||||
|
||||
if (m_depth < 0) return m_depth;
|
||||
|
||||
|
@ -398,7 +398,7 @@ node_entry const* routing_table::next_refresh()
|
|||
node_entry* candidate = NULL;
|
||||
|
||||
// this will have a bias towards pinging nodes close to us first.
|
||||
int idx = m_buckets.size() - 1;
|
||||
int idx = int(m_buckets.size()) - 1;
|
||||
for (table_t::reverse_iterator i = m_buckets.rbegin()
|
||||
, end(m_buckets.rend()); i != end; ++i, --idx)
|
||||
{
|
||||
|
@ -445,7 +445,7 @@ routing_table::table_t::iterator routing_table::find_bucket(node_id const& id)
|
|||
{
|
||||
// TORRENT_ASSERT(id != m_id);
|
||||
|
||||
int num_buckets = m_buckets.size();
|
||||
int num_buckets = int(m_buckets.size());
|
||||
if (num_buckets == 0)
|
||||
{
|
||||
m_buckets.push_back(routing_table_node());
|
||||
|
@ -558,7 +558,7 @@ bool routing_table::add_node(node_entry e)
|
|||
|
||||
// if the new bucket still has too many nodes in it, we need to keep
|
||||
// splitting
|
||||
if (m_buckets.back().live_nodes.size() > bucket_limit(m_buckets.size()-1))
|
||||
if (m_buckets.back().live_nodes.size() > bucket_limit(int(m_buckets.size()) - 1))
|
||||
continue;
|
||||
|
||||
s = add_node_impl(e);
|
||||
|
@ -838,7 +838,7 @@ ip_ok:
|
|||
// have a unique prefix
|
||||
|
||||
// find node entries with duplicate prefixes in O(1)
|
||||
std::vector<bucket_t::iterator> prefix(1 << (8 - mask_shift), b.end());
|
||||
std::vector<bucket_t::iterator> prefix(int(1 << (8 - mask_shift)), b.end());
|
||||
TORRENT_ASSERT(int(prefix.size()) >= bucket_size_limit);
|
||||
|
||||
// the begin iterator from this object is used as a placeholder
|
||||
|
@ -957,7 +957,7 @@ void routing_table::split_bucket()
|
|||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
int const bucket_index = m_buckets.size()-1;
|
||||
int const bucket_index = int(m_buckets.size()) - 1;
|
||||
int const bucket_size_limit = bucket_limit(bucket_index);
|
||||
TORRENT_ASSERT(int(m_buckets.back().live_nodes.size()) >= bucket_limit(bucket_index + 1));
|
||||
|
||||
|
@ -1300,7 +1300,7 @@ void routing_table::check_invariant() const
|
|||
|
||||
bool routing_table::is_full(int bucket) const
|
||||
{
|
||||
int num_buckets = m_buckets.size();
|
||||
int num_buckets = int(m_buckets.size());
|
||||
if (num_buckets == 0) return false;
|
||||
if (bucket >= num_buckets) return false;
|
||||
|
||||
|
|
|
@ -510,7 +510,7 @@ namespace libtorrent
|
|||
if (line_len > limit) return -1;
|
||||
for (int i = 0; i < e.dict_size(); ++i)
|
||||
{
|
||||
line_len += 4 + e.dict_at(i).first.size();
|
||||
line_len += 4 + int(e.dict_at(i).first.size());
|
||||
if (line_len > limit) return -1;
|
||||
int ret = line_longer_than(*e.dict_at(i).second, limit - line_len);
|
||||
if (ret == -1) return -1;
|
||||
|
@ -644,7 +644,7 @@ namespace libtorrent
|
|||
{
|
||||
if (i == 0 && one_liner) ret += " ";
|
||||
std::pair<std::string, lazy_entry const*> ent = e.dict_at(i);
|
||||
print_string(ret, ent.first.c_str(), ent.first.size(), true);
|
||||
print_string(ret, ent.first.c_str(), int(ent.first.size()), true);
|
||||
ret += ": ";
|
||||
ret += print_entry(*ent.second, single_line, indent + 2);
|
||||
if (i < e.dict_size() - 1) ret += (one_liner?", ":indent_str);
|
||||
|
|
|
@ -235,7 +235,7 @@ namespace libtorrent { namespace
|
|||
if (e.url.empty()) continue;
|
||||
|
||||
// ignore urls with binary data in them
|
||||
if (need_encoding(e.url.c_str(), e.url.size())) continue;
|
||||
if (need_encoding(e.url.c_str(), int(e.url.size()))) continue;
|
||||
|
||||
// ignore invalid URLs
|
||||
error_code err;
|
||||
|
@ -304,11 +304,11 @@ namespace libtorrent { namespace
|
|||
char msg[6];
|
||||
char* ptr = msg;
|
||||
|
||||
detail::write_uint32(1 + 1 + tex_msg.size(), ptr);
|
||||
detail::write_uint32(1 + 1 + int(tex_msg.size()), ptr);
|
||||
detail::write_uint8(bt_peer_connection::msg_extended, ptr);
|
||||
detail::write_uint8(m_message_index, ptr);
|
||||
m_pc.send_buffer(msg, sizeof(msg));
|
||||
m_pc.send_buffer(&tex_msg[0], tex_msg.size());
|
||||
m_pc.send_buffer(&tex_msg[0], int(tex_msg.size()));
|
||||
m_pc.setup_send();
|
||||
}
|
||||
|
||||
|
@ -340,11 +340,11 @@ namespace libtorrent { namespace
|
|||
char msg[6];
|
||||
char* ptr = msg;
|
||||
|
||||
detail::write_uint32(1 + 1 + tex_msg.size(), ptr);
|
||||
detail::write_uint32(1 + 1 + int(tex_msg.size()), ptr);
|
||||
detail::write_uint8(bt_peer_connection::msg_extended, ptr);
|
||||
detail::write_uint8(m_message_index, ptr);
|
||||
m_pc.send_buffer(msg, sizeof(msg));
|
||||
m_pc.send_buffer(&tex_msg[0], tex_msg.size());
|
||||
m_pc.send_buffer(&tex_msg[0], int(tex_msg.size()));
|
||||
m_pc.setup_send();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace libtorrent
|
|||
if (!name.empty())
|
||||
{
|
||||
ret += "&dn=";
|
||||
ret += escape_string(name.c_str(), name.length());
|
||||
ret += escape_string(name.c_str(), int(name.length()));
|
||||
}
|
||||
|
||||
std::vector<announce_entry> const& tr = info.trackers();
|
||||
|
@ -97,7 +97,7 @@ namespace libtorrent
|
|||
for (std::vector<announce_entry>::const_iterator i = tr.begin(), end(tr.end()); i != end; ++i)
|
||||
{
|
||||
ret += "&tr=";
|
||||
ret += escape_string(i->url.c_str(), i->url.length());
|
||||
ret += escape_string(i->url.c_str(), int(i->url.length()));
|
||||
}
|
||||
|
||||
std::vector<web_seed_entry> const& seeds = info.web_seeds();
|
||||
|
@ -107,7 +107,7 @@ namespace libtorrent
|
|||
if (i->type != web_seed_entry::url_seed) continue;
|
||||
|
||||
ret += "&ws=";
|
||||
ret += escape_string(i->url.c_str(), i->url.length());
|
||||
ret += escape_string(i->url.c_str(), int(i->url.length()));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
/* Start: bn_error.c */
|
||||
#include "libtorrent/tommath.h"
|
||||
#ifdef _MSC_VER
|
||||
// disable warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
|
||||
#pragma warning(disable: 4334)
|
||||
#endif
|
||||
#ifdef BN_ERROR_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis
|
||||
*
|
||||
|
|
|
@ -144,7 +144,7 @@ namespace libtorrent {
|
|||
return 0;
|
||||
}
|
||||
|
||||
const int mask = (m_capacity - 1);
|
||||
const int mask = int(m_capacity - 1);
|
||||
return m_storage[idx & mask];
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ namespace libtorrent {
|
|||
if (compare_less_wrap(idx, m_first, 0xffff))
|
||||
return 0;
|
||||
|
||||
const int mask = (m_capacity - 1);
|
||||
const int mask = int(m_capacity - 1);
|
||||
void* old_value = m_storage[idx & mask];
|
||||
m_storage[idx & mask] = 0;
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace libtorrent
|
|||
to_process = 0;
|
||||
break;
|
||||
}
|
||||
to_process -= boost::asio::buffer_size(*i);
|
||||
to_process -= int(boost::asio::buffer_size(*i));
|
||||
}
|
||||
TORRENT_ASSERT(to_process == 0);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ namespace libtorrent
|
|||
std::vector<boost::asio::mutable_buffer> wr_buf;
|
||||
recv_buffer.mutable_buffers(wr_buf, bytes_transferred);
|
||||
int packet_size = 0;
|
||||
int produce = bytes_transferred;
|
||||
int produce = int(bytes_transferred);
|
||||
m_dec_handler->decrypt(wr_buf, consume, produce, packet_size);
|
||||
TORRENT_ASSERT(packet_size || produce);
|
||||
TORRENT_ASSERT(packet_size >= 0);
|
||||
|
@ -326,7 +326,7 @@ namespace libtorrent
|
|||
i != buf.end(); ++i)
|
||||
{
|
||||
unsigned char* pos = boost::asio::buffer_cast<unsigned char*>(*i);
|
||||
int len = boost::asio::buffer_size(*i);
|
||||
int len = int(boost::asio::buffer_size(*i));
|
||||
|
||||
TORRENT_ASSERT(len >= 0);
|
||||
TORRENT_ASSERT(pos);
|
||||
|
@ -354,7 +354,7 @@ namespace libtorrent
|
|||
i != buf.end(); ++i)
|
||||
{
|
||||
unsigned char* pos = boost::asio::buffer_cast<unsigned char*>(*i);
|
||||
int len = boost::asio::buffer_size(*i);
|
||||
int len = int(boost::asio::buffer_size(*i));
|
||||
|
||||
TORRENT_ASSERT(len >= 0);
|
||||
TORRENT_ASSERT(pos);
|
||||
|
|
|
@ -628,7 +628,7 @@ namespace libtorrent
|
|||
#endif
|
||||
x.append(t->torrent_file().info_hash().data(), 20);
|
||||
|
||||
sha1_hash hash = hasher(x.c_str(), x.size()).final();
|
||||
sha1_hash hash = hasher(x.c_str(), int(x.size())).final();
|
||||
for (;;)
|
||||
{
|
||||
char* p = hash.data();
|
||||
|
@ -5031,7 +5031,7 @@ namespace libtorrent
|
|||
|
||||
// time out the last request eligible
|
||||
// block in the queue
|
||||
int i = m_download_queue.size() - 1;
|
||||
int i = int(m_download_queue.size()) - 1;
|
||||
for (; i >= 0; --i)
|
||||
{
|
||||
if (!m_download_queue[i].timed_out
|
||||
|
@ -5560,8 +5560,8 @@ namespace libtorrent
|
|||
i != vec.rend(); ++i)
|
||||
{
|
||||
m_send_buffer.prepend_buffer(boost::asio::buffer_cast<char*>(*i)
|
||||
, boost::asio::buffer_size(*i)
|
||||
, boost::asio::buffer_size(*i)
|
||||
, int(boost::asio::buffer_size(*i))
|
||||
, int(boost::asio::buffer_size(*i))
|
||||
, &nop
|
||||
, NULL);
|
||||
}
|
||||
|
@ -5844,7 +5844,7 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(boost::asio::buffer_size(vec[0]) > 0);
|
||||
j.recv_buf = boost::asio::buffer_cast<char*>(vec[0]);
|
||||
j.buf_size = boost::asio::buffer_size(vec[0]);
|
||||
j.buf_size = int(boost::asio::buffer_size(vec[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6022,7 +6022,7 @@ namespace libtorrent
|
|||
{
|
||||
if (buffer_size > m_quota[download_channel])
|
||||
{
|
||||
request_bandwidth(download_channel, buffer_size);
|
||||
request_bandwidth(download_channel, int(buffer_size));
|
||||
buffer_size = m_quota[download_channel];
|
||||
}
|
||||
// we're already waiting to get some more
|
||||
|
@ -6038,7 +6038,7 @@ namespace libtorrent
|
|||
|
||||
if (buffer_size > 2097152) buffer_size = 2097152;
|
||||
|
||||
boost::asio::mutable_buffer buffer = m_recv_buffer.reserve(buffer_size);
|
||||
boost::asio::mutable_buffer buffer = m_recv_buffer.reserve(int(buffer_size));
|
||||
TORRENT_ASSERT(m_recv_buffer.normalized());
|
||||
|
||||
// utp sockets aren't thread safe...
|
||||
|
@ -6067,7 +6067,7 @@ namespace libtorrent
|
|||
socket_job j;
|
||||
j.type = socket_job::read_job;
|
||||
j.recv_buf = boost::asio::buffer_cast<char*>(buffer);
|
||||
j.buf_size = boost::asio::buffer_size(buffer);
|
||||
j.buf_size = int(boost::asio::buffer_size(buffer));
|
||||
j.peer = self();
|
||||
m_ses.post_socket_job(j);
|
||||
return;
|
||||
|
@ -6128,7 +6128,7 @@ namespace libtorrent
|
|||
|
||||
INVARIANT_CHECK;
|
||||
|
||||
int bytes_in_loop = bytes_transferred;
|
||||
int bytes_in_loop = int(bytes_transferred);
|
||||
|
||||
if (error)
|
||||
{
|
||||
|
@ -6146,7 +6146,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(bytes_transferred > 0);
|
||||
|
||||
m_counters.inc_stats_counter(counters::on_read_counter);
|
||||
m_ses.received_buffer(bytes_transferred);
|
||||
m_ses.received_buffer(int(bytes_transferred));
|
||||
|
||||
if (m_extension_outstanding_bytes > 0)
|
||||
m_extension_outstanding_bytes -= (std::min)(m_extension_outstanding_bytes, int(bytes_transferred));
|
||||
|
@ -6163,7 +6163,7 @@ namespace libtorrent
|
|||
#endif
|
||||
// correct the dl quota usage, if not all of the buffer was actually read
|
||||
TORRENT_ASSERT(int(bytes_transferred) <= m_quota[download_channel]);
|
||||
m_quota[download_channel] -= bytes_transferred;
|
||||
m_quota[download_channel] -= int(bytes_transferred);
|
||||
|
||||
if (m_disconnecting)
|
||||
{
|
||||
|
@ -6172,9 +6172,9 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
TORRENT_ASSERT(bytes_transferred > 0);
|
||||
m_recv_buffer.received(bytes_transferred);
|
||||
m_recv_buffer.received(int(bytes_transferred));
|
||||
|
||||
int bytes = bytes_transferred;
|
||||
int bytes = int(bytes_transferred);
|
||||
int sub_transferred = 0;
|
||||
do {
|
||||
// TODO: The stats checks can not be honored when authenticated encryption is in use
|
||||
|
@ -6221,7 +6221,7 @@ namespace libtorrent
|
|||
disconnect(ec, op_sock_read);
|
||||
return;
|
||||
}
|
||||
bytes_in_loop += bytes_transferred;
|
||||
bytes_in_loop += int(bytes_transferred);
|
||||
++num_loops;
|
||||
}
|
||||
while (bytes_transferred > 0);
|
||||
|
@ -6437,7 +6437,7 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
m_counters.inc_stats_counter(counters::on_write_counter);
|
||||
m_ses.sent_buffer(bytes_transferred);
|
||||
m_ses.sent_buffer(int(bytes_transferred));
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
TORRENT_ASSERT(m_socket_is_writing);
|
||||
|
@ -6462,7 +6462,7 @@ namespace libtorrent
|
|||
|
||||
TORRENT_ASSERT(m_channel_state[upload_channel] & peer_info::bw_network);
|
||||
|
||||
m_send_buffer.pop_front(bytes_transferred);
|
||||
m_send_buffer.pop_front(int(bytes_transferred));
|
||||
|
||||
time_point now = clock_type::now();
|
||||
|
||||
|
@ -6471,7 +6471,7 @@ namespace libtorrent
|
|||
{
|
||||
if (i->send_buffer_offset == pending_block::not_in_buffer) continue;
|
||||
boost::int32_t offset = i->send_buffer_offset;
|
||||
offset -= bytes_transferred;
|
||||
offset -= int(bytes_transferred);
|
||||
if (offset < 0)
|
||||
i->send_buffer_offset = pending_block::not_in_buffer;
|
||||
else
|
||||
|
@ -6481,12 +6481,12 @@ namespace libtorrent
|
|||
m_channel_state[upload_channel] &= ~peer_info::bw_network;
|
||||
|
||||
TORRENT_ASSERT(int(bytes_transferred) <= m_quota[upload_channel]);
|
||||
m_quota[upload_channel] -= bytes_transferred;
|
||||
m_quota[upload_channel] -= int(bytes_transferred);
|
||||
|
||||
trancieve_ip_packet(bytes_transferred, m_remote.address().is_v6());
|
||||
trancieve_ip_packet(int(bytes_transferred), m_remote.address().is_v6());
|
||||
|
||||
if (m_send_barrier != INT_MAX)
|
||||
m_send_barrier -= bytes_transferred;
|
||||
m_send_barrier -= int(bytes_transferred);
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
peer_log(peer_log_alert::outgoing, "WROTE"
|
||||
|
|
|
@ -231,7 +231,7 @@ namespace libtorrent
|
|||
{
|
||||
// disconnecting the peer here may also delete the
|
||||
// peer_info_struct. If that is the case, just continue
|
||||
int count = m_peers.size();
|
||||
int count = int(m_peers.size());
|
||||
peer_connection_interface* p = (*i)->connection;
|
||||
|
||||
banned.push_back(p->remote().address());
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace libtorrent
|
|||
if (m_free_block_infos.empty())
|
||||
{
|
||||
// we need to allocate more space in m_block_info
|
||||
block_index = m_block_info.size() / m_blocks_per_piece;
|
||||
block_index = int(m_block_info.size() / m_blocks_per_piece);
|
||||
TORRENT_ASSERT((m_block_info.size() % m_blocks_per_piece) == 0);
|
||||
m_block_info.resize(m_block_info.size() + m_blocks_per_piece);
|
||||
}
|
||||
|
@ -304,17 +304,17 @@ namespace libtorrent
|
|||
{
|
||||
int ret = 0;
|
||||
for (int k = 0; k < piece_pos::num_download_categories; ++k)
|
||||
ret += m_downloads[k].size();
|
||||
ret += int(m_downloads[k].size());
|
||||
return ret;
|
||||
}
|
||||
|
||||
void piece_picker::get_download_queue_sizes(int* partial
|
||||
, int* full, int* finished, int* zero_prio) const
|
||||
{
|
||||
*partial = m_downloads[piece_pos::piece_downloading].size();
|
||||
*full = m_downloads[piece_pos::piece_full].size();
|
||||
*finished = m_downloads[piece_pos::piece_finished].size();
|
||||
*zero_prio = m_downloads[piece_pos::piece_zero_prio].size();
|
||||
*partial = int(m_downloads[piece_pos::piece_downloading].size());
|
||||
*full = int(m_downloads[piece_pos::piece_full].size());
|
||||
*finished = int(m_downloads[piece_pos::piece_finished].size());
|
||||
*zero_prio = int(m_downloads[piece_pos::piece_zero_prio].size());
|
||||
}
|
||||
|
||||
piece_picker::block_info* piece_picker::blocks_for_piece(
|
||||
|
@ -792,7 +792,7 @@ namespace libtorrent
|
|||
std::pair<int, int> piece_picker::distributed_copies() const
|
||||
{
|
||||
TORRENT_ASSERT(m_seeds >= 0);
|
||||
const int num_pieces = m_piece_map.size();
|
||||
const int num_pieces = int(m_piece_map.size());
|
||||
|
||||
if (num_pieces == 0) return std::make_pair(1, 0);
|
||||
int min_availability = piece_pos::max_peer_count;
|
||||
|
@ -852,7 +852,7 @@ namespace libtorrent
|
|||
if (priority < 0) return;
|
||||
|
||||
if (int(m_priority_boundries.size()) <= priority)
|
||||
m_priority_boundries.resize(priority + 1, m_pieces.size());
|
||||
m_priority_boundries.resize(priority + 1, int(m_pieces.size()));
|
||||
|
||||
TORRENT_ASSERT(int(m_priority_boundries.size()) >= priority);
|
||||
|
||||
|
@ -984,7 +984,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
if (int(m_priority_boundries.size()) <= new_priority)
|
||||
m_priority_boundries.resize(new_priority + 1, m_pieces.size());
|
||||
m_priority_boundries.resize(new_priority + 1, int(m_pieces.size()));
|
||||
|
||||
#ifdef TORRENT_PICKER_LOG
|
||||
std::cerr << "[" << this << "] " << "update " << index << " (" << priority << "->" << new_priority << ")" << std::endl;
|
||||
|
@ -2189,7 +2189,7 @@ namespace libtorrent
|
|||
// front of the list
|
||||
if ((options & reverse) && (options & time_critical_mode) == 0)
|
||||
{
|
||||
for (int i = m_priority_boundries.size() - 1; i >= 0; --i)
|
||||
for (int i = int(m_priority_boundries.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
int start = (i == 0) ? 0 : m_priority_boundries[i - 1];
|
||||
int end = m_priority_boundries[i];
|
||||
|
|
|
@ -421,7 +421,7 @@ void crypto_receive_buffer::mutable_buffers(
|
|||
std::vector<boost::asio::mutable_buffer>& vec
|
||||
, std::size_t bytes_transfered)
|
||||
{
|
||||
int pending_decryption = bytes_transfered;
|
||||
int pending_decryption = int(bytes_transfered);
|
||||
if (m_recv_pos != INT_MAX)
|
||||
{
|
||||
pending_decryption = m_connection_buffer.packet_size() - m_recv_pos;
|
||||
|
|
|
@ -465,8 +465,8 @@ void feed::load_state(bdecode_node const& rd)
|
|||
}
|
||||
|
||||
m_settings.url = rd.dict_find_string_value("url");
|
||||
m_settings.auto_download = rd.dict_find_int_value("auto_download");
|
||||
m_settings.auto_map_handles = rd.dict_find_int_value("auto_map_handles");
|
||||
m_settings.auto_download = rd.dict_find_int_value("auto_download") != 0;
|
||||
m_settings.auto_map_handles = rd.dict_find_int_value("auto_map_handles") != 0;
|
||||
m_settings.default_ttl = rd.dict_find_int_value("default_ttl");
|
||||
|
||||
e = rd.dict_find_dict("add_params");
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace libtorrent
|
|||
|
||||
error_code ec;
|
||||
add_torrent_params resume_data
|
||||
= read_resume_data(&atp.resume_data[0], atp.resume_data.size(), ec);
|
||||
= read_resume_data(&atp.resume_data[0], int(atp.resume_data.size()), ec);
|
||||
|
||||
resume_data.internal_resume_data_error = ec;
|
||||
if (ec) return;
|
||||
|
@ -550,7 +550,7 @@ namespace libtorrent
|
|||
{
|
||||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), data);
|
||||
sha1_hash ret = hasher(&buf[0], buf.size()).final();
|
||||
sha1_hash ret = hasher(&buf[0], int(buf.size())).final();
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_ASYNC_CALL2(dht_put_immutable_item, data, ret);
|
||||
|
|
|
@ -780,9 +780,9 @@ namespace aux {
|
|||
val = settings.dict_find_int("type");
|
||||
if (val) m_settings.set_int(settings_pack::proxy_type, val.int_value());
|
||||
val = settings.dict_find_int("proxy_hostnames");
|
||||
if (val) m_settings.set_bool(settings_pack::proxy_hostnames, val.int_value());
|
||||
if (val) m_settings.set_bool(settings_pack::proxy_hostnames, val.int_value() != 0);
|
||||
val = settings.dict_find_int("proxy_peer_connections");
|
||||
if (val) m_settings.set_bool(settings_pack::proxy_peer_connections, val.int_value());
|
||||
if (val) m_settings.set_bool(settings_pack::proxy_peer_connections, val.int_value() != 0);
|
||||
val = settings.dict_find_string("hostname");
|
||||
if (val) m_settings.set_str(settings_pack::proxy_hostname, val.string_value());
|
||||
val = settings.dict_find_string("password");
|
||||
|
@ -798,7 +798,7 @@ namespace aux {
|
|||
{
|
||||
bdecode_node val;
|
||||
val = settings.dict_find_int("prefer_rc4");
|
||||
if (val) m_settings.set_bool(settings_pack::prefer_rc4, val.int_value());
|
||||
if (val) m_settings.set_bool(settings_pack::prefer_rc4, val.int_value() != 0);
|
||||
val = settings.dict_find_int("out_enc_policy");
|
||||
if (val) m_settings.set_int(settings_pack::out_enc_policy, val.int_value());
|
||||
val = settings.dict_find_int("in_enc_policy");
|
||||
|
@ -2596,7 +2596,7 @@ namespace aux {
|
|||
i->second->disconnect_peers(1, e);
|
||||
}
|
||||
|
||||
m_settings.set_int(settings_pack::connections_limit, m_connections.size());
|
||||
m_settings.set_int(settings_pack::connections_limit, int(m_connections.size()));
|
||||
}
|
||||
// try again, but still alert the user of the problem
|
||||
async_accept(listener, ssl);
|
||||
|
@ -3469,7 +3469,7 @@ namespace aux {
|
|||
else
|
||||
{
|
||||
cache_size = cache_size * least_recently_refreshed->second->num_peers()
|
||||
/ m_connections.size();
|
||||
/ int(m_connections.size());
|
||||
}
|
||||
|
||||
if (least_recently_refreshed != m_torrents.end())
|
||||
|
@ -4888,7 +4888,7 @@ namespace aux {
|
|||
// just a URL, set the temporary info-hash to the
|
||||
// hash of the URL. This will be changed once we
|
||||
// have the actual .torrent file
|
||||
tmp = hasher(¶ms.url[0], params.url.size()).final();
|
||||
tmp = hasher(¶ms.url[0], int(params.url.size())).final();
|
||||
ih = &tmp;
|
||||
}
|
||||
#endif
|
||||
|
@ -5193,7 +5193,7 @@ namespace aux {
|
|||
if (i == m_torrents.end() && !tptr->url().empty())
|
||||
{
|
||||
std::string const& url = tptr->url();
|
||||
sha1_hash urlhash = hasher(&url[0], url.size()).final();
|
||||
sha1_hash urlhash = hasher(&url[0], int(url.size())).final();
|
||||
i = m_torrents.find(urlhash);
|
||||
}
|
||||
#endif
|
||||
|
@ -5623,7 +5623,7 @@ namespace aux {
|
|||
s.disk_write_queue = m_stats_counters[counters::num_peers_down_disk];
|
||||
s.disk_read_queue = m_stats_counters[counters::num_peers_up_disk];
|
||||
|
||||
s.has_incoming_connections = m_stats_counters[counters::has_incoming_connections];
|
||||
s.has_incoming_connections = m_stats_counters[counters::has_incoming_connections] != 0;
|
||||
|
||||
// total
|
||||
s.download_rate = m_stat.download_rate();
|
||||
|
@ -6369,7 +6369,7 @@ namespace aux {
|
|||
return;
|
||||
}
|
||||
|
||||
m_dht_interval_update_torrents = m_torrents.size();
|
||||
m_dht_interval_update_torrents = int(m_torrents.size());
|
||||
|
||||
if (m_abort)
|
||||
{
|
||||
|
@ -6480,7 +6480,7 @@ namespace aux {
|
|||
int to_disconnect = num_connections() - m_settings.get_int(settings_pack::connections_limit);
|
||||
|
||||
int last_average = 0;
|
||||
int average = m_settings.get_int(settings_pack::connections_limit) / m_torrents.size();
|
||||
int average = int(m_settings.get_int(settings_pack::connections_limit) / m_torrents.size());
|
||||
|
||||
// the number of slots that are unused by torrents
|
||||
int extra = m_settings.get_int(settings_pack::connections_limit) % m_torrents.size();
|
||||
|
@ -6622,7 +6622,7 @@ namespace aux {
|
|||
{
|
||||
alerts->push_back((*i)->clone().release());
|
||||
}
|
||||
m_alert_pointer_pos = m_alert_pointers.size();
|
||||
m_alert_pointer_pos = int(m_alert_pointers.size());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -6634,8 +6634,8 @@ namespace aux {
|
|||
#ifndef TORRENT_NO_DEPRECATE
|
||||
size_t session_impl::set_alert_queue_size_limit(size_t queue_size_limit_)
|
||||
{
|
||||
m_settings.set_int(settings_pack::alert_queue_size, queue_size_limit_);
|
||||
return m_alerts.set_alert_queue_size_limit(queue_size_limit_);
|
||||
m_settings.set_int(settings_pack::alert_queue_size, int(queue_size_limit_));
|
||||
return m_alerts.set_alert_queue_size_limit(int(queue_size_limit_));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -141,13 +141,13 @@ namespace libtorrent
|
|||
if (ip.is_v6())
|
||||
{
|
||||
address_v6::bytes_type b = ip.to_v6().to_bytes();
|
||||
h = hasher(reinterpret_cast<char*>(&b[0]), b.size()).final();
|
||||
h = hasher(reinterpret_cast<char*>(&b[0]), int(b.size())).final();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
address_v4::bytes_type b = ip.to_v4().to_bytes();
|
||||
h = hasher(reinterpret_cast<char*>(&b[0]), b.size()).final();
|
||||
h = hasher(reinterpret_cast<char*>(&b[0]), int(b.size())).final();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace libtorrent
|
|||
std::vector<error_code>::iterator i = std::find(m_errors.begin(), m_errors.end(), ec);
|
||||
if (i != m_errors.end()) return i - m_errors.begin();
|
||||
m_errors.push_back(ec);
|
||||
return m_errors.size() - 1;
|
||||
return int(m_errors.size()) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace libtorrent
|
|||
for (;;)
|
||||
{
|
||||
*target = *bufs;
|
||||
size += bufs->iov_len;
|
||||
size += int(bufs->iov_len);
|
||||
if (size >= bytes)
|
||||
{
|
||||
target->iov_len -= size - bytes;
|
||||
|
@ -146,7 +146,7 @@ namespace libtorrent
|
|||
int size = 0;
|
||||
for (;;)
|
||||
{
|
||||
size += bufs->iov_len;
|
||||
size += int(bufs->iov_len);
|
||||
if (size >= bytes)
|
||||
{
|
||||
bufs->iov_base = reinterpret_cast<char*>(bufs->iov_base)
|
||||
|
@ -173,7 +173,7 @@ namespace libtorrent
|
|||
if (bytes == 0) return 0;
|
||||
for (file::iovec_t const* i = bufs;; ++i, ++count)
|
||||
{
|
||||
size += i->iov_len;
|
||||
size += int(i->iov_len);
|
||||
if (size >= bytes) return count;
|
||||
}
|
||||
}
|
||||
|
@ -1370,7 +1370,7 @@ namespace libtorrent
|
|||
for (int i = 0; i < num_bufs; ++i)
|
||||
{
|
||||
memset(bufs[i].iov_base, 0, bufs[i].iov_len);
|
||||
ret += bufs[i].iov_len;
|
||||
ret += int(bufs[i].iov_len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1380,7 +1380,7 @@ namespace libtorrent
|
|||
{
|
||||
int ret = 0;
|
||||
for (int i = 0; i < num_bufs; ++i)
|
||||
ret += bufs[i].iov_len;
|
||||
ret += int(bufs[i].iov_len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2053,7 +2053,7 @@ namespace libtorrent
|
|||
bool torrent::load(std::vector<char>& buffer)
|
||||
{
|
||||
error_code ec;
|
||||
m_torrent_file->load(&buffer[0], buffer.size(), ec);
|
||||
m_torrent_file->load(&buffer[0], int(buffer.size()), ec);
|
||||
if (ec)
|
||||
{
|
||||
set_error(ec, torrent_status::error_file_metadata);
|
||||
|
@ -6795,7 +6795,7 @@ namespace libtorrent
|
|||
}
|
||||
else if (has_picker())
|
||||
{
|
||||
for (int i = 0, end(pieces.size()); i < end; ++i)
|
||||
for (int i = 0, end(int(pieces.size())); i < end; ++i)
|
||||
pieces[i] = m_picker->have_piece(i) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
@ -6803,7 +6803,7 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(m_verified.size() == pieces.size());
|
||||
TORRENT_ASSERT(m_verifying.size() == pieces.size());
|
||||
for (int i = 0, end(pieces.size()); i < end; ++i)
|
||||
for (int i = 0, end(int(pieces.size())); i < end; ++i)
|
||||
pieces[i] |= m_verified[i] ? 2 : 0;
|
||||
}
|
||||
}
|
||||
|
@ -6945,7 +6945,7 @@ namespace libtorrent
|
|||
// write file priorities
|
||||
entry::list_type& file_priority = ret["file_priority"].list();
|
||||
file_priority.clear();
|
||||
for (int i = 0, end(m_file_priority.size()); i < end; ++i)
|
||||
for (int i = 0, end(int(m_file_priority.size())); i < end; ++i)
|
||||
file_priority.push_back(m_file_priority[i]);
|
||||
}
|
||||
}
|
||||
|
@ -6966,7 +6966,7 @@ namespace libtorrent
|
|||
entry::string_type& piece_priority = ret["piece_priority"].string();
|
||||
piece_priority.resize(m_torrent_file->num_pieces());
|
||||
|
||||
for (int i = 0, end(piece_priority.size()); i < end; ++i)
|
||||
for (int i = 0, end(int(piece_priority.size())); i < end; ++i)
|
||||
piece_priority[i] = m_picker->piece_priority(i);
|
||||
}
|
||||
}
|
||||
|
@ -10554,7 +10554,7 @@ namespace libtorrent
|
|||
|
||||
// remove the bottom 10% of peers from the candidate set.
|
||||
// this is just to remove outliers that might stall downloads
|
||||
int new_size = (peers.size() * 9 + 9) / 10;
|
||||
int new_size = int((peers.size() * 9 + 9) / 10);
|
||||
TORRENT_ASSERT(new_size <= int(peers.size()));
|
||||
peers.resize(new_size);
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ namespace libtorrent
|
|||
|
||||
#ifdef TORRENT_WINDOWS
|
||||
// remove trailing spaces and dots. These aren't allowed in filenames on windows
|
||||
for (int i = path.size() - 1; i >= 0; --i)
|
||||
for (int i = int(path.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
if (path[i] != ' ' && path[i] != '.') break;
|
||||
path.resize(i);
|
||||
|
@ -440,7 +440,7 @@ namespace libtorrent
|
|||
return false;
|
||||
}
|
||||
|
||||
int preallocate = path.size();
|
||||
int preallocate = int(path.size());
|
||||
for (int i = 0, end(p.list_size()); i < end; ++i)
|
||||
{
|
||||
bdecode_node e = p.list_at(i);
|
||||
|
|
|
@ -496,11 +496,11 @@ namespace libtorrent { namespace
|
|||
char msg[6];
|
||||
char* ptr = msg;
|
||||
|
||||
detail::write_uint32(1 + 1 + pex_msg.size(), ptr);
|
||||
detail::write_uint32(1 + 1 + int(pex_msg.size()), ptr);
|
||||
detail::write_uint8(bt_peer_connection::msg_extended, ptr);
|
||||
detail::write_uint8(m_message_index, ptr);
|
||||
m_pc.send_buffer(msg, sizeof(msg));
|
||||
m_pc.send_buffer(&pex_msg[0], pex_msg.size());
|
||||
m_pc.send_buffer(&pex_msg[0], int(pex_msg.size()));
|
||||
|
||||
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_extended);
|
||||
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_pex);
|
||||
|
@ -608,11 +608,11 @@ namespace libtorrent { namespace
|
|||
char msg[6];
|
||||
char* ptr = msg;
|
||||
|
||||
detail::write_uint32(1 + 1 + pex_msg.size(), ptr);
|
||||
detail::write_uint32(1 + 1 + int(pex_msg.size()), ptr);
|
||||
detail::write_uint8(bt_peer_connection::msg_extended, ptr);
|
||||
detail::write_uint8(m_message_index, ptr);
|
||||
m_pc.send_buffer(msg, sizeof(msg));
|
||||
m_pc.send_buffer(&pex_msg[0], pex_msg.size());
|
||||
m_pc.send_buffer(&pex_msg[0], int(pex_msg.size()));
|
||||
|
||||
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_extended);
|
||||
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_pex);
|
||||
|
|
|
@ -1000,7 +1000,7 @@ void utp_stream::add_read_buffer(void* buf, size_t len)
|
|||
TORRENT_ASSERT(len > 0);
|
||||
TORRENT_ASSERT(buf);
|
||||
m_impl->m_read_buffer.push_back(utp_socket_impl::iovec_t(buf, len));
|
||||
m_impl->m_read_buffer_size += len;
|
||||
m_impl->m_read_buffer_size += int(len);
|
||||
|
||||
UTP_LOGV("%8p: add_read_buffer %d bytes\n", static_cast<void*>(m_impl), int(len));
|
||||
}
|
||||
|
@ -1026,7 +1026,7 @@ void utp_stream::add_write_buffer(void const* buf, size_t len)
|
|||
#endif
|
||||
|
||||
m_impl->m_write_buffer.push_back(utp_socket_impl::iovec_t(const_cast<void*>(buf), len));
|
||||
m_impl->m_write_buffer_size += len;
|
||||
m_impl->m_write_buffer_size += int(len);
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
write_buffer_size = 0;
|
||||
|
@ -1063,7 +1063,7 @@ void utp_stream::issue_read()
|
|||
// have some data in the read buffer, move it into the
|
||||
// client's buffer right away
|
||||
|
||||
m_impl->m_read += read_some(false);
|
||||
m_impl->m_read += int(read_some(false));
|
||||
m_impl->maybe_trigger_receive_callback();
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ namespace libtorrent
|
|||
INVARIANT_CHECK;
|
||||
|
||||
if (error) return;
|
||||
sent_bytes(0, bytes_transferred);
|
||||
sent_bytes(0, int(bytes_transferred));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ void web_peer_connection::disconnect(error_code const& ec
|
|||
{
|
||||
// we're about to replace a different restart piece
|
||||
// buffer. So it was wasted download
|
||||
if (t) t->add_redundant_bytes(m_web->restart_piece.size()
|
||||
if (t) t->add_redundant_bytes(int(m_web->restart_piece.size())
|
||||
, torrent::piece_closing);
|
||||
}
|
||||
m_web->restart_piece.swap(m_piece);
|
||||
|
@ -206,12 +206,12 @@ web_peer_connection::downloading_piece_progress() const
|
|||
piece_block_progress ret;
|
||||
|
||||
ret.piece_index = m_requests.front().piece;
|
||||
ret.bytes_downloaded = m_piece.size();
|
||||
ret.bytes_downloaded = int(m_piece.size());
|
||||
// this is used to make sure that the block_index stays within
|
||||
// bounds. If the entire piece is downloaded, the block_index
|
||||
// would otherwise point to one past the end
|
||||
int correction = m_piece.size() ? -1 : 0;
|
||||
ret.block_index = (m_requests.front().start + m_piece.size() + correction) / t->block_size();
|
||||
ret.block_index = int((m_requests.front().start + m_piece.size() + correction) / t->block_size());
|
||||
TORRENT_ASSERT(ret.block_index < int(piece_block::invalid.block_index));
|
||||
TORRENT_ASSERT(ret.piece_index < int(piece_block::invalid.piece_index));
|
||||
|
||||
|
@ -300,12 +300,12 @@ void web_peer_connection::write_request(peer_request const& r)
|
|||
TORRENT_UNUSED(front);
|
||||
#endif
|
||||
|
||||
req.start += m_piece.size();
|
||||
req.length -= m_piece.size();
|
||||
req.start += int(m_piece.size());
|
||||
req.length -= int(m_piece.size());
|
||||
|
||||
// just to keep the accounting straight for the upper layer.
|
||||
// it doesn't know we just re-wrote the request
|
||||
incoming_piece_fragment(m_piece.size());
|
||||
incoming_piece_fragment(int(m_piece.size()));
|
||||
m_web->restart_request.piece = -1;
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ void web_peer_connection::write_request(peer_request const& r)
|
|||
#ifdef TORRENT_WINDOWS
|
||||
convert_path_to_posix(path);
|
||||
#endif
|
||||
request += escape_path(path.c_str(), path.length());
|
||||
request += escape_path(path.c_str(), int(path.length()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -400,7 +400,7 @@ void web_peer_connection::write_request(peer_request const& r)
|
|||
#ifdef TORRENT_WINDOWS
|
||||
convert_path_to_posix(path);
|
||||
#endif
|
||||
request += escape_path(path.c_str(), path.length());
|
||||
request += escape_path(path.c_str(), int(path.length()));
|
||||
}
|
||||
request += " HTTP/1.1\r\n";
|
||||
add_headers(request, m_settings, using_proxy);
|
||||
|
@ -434,7 +434,7 @@ void web_peer_connection::write_request(peer_request const& r)
|
|||
peer_log(peer_log_alert::outgoing_message, "REQUEST", "%s", request.c_str());
|
||||
#endif
|
||||
|
||||
send_buffer(request.c_str(), request.size(), message_type_request);
|
||||
send_buffer(request.c_str(), int(request.size()), message_type_request);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -608,7 +608,7 @@ void web_peer_connection::handle_redirect(int bytes_left)
|
|||
#ifdef TORRENT_WINDOWS
|
||||
convert_path_to_posix(path);
|
||||
#endif
|
||||
path = escape_path(path.c_str(), path.length());
|
||||
path = escape_path(path.c_str(), int(path.length()));
|
||||
size_t i = location.rfind(path);
|
||||
if (i == std::string::npos)
|
||||
{
|
||||
|
@ -641,7 +641,7 @@ void web_peer_connection::on_receive(error_code const& error
|
|||
|
||||
if (error)
|
||||
{
|
||||
received_bytes(0, bytes_transferred);
|
||||
received_bytes(0, int(bytes_transferred));
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
peer_log(peer_log_alert::info, "ERROR"
|
||||
, "web_peer_connection error: %s", error.message().c_str());
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace libtorrent
|
|||
{
|
||||
token = xml_parse_error;
|
||||
start = "unexpected end of file";
|
||||
callback(token, start, strlen(start), NULL, 0);
|
||||
callback(token, start, int(strlen(start)), NULL, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ namespace libtorrent
|
|||
{
|
||||
token = xml_parse_error;
|
||||
start = "unexpected end of file";
|
||||
callback(token, start, strlen(start), NULL, 0);
|
||||
callback(token, start, int(strlen(start)), NULL, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ namespace libtorrent
|
|||
{
|
||||
token = xml_parse_error;
|
||||
start = "unquoted attribute value";
|
||||
callback(token, start, strlen(start), NULL, 0);
|
||||
callback(token, start, int(strlen(start)), NULL, 0);
|
||||
break;
|
||||
}
|
||||
char quote = *i;
|
||||
|
@ -182,7 +182,7 @@ namespace libtorrent
|
|||
{
|
||||
token = xml_parse_error;
|
||||
start = "missing end quote on attribute";
|
||||
callback(token, start, strlen(start), NULL, 0);
|
||||
callback(token, start, int(strlen(start)), NULL, 0);
|
||||
break;
|
||||
}
|
||||
const int val_len = i - val_start;
|
||||
|
|
|
@ -73,6 +73,8 @@ lib libtorrent_test
|
|||
<target-os>windows:<library>advapi32
|
||||
<conditional>@link_libtorrent
|
||||
<toolset>darwin:<cflags>-Wno-unused-command-line-argument
|
||||
# disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
|
||||
<toolset>msvc:<cflags>/wd4275
|
||||
<debug-iterators>on
|
||||
|
||||
: # default build
|
||||
|
@ -95,6 +97,8 @@ project
|
|||
<conditional>@link_test
|
||||
<conditional>@link_libtorrent
|
||||
<toolset>darwin:<cflags>-Wno-unused-command-line-argument
|
||||
# disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
|
||||
<toolset>msvc:<cflags>/wd4275
|
||||
: default-build
|
||||
<threading>multi
|
||||
<invariant-checks>full
|
||||
|
|
|
@ -361,7 +361,7 @@ void peer_conn::on_message(error_code const& ec, size_t bytes_transferred)
|
|||
char* ptr = (char*)buffer;
|
||||
int msg = read_uint8(ptr);
|
||||
|
||||
m_on_msg(msg, ptr, bytes_transferred);
|
||||
m_on_msg(msg, ptr, int(bytes_transferred));
|
||||
|
||||
switch (m_mode)
|
||||
{
|
||||
|
|
|
@ -91,7 +91,7 @@ void output_test_log_to_terminal()
|
|||
char buf[4096];
|
||||
int size = 0;
|
||||
do {
|
||||
size = fread(buf, 1, sizeof(buf), current_test->output);
|
||||
size = int(fread(buf, 1, sizeof(buf), current_test->output));
|
||||
if (size > 0) fwrite(buf, 1, size, stderr);
|
||||
} while (size > 0);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ boost::shared_ptr<libtorrent::torrent_info> make_test_torrent(
|
|||
std::string name = "test_file-1";
|
||||
if (ent.find("name=") != std::string::npos)
|
||||
{
|
||||
int pos = ent.find("name=") + 5;
|
||||
std::string::size_type pos = ent.find("name=") + 5;
|
||||
name = ent.substr(pos, ent.find(',', pos));
|
||||
}
|
||||
info["name"] = name;
|
||||
|
@ -103,7 +103,7 @@ boost::shared_ptr<libtorrent::torrent_info> make_test_torrent(
|
|||
std::string name = filename;
|
||||
if (ent.find("name=") != std::string::npos)
|
||||
{
|
||||
int pos = ent.find("name=") + 5;
|
||||
std::string::size_type pos = ent.find("name=") + 5;
|
||||
name = ent.substr(pos, ent.find(',', pos));
|
||||
}
|
||||
file_entry["path"].list().push_back(name);
|
||||
|
@ -160,7 +160,7 @@ boost::shared_ptr<libtorrent::torrent_info> make_test_torrent(
|
|||
fwrite(&tmp[0], 1, tmp.size(), f);
|
||||
fclose(f);
|
||||
|
||||
return boost::make_shared<torrent_info>(&tmp[0], tmp.size());
|
||||
return boost::make_shared<torrent_info>(&tmp[0], int(tmp.size()));
|
||||
}
|
||||
|
||||
void generate_files(libtorrent::torrent_info const& ti, std::string const& path
|
||||
|
|
|
@ -225,7 +225,7 @@ int load_file(std::string const& filename, std::vector<char>& v, libtorrent::err
|
|||
return 0;
|
||||
}
|
||||
|
||||
r = fread(&v[0], 1, v.size(), f);
|
||||
r = int(fread(&v[0], 1, v.size(), f));
|
||||
if (r < 0)
|
||||
{
|
||||
ec.assign(errno, boost::system::system_category());
|
||||
|
@ -671,7 +671,7 @@ boost::shared_ptr<torrent_info> create_torrent(std::ostream* file
|
|||
|
||||
// calculate the hash for all pieces
|
||||
int num = t.num_pieces();
|
||||
sha1_hash ph = hasher(&piece[0], piece.size()).final();
|
||||
sha1_hash ph = hasher(&piece[0], int(piece.size())).final();
|
||||
for (int i = 0; i < num; ++i)
|
||||
t.set_hash(i, ph);
|
||||
|
||||
|
@ -680,7 +680,7 @@ boost::shared_ptr<torrent_info> create_torrent(std::ostream* file
|
|||
while (total_size > 0)
|
||||
{
|
||||
file->write(&piece[0], (std::min)(int(piece.size()), total_size));
|
||||
total_size -= piece.size();
|
||||
total_size -= int(piece.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ int print_failures()
|
|||
int longest_name = 0;
|
||||
for (int i = 0; i < _g_num_unit_tests; ++i)
|
||||
{
|
||||
int len = strlen(_g_unit_tests[i].name);
|
||||
int len = int(strlen(_g_unit_tests[i].name));
|
||||
if (len > longest_name) longest_name = len;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ TORRENT_TEST(bitfield)
|
|||
TEST_CHECK(test1.all_set() == false);
|
||||
test1.clear_bit(2);
|
||||
TEST_EQUAL(test1.count(), 2);
|
||||
int distance = std::distance(test1.begin(), test1.end());
|
||||
int distance = int(std::distance(test1.begin(), test1.end()));
|
||||
printf("distance: %d\n", distance);
|
||||
TEST_CHECK(distance == 10);
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ int copy_buffers(T const& b, char* target)
|
|||
{
|
||||
memcpy(target, boost::asio::buffer_cast<char const*>(*i), boost::asio::buffer_size(*i));
|
||||
target += boost::asio::buffer_size(*i);
|
||||
copied += boost::asio::buffer_size(*i);
|
||||
copied += int(boost::asio::buffer_size(*i));
|
||||
}
|
||||
return copied;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ void test_checking(int flags = read_only_files)
|
|||
|
||||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), t.generate());
|
||||
boost::shared_ptr<torrent_info> ti(new torrent_info(&buf[0], buf.size(), ec));
|
||||
boost::shared_ptr<torrent_info> ti(new torrent_info(&buf[0], int(buf.size()), ec));
|
||||
|
||||
fprintf(stderr, "generated torrent: %s tmp1_checking/test_torrent_dir\n"
|
||||
, to_hex(ti->info_hash().to_string()).c_str());
|
||||
|
|
|
@ -1364,7 +1364,7 @@ TORRENT_TEST(dht)
|
|||
std::vector<node_entry> temp;
|
||||
|
||||
std::generate(tmp.begin(), tmp.end(), random_byte);
|
||||
table.find_node(tmp, temp, 0, nodes.size() * 2);
|
||||
table.find_node(tmp, temp, 0, int(nodes.size()) * 2);
|
||||
printf("returned-all: %d\n", int(temp.size()));
|
||||
TEST_EQUAL(temp.size(), nodes.size());
|
||||
|
||||
|
@ -1805,7 +1805,7 @@ TORRENT_TEST(dht)
|
|||
std::string flat_data;
|
||||
bencode(std::back_inserter(flat_data), put_data);
|
||||
sha1_hash target = item_target_id(
|
||||
std::pair<char const*, int>(flat_data.c_str(), flat_data.size()));
|
||||
std::pair<char const*, int>(flat_data.c_str(), int(flat_data.size())));
|
||||
|
||||
node.put_item(target, put_data, boost::bind(&put_immutable_item_cb, _1, loop));
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ void send_bitfield(tcp::socket& s, char const* bits)
|
|||
{
|
||||
using namespace libtorrent::detail;
|
||||
|
||||
int num_pieces = strlen(bits);
|
||||
int num_pieces = int(strlen(bits));
|
||||
int packet_size = (num_pieces+7)/8 + 5;
|
||||
char* msg = (char*)TORRENT_ALLOCA(char, packet_size);
|
||||
memset(msg, 0, packet_size);
|
||||
|
@ -301,7 +301,7 @@ void send_extension_handshake(tcp::socket& s, entry const& e)
|
|||
using namespace libtorrent::detail;
|
||||
|
||||
char* ptr = &buf[0];
|
||||
write_uint32(buf.size() - 4, ptr);
|
||||
write_uint32(int(buf.size()) - 4, ptr);
|
||||
write_uint8(20, ptr);
|
||||
write_uint8(0, ptr);
|
||||
|
||||
|
@ -367,7 +367,7 @@ void send_ut_metadata_msg(tcp::socket& s, int ut_metadata_msg, int type, int pie
|
|||
using namespace libtorrent::detail;
|
||||
|
||||
char* ptr = &buf[0];
|
||||
write_uint32(buf.size() - 4, ptr);
|
||||
write_uint32(int(buf.size()) - 4, ptr);
|
||||
write_uint8(20, ptr);
|
||||
write_uint8(ut_metadata_msg, ptr);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ TORRENT_TEST(gzip)
|
|||
TEST_CHECK(!ec);
|
||||
|
||||
std::vector<char> inflated;
|
||||
inflate_gzip(&zipped[0], zipped.size(), inflated, 1000000, ec);
|
||||
inflate_gzip(&zipped[0], int(zipped.size()), inflated, 1000000, ec);
|
||||
|
||||
if (ec) {
|
||||
fprintf(stderr, "failed to unzip: %s\n", ec.message().c_str());
|
||||
|
|
|
@ -67,7 +67,7 @@ TORRENT_TEST(hasher)
|
|||
{
|
||||
hasher h;
|
||||
for (int i = 0; i < repeat_count[test]; ++i)
|
||||
h.update(test_array[test], std::strlen(test_array[test]));
|
||||
h.update(test_array[test], int(std::strlen(test_array[test])));
|
||||
|
||||
sha1_hash result;
|
||||
from_hex(result_array[test], 40, (char*)&result[0]);
|
||||
|
|
|
@ -340,7 +340,7 @@ TORRENT_TEST(make_magnet_uri)
|
|||
buf.push_back('\0');
|
||||
printf("%s\n", &buf[0]);
|
||||
error_code ec;
|
||||
torrent_info ti(&buf[0], buf.size(), ec);
|
||||
torrent_info ti(&buf[0], int(buf.size()), ec);
|
||||
|
||||
TEST_EQUAL(al.size(), ti.trackers().size());
|
||||
|
||||
|
@ -367,7 +367,7 @@ TORRENT_TEST(make_magnet_uri2)
|
|||
buf.push_back('\0');
|
||||
printf("%s\n", &buf[0]);
|
||||
error_code ec;
|
||||
torrent_info ti(&buf[0], buf.size(), ec);
|
||||
torrent_info ti(&buf[0], int(buf.size()), ec);
|
||||
|
||||
std::string magnet = make_magnet_uri(ti);
|
||||
printf("%s len: %d\n", magnet.c_str(), int(magnet.size()));
|
||||
|
|
|
@ -91,14 +91,14 @@ TORRENT_TEST(insert)
|
|||
for (int i = 0; i < 0xff; ++i)
|
||||
{
|
||||
int index = (i + 0xfff0) & 0xffff;
|
||||
pb.insert(index, reinterpret_cast<int*>(index + 1));
|
||||
pb.insert(index, reinterpret_cast<int*>(size_t(index) + 1));
|
||||
fprintf(stderr, "insert: %u (mask: %x)\n", index, int(pb.capacity() - 1));
|
||||
TEST_EQUAL(pb.capacity(), 512);
|
||||
if (i >= 14)
|
||||
{
|
||||
index = (index - 14) & 0xffff;
|
||||
fprintf(stderr, "remove: %u\n", index);
|
||||
TEST_CHECK(pb.remove(index) == reinterpret_cast<int*>(index + 1));
|
||||
TEST_CHECK(pb.remove(index) == reinterpret_cast<int*>(size_t(index) + 1));
|
||||
TEST_EQUAL(pb.size(), 14);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ const int blocks_per_piece = 4;
|
|||
|
||||
bitfield string2vec(char const* have_str)
|
||||
{
|
||||
const int num_pieces = strlen(have_str);
|
||||
const int num_pieces = int(strlen(have_str));
|
||||
bitfield have(num_pieces, false);
|
||||
for (int i = 0; i < num_pieces; ++i)
|
||||
if (have_str[i] != ' ') have.set_bit(i);
|
||||
|
@ -91,7 +91,7 @@ boost::shared_ptr<piece_picker> setup_picker(
|
|||
, char const* priority
|
||||
, char const* partial)
|
||||
{
|
||||
const int num_pieces = strlen(availability);
|
||||
const int num_pieces = int(strlen(availability));
|
||||
TORRENT_ASSERT(int(strlen(have_str)) == num_pieces);
|
||||
|
||||
boost::shared_ptr<piece_picker> p(new piece_picker);
|
||||
|
|
|
@ -295,7 +295,7 @@ done:
|
|||
#endif
|
||||
{
|
||||
error_code ec;
|
||||
p = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
p = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_CHECK(!ec);
|
||||
}
|
||||
p.flags &= ~add_torrent_params::flag_paused;
|
||||
|
|
|
@ -83,7 +83,7 @@ void test_read_piece(int flags)
|
|||
|
||||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), t.generate());
|
||||
boost::shared_ptr<torrent_info> ti(new torrent_info(&buf[0], buf.size(), ec));
|
||||
boost::shared_ptr<torrent_info> ti(new torrent_info(&buf[0], int(buf.size()), ec));
|
||||
|
||||
fprintf(stderr, "generated torrent: %s tmp1_read_piece/test_torrent\n"
|
||||
, to_hex(ti->info_hash().to_string()).c_str());
|
||||
|
|
|
@ -77,7 +77,7 @@ TORRENT_TEST(read_resume)
|
|||
bencode(std::back_inserter(resume_data), rd);
|
||||
|
||||
error_code ec;
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
|
||||
TEST_CHECK(!ec);
|
||||
|
||||
|
@ -123,7 +123,7 @@ TORRENT_TEST(read_resume_missing_info_hash)
|
|||
bencode(std::back_inserter(resume_data), rd);
|
||||
|
||||
error_code ec;
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_EQUAL(ec, error_code(errors::missing_info_hash, get_libtorrent_category()));
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ TORRENT_TEST(read_resume_missing_file_format)
|
|||
bencode(std::back_inserter(resume_data), rd);
|
||||
|
||||
error_code ec;
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_EQUAL(ec, error_code(errors::invalid_file_tag, get_libtorrent_category()));
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ TORRENT_TEST(read_resume_mismatching_torrent)
|
|||
// the info-hash field does not match the torrent in the "info" field, so it
|
||||
// will be ignored
|
||||
error_code ec;
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_CHECK(!ec);
|
||||
TEST_CHECK(!atp.ti);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ TORRENT_TEST(read_resume_torrent)
|
|||
// the info-hash field does not match the torrent in the "info" field, so it
|
||||
// will be ignored
|
||||
error_code ec;
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
add_torrent_params atp = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_CHECK(!ec);
|
||||
TEST_CHECK(atp.ti);
|
||||
|
||||
|
|
|
@ -124,8 +124,8 @@ void test_remap_files_gather(storage_mode_t storage_mode = storage_mode_sparse)
|
|||
}
|
||||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), ct.generate());
|
||||
boost::shared_ptr<torrent_info> t(new torrent_info(&buf[0], buf.size(), ec));
|
||||
boost::shared_ptr<torrent_info> t2(new torrent_info(&buf[0], buf.size(), ec));
|
||||
boost::shared_ptr<torrent_info> t(new torrent_info(&buf[0], int(buf.size()), ec));
|
||||
boost::shared_ptr<torrent_info> t2(new torrent_info(&buf[0], int(buf.size()), ec));
|
||||
|
||||
// remap the files to a single one
|
||||
file_storage st;
|
||||
|
@ -419,7 +419,7 @@ void test_remap_files_prio(storage_mode_t storage_mode = storage_mode_sparse)
|
|||
|
||||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), ct.generate());
|
||||
boost::shared_ptr<torrent_info> t(new torrent_info(&buf[0], buf.size(), ec));
|
||||
boost::shared_ptr<torrent_info> t(new torrent_info(&buf[0], int(buf.size()), ec));
|
||||
|
||||
int num_new_files = 3;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ struct test_torrent_t
|
|||
{
|
||||
char const* filename1;
|
||||
char const* filename2;
|
||||
int expected_matches;
|
||||
std::string::size_type expected_matches;
|
||||
};
|
||||
|
||||
static test_torrent_t test_torrents[] = {
|
||||
|
@ -108,7 +108,7 @@ TORRENT_TEST(resolve_links)
|
|||
|
||||
std::vector<resolve_links::link_t> const& links = l.get_links();
|
||||
|
||||
int num_matches = std::count_if(links.begin(), links.end()
|
||||
std::string::size_type num_matches = std::count_if(links.begin(), links.end()
|
||||
, boost::bind(&resolve_links::link_t::ti, _1));
|
||||
|
||||
// some debug output in case the test fails
|
||||
|
|
|
@ -158,7 +158,7 @@ torrent_handle test_resume_flags(lt::session& ses, int flags
|
|||
#endif
|
||||
{
|
||||
error_code ec;
|
||||
p = read_resume_data(&rd[0], rd.size(), ec);
|
||||
p = read_resume_data(&rd[0], int(rd.size()), ec);
|
||||
TEST_CHECK(!ec);
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ void test_piece_priorities(bool test_deprecated = false)
|
|||
#endif
|
||||
{
|
||||
error_code ec;
|
||||
p = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
p = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_CHECK(!ec);
|
||||
p.ti = ti;
|
||||
p.save_path = ".";
|
||||
|
@ -753,7 +753,7 @@ void test_zero_file_prio(bool test_deprecated = false)
|
|||
#endif
|
||||
{
|
||||
error_code ec;
|
||||
p = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
p = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_CHECK(!ec);
|
||||
p.ti = ti;
|
||||
p.save_path = ".";
|
||||
|
@ -839,7 +839,7 @@ void test_seed_mode(bool const file_prio, bool const pieces_have, bool const pie
|
|||
#endif
|
||||
{
|
||||
error_code ec;
|
||||
p = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
p = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_CHECK(!ec);
|
||||
p.ti = ti;
|
||||
p.save_path = ".";
|
||||
|
|
|
@ -698,7 +698,7 @@ void test_fastresume(bool const test_deprecated)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
p = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
p = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_CHECK(!ec);
|
||||
}
|
||||
|
||||
|
@ -809,7 +809,7 @@ void test_rename_file_fastresume(bool test_deprecated)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
p = read_resume_data(&resume_data[0], resume_data.size(), ec);
|
||||
p = read_resume_data(&resume_data[0], int(resume_data.size()), ec);
|
||||
TEST_CHECK(!ec);
|
||||
}
|
||||
p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
|
||||
|
@ -1118,7 +1118,7 @@ int count_bufs(file::iovec_t const* bufs, int bytes)
|
|||
if (bytes == 0) return 0;
|
||||
for (file::iovec_t const* i = bufs;; ++i, ++count)
|
||||
{
|
||||
size += i->iov_len;
|
||||
size += int(i->iov_len);
|
||||
if (size >= bytes) return count;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,22 +147,22 @@ TORRENT_TEST(string)
|
|||
|
||||
// escape_string
|
||||
char const* test_string = "!@#$%^&*()-_=+/,. %?";
|
||||
TEST_EQUAL(escape_string(test_string, strlen(test_string))
|
||||
TEST_EQUAL(escape_string(test_string, int(strlen(test_string)))
|
||||
, "!%40%23%24%25%5e%26*()-_%3d%2b%2f%2c.%20%25%3f");
|
||||
|
||||
// escape_path
|
||||
TEST_EQUAL(escape_path(test_string, strlen(test_string))
|
||||
TEST_EQUAL(escape_path(test_string, int(strlen(test_string)))
|
||||
, "!%40%23%24%25%5e%26*()-_%3d%2b/%2c.%20%25%3f");
|
||||
|
||||
error_code ec;
|
||||
TEST_CHECK(unescape_string(escape_path(test_string, strlen(test_string)), ec) == test_string);
|
||||
TEST_CHECK(unescape_string(escape_path(test_string, int(strlen(test_string))), ec) == test_string);
|
||||
TEST_CHECK(!ec);
|
||||
if (ec) fprintf(stderr, "%s\n", ec.message().c_str());
|
||||
|
||||
// need_encoding
|
||||
char const* test_string2 = "!@$&()-_/,.%?";
|
||||
TEST_CHECK(need_encoding(test_string, strlen(test_string)) == true);
|
||||
TEST_CHECK(need_encoding(test_string2, strlen(test_string2)) == false);
|
||||
TEST_CHECK(need_encoding(test_string, int(strlen(test_string))) == true);
|
||||
TEST_CHECK(need_encoding(test_string2, int(strlen(test_string2))) == false);
|
||||
TEST_CHECK(need_encoding("\n", 1) == true);
|
||||
|
||||
// maybe_url_encode
|
||||
|
@ -172,9 +172,9 @@ TORRENT_TEST(string)
|
|||
TEST_EQUAL(maybe_url_encode("?&"), "?&");
|
||||
|
||||
// unescape_string
|
||||
TEST_CHECK(unescape_string(escape_string(test_string, strlen(test_string)), ec)
|
||||
TEST_CHECK(unescape_string(escape_string(test_string, int(strlen(test_string))), ec)
|
||||
== test_string);
|
||||
std::cerr << unescape_string(escape_string(test_string, strlen(test_string)), ec) << std::endl;
|
||||
std::cerr << unescape_string(escape_string(test_string, int(strlen(test_string))), ec) << std::endl;
|
||||
// prematurely terminated string
|
||||
unescape_string("%", ec);
|
||||
TEST_CHECK(ec == error_code(errors::invalid_escaped_string));
|
||||
|
|
|
@ -149,7 +149,7 @@ void test_running_torrent(boost::shared_ptr<torrent_info> info, boost::int64_t f
|
|||
TEST_CHECK(memcmp(&piece[0], rpa->buffer.get(), piece.size()) == 0);
|
||||
TEST_CHECK(rpa->size == info->piece_size(0));
|
||||
TEST_CHECK(rpa->piece == 0);
|
||||
TEST_CHECK(hasher(&piece[0], piece.size()).final() == info->hash_for_piece(0));
|
||||
TEST_CHECK(hasher(&piece[0], int(piece.size())).final() == info->hash_for_piece(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ TORRENT_TEST(mutable_torrents)
|
|||
entry tor = t.generate();
|
||||
bencode(out, tor);
|
||||
|
||||
torrent_info ti(&tmp[0], tmp.size());
|
||||
torrent_info ti(&tmp[0], int(tmp.size()));
|
||||
|
||||
std::vector<sha1_hash> similar;
|
||||
similar.push_back(sha1_hash("abababababababababab"));
|
||||
|
@ -578,7 +578,7 @@ TORRENT_TEST(parse_torrents)
|
|||
|
||||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), torrent);
|
||||
torrent_info ti(&buf[0], buf.size(), ec);
|
||||
torrent_info ti(&buf[0], int(buf.size()), ec);
|
||||
std::cerr << ti.name() << std::endl;
|
||||
TEST_CHECK(ti.name() == "test1");
|
||||
|
||||
|
@ -590,7 +590,7 @@ TORRENT_TEST(parse_torrents)
|
|||
torrent["info"] = info;
|
||||
buf.clear();
|
||||
bencode(std::back_inserter(buf), torrent);
|
||||
torrent_info ti2(&buf[0], buf.size(), ec);
|
||||
torrent_info ti2(&buf[0], int(buf.size()), ec);
|
||||
std::cerr << ti2.name() << std::endl;
|
||||
#ifdef TORRENT_WINDOWS
|
||||
TEST_EQUAL(ti2.name(), "ctest1test2test3");
|
||||
|
@ -602,7 +602,7 @@ TORRENT_TEST(parse_torrents)
|
|||
torrent["info"] = info;
|
||||
buf.clear();
|
||||
bencode(std::back_inserter(buf), torrent);
|
||||
torrent_info ti3(&buf[0], buf.size(), ec);
|
||||
torrent_info ti3(&buf[0], int(buf.size()), ec);
|
||||
std::cerr << ti3.name() << std::endl;
|
||||
TEST_EQUAL(ti3.name(), "test2..test3.......test4");
|
||||
|
||||
|
@ -805,7 +805,7 @@ void test_resolve_duplicates(int test_case)
|
|||
entry tor = t.generate();
|
||||
bencode(out, tor);
|
||||
|
||||
torrent_info ti(&tmp[0], tmp.size());
|
||||
torrent_info ti(&tmp[0], int(tmp.size()));
|
||||
|
||||
char const* filenames[4][4] =
|
||||
{
|
||||
|
|
|
@ -106,7 +106,7 @@ struct test_storage : default_storage
|
|||
}
|
||||
|
||||
for (int i = 0; i < num_bufs; ++i)
|
||||
m_written += bufs[i].iov_len;
|
||||
m_written += int(bufs[i].iov_len);
|
||||
l.unlock();
|
||||
return default_storage::writev(bufs, num_bufs, piece_index, offset, flags, se);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ using namespace libtorrent;
|
|||
void verify_transforms(char const* utf8_source, int utf8_source_len = -1)
|
||||
{
|
||||
if (utf8_source_len == -1)
|
||||
utf8_source_len = strlen(utf8_source);
|
||||
utf8_source_len = int(strlen(utf8_source));
|
||||
|
||||
// utf8 -> utf16 -> utf32 -> utf8
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ TORRENT_TEST(utf8)
|
|||
|
||||
// test lower level conversions
|
||||
|
||||
verify_transforms(&utf8_source[0], utf8_source.size());
|
||||
verify_transforms(&utf8_source[0], int(utf8_source.size()));
|
||||
|
||||
verify_transforms("\xc3\xb0");
|
||||
verify_transforms("\xed\x9f\xbf");
|
||||
|
|
|
@ -85,7 +85,7 @@ TORRENT_TEST(web_seed_redirect)
|
|||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), t.generate());
|
||||
boost::shared_ptr<torrent_info> torrent_file(new torrent_info(&buf[0]
|
||||
, buf.size(), ec));
|
||||
, int(buf.size()), ec));
|
||||
|
||||
{
|
||||
settings_pack settings;
|
||||
|
|
|
@ -192,8 +192,8 @@ struct udp_tracker
|
|||
error_code ec;
|
||||
udp::endpoint from;
|
||||
m_socket.async_receive_from(
|
||||
boost::asio::buffer(buffer, sizeof(buffer)), from, 0
|
||||
, boost::bind(&udp_tracker::on_udp_receive, this, _1, _2, &from, &buffer[0], sizeof(buffer)));
|
||||
boost::asio::buffer(buffer, int(sizeof(buffer))), from, 0
|
||||
, boost::bind(&udp_tracker::on_udp_receive, this, _1, _2, &from, &buffer[0], int(sizeof(buffer))));
|
||||
|
||||
m_ios.run(ec);
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ rule link_libtorrent ( properties * )
|
|||
project tools
|
||||
: requirements
|
||||
<threading>multi
|
||||
# disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
|
||||
<toolset>msvc:<cflags>/wd4275
|
||||
<conditional>@link_libtorrent
|
||||
: default-build
|
||||
<link>static
|
||||
|
|
|
@ -116,8 +116,8 @@ void put_string(entry& e, boost::array<char, 64>& sig, boost::uint64_t& seq
|
|||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), e);
|
||||
++seq;
|
||||
sign_mutable_item(std::pair<char const*, int>(&buf[0], buf.size())
|
||||
, std::pair<char const*, int>(&salt[0], salt.size())
|
||||
sign_mutable_item(std::pair<char const*, int>(&buf[0], int(buf.size()))
|
||||
, std::pair<char const*, int>(&salt[0], int(salt.size()))
|
||||
, seq
|
||||
, public_key
|
||||
, private_key
|
||||
|
@ -142,7 +142,7 @@ int dump_key(char *filename)
|
|||
}
|
||||
|
||||
unsigned char seed[32];
|
||||
int size = fread(seed, 1, 32, f);
|
||||
int size = int(fread(seed, 1, 32, f));
|
||||
if (size != 32)
|
||||
{
|
||||
fprintf(stderr, "invalid key file.\n");
|
||||
|
@ -175,7 +175,7 @@ int generate_key(char* filename)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int size = fwrite(seed, 1, 32, f);
|
||||
int size = int(fwrite(seed, 1, 32, f));
|
||||
if (size != 32)
|
||||
{
|
||||
fprintf(stderr, "failed to write key file.\n");
|
||||
|
@ -368,7 +368,7 @@ int main(int argc, char* argv[])
|
|||
--argc;
|
||||
if (argc < 1) usage();
|
||||
|
||||
int len = strlen(argv[0]);
|
||||
int len = int(strlen(argv[0]));
|
||||
if (len != 64)
|
||||
{
|
||||
fprintf(stderr, "public key is expected to be 64 hex digits\n");
|
||||
|
|
|
@ -333,7 +333,7 @@ int load_file(std::string const& filename, std::vector<char>& v
|
|||
return 0;
|
||||
}
|
||||
|
||||
r = fread(&v[0], 1, v.size(), f);
|
||||
r = int(fread(&v[0], 1, v.size(), f));
|
||||
if (r < 0)
|
||||
{
|
||||
ec.assign(errno, boost::system::system_category());
|
||||
|
@ -388,7 +388,7 @@ int main(int argc, char const* argv[])
|
|||
render_variant(test_buffer, e);
|
||||
|
||||
libtorrent::error_code ec;
|
||||
libtorrent::torrent_info t(test_buffer.c_str(), test_buffer.size(), ec);
|
||||
libtorrent::torrent_info t(test_buffer.c_str(), int(test_buffer.size()), ec);
|
||||
|
||||
// TODO: add option to save to file unconditionally (to test other clients)
|
||||
/*
|
||||
|
|
|
@ -85,7 +85,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
char entry[21];
|
||||
char* ptr = entry;
|
||||
int ret = fread(&entry, 1, sizeof(entry), log_file);
|
||||
int ret = int(fread(&entry, 1, sizeof(entry), log_file));
|
||||
if (ret != sizeof(entry)) break;
|
||||
|
||||
file_op op;
|
||||
|
|
Loading…
Reference in New Issue