mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-16 15:12:30 +00:00
C++11 compatibility fixes.
This commit is contained in:
@@ -82,7 +82,7 @@ CurlGet::start() {
|
||||
|
||||
// Normally libcurl should handle the timeout. But sometimes that doesn't
|
||||
// work right so we do a fallback timeout that just aborts the transfer.
|
||||
m_taskTimeout.slot() = std::tr1::bind(&CurlGet::receive_timeout, this);
|
||||
m_taskTimeout.slot() = std::bind(&CurlGet::receive_timeout, this);
|
||||
priority_queue_erase(&taskScheduler, &m_taskTimeout);
|
||||
priority_queue_insert(&taskScheduler, &m_taskTimeout, cachedTime + rak::timer::from_seconds(m_timeout + 5));
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ CurlStack::CurlStack() :
|
||||
m_ssl_verify_peer(true),
|
||||
m_dns_timeout(60) {
|
||||
|
||||
m_taskTimeout.slot() = std::tr1::bind(&CurlStack::receive_timeout, this);
|
||||
m_taskTimeout.slot() = std::bind(&CurlStack::receive_timeout, this);
|
||||
|
||||
#if (LIBCURL_VERSION_NUM >= 0x071000)
|
||||
curl_multi_setopt((CURLM*)m_handle, CURLMOPT_TIMERDATA, this);
|
||||
|
||||
@@ -114,7 +114,7 @@ DhtManager::start_dht() {
|
||||
torrent::dht_manager()->start(port);
|
||||
torrent::dht_manager()->reset_statistics();
|
||||
|
||||
m_updateTimeout.slot() = std::tr1::bind(&DhtManager::update, this);
|
||||
m_updateTimeout.slot() = std::bind(&DhtManager::update, this);
|
||||
priority_queue_insert(&taskScheduler, &m_updateTimeout, (cachedTime + rak::timer::from_seconds(60)).round_seconds());
|
||||
|
||||
m_dhtPrevCycle = 0;
|
||||
@@ -197,7 +197,7 @@ DhtManager::update() {
|
||||
break;
|
||||
|
||||
if (itr == end) {
|
||||
m_stopTimeout.slot() = std::tr1::bind(&DhtManager::stop_dht, this);
|
||||
m_stopTimeout.slot() = std::bind(&DhtManager::stop_dht, this);
|
||||
priority_queue_insert(&taskScheduler, &m_stopTimeout, (cachedTime + rak::timer::from_seconds(15 * 60)).round_seconds());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ Download::Download(download_type d) :
|
||||
m_resumeFlags(~uint32_t()),
|
||||
m_group(0) {
|
||||
|
||||
m_download.info()->signal_tracker_success().push_back(tr1::bind(&Download::receive_tracker_msg, this, ""));
|
||||
m_download.info()->signal_tracker_failed().push_back(tr1::bind(&Download::receive_tracker_msg, this, tr1::placeholders::_1));
|
||||
m_download.info()->signal_tracker_success().push_back(std::bind(&Download::receive_tracker_msg, this, ""));
|
||||
m_download.info()->signal_tracker_failed().push_back(std::bind(&Download::receive_tracker_msg, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
Download::~Download() {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <rak/path.h>
|
||||
#include <tr1/functional>
|
||||
#include lt_tr1_functional
|
||||
#include <torrent/utils/log.h>
|
||||
#include <torrent/utils/resume.h>
|
||||
#include <torrent/object.h>
|
||||
@@ -107,8 +107,8 @@ DownloadFactory::DownloadFactory(Manager* m) :
|
||||
m_printLog(true),
|
||||
m_isFile(false) {
|
||||
|
||||
m_taskLoad.slot() = std::tr1::bind(&DownloadFactory::receive_load, this);
|
||||
m_taskCommit.slot() = std::tr1::bind(&DownloadFactory::receive_commit, this);
|
||||
m_taskLoad.slot() = std::bind(&DownloadFactory::receive_load, this);
|
||||
m_taskCommit.slot() = std::bind(&DownloadFactory::receive_commit, this);
|
||||
|
||||
// m_variables["connection_leech"] = rpc::call_command("protocol.connection.leech");
|
||||
// m_variables["connection_seed"] = rpc::call_command("protocol.connection.seed");
|
||||
@@ -158,8 +158,8 @@ DownloadFactory::receive_load() {
|
||||
m_stream = new std::stringstream;
|
||||
HttpQueue::iterator itr = m_manager->http_queue()->insert(m_uri, m_stream);
|
||||
|
||||
(*itr)->signal_done().push_front(std::tr1::bind(&DownloadFactory::receive_loaded, this));
|
||||
(*itr)->signal_failed().push_front(std::tr1::bind(&DownloadFactory::receive_failed, this, std::tr1::placeholders::_1));
|
||||
(*itr)->signal_done().push_front(std::bind(&DownloadFactory::receive_loaded, this));
|
||||
(*itr)->signal_failed().push_front(std::bind(&DownloadFactory::receive_failed, this, std::placeholders::_1));
|
||||
|
||||
m_variables["tied_to_file"] = (int64_t)false;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <iosfwd>
|
||||
#include <rak/priority_queue_default.h>
|
||||
#include <torrent/object.h>
|
||||
#include <tr1/functional>
|
||||
#include lt_tr1_functional
|
||||
|
||||
#include "http_queue.h"
|
||||
|
||||
@@ -54,7 +54,7 @@ class Manager;
|
||||
|
||||
class DownloadFactory {
|
||||
public:
|
||||
typedef std::tr1::function<void ()> slot_void;
|
||||
typedef std::function<void ()> slot_void;
|
||||
typedef std::vector<std::string> command_list_type;
|
||||
|
||||
// Do not destroy this object while it is in a HttpQueue.
|
||||
|
||||
@@ -180,8 +180,8 @@ DownloadList::insert(Download* download) {
|
||||
lt_log_print_info(torrent::LOG_TORRENT_INFO, download->info(), "download_list", "Inserting download.");
|
||||
|
||||
try {
|
||||
(*itr)->data()->slot_initial_hash() = tr1::bind(&DownloadList::hash_done, this, download);
|
||||
(*itr)->data()->slot_download_done() = tr1::bind(&DownloadList::received_finished, this, download);
|
||||
(*itr)->data()->slot_initial_hash() = std::bind(&DownloadList::hash_done, this, download);
|
||||
(*itr)->data()->slot_download_done() = std::bind(&DownloadList::received_finished, this, download);
|
||||
|
||||
// This needs to be separated into two different calls to ensure
|
||||
// the download remains in the view.
|
||||
|
||||
@@ -39,15 +39,15 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <tr1/functional>
|
||||
#include lt_tr1_functional
|
||||
|
||||
#include "download.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class DownloadSlotMap : public std::map<std::string, std::tr1::function<void (Download*)> > {
|
||||
class DownloadSlotMap : public std::map<std::string, std::function<void (Download*)> > {
|
||||
public:
|
||||
typedef std::tr1::function<void (Download*)> slot_download;
|
||||
typedef std::function<void (Download*)> slot_download;
|
||||
typedef std::map<std::string, slot_download> Base;
|
||||
|
||||
void insert(const std::string& key, slot_download s) { Base::operator[](key) = s; }
|
||||
|
||||
@@ -56,8 +56,8 @@ HttpQueue::insert(const std::string& url, std::iostream* s) {
|
||||
|
||||
iterator signal_itr = base_type::insert(end(), h.get());
|
||||
|
||||
h->signal_done().push_back(std::tr1::bind(&HttpQueue::erase, this, signal_itr));
|
||||
h->signal_failed().push_back(std::tr1::bind(&HttpQueue::erase, this, signal_itr));
|
||||
h->signal_done().push_back(std::bind(&HttpQueue::erase, this, signal_itr));
|
||||
h->signal_failed().push_back(std::bind(&HttpQueue::erase, this, signal_itr));
|
||||
|
||||
(*signal_itr)->start();
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <list>
|
||||
#include <iosfwd>
|
||||
#include <tr1/functional>
|
||||
#include lt_tr1_functional
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -48,8 +48,8 @@ class CurlGet;
|
||||
class HttpQueue : private std::list<CurlGet*> {
|
||||
public:
|
||||
typedef std::list<CurlGet*> base_type;
|
||||
typedef std::tr1::function<CurlGet* ()> slot_factory;
|
||||
typedef std::tr1::function<void (CurlGet*)> slot_curl_get;
|
||||
typedef std::function<CurlGet* ()> slot_factory;
|
||||
typedef std::function<void (CurlGet*)> slot_curl_get;
|
||||
typedef std::list<slot_curl_get> signal_curl_get;
|
||||
|
||||
using base_type::iterator;
|
||||
|
||||
+11
-6
@@ -74,6 +74,11 @@
|
||||
|
||||
namespace core {
|
||||
|
||||
const int Manager::create_start;
|
||||
const int Manager::create_tied;
|
||||
const int Manager::create_quiet;
|
||||
const int Manager::create_raw_data;
|
||||
|
||||
void
|
||||
Manager::push_log(const char* msg) {
|
||||
m_log_important->lock_and_push_log(msg, strlen(msg), 0);
|
||||
@@ -113,7 +118,7 @@ Manager::set_hashing_view(View* v) {
|
||||
throw torrent::internal_error("Manager::set_hashing_view(...) received NULL or is already set.");
|
||||
|
||||
m_hashingView = v;
|
||||
m_hashingView->signal_changed().push_back(std::tr1::bind(&Manager::receive_hashing_changed, this));
|
||||
m_hashingView->signal_changed().push_back(std::bind(&Manager::receive_hashing_changed, this));
|
||||
}
|
||||
|
||||
torrent::ThrottlePair
|
||||
@@ -133,7 +138,7 @@ Manager::get_throttle(const std::string& name) {
|
||||
void
|
||||
Manager::set_address_throttle(uint32_t begin, uint32_t end, torrent::ThrottlePair throttles) {
|
||||
m_addressThrottles.set_merge(begin, end, throttles);
|
||||
torrent::connection_manager()->address_throttle() = tr1::bind(&core::Manager::get_address_throttle, control->core(), tr1::placeholders::_1);
|
||||
torrent::connection_manager()->address_throttle() = std::bind(&core::Manager::get_address_throttle, control->core(), std::placeholders::_1);
|
||||
}
|
||||
|
||||
torrent::ThrottlePair
|
||||
@@ -144,8 +149,8 @@ Manager::get_address_throttle(const sockaddr* addr) {
|
||||
// Most of this should be possible to move out.
|
||||
void
|
||||
Manager::initialize_second() {
|
||||
torrent::Http::slot_factory() = std::tr1::bind(&CurlStack::new_object, m_httpStack);
|
||||
m_httpQueue->set_slot_factory(std::tr1::bind(&CurlStack::new_object, m_httpStack));
|
||||
torrent::Http::slot_factory() = std::bind(&CurlStack::new_object, m_httpStack);
|
||||
m_httpQueue->set_slot_factory(std::bind(&CurlStack::new_object, m_httpStack));
|
||||
|
||||
CurlStack::global_init();
|
||||
}
|
||||
@@ -330,7 +335,7 @@ Manager::try_create_download(const std::string& uri, int flags, const command_li
|
||||
|
||||
f->set_start(flags & create_start);
|
||||
f->set_print_log(!(flags & create_quiet));
|
||||
f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, f));
|
||||
f->slot_finished(std::bind(&rak::call_delete_func<core::DownloadFactory>, f));
|
||||
|
||||
if (flags & create_raw_data)
|
||||
f->load_raw_data(uri);
|
||||
@@ -354,7 +359,7 @@ Manager::try_create_download_from_meta_download(torrent::Object* bencode, const
|
||||
|
||||
f->set_start(meta.get_key_value("start"));
|
||||
f->set_print_log(meta.get_key_value("print_log"));
|
||||
f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, f));
|
||||
f->slot_finished(std::bind(&rak::call_delete_func<core::DownloadFactory>, f));
|
||||
|
||||
// Bit of a waste to create the bencode repesentation here
|
||||
// only to have the DownloadFactory decode it.
|
||||
|
||||
+2
-2
@@ -69,8 +69,8 @@ public:
|
||||
typedef DownloadList::iterator DListItr;
|
||||
typedef utils::FileStatusCache FileStatusCache;
|
||||
|
||||
// typedef std::tr1::function<void (DownloadList::iterator)> slot_ready;
|
||||
// typedef std::tr1::function<void ()> slot_void;
|
||||
// typedef std::function<void (DownloadList::iterator)> slot_ready;
|
||||
// typedef std::function<void ()> slot_void;
|
||||
|
||||
Manager();
|
||||
~Manager();
|
||||
|
||||
+3
-3
@@ -177,7 +177,7 @@ View::initialize(const std::string& name) {
|
||||
m_focus = 0;
|
||||
|
||||
set_last_changed(rak::timer());
|
||||
m_delayChanged.slot() = std::tr1::bind(&View::emit_changed_now, this);
|
||||
m_delayChanged.slot() = std::bind(&View::emit_changed_now, this);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -282,11 +282,11 @@ View::filter() {
|
||||
// perhaps always clear them, thus not throwing anything.
|
||||
if (!m_event_removed.is_empty())
|
||||
std::for_each(changed.begin(), splitChanged,
|
||||
tr1::bind(&rpc::call_object_d_nothrow, m_event_removed, tr1::placeholders::_1));
|
||||
std::bind(&rpc::call_object_d_nothrow, m_event_removed, std::placeholders::_1));
|
||||
|
||||
if (!m_event_added.is_empty())
|
||||
std::for_each(changed.begin(), splitChanged,
|
||||
tr1::bind(&rpc::call_object_d_nothrow, m_event_added, tr1::placeholders::_1));
|
||||
std::bind(&rpc::call_object_d_nothrow, m_event_added, std::placeholders::_1));
|
||||
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@
|
||||
#include <vector>
|
||||
#include <rak/timer.h>
|
||||
#include <torrent/object.h>
|
||||
#include <tr1/functional>
|
||||
#include lt_tr1_functional
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
@@ -64,7 +64,7 @@ class Download;
|
||||
class View : private std::vector<Download*> {
|
||||
public:
|
||||
typedef std::vector<Download*> base_type;
|
||||
typedef std::tr1::function<void ()> slot_void;
|
||||
typedef std::function<void ()> slot_void;
|
||||
typedef std::list<slot_void> signal_void;
|
||||
|
||||
using base_type::iterator;
|
||||
|
||||
Reference in New Issue
Block a user