forked from premiere/premiere-libtorrent
fix build from RC_1_1 merge
This commit is contained in:
parent
3ffa3f2a08
commit
a670871519
|
@ -1194,7 +1194,7 @@ namespace libtorrent
|
||||||
// this keeps the timers more accurate over time
|
// this keeps the timers more accurate over time
|
||||||
// as a kind of "leap second" to adjust for the
|
// as a kind of "leap second" to adjust for the
|
||||||
// accumulated error
|
// accumulated error
|
||||||
std::uint16_t m_tick_residual = 0;
|
std::int16_t m_tick_residual = 0;
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
virtual bool should_log() const override;
|
virtual bool should_log() const override;
|
||||||
|
|
|
@ -80,8 +80,8 @@ namespace libtorrent
|
||||||
|| std::is_enum<In>::value>::type>
|
|| std::is_enum<In>::value>::type>
|
||||||
inline void write_impl(In data, OutIt& start)
|
inline void write_impl(In data, OutIt& start)
|
||||||
{
|
{
|
||||||
T val = T(data);
|
T val = static_cast<T>(data);
|
||||||
TORRENT_ASSERT(data == In(val));
|
TORRENT_ASSERT(data == static_cast<In>(val));
|
||||||
for (int i = int(sizeof(T)) - 1; i >= 0; --i)
|
for (int i = int(sizeof(T)) - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
*start = static_cast<unsigned char>((val >> (i * 8)) & 0xff);
|
*start = static_cast<unsigned char>((val >> (i * 8)) & 0xff);
|
||||||
|
@ -89,6 +89,10 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T, class OutIt>
|
||||||
|
inline void write_impl(bool val, OutIt& start)
|
||||||
|
{ write_impl<std::uint8_t>(val ? 1 : 0, start); }
|
||||||
|
|
||||||
// -- adaptors
|
// -- adaptors
|
||||||
|
|
||||||
template <class InIt>
|
template <class InIt>
|
||||||
|
|
|
@ -1189,7 +1189,7 @@ namespace libtorrent
|
||||||
// processes.
|
// processes.
|
||||||
file_checks_delay_per_block,
|
file_checks_delay_per_block,
|
||||||
#else
|
#else
|
||||||
deprecated14,
|
deprecated23,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ``read_cache_line_size`` is the number of blocks to read into the
|
// ``read_cache_line_size`` is the number of blocks to read into the
|
||||||
|
|
|
@ -81,8 +81,8 @@ namespace libtorrent
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rc4_init(const unsigned char* in, unsigned long len, rc4 *state);
|
void rc4_init(const unsigned char* in, std::size_t len, rc4 *state);
|
||||||
unsigned long rc4_encrypt(unsigned char *out, unsigned long outlen, rc4 *state);
|
std::size_t rc4_encrypt(unsigned char *out, std::size_t outlen, rc4 *state);
|
||||||
|
|
||||||
// Set the prime P and the generator, generate local public key
|
// Set the prime P and the generator, generate local public key
|
||||||
dh_key_exchange::dh_key_exchange()
|
dh_key_exchange::dh_key_exchange()
|
||||||
|
@ -349,9 +349,9 @@ namespace libtorrent
|
||||||
// this library is public domain and has been specially
|
// this library is public domain and has been specially
|
||||||
// tailored for libtorrent by Arvid Norberg
|
// tailored for libtorrent by Arvid Norberg
|
||||||
|
|
||||||
void rc4_init(const unsigned char* in, unsigned long len, rc4 *state)
|
void rc4_init(const unsigned char* in, std::size_t len, rc4 *state)
|
||||||
{
|
{
|
||||||
size_t const key_size = sizeof(state->buf);
|
std::size_t const key_size = sizeof(state->buf);
|
||||||
aux::array<std::uint8_t, key_size> key;
|
aux::array<std::uint8_t, key_size> key;
|
||||||
std::uint8_t tmp, *s;
|
std::uint8_t tmp, *s;
|
||||||
int keylen, x, y, j;
|
int keylen, x, y, j;
|
||||||
|
@ -386,10 +386,10 @@ void rc4_init(const unsigned char* in, unsigned long len, rc4 *state)
|
||||||
state->y = 0;
|
state->y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long rc4_encrypt(unsigned char *out, unsigned long outlen, rc4 *state)
|
std::size_t rc4_encrypt(unsigned char *out, std::size_t outlen, rc4 *state)
|
||||||
{
|
{
|
||||||
std::uint8_t x, y, *s, tmp;
|
std::uint8_t x, y, *s, tmp;
|
||||||
unsigned long n;
|
std::size_t n;
|
||||||
|
|
||||||
TORRENT_ASSERT(out != nullptr);
|
TORRENT_ASSERT(out != nullptr);
|
||||||
TORRENT_ASSERT(state != nullptr);
|
TORRENT_ASSERT(state != nullptr);
|
||||||
|
|
|
@ -861,10 +861,10 @@ namespace libtorrent
|
||||||
return;
|
return;
|
||||||
m_fast_reconnect = r;
|
m_fast_reconnect = r;
|
||||||
peer_info_struct()->last_connected = std::uint16_t(m_ses.session_time());
|
peer_info_struct()->last_connected = std::uint16_t(m_ses.session_time());
|
||||||
int rewind = m_settings.get_int(settings_pack::min_reconnect_time)
|
int const rewind = m_settings.get_int(settings_pack::min_reconnect_time)
|
||||||
* m_settings.get_int(settings_pack::max_failcount);
|
* m_settings.get_int(settings_pack::max_failcount);
|
||||||
if (peer_info_struct()->last_connected < rewind) peer_info_struct()->last_connected = 0;
|
if (int(peer_info_struct()->last_connected) < rewind) peer_info_struct()->last_connected = 0;
|
||||||
else peer_info_struct()->last_connected -= rewind;
|
else peer_info_struct()->last_connected -= std::uint16_t(rewind);
|
||||||
|
|
||||||
if (peer_info_struct()->fast_reconnects < 15)
|
if (peer_info_struct()->fast_reconnects < 15)
|
||||||
++peer_info_struct()->fast_reconnects;
|
++peer_info_struct()->fast_reconnects;
|
||||||
|
|
|
@ -3155,9 +3155,10 @@ namespace aux {
|
||||||
m_ssl_utp_socket_manager.decay();
|
m_ssl_utp_socket_manager.decay();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int tick_interval_ms = int(total_milliseconds(now - m_last_second_tick));
|
int const tick_interval_ms = aux::numeric_cast<int>(total_milliseconds(now - m_last_second_tick));
|
||||||
m_last_second_tick = now;
|
m_last_second_tick = now;
|
||||||
m_tick_residual += tick_interval_ms - 1000;
|
m_tick_residual = aux::numeric_cast<std::int16_t>(m_tick_residual + tick_interval_ms - 1000);
|
||||||
|
TORRENT_ASSERT(m_tick_residual >= 0);
|
||||||
|
|
||||||
std::int32_t const stime = session_time();
|
std::int32_t const stime = session_time();
|
||||||
if (stime > 65000)
|
if (stime > 65000)
|
||||||
|
|
|
@ -523,7 +523,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(new_gauge_state >= 0);
|
TORRENT_ASSERT(new_gauge_state >= 0);
|
||||||
TORRENT_ASSERT(new_gauge_state <= no_gauge_state);
|
TORRENT_ASSERT(new_gauge_state <= no_gauge_state);
|
||||||
|
|
||||||
if (new_gauge_state == m_current_gauge_state) return;
|
if (new_gauge_state == int(m_current_gauge_state)) return;
|
||||||
|
|
||||||
if (m_current_gauge_state != no_gauge_state)
|
if (m_current_gauge_state != no_gauge_state)
|
||||||
inc_stats_counter(m_current_gauge_state + counters::num_checking_torrents, -1);
|
inc_stats_counter(m_current_gauge_state + counters::num_checking_torrents, -1);
|
||||||
|
@ -2919,14 +2919,14 @@ namespace libtorrent
|
||||||
downloaded = (std::max)(t.scrape_downloaded, downloaded);
|
downloaded = (std::max)(t.scrape_downloaded, downloaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((complete >= 0 && m_complete != complete)
|
if ((complete >= 0 && int(m_complete) != complete)
|
||||||
|| (incomplete >= 0 && m_incomplete != incomplete)
|
|| (incomplete >= 0 && int(m_incomplete) != incomplete)
|
||||||
|| (downloaded >= 0 && m_downloaded != downloaded))
|
|| (downloaded >= 0 && int(m_downloaded) != downloaded))
|
||||||
state_updated();
|
state_updated();
|
||||||
|
|
||||||
if (m_complete != complete
|
if (int(m_complete) != complete
|
||||||
|| m_incomplete != incomplete
|
|| int(m_incomplete) != incomplete
|
||||||
|| m_downloaded != downloaded)
|
|| int(m_downloaded) != downloaded)
|
||||||
{
|
{
|
||||||
m_complete = std::uint32_t(complete);
|
m_complete = std::uint32_t(complete);
|
||||||
m_incomplete = std::uint32_t(incomplete);
|
m_incomplete = std::uint32_t(incomplete);
|
||||||
|
@ -3419,7 +3419,7 @@ namespace libtorrent
|
||||||
|
|
||||||
std::vector<file_slice> files = fs.map_block(
|
std::vector<file_slice> files = fs.map_block(
|
||||||
p.piece_index, offset, (std::min)(piece_size - offset, block_size()));
|
p.piece_index, offset, (std::min)(piece_size - offset, block_size()));
|
||||||
int ret = 0;
|
std::int64_t ret = 0;
|
||||||
for (std::vector<file_slice>::iterator i = files.begin()
|
for (std::vector<file_slice>::iterator i = files.begin()
|
||||||
, end(files.end()); i != end; ++i)
|
, end(files.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
|
@ -3427,7 +3427,7 @@ namespace libtorrent
|
||||||
ret += i->size;
|
ret += i->size;
|
||||||
}
|
}
|
||||||
TORRENT_ASSERT(ret <= (std::min)(piece_size - offset, block_size()));
|
TORRENT_ASSERT(ret <= (std::min)(piece_size - offset, block_size()));
|
||||||
return ret;
|
return aux::numeric_cast<int>(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fills in total_wanted, total_wanted_done and total_done
|
// fills in total_wanted, total_wanted_done and total_done
|
||||||
|
@ -5385,8 +5385,8 @@ namespace libtorrent
|
||||||
|
|
||||||
TORRENT_ASSERT(pp->prev_amount_upload == 0);
|
TORRENT_ASSERT(pp->prev_amount_upload == 0);
|
||||||
TORRENT_ASSERT(pp->prev_amount_download == 0);
|
TORRENT_ASSERT(pp->prev_amount_download == 0);
|
||||||
pp->prev_amount_download += p->statistics().total_payload_download() >> 10;
|
pp->prev_amount_download += aux::numeric_cast<std::uint32_t>(p->statistics().total_payload_download() >> 10);
|
||||||
pp->prev_amount_upload += p->statistics().total_payload_upload() >> 10;
|
pp->prev_amount_upload += aux::numeric_cast<std::uint32_t>(p->statistics().total_payload_upload() >> 10);
|
||||||
|
|
||||||
if (pp->seed)
|
if (pp->seed)
|
||||||
{
|
{
|
||||||
|
@ -7997,7 +7997,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
TORRENT_ASSERT(limit >= -1);
|
TORRENT_ASSERT(limit >= -1);
|
||||||
if (limit <= 0) limit = (1 << 24) - 1;
|
if (limit <= 0) limit = (1 << 24) - 1;
|
||||||
if (m_max_uploads != limit && state_update) state_updated();
|
if (int(m_max_uploads)!= limit && state_update) state_updated();
|
||||||
m_max_uploads = aux::numeric_cast<std::uint32_t>(limit);
|
m_max_uploads = aux::numeric_cast<std::uint32_t>(limit);
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
debug_log("*** set-max-uploads: %d", m_max_uploads);
|
debug_log("*** set-max-uploads: %d", m_max_uploads);
|
||||||
|
@ -8012,7 +8012,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
TORRENT_ASSERT(limit >= -1);
|
TORRENT_ASSERT(limit >= -1);
|
||||||
if (limit <= 0) limit = (1 << 24) - 1;
|
if (limit <= 0) limit = (1 << 24) - 1;
|
||||||
if (m_max_connections != limit && state_update) state_updated();
|
if (int(m_max_connections) != limit && state_update) state_updated();
|
||||||
m_max_connections = aux::numeric_cast<std::uint32_t>(limit);
|
m_max_connections = aux::numeric_cast<std::uint32_t>(limit);
|
||||||
update_want_peers();
|
update_want_peers();
|
||||||
|
|
||||||
|
@ -9421,7 +9421,7 @@ namespace libtorrent
|
||||||
|
|
||||||
// only allow a single additional request per block, in order
|
// only allow a single additional request per block, in order
|
||||||
// to spread it out evenly across all stalled blocks
|
// to spread it out evenly across all stalled blocks
|
||||||
if (info[k].num_peers > timed_out)
|
if (int(info[k].num_peers) > timed_out)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
busy_blocks[busy_count].peers = info[k].num_peers;
|
busy_blocks[busy_count].peers = info[k].num_peers;
|
||||||
|
|
Loading…
Reference in New Issue