forked from premiere/premiere-libtorrent
fix some warnings
This commit is contained in:
parent
12136563c4
commit
a81ca2391b
|
@ -370,7 +370,7 @@ namespace libtorrent
|
|||
#else
|
||||
if (m_using_pool_allocator)
|
||||
{
|
||||
ret = (char*)m_pool.malloc();
|
||||
ret = static_cast<char*>(m_pool.malloc());
|
||||
int effective_block_size = m_cache_buffer_chunk_size
|
||||
? m_cache_buffer_chunk_size
|
||||
: (std::max)(m_max_use / 10, 1);
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace libtorrent
|
|||
disk_io_job* disk_job_pool::allocate_job(int type)
|
||||
{
|
||||
mutex::scoped_lock l(m_job_mutex);
|
||||
disk_io_job* ptr = (disk_io_job*)m_job_pool.malloc();
|
||||
disk_io_job* ptr = static_cast<disk_io_job*>(m_job_pool.malloc());
|
||||
m_job_pool.set_next_size(100);
|
||||
if (ptr == 0) return 0;
|
||||
++m_jobs_in_use;
|
||||
|
@ -61,7 +61,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(ptr);
|
||||
|
||||
new (ptr) disk_io_job;
|
||||
ptr->action = (disk_io_job::action_t)type;
|
||||
ptr->action = static_cast<disk_io_job::action_t>(type);
|
||||
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||
ptr->in_use = true;
|
||||
#endif
|
||||
|
|
|
@ -472,8 +472,8 @@ namespace libtorrent
|
|||
case dictionary_t:
|
||||
new (data) dictionary_type;
|
||||
break;
|
||||
default:
|
||||
TORRENT_ASSERT(t == undefined_t);
|
||||
case undefined_t:
|
||||
break;
|
||||
}
|
||||
m_type = t;
|
||||
#ifdef TORRENT_DEBUG
|
||||
|
@ -497,7 +497,7 @@ namespace libtorrent
|
|||
case dictionary_t:
|
||||
new (data) dictionary_type(e.dict());
|
||||
break;
|
||||
default:
|
||||
case undefined_t:
|
||||
TORRENT_ASSERT(e.type() == undefined_t);
|
||||
}
|
||||
m_type = e.type();
|
||||
|
@ -664,6 +664,7 @@ namespace libtorrent
|
|||
i->second.to_string_impl(out, indent+2);
|
||||
}
|
||||
} break;
|
||||
case undefined_t:
|
||||
default:
|
||||
out += "<uninitialized>\n";
|
||||
}
|
||||
|
|
|
@ -371,46 +371,46 @@ namespace libtorrent
|
|||
char* name = string_tokenize(next, '=', &next);
|
||||
if (name == 0) break;
|
||||
// fprintf(stderr, "name=\"%s\"\n", name);
|
||||
char* ptr = string_tokenize(next, ' ', &next);
|
||||
if (ptr == 0) { handle_error(invalid_response, h); return; }
|
||||
// fprintf(stderr, "value=\"%s\"\n", ptr);
|
||||
char* ptr2 = string_tokenize(next, ' ', &next);
|
||||
if (ptr2 == 0) { handle_error(invalid_response, h); return; }
|
||||
// fprintf(stderr, "value=\"%s\"\n", ptr2);
|
||||
|
||||
if (strcmp("RESULT", name) == 0)
|
||||
{
|
||||
if (strcmp("OK", ptr) == 0)
|
||||
if (strcmp("OK", ptr2) == 0)
|
||||
result = i2p_error::no_error;
|
||||
else if (strcmp("CANT_REACH_PEER", ptr) == 0)
|
||||
else if (strcmp("CANT_REACH_PEER", ptr2) == 0)
|
||||
result = i2p_error::cant_reach_peer;
|
||||
else if (strcmp("I2P_ERROR", ptr) == 0)
|
||||
else if (strcmp("I2P_ERROR", ptr2) == 0)
|
||||
result = i2p_error::i2p_error;
|
||||
else if (strcmp("INVALID_KEY", ptr) == 0)
|
||||
else if (strcmp("INVALID_KEY", ptr2) == 0)
|
||||
result = i2p_error::invalid_key;
|
||||
else if (strcmp("INVALID_ID", ptr) == 0)
|
||||
else if (strcmp("INVALID_ID", ptr2) == 0)
|
||||
result = i2p_error::invalid_id;
|
||||
else if (strcmp("TIMEOUT", ptr) == 0)
|
||||
else if (strcmp("TIMEOUT", ptr2) == 0)
|
||||
result = i2p_error::timeout;
|
||||
else if (strcmp("KEY_NOT_FOUND", ptr) == 0)
|
||||
else if (strcmp("KEY_NOT_FOUND", ptr2) == 0)
|
||||
result = i2p_error::key_not_found;
|
||||
else if (strcmp("DUPLICATED_ID", ptr) == 0)
|
||||
else if (strcmp("DUPLICATED_ID", ptr2) == 0)
|
||||
result = i2p_error::duplicated_id;
|
||||
else
|
||||
result = i2p_error::num_errors; // unknown error
|
||||
}
|
||||
else if (strcmp("MESSAGE", name) == 0)
|
||||
{
|
||||
// message = ptr;
|
||||
// message = ptr2;
|
||||
}
|
||||
else if (strcmp("VERSION", name) == 0)
|
||||
{
|
||||
// version = float(atof(ptr));
|
||||
// version = float(atof(ptr2));
|
||||
}
|
||||
else if (strcmp("VALUE", name) == 0)
|
||||
{
|
||||
m_name_lookup = ptr;
|
||||
m_name_lookup = ptr2;
|
||||
}
|
||||
else if (strcmp("DESTINATION", name) == 0)
|
||||
{
|
||||
m_dest = ptr;
|
||||
m_dest = ptr2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -380,7 +380,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
if (find_string(PID, "-BOW") && PID[7] == '-')
|
||||
return "Bits on Wheels " + std::string(PID + 4, (char const*)PID + 7);
|
||||
return "Bits on Wheels " + std::string(PID + 4, PID + 7);
|
||||
|
||||
if (find_string(PID, "eX"))
|
||||
{
|
||||
|
|
|
@ -398,7 +398,7 @@ namespace libtorrent { namespace dht
|
|||
|
||||
void add_node_fun(void* userdata, node_entry const& e)
|
||||
{
|
||||
entry* n = (entry*)userdata;
|
||||
entry* n = static_cast<entry*>(userdata);
|
||||
std::string node;
|
||||
std::back_insert_iterator<std::string> out(node);
|
||||
write_endpoint(e.ep(), out);
|
||||
|
@ -475,7 +475,7 @@ namespace libtorrent { namespace dht
|
|||
bencode(std::back_inserter(m_send_buf), e);
|
||||
error_code ec;
|
||||
|
||||
if (m_sock.send(addr, &m_send_buf[0], (int)m_send_buf.size(), ec, send_flags))
|
||||
if (m_sock.send(addr, &m_send_buf[0], int(m_send_buf.size()), ec, send_flags))
|
||||
{
|
||||
if (ec)
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace {
|
|||
|
||||
void add_entry_fun(void* userdata, node_entry const& e)
|
||||
{
|
||||
traversal_algorithm* f = (traversal_algorithm*)userdata;
|
||||
traversal_algorithm* f = static_cast<traversal_algorithm*>(userdata);
|
||||
f->add_entry(e.id, e.ep(), observer::flag_initial);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ void find_data::start()
|
|||
// if the user didn't add seed-nodes manually, grab a bunch of nodes from the
|
||||
// routing table
|
||||
if (m_results.empty())
|
||||
m_node.m_table.for_each_node(&add_entry_fun, 0, (traversal_algorithm*)this);
|
||||
m_node.m_table.for_each_node(&add_entry_fun, 0, this);
|
||||
|
||||
traversal_algorithm::start();
|
||||
}
|
||||
|
|
|
@ -167,7 +167,6 @@ namespace libtorrent
|
|||
case lazy_entry::int_t:
|
||||
case lazy_entry::string_t:
|
||||
case lazy_entry::none_t:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1435,16 +1435,16 @@ namespace libtorrent
|
|||
|
||||
if (is_disconnecting()) return;
|
||||
|
||||
std::vector<pending_block>::iterator i = std::find_if(
|
||||
std::vector<pending_block>::iterator dlq_iter = std::find_if(
|
||||
m_download_queue.begin(), m_download_queue.end()
|
||||
, boost::bind(match_request, boost::cref(r), boost::bind(&pending_block::block, _1)
|
||||
, t->block_size()));
|
||||
|
||||
if (i != m_download_queue.end())
|
||||
if (dlq_iter != m_download_queue.end())
|
||||
{
|
||||
pending_block b = *i;
|
||||
bool remove_from_picker = !i->timed_out && !i->not_wanted;
|
||||
m_download_queue.erase(i);
|
||||
pending_block b = *dlq_iter;
|
||||
bool remove_from_picker = !dlq_iter->timed_out && !dlq_iter->not_wanted;
|
||||
m_download_queue.erase(dlq_iter);
|
||||
TORRENT_ASSERT(m_outstanding_bytes >= r.length);
|
||||
m_outstanding_bytes -= r.length;
|
||||
if (m_outstanding_bytes < 0) m_outstanding_bytes = 0;
|
||||
|
@ -2855,13 +2855,13 @@ namespace libtorrent
|
|||
{
|
||||
// only make predictions if all remaining
|
||||
// blocks are requested from the same peer
|
||||
torrent_peer* p = (torrent_peer*)d[0];
|
||||
if (p->connection)
|
||||
torrent_peer* peer = static_cast<torrent_peer*>(d[0]);
|
||||
if (peer->connection)
|
||||
{
|
||||
// we have a connection. now, what is the current
|
||||
// download rate from this peer, and how many blocks
|
||||
// do we have left to download?
|
||||
boost::int64_t rate = p->connection->statistics().download_payload_rate();
|
||||
boost::int64_t rate = peer->connection->statistics().download_payload_rate();
|
||||
boost::int64_t bytes_left = boost::int64_t(st.requested) * t->block_size();
|
||||
// the settings unit is milliseconds, so calculate the
|
||||
// number of milliseconds worth of bytes left in the piece
|
||||
|
@ -2996,8 +2996,7 @@ namespace libtorrent
|
|||
i = q.begin(), end(q.end()); i != end; ++i)
|
||||
{
|
||||
if (i->index != block_finished.piece_index) continue;
|
||||
piece_picker::downloading_piece const& p = *i;
|
||||
piece_picker::block_info* info = picker.blocks_for_piece(p);
|
||||
piece_picker::block_info* info = picker.blocks_for_piece(*i);
|
||||
TORRENT_ASSERT(info[block_finished.block_index].state
|
||||
== piece_picker::block_info::state_finished);
|
||||
}
|
||||
|
@ -5814,7 +5813,7 @@ namespace libtorrent
|
|||
namespace {
|
||||
void session_free_buffer(char* buffer, void* userdata, block_cache_reference)
|
||||
{
|
||||
aux::session_interface* ses = (aux::session_interface*)userdata;
|
||||
aux::session_interface* ses = static_cast<aux::session_interface*>(userdata);
|
||||
ses->free_buffer(buffer);
|
||||
}
|
||||
}
|
||||
|
@ -6332,17 +6331,22 @@ namespace libtorrent
|
|||
|
||||
if (m_remote.address().is_v4() && m_settings.get_int(settings_pack::peer_tos) != 0)
|
||||
{
|
||||
error_code ec;
|
||||
m_socket->set_option(type_of_service(m_settings.get_int(settings_pack::peer_tos)), ec);
|
||||
error_code err;
|
||||
m_socket->set_option(type_of_service(m_settings.get_int(settings_pack::peer_tos)), err);
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
peer_log(peer_log_alert::outgoing, "SET_TOS", "tos: %d e: %s"
|
||||
, m_settings.get_int(settings_pack::peer_tos), ec.message().c_str());
|
||||
, m_settings.get_int(settings_pack::peer_tos), err.message().c_str());
|
||||
#endif
|
||||
}
|
||||
#if TORRENT_USE_IPV6 && defined IPV6_TCLASS
|
||||
else if (m_remote.address().is_v6() && m_settings.get_int(settings_pack::peer_tos) != 0)
|
||||
{
|
||||
m_socket->set_option(traffic_class(m_settings.get_int(settings_pack::peer_tos)), ec);
|
||||
error_code err;
|
||||
m_socket->set_option(traffic_class(m_settings.get_int(settings_pack::peer_tos)), err);
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
peer_log(peer_log_alert::outgoing, "SET_TOS", "tos: %d e: %s"
|
||||
, m_settings.get_int(settings_pack::peer_tos), err.message().c_str());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ namespace libtorrent
|
|||
{
|
||||
if (info[k].peer)
|
||||
{
|
||||
torrent_peer* p = (torrent_peer*)info[k].peer;
|
||||
torrent_peer* p = static_cast<torrent_peer*>(info[k].peer);
|
||||
TORRENT_ASSERT(p->in_use);
|
||||
TORRENT_ASSERT(p->connection == NULL
|
||||
|| static_cast<peer_connection*>(p->connection)->m_in_use);
|
||||
|
@ -481,7 +481,7 @@ namespace libtorrent
|
|||
for (int k = 0; k < m_blocks_per_piece; ++k)
|
||||
{
|
||||
if (!info[k].peer) continue;
|
||||
torrent_peer* p = (torrent_peer*)info[k].peer;
|
||||
torrent_peer* p = static_cast<torrent_peer*>(info[k].peer);
|
||||
TORRENT_ASSERT(p->in_use);
|
||||
TORRENT_ASSERT(p->connection == NULL
|
||||
|| static_cast<peer_connection*>(p->connection)->m_in_use);
|
||||
|
@ -2637,7 +2637,7 @@ get_out:
|
|||
, int options) const
|
||||
{
|
||||
TORRENT_ASSERT(piece >= 0);
|
||||
TORRENT_ASSERT(piece < (int)m_piece_map.size());
|
||||
TORRENT_ASSERT(piece < int(m_piece_map.size()));
|
||||
TORRENT_ASSERT(is_piece_free(piece, pieces));
|
||||
|
||||
// std::cout << "add_blocks(" << piece << ")" << std::endl;
|
||||
|
|
|
@ -4674,7 +4674,7 @@ retry:
|
|||
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
|
||||
hasher h;
|
||||
h.update("req2", 4);
|
||||
h.update((char*)&(*ih)[0], 20);
|
||||
h.update(ih->data(), 20);
|
||||
// this is SHA1("req2" + info-hash), used for
|
||||
// encrypted hand shakes
|
||||
m_obfuscated_torrents.insert(std::make_pair(h.final(), torrent_ptr));
|
||||
|
|
|
@ -155,7 +155,8 @@ namespace
|
|||
{
|
||||
m_torrent.session().disk_thread().async_read(&m_torrent.storage()
|
||||
, r, boost::bind(&smart_ban_plugin::on_read_ok_block
|
||||
, shared_from_this(), *i, i->second.peer->address(), _1), (void*)1);
|
||||
, shared_from_this(), *i, i->second.peer->address(), _1)
|
||||
, reinterpret_cast<void*>(1));
|
||||
m_block_hashes.erase(i++);
|
||||
}
|
||||
else
|
||||
|
@ -211,7 +212,8 @@ namespace
|
|||
// block read will have been deleted by the time it gets back to the network thread
|
||||
m_torrent.session().disk_thread().async_read(&m_torrent.storage(), r
|
||||
, boost::bind(&smart_ban_plugin::on_read_failed_block
|
||||
, shared_from_this(), pb, ((torrent_peer*)*i)->address(), _1), (void*)1
|
||||
, shared_from_this(), pb, static_cast<torrent_peer*>(*i)->address(), _1)
|
||||
, reinterpret_cast<void*>(1)
|
||||
, disk_io_job::force_copy);
|
||||
}
|
||||
|
||||
|
@ -244,7 +246,7 @@ namespace
|
|||
|
||||
hasher h;
|
||||
h.update(j->buffer.disk_block, j->d.io.buffer_size);
|
||||
h.update((char const*)&m_salt, sizeof(m_salt));
|
||||
h.update(reinterpret_cast<char const*>(&m_salt), sizeof(m_salt));
|
||||
|
||||
std::pair<peer_list::iterator, peer_list::iterator> range
|
||||
= m_torrent.find_peers(a);
|
||||
|
@ -325,7 +327,7 @@ namespace
|
|||
|
||||
hasher h;
|
||||
h.update(j->buffer.disk_block, j->d.io.buffer_size);
|
||||
h.update((char const*)&m_salt, sizeof(m_salt));
|
||||
h.update(reinterpret_cast<char const*>(&m_salt), sizeof(m_salt));
|
||||
sha1_hash ok_digest = h.final();
|
||||
|
||||
if (b.second.digest == ok_digest) return;
|
||||
|
|
|
@ -141,13 +141,13 @@ namespace libtorrent
|
|||
if (ip.is_v6())
|
||||
{
|
||||
address_v6::bytes_type b = ip.to_v6().to_bytes();
|
||||
h = hasher((char*)&b[0], b.size()).final();
|
||||
h = hasher(reinterpret_cast<char*>(&b[0]), b.size()).final();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
address_v4::bytes_type b = ip.to_v4().to_bytes();
|
||||
h = hasher((char*)&b[0], b.size()).final();
|
||||
h = hasher(reinterpret_cast<char*>(&b[0]), b.size()).final();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -223,20 +223,20 @@ namespace libtorrent
|
|||
{
|
||||
case 0: break;
|
||||
case socket_type_int_impl<tcp::socket>::value:
|
||||
new ((tcp::socket*)m_data) tcp::socket(m_io_service);
|
||||
new (reinterpret_cast<tcp::socket*>(m_data)) tcp::socket(m_io_service);
|
||||
break;
|
||||
case socket_type_int_impl<socks5_stream>::value:
|
||||
new ((socks5_stream*)m_data) socks5_stream(m_io_service);
|
||||
new (reinterpret_cast<socks5_stream*>(m_data)) socks5_stream(m_io_service);
|
||||
break;
|
||||
case socket_type_int_impl<http_stream>::value:
|
||||
new ((http_stream*)m_data) http_stream(m_io_service);
|
||||
new (reinterpret_cast<http_stream*>(m_data)) http_stream(m_io_service);
|
||||
break;
|
||||
case socket_type_int_impl<utp_stream>::value:
|
||||
new ((utp_stream*)m_data) utp_stream(m_io_service);
|
||||
new (reinterpret_cast<utp_stream*>(m_data)) utp_stream(m_io_service);
|
||||
break;
|
||||
#if TORRENT_USE_I2P
|
||||
case socket_type_int_impl<i2p_stream>::value:
|
||||
new ((i2p_stream*)m_data) i2p_stream(m_io_service);
|
||||
new (reinterpret_cast<i2p_stream*>(m_data)) i2p_stream(m_io_service);
|
||||
break;
|
||||
#endif
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
|
|
|
@ -1628,7 +1628,7 @@ namespace libtorrent
|
|||
int ret = 0;
|
||||
while (m_blocked_jobs.size())
|
||||
{
|
||||
disk_io_job *bj = (disk_io_job*)m_blocked_jobs.pop_front();
|
||||
disk_io_job *bj = static_cast<disk_io_job*>(m_blocked_jobs.pop_front());
|
||||
if (bj->flags & disk_io_job::fence)
|
||||
{
|
||||
// we encountered another fence. We cannot post anymore
|
||||
|
@ -1679,7 +1679,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(m_blocked_jobs.size() > 0);
|
||||
|
||||
// this is the fence job
|
||||
disk_io_job *bj = (disk_io_job*)m_blocked_jobs.pop_front();
|
||||
disk_io_job *bj = static_cast<disk_io_job*>(m_blocked_jobs.pop_front());
|
||||
TORRENT_ASSERT(bj->flags & disk_io_job::fence);
|
||||
|
||||
TORRENT_ASSERT((bj->flags & disk_io_job::in_progress) == 0);
|
||||
|
|
|
@ -635,7 +635,7 @@ namespace libtorrent
|
|||
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
|
||||
hasher h;
|
||||
h.update("req2", 4);
|
||||
h.update((char*)&m_torrent_file->info_hash()[0], 20);
|
||||
h.update(m_torrent_file->info_hash().data(), 20);
|
||||
m_ses.add_obfuscated_hash(h.final(), shared_from_this());
|
||||
#endif
|
||||
|
||||
|
@ -810,7 +810,8 @@ namespace libtorrent
|
|||
debug_log("resume data rejected: %s pos: %d", ec.message().c_str(), pos);
|
||||
#endif
|
||||
if (m_ses.alerts().should_post<fastresume_rejected_alert>())
|
||||
m_ses.alerts().emplace_alert<fastresume_rejected_alert>(get_handle(), ec, "", (char const*)0);
|
||||
m_ses.alerts().emplace_alert<fastresume_rejected_alert>(get_handle()
|
||||
, ec, "", static_cast<char const*>(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1006,8 +1007,9 @@ namespace libtorrent
|
|||
{
|
||||
r.length = (std::min)(piece_size - r.start, block_size());
|
||||
inc_refcount("read_piece");
|
||||
m_ses.disk_thread().async_read(&storage(), r, boost::bind(&torrent::on_disk_read_complete
|
||||
, shared_from_this(), _1, r, rp), (void*)1);
|
||||
m_ses.disk_thread().async_read(&storage(), r
|
||||
, boost::bind(&torrent::on_disk_read_complete
|
||||
, shared_from_this(), _1, r, rp), reinterpret_cast<void*>(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1018,7 +1020,7 @@ namespace libtorrent
|
|||
, end(m_connections.end()); i != end; ++i)
|
||||
{
|
||||
if ((*i)->type() != peer_connection::bittorrent_connection) continue;
|
||||
bt_peer_connection* p = (bt_peer_connection*)*i;
|
||||
bt_peer_connection* p = static_cast<bt_peer_connection*>(*i);
|
||||
p->write_share_mode();
|
||||
}
|
||||
#endif
|
||||
|
@ -1037,7 +1039,7 @@ namespace libtorrent
|
|||
// since the call to disconnect_if_redundant() may
|
||||
// delete the entry from this container, make sure
|
||||
// to increment the iterator early
|
||||
bt_peer_connection* p = (bt_peer_connection*)*i;
|
||||
bt_peer_connection* p = static_cast<bt_peer_connection*>(*i);
|
||||
if (p->type() == peer_connection::bittorrent_connection)
|
||||
{
|
||||
boost::shared_ptr<peer_connection> me(p->self());
|
||||
|
@ -1747,7 +1749,7 @@ namespace libtorrent
|
|||
}
|
||||
params.path = m_save_path;
|
||||
params.pool = &m_ses.disk_thread().files();
|
||||
params.mode = (storage_mode_t)m_storage_mode;
|
||||
params.mode = static_cast<storage_mode_t>(m_storage_mode);
|
||||
params.priorities = &m_file_priority;
|
||||
params.info = m_torrent_file.get();
|
||||
|
||||
|
@ -1757,7 +1759,8 @@ namespace libtorrent
|
|||
// the shared_from_this() will create an intentional
|
||||
// cycle of ownership, se the hpp file for description.
|
||||
m_storage = boost::make_shared<piece_manager>(
|
||||
storage_impl, shared_from_this(), (file_storage*)&m_torrent_file->files());
|
||||
storage_impl, shared_from_this()
|
||||
, const_cast<file_storage*>(&m_torrent_file->files()));
|
||||
}
|
||||
|
||||
peer_connection* torrent::find_lowest_ranking_peer() const
|
||||
|
@ -1839,7 +1842,8 @@ namespace libtorrent
|
|||
if (ev && m_ses.alerts().should_post<fastresume_rejected_alert>())
|
||||
{
|
||||
error_code ec = error_code(ev, get_libtorrent_category());
|
||||
m_ses.alerts().emplace_alert<fastresume_rejected_alert>(get_handle(), ec, "", (char const*)0);
|
||||
m_ses.alerts().emplace_alert<fastresume_rejected_alert>(get_handle()
|
||||
, ec, "", static_cast<char const*>(0));
|
||||
}
|
||||
|
||||
if (ev)
|
||||
|
@ -2232,11 +2236,11 @@ namespace libtorrent
|
|||
for (const_peer_iterator i = m_connections.begin(); i != m_connections.end(); ++i)
|
||||
{
|
||||
if ((*i)->type() != peer_connection::bittorrent_connection) continue;
|
||||
bt_peer_connection* p = (bt_peer_connection*)(*i);
|
||||
bt_peer_connection* p = static_cast<bt_peer_connection*>(*i);
|
||||
if (!p->supports_holepunch()) continue;
|
||||
peer_plugin const* pp = p->find_plugin("ut_pex");
|
||||
if (!pp) continue;
|
||||
if (was_introduced_by(pp, ep)) return (bt_peer_connection*)p;
|
||||
if (was_introduced_by(pp, ep)) return p;
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
|
@ -2248,7 +2252,7 @@ namespace libtorrent
|
|||
{
|
||||
peer_connection* p = *i;
|
||||
if (p->type() != peer_connection::bittorrent_connection) continue;
|
||||
if (p->remote() == ep) return (bt_peer_connection*)p;
|
||||
if (p->remote() == ep) return static_cast<bt_peer_connection*>(p);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2362,7 +2366,7 @@ namespace libtorrent
|
|||
int port = e.dict_find_int_value("port");
|
||||
if (ip.empty() || port == 0) continue;
|
||||
error_code ec;
|
||||
tcp::endpoint a(address::from_string(ip, ec), (unsigned short)port);
|
||||
tcp::endpoint a(address::from_string(ip, ec), boost::uint16_t(port));
|
||||
if (ec) continue;
|
||||
add_peer(a, peer_info::resume_data);
|
||||
}
|
||||
|
@ -2380,7 +2384,8 @@ namespace libtorrent
|
|||
int port = e.dict_find_int_value("port");
|
||||
if (ip.empty() || port == 0) continue;
|
||||
error_code ec;
|
||||
tcp::endpoint a(address::from_string(ip, ec), (unsigned short)port);
|
||||
tcp::endpoint a(address::from_string(ip, ec)
|
||||
, boost::uint16_t(port));
|
||||
if (ec) continue;
|
||||
torrent_peer* p = add_peer(a, peer_info::resume_data);
|
||||
if (p) ban_peer(p);
|
||||
|
@ -2498,7 +2503,7 @@ namespace libtorrent
|
|||
if (int(bitmask.size()) != num_bitmask_bytes) continue;
|
||||
for (int k = 0; k < num_bitmask_bytes; ++k)
|
||||
{
|
||||
const unsigned char bits = (unsigned char)bitmask[k];
|
||||
const boost::uint8_t bits = boost::uint8_t(bitmask[k]);
|
||||
int num_bits = (std::min)(num_blocks_per_piece - k*8, 8);
|
||||
for (int b = 0; b < num_bits; ++b)
|
||||
{
|
||||
|
@ -4249,7 +4254,7 @@ namespace libtorrent
|
|||
// significant operations, but we should use them right away
|
||||
// ignore NULL pointers
|
||||
std::remove_copy(downloaders.begin(), downloaders.end()
|
||||
, std::inserter(peers, peers.begin()), (torrent_peer*)0);
|
||||
, std::inserter(peers, peers.begin()), static_cast<torrent_peer*>(0));
|
||||
|
||||
for (std::set<void*>::iterator i = peers.begin()
|
||||
, end(peers.end()); i != end; ++i)
|
||||
|
|
|
@ -103,8 +103,8 @@ namespace libtorrent
|
|||
tmp_path.reserve(target.size()+5);
|
||||
bool valid_encoding = true;
|
||||
|
||||
UTF8 const* ptr = (UTF8 const*)&target[0];
|
||||
UTF8 const* end = (UTF8 const*)&target[0] + target.size();
|
||||
UTF8 const* ptr = reinterpret_cast<UTF8 const*>(&target[0]);
|
||||
UTF8 const* end = ptr + target.size();
|
||||
while (ptr < end)
|
||||
{
|
||||
UTF32 codepoint;
|
||||
|
@ -154,11 +154,11 @@ namespace libtorrent
|
|||
cp = &codepoint;
|
||||
UTF8 sequence[5];
|
||||
UTF8* start = sequence;
|
||||
res = ConvertUTF32toUTF8((const UTF32**)&cp, cp + 1, &start, start + 5, lenientConversion);
|
||||
res = ConvertUTF32toUTF8(const_cast<const UTF32**>(&cp), cp + 1, &start, start + 5, lenientConversion);
|
||||
TORRENT_ASSERT(res == conversionOK);
|
||||
|
||||
for (int i = 0; i < start - sequence; ++i)
|
||||
tmp_path += (char)sequence[i];
|
||||
tmp_path += char(sequence[i]);
|
||||
}
|
||||
|
||||
// the encoding was not valid utf-8
|
||||
|
|
Loading…
Reference in New Issue