fix some msvc warnings
This commit is contained in:
parent
4b9f4c7690
commit
e225259481
|
@ -1,6 +1,11 @@
|
|||
#include "fixedint.h"
|
||||
#include "fe.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4146 ) /* warning C4146: unary minus operator applied to unsigned type, result still unsigned */
|
||||
#pragma warning(disable : 4244 ) /* warning C4244: '=' : conversion from 'int64_t' to 'int32_t', possible loss of data */
|
||||
#endif // _MSC_VER
|
||||
|
||||
/*
|
||||
helper functions
|
||||
|
@ -225,7 +230,7 @@ void fe_cswap(fe f,fe g,unsigned int b) {
|
|||
int32_t x7 = f7 ^ g7;
|
||||
int32_t x8 = f8 ^ g8;
|
||||
int32_t x9 = f9 ^ g9;
|
||||
b = -b;
|
||||
b = -b; // warning C4146: unary minus operator applied to unsigned type, result still unsigned
|
||||
x0 &= b;
|
||||
x1 &= b;
|
||||
x2 &= b;
|
||||
|
@ -1489,3 +1494,7 @@ void fe_tobytes(unsigned char *s, const fe h) {
|
|||
s[30] = (unsigned char) ((h9 >> 10) & 0xff);
|
||||
s[31] = (unsigned char) ((h9 >> 18) & 0xff);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
|
@ -4,6 +4,12 @@
|
|||
Not a compatible replacement for <stdint.h>, do not blindly use it as such.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4142 ) /* warning C4142: benign redefinition oef type */
|
||||
#pragma warning(disable : 4005 ) /* warning C4005: 'UINT64_C' : macro redefinition */
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined(__WATCOMC__) && (defined(_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined(__UINT_FAST64_TYPE__)) )) && !defined(FIXEDINT_H_INCLUDED)
|
||||
#include <stdint.h>
|
||||
#define FIXEDINT_H_INCLUDED
|
||||
|
@ -70,3 +76,7 @@
|
|||
#define INT64_C(v) v ##I64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace libtorrent {
|
|||
|
||||
bool should_post(alert const* a) const
|
||||
{
|
||||
return m_alert_mask & a->category();
|
||||
return (m_alert_mask & a->category()) != 0;
|
||||
}
|
||||
|
||||
alert const* wait_for_alert(time_duration max_wait);
|
||||
|
|
|
@ -461,7 +461,7 @@ namespace libtorrent
|
|||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
bool is_dht_running() const { return m_dht.get(); }
|
||||
bool is_dht_running() const { return (m_dht.get() != NULL); }
|
||||
#endif
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
|
@ -901,7 +901,7 @@ namespace libtorrent
|
|||
void recalculate_optimistic_unchoke_slots();
|
||||
|
||||
ptime m_created;
|
||||
int session_time() const { return total_seconds(time_now() - m_created); }
|
||||
int64_t session_time() const { return total_seconds(time_now() - m_created); }
|
||||
|
||||
ptime m_last_tick;
|
||||
ptime m_last_second_tick;
|
||||
|
|
|
@ -69,7 +69,7 @@ struct TORRENT_EXTRA_EXPORT bandwidth_manager
|
|||
#endif
|
||||
|
||||
int queue_size() const;
|
||||
int queued_bytes() const;
|
||||
boost::int64_t queued_bytes() const;
|
||||
|
||||
// non prioritized means that, if there's a line for bandwidth,
|
||||
// others will cut in front of the non-prioritized peers.
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace libtorrent
|
|||
return m_queue.size();
|
||||
}
|
||||
|
||||
int bandwidth_manager::queued_bytes() const
|
||||
boost::int64_t bandwidth_manager::queued_bytes() const
|
||||
{
|
||||
return m_queued_bytes;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ namespace libtorrent
|
|||
|
||||
INVARIANT_CHECK;
|
||||
|
||||
int dt_milliseconds = total_milliseconds(dt);
|
||||
int64_t dt_milliseconds = total_milliseconds(dt);
|
||||
if (dt_milliseconds > 3000) dt_milliseconds = 3000;
|
||||
|
||||
// for each bandwidth channel, call update_quota(dt)
|
||||
|
@ -208,7 +208,7 @@ namespace libtorrent
|
|||
for (std::vector<bandwidth_channel*>::iterator i = channels.begin()
|
||||
, end(channels.end()); i != end; ++i)
|
||||
{
|
||||
(*i)->update_quota(dt_milliseconds);
|
||||
(*i)->update_quota(int(dt_milliseconds));
|
||||
}
|
||||
|
||||
for (queue_t::iterator i = m_queue.begin();
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace libtorrent
|
|||
|| (ip & 0xffff0000) == 0xc0a80000 // 192.168.x.x
|
||||
|| (ip & 0xffff0000) == 0xa9fe0000 // 169.254.x.x
|
||||
|| (ip & 0xff000000) == 0x7f000000); // 127.x.x.x
|
||||
} TORRENT_CATCH(std::exception& e) { return false; }
|
||||
} TORRENT_CATCH(std::exception&) { return false; }
|
||||
}
|
||||
|
||||
bool is_loopback(address const& addr)
|
||||
|
@ -91,7 +91,7 @@ namespace libtorrent
|
|||
return addr.to_v4() == address_v4::loopback();
|
||||
else
|
||||
return addr.to_v6() == address_v6::loopback();
|
||||
} TORRENT_CATCH(std::exception& e) { return false; }
|
||||
} TORRENT_CATCH(std::exception&) { return false; }
|
||||
#else
|
||||
return addr.to_v4() == address_v4::loopback();
|
||||
#endif
|
||||
|
@ -105,7 +105,7 @@ namespace libtorrent
|
|||
return addr.to_v4().is_multicast();
|
||||
else
|
||||
return addr.to_v6().is_multicast();
|
||||
} TORRENT_CATCH(std::exception& e) { return false; }
|
||||
} TORRENT_CATCH(std::exception&) { return false; }
|
||||
#else
|
||||
return addr.to_v4().is_multicast();
|
||||
#endif
|
||||
|
@ -124,7 +124,7 @@ namespace libtorrent
|
|||
#else
|
||||
return addr.to_v4() == address_v4::any();
|
||||
#endif
|
||||
} TORRENT_CATCH(std::exception& e) { return false; }
|
||||
} TORRENT_CATCH(std::exception&) { return false; }
|
||||
}
|
||||
|
||||
bool is_teredo(address const& addr)
|
||||
|
@ -135,7 +135,7 @@ namespace libtorrent
|
|||
boost::uint8_t teredo_prefix[] = {0x20, 0x01, 0, 0};
|
||||
address_v6::bytes_type b = addr.to_v6().to_bytes();
|
||||
return memcmp(&b[0], teredo_prefix, 4) == 0;
|
||||
} TORRENT_CATCH(std::exception& e) { return false; }
|
||||
} TORRENT_CATCH(std::exception&) { return false; }
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
@ -148,7 +148,7 @@ namespace libtorrent
|
|||
error_code ec;
|
||||
address::from_string("::1", ec);
|
||||
return !ec;
|
||||
} TORRENT_CATCH(std::exception& e) { return false; }
|
||||
} TORRENT_CATCH(std::exception&) { return false; }
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace libtorrent
|
|||
char *p = &ret.back();
|
||||
*p = '\0';
|
||||
unsigned_size_type un = n;
|
||||
if (n < 0) un = -un;
|
||||
if (n < 0) un = -un; // TODO: warning C4146: unary minus operator applied to unsigned type, result still unsigned
|
||||
do {
|
||||
*--p = '0' + un % 10;
|
||||
un /= 10;
|
||||
|
|
12
src/file.cpp
12
src/file.cpp
|
@ -169,7 +169,7 @@ namespace libtorrent
|
|||
#ifdef TORRENT_WINDOWS
|
||||
std::string convert_separators(std::string p)
|
||||
{
|
||||
for (int i = 0; i < p.size(); ++i)
|
||||
for (int i = 0; i < int(p.size()); ++i)
|
||||
if (p[i] == '/') p[i] = '\\';
|
||||
return p;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ namespace libtorrent
|
|||
// we don't care about the last character, since it's OK for it
|
||||
// to be a slash or a back slash
|
||||
bool found = false;
|
||||
for (int i = 2; i < f.size() - 1; ++i)
|
||||
for (int i = 2; i < int(f.size()) - 1; ++i)
|
||||
{
|
||||
if (f[i] != '\\' && f[i] != '/') continue;
|
||||
// there is a directory separator in here,
|
||||
|
@ -1085,7 +1085,7 @@ namespace libtorrent
|
|||
if ((mode & file::sparse) && (mode & rw_mask) != read_only)
|
||||
{
|
||||
DWORD temp;
|
||||
bool use_overlapped = m_open_mode & no_buffer;
|
||||
bool use_overlapped = (m_open_mode & no_buffer) != 0;
|
||||
overlapped_t ol;
|
||||
BOOL ret = ::DeviceIoControl(m_file_handle, FSCTL_SET_SPARSE, 0, 0
|
||||
, 0, 0, &temp, use_overlapped ? &ol.ol : NULL);
|
||||
|
@ -1283,10 +1283,10 @@ namespace libtorrent
|
|||
{
|
||||
LARGE_INTEGER file_size;
|
||||
if (!GetFileSizeEx(file, &file_size))
|
||||
return -1;
|
||||
return false;
|
||||
|
||||
overlapped_t ol;
|
||||
if (ol.ol.hEvent == NULL) return -1;
|
||||
if (ol.ol.hEvent == NULL) return false;
|
||||
|
||||
#ifdef TORRENT_MINGW
|
||||
typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
|
||||
|
@ -1335,7 +1335,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
|
|||
// flag set, but there are no sparse regions, unset
|
||||
// the flag
|
||||
int rw_mode = m_open_mode & rw_mask;
|
||||
bool use_overlapped = m_open_mode & no_buffer;
|
||||
bool use_overlapped = (m_open_mode & no_buffer) != 0;
|
||||
if ((rw_mode != read_only)
|
||||
&& (m_open_mode & sparse)
|
||||
&& !is_sparse(m_file_handle, use_overlapped))
|
||||
|
|
|
@ -324,7 +324,7 @@ namespace libtorrent
|
|||
for (; size > 0; file_offset -= file_iter->size, ++file_iter)
|
||||
{
|
||||
TORRENT_ASSERT(file_iter != m_files.end());
|
||||
if (file_offset < file_iter->size)
|
||||
if (file_offset < size_type(file_iter->size))
|
||||
{
|
||||
file_slice f;
|
||||
f.file_index = file_iter - m_files.begin();
|
||||
|
@ -391,7 +391,7 @@ namespace libtorrent
|
|||
ret.start = int(offset % piece_length());
|
||||
ret.length = size;
|
||||
if (offset + size > total_size())
|
||||
ret.length = total_size() - offset;
|
||||
ret.length = int(total_size() - offset);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -158,7 +158,8 @@ namespace libtorrent
|
|||
TORRENT_TRY {
|
||||
buffer.resize(destlen);
|
||||
} TORRENT_CATCH(std::exception& e) {
|
||||
error = "out of memory";
|
||||
error = "out of memory: ";
|
||||
error += e.what();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
destlen *= 2;
|
||||
if (destlen > maximum_size)
|
||||
if (destlen > (unsigned int)maximum_size)
|
||||
destlen = maximum_size;
|
||||
}
|
||||
} while (ret == 1);
|
||||
|
|
|
@ -1095,13 +1095,13 @@ void node_impl::incoming_request(msg const& m, entry& e)
|
|||
}
|
||||
}
|
||||
|
||||
if (item->seq > msg_keys[2]->int_value())
|
||||
if (item->seq > boost::uint64_t(msg_keys[2]->int_value()))
|
||||
{
|
||||
incoming_error(e, "old sequence number", 302);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->seq < msg_keys[2]->int_value())
|
||||
if (item->seq < boost::uint64_t(msg_keys[2]->int_value()))
|
||||
{
|
||||
if (item->size != buf.second)
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ void routing_table::status(session_status& s) const
|
|||
dht_routing_bucket b;
|
||||
b.num_nodes = i->live_nodes.size();
|
||||
b.num_replacements = i->replacements.size();
|
||||
b.last_active = total_seconds(now - i->last_active);
|
||||
b.last_active = int(total_seconds(now - i->last_active));
|
||||
s.dht_routing_table.push_back(b);
|
||||
}
|
||||
}
|
||||
|
@ -132,21 +132,21 @@ size_type routing_table::num_global_nodes() const
|
|||
|
||||
int routing_table::depth() const
|
||||
{
|
||||
if (m_depth >= m_buckets.size())
|
||||
if (m_depth >= int(m_buckets.size()))
|
||||
m_depth = m_buckets.size() - 1;
|
||||
|
||||
if (m_depth < 0) return m_depth;
|
||||
|
||||
// maybe the table is deeper now?
|
||||
while (m_depth < int(m_buckets.size())-1
|
||||
&& m_buckets[m_depth+1].live_nodes.size() >= m_bucket_size / 2)
|
||||
&& int(m_buckets[m_depth+1].live_nodes.size()) >= m_bucket_size / 2)
|
||||
{
|
||||
++m_depth;
|
||||
}
|
||||
|
||||
// maybe the table is more shallow now?
|
||||
while (m_depth > 0
|
||||
&& m_buckets[m_depth-1].live_nodes.size() < m_bucket_size / 2)
|
||||
&& int(m_buckets[m_depth-1].live_nodes.size()) < m_bucket_size / 2)
|
||||
{
|
||||
--m_depth;
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ bool routing_table::add_node(node_entry e)
|
|||
|
||||
m_ips.insert(e.addr().to_v4().to_bytes());
|
||||
|
||||
while (m_buckets.back().live_nodes.size() > bucket_limit(m_buckets.size()-1))
|
||||
while (int(m_buckets.back().live_nodes.size()) > bucket_limit(m_buckets.size() - 1))
|
||||
split_bucket();
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ rpc_manager::rpc_manager(node_id const& our_id
|
|||
, m_allocated_observers(0)
|
||||
, m_destructing(false)
|
||||
{
|
||||
std::srand(time(0));
|
||||
std::srand((unsigned int)time(0));
|
||||
|
||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||
TORRENT_LOG(rpc) << "Constructing";
|
||||
|
@ -377,7 +377,7 @@ bool rpc_manager::incoming(msg const& m, node_id* id, libtorrent::dht_settings c
|
|||
o->reply(m);
|
||||
*id = nid;
|
||||
|
||||
int rtt = total_milliseconds(now - o->sent());
|
||||
int rtt = int(total_milliseconds(now - o->sent()));
|
||||
|
||||
// we found an observer for this reply, hence the node is not spoofing
|
||||
// add it to the routing table
|
||||
|
|
|
@ -884,7 +884,7 @@ namespace libtorrent
|
|||
if (!peer_info_struct() || peer_info_struct()->fast_reconnects > 1)
|
||||
return;
|
||||
m_fast_reconnect = r;
|
||||
peer_info_struct()->last_connected = m_ses.session_time();
|
||||
peer_info_struct()->last_connected = (boost::uint16_t)m_ses.session_time();
|
||||
int rewind = m_ses.settings().min_reconnect_time * m_ses.settings().max_failcount;
|
||||
if (peer_info_struct()->last_connected < rewind) peer_info_struct()->last_connected = 0;
|
||||
else peer_info_struct()->last_connected -= rewind;
|
||||
|
@ -3775,8 +3775,8 @@ namespace libtorrent
|
|||
p.receive_quota = m_quota[download_channel];
|
||||
p.num_pieces = m_num_pieces;
|
||||
if (m_download_queue.empty()) p.request_timeout = -1;
|
||||
else p.request_timeout = total_seconds(m_requested - now) + m_ses.settings().request_timeout
|
||||
+ m_timeout_extend;
|
||||
else p.request_timeout = int(total_seconds(m_requested - now) + m_ses.settings().request_timeout
|
||||
+ m_timeout_extend);
|
||||
#ifndef TORRENT_DISABLE_GEO_IP
|
||||
p.inet_as_name = m_inet_as_name;
|
||||
#endif
|
||||
|
@ -4168,7 +4168,7 @@ namespace libtorrent
|
|||
// if we can't read, it means we're blocked on the rate-limiter
|
||||
// or the disk, not the peer itself. In this case, don't blame
|
||||
// the peer and disconnect it
|
||||
bool may_timeout = (m_channel_state[download_channel] & peer_info::bw_network);
|
||||
bool may_timeout = (m_channel_state[download_channel] & peer_info::bw_network) != 0;
|
||||
|
||||
if (may_timeout && d > seconds(m_timeout) && !m_connecting
|
||||
&& can_disconnect(error_code(errors::timed_out_inactivity, get_libtorrent_category())))
|
||||
|
@ -4331,11 +4331,11 @@ namespace libtorrent
|
|||
boost::int64_t piece_size = t->torrent_file().piece_length();
|
||||
|
||||
if (m_remote_dl_rate > 0)
|
||||
m_remote_dl_rate = (m_remote_dl_rate * 2 / 3) +
|
||||
((boost::int64_t(m_remote_pieces_dled) * piece_size / 3) / 60);
|
||||
m_remote_dl_rate = int((m_remote_dl_rate * 2 / 3) +
|
||||
((boost::int64_t(m_remote_pieces_dled) * piece_size / 3) / 60));
|
||||
else
|
||||
m_remote_dl_rate = boost::int64_t(m_remote_pieces_dled)
|
||||
* piece_size / 60;
|
||||
m_remote_dl_rate = int(boost::int64_t(m_remote_pieces_dled)
|
||||
* piece_size / 60);
|
||||
|
||||
m_remote_pieces_dled = 0;
|
||||
m_remote_dl_update = now;
|
||||
|
@ -4483,8 +4483,8 @@ namespace libtorrent
|
|||
|
||||
boost::uint64_t upload_rate = int(m_statistics.upload_rate());
|
||||
|
||||
int buffer_size_watermark = upload_rate
|
||||
* m_ses.settings().send_buffer_watermark_factor / 100;
|
||||
int buffer_size_watermark = int(upload_rate
|
||||
* m_ses.settings().send_buffer_watermark_factor / 100);
|
||||
|
||||
if (buffer_size_watermark < m_ses.settings().send_buffer_low_watermark)
|
||||
{
|
||||
|
@ -5503,7 +5503,7 @@ namespace libtorrent
|
|||
|
||||
INVARIANT_CHECK;
|
||||
|
||||
m_rtt = total_milliseconds(completed - m_connect);
|
||||
m_rtt = boost::uint16_t(total_milliseconds(completed - m_connect));
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
// add this RTT to the PRNG seed, to add more unpredictability
|
||||
|
|
|
@ -1510,7 +1510,7 @@ namespace libtorrent
|
|||
// make this scale by the number of peers we have. For large
|
||||
// scale clients, we would have more peers, and allow a higher
|
||||
// threshold for the number of partials
|
||||
if (m_downloads.size() > m_num_pad_files + num_peers * 3 / 2) options |= prioritize_partials;
|
||||
if (int(m_downloads.size()) > m_num_pad_files + num_peers * 3 / 2) options |= prioritize_partials;
|
||||
|
||||
if (options & ignore_whole_pieces) prefer_whole_pieces = 0;
|
||||
|
||||
|
@ -1552,8 +1552,8 @@ namespace libtorrent
|
|||
|
||||
if (!is_piece_free(i->index, pieces)) continue;
|
||||
if (m_piece_map[i->index].full
|
||||
&& backup_blocks.size() >= num_blocks
|
||||
&& backup_blocks2.size() >= num_blocks)
|
||||
&& int(backup_blocks.size()) >= num_blocks
|
||||
&& int(backup_blocks2.size()) >= num_blocks)
|
||||
continue;
|
||||
|
||||
num_blocks = add_blocks_downloading(*i, pieces
|
||||
|
|
|
@ -513,7 +513,7 @@ namespace libtorrent
|
|||
|
||||
p->disconnect(errors::banned_by_ip_filter);
|
||||
// what *i refers to has changed, i.e. cur was deleted
|
||||
if (m_peers.size() < count)
|
||||
if (int(m_peers.size()) < count)
|
||||
{
|
||||
i = m_peers.begin() + current;
|
||||
continue;
|
||||
|
|
|
@ -612,7 +612,7 @@ void feed::get_feed_status(feed_status* ret) const
|
|||
|
||||
int feed::next_update(time_t now) const
|
||||
{
|
||||
if (m_last_update == 0) return m_last_attempt + 60 * 5 - now;
|
||||
if (m_last_update == 0) return int(m_last_attempt + 60 * 5 - now);
|
||||
int ttl = m_ttl == -1 ? m_settings.default_ttl : m_ttl;
|
||||
TORRENT_ASSERT((m_last_update + ttl * 60) - now < INT_MAX);
|
||||
return int((m_last_update + ttl * 60) - now);
|
||||
|
|
|
@ -3105,11 +3105,11 @@ retry:
|
|||
, boost::bind(&peer_connection::refcount, _1) == 1);
|
||||
m_undead_peers.erase(i, m_undead_peers.end());
|
||||
|
||||
int tick_interval_ms = total_milliseconds(now - m_last_second_tick);
|
||||
int tick_interval_ms = int(total_milliseconds(now - m_last_second_tick));
|
||||
m_last_second_tick = now;
|
||||
m_tick_residual += tick_interval_ms - 1000;
|
||||
|
||||
int session_time = total_seconds(now - m_created);
|
||||
boost::int64_t session_time = total_seconds(now - m_created);
|
||||
if (session_time > 65000)
|
||||
{
|
||||
// we're getting close to the point where our timestamps
|
||||
|
@ -4411,7 +4411,7 @@ retry:
|
|||
{
|
||||
pi->optimistically_unchoked = true;
|
||||
++m_num_unchoked;
|
||||
pi->last_optimistically_unchoked = session_time();
|
||||
pi->last_optimistically_unchoked = boost::uint16_t(session_time());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5598,8 +5598,8 @@ retry:
|
|||
s.up_bandwidth_queue = m_upload_rate.queue_size();
|
||||
s.down_bandwidth_queue = m_download_rate.queue_size();
|
||||
|
||||
s.up_bandwidth_bytes_queue = m_upload_rate.queued_bytes();
|
||||
s.down_bandwidth_bytes_queue = m_download_rate.queued_bytes();
|
||||
s.up_bandwidth_bytes_queue = int(m_upload_rate.queued_bytes());
|
||||
s.down_bandwidth_bytes_queue = int(m_download_rate.queued_bytes());
|
||||
|
||||
s.disk_write_queue = m_disk_queues[peer_connection::download_channel];
|
||||
s.disk_read_queue = m_disk_queues[peer_connection::upload_channel];
|
||||
|
|
|
@ -1428,7 +1428,7 @@ ret:
|
|||
if (!m_allocate_files) mode |= file::sparse;
|
||||
|
||||
// files with priority 0 should always be sparse
|
||||
if (m_file_priority.size() > file_index && m_file_priority[file_index] == 0)
|
||||
if (int(m_file_priority.size()) > file_index && m_file_priority[file_index] == 0)
|
||||
mode |= file::sparse;
|
||||
|
||||
if (m_settings && settings().no_atime_storage) mode |= file::no_atime;
|
||||
|
|
|
@ -1454,7 +1454,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(m_torrent_file->num_files() > 0);
|
||||
TORRENT_ASSERT(m_torrent_file->total_size() >= 0);
|
||||
|
||||
if (m_file_priority.size() > m_torrent_file->num_files())
|
||||
if (int(m_file_priority.size()) > m_torrent_file->num_files())
|
||||
m_file_priority.resize(m_torrent_file->num_files());
|
||||
|
||||
std::string cert = m_torrent_file->ssl_cert();
|
||||
|
@ -1589,7 +1589,7 @@ namespace libtorrent
|
|||
if (fs.pad_file_at(i)) ++num_pad_files;
|
||||
|
||||
if (!fs.pad_file_at(i) || fs.file_size(i) == 0) continue;
|
||||
m_padding += fs.file_size(i);
|
||||
m_padding += boost::uint32_t(fs.file_size(i));
|
||||
|
||||
peer_request pr = m_torrent_file->map_file(i, 0, fs.file_size(i));
|
||||
int off = pr.start & (block_size()-1);
|
||||
|
|
|
@ -492,7 +492,7 @@ namespace libtorrent
|
|||
ec = error_code(errors::metadata_too_large, get_libtorrent_category());
|
||||
return -2;
|
||||
}
|
||||
v.resize(s);
|
||||
v.resize((unsigned int)s);
|
||||
if (s == 0) return 0;
|
||||
file::iovec_t b = {&v[0], size_t(s) };
|
||||
size_type read = f.readv(0, &b, 1, ec);
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace libtorrent
|
|||
if (m_completion_timeout > 0)
|
||||
{
|
||||
timeout = timeout == 0
|
||||
? m_completion_timeout - total_seconds(m_read_time - m_start_time)
|
||||
? int(m_completion_timeout - total_seconds(m_read_time - m_start_time))
|
||||
: (std::min)(int(m_completion_timeout - total_seconds(m_read_time - m_start_time)), timeout);
|
||||
}
|
||||
#if defined TORRENT_ASIO_DEBUGGING
|
||||
|
|
|
@ -330,7 +330,7 @@ namespace libtorrent
|
|||
if (ph->get_type() == ST_SYN)
|
||||
{
|
||||
// possible SYN flood. Just ignore
|
||||
if (m_utp_sockets.size() > m_sett.connections_limit * 2)
|
||||
if (int(m_utp_sockets.size()) > m_sett.connections_limit * 2)
|
||||
return false;
|
||||
|
||||
// UTP_LOGV("not found, new connection id:%d\n", m_new_connection);
|
||||
|
|
|
@ -350,9 +350,9 @@ namespace libtorrent
|
|||
// assume the web seed has a different copy of this specific file
|
||||
// than what we expect, and pretend not to have it.
|
||||
int fi = files[0].file_index;
|
||||
int first_piece = fs.file_offset(fi) / fs.piece_length();
|
||||
int first_piece = int(fs.file_offset(fi) / fs.piece_length());
|
||||
// one past last piece
|
||||
int end_piece = (fs.file_offset(fi) + fs.file_size(fi) + 1) / fs.piece_length();
|
||||
int end_piece = int((fs.file_offset(fi) + fs.file_size(fi) + 1) / fs.piece_length());
|
||||
for (int i = first_piece; i < end_piece; ++i)
|
||||
incoming_dont_have(i);
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ namespace libtorrent
|
|||
m_chunk_pos -= copy_size;
|
||||
}
|
||||
TORRENT_ASSERT(m_received_body <= range_end - range_start);
|
||||
TORRENT_ASSERT(int(m_piece.size()) <= front_request.length);
|
||||
TORRENT_ASSERT(m_piece.size() <= front_request.length);
|
||||
incoming_piece_fragment(copy_size);
|
||||
TORRENT_ASSERT(m_piece.size() == m_received_in_piece);
|
||||
}
|
||||
|
@ -902,10 +902,10 @@ namespace libtorrent
|
|||
m_file_requests.pop_front();
|
||||
size_type file_size = info.orig_files().file_size(file_index);
|
||||
TORRENT_ASSERT(m_block_pos < front_request.length);
|
||||
int pad_size = (std::min)(file_size, size_type(front_request.length - m_block_pos));
|
||||
int pad_size = int((std::min)(file_size, size_type(front_request.length - m_block_pos)));
|
||||
|
||||
// insert zeroes to represent the pad file
|
||||
m_piece.resize(m_piece.size() + pad_size, 0);
|
||||
m_piece.resize(m_piece.size() + size_t(pad_size), 0);
|
||||
m_block_pos += pad_size;
|
||||
incoming_piece_fragment(pad_size);
|
||||
|
||||
|
|
|
@ -613,17 +613,17 @@ setup_transfer(session* ses1, session* ses2, session* ses3
|
|||
}
|
||||
|
||||
session_settings sess_set = ses1->settings();
|
||||
update_settings(sess_set, ses3);
|
||||
update_settings(sess_set, ses3 != NULL);
|
||||
ses1->set_settings(sess_set);
|
||||
|
||||
sess_set = ses2->settings();
|
||||
update_settings(sess_set, ses3);
|
||||
update_settings(sess_set, ses3 != NULL);
|
||||
ses2->set_settings(sess_set);
|
||||
|
||||
if (ses3)
|
||||
{
|
||||
sess_set = ses3->settings();
|
||||
update_settings(sess_set, ses3);
|
||||
update_settings(sess_set, ses3 != NULL);
|
||||
ses3->set_settings(sess_set);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue