mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-15 22:52:31 +00:00
Fixed compiler issues with gcc-4.6 c++0x.
This commit is contained in:
+8
-3
@@ -47,9 +47,7 @@
|
||||
#include <torrent/data/file_list_iterator.h>
|
||||
|
||||
// Move into config.h or something.
|
||||
namespace std {
|
||||
using namespace tr1;
|
||||
}
|
||||
namespace tr1 { using namespace std::tr1; }
|
||||
|
||||
namespace core {
|
||||
class Download;
|
||||
@@ -210,9 +208,16 @@ protected:
|
||||
// within commands. E.d. callable command strings where one of the
|
||||
// arguments within the command needs to be supplied by the caller.
|
||||
|
||||
#ifdef HAVE_CXX11
|
||||
union {
|
||||
base_function t_pod;
|
||||
// char t_pod[sizeof(base_function)];
|
||||
};
|
||||
#else
|
||||
union {
|
||||
char t_pod[sizeof(base_function)];
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename T1 = void, typename T2 = void>
|
||||
|
||||
@@ -71,7 +71,7 @@ CommandScheduler::insert(const std::string& key) {
|
||||
delete *itr;
|
||||
|
||||
*itr = new CommandSchedulerItem(key);
|
||||
(*itr)->set_slot(rak::bind_mem_fn(this, &CommandScheduler::call_item, *itr));
|
||||
(*itr)->set_slot(std::tr1::bind(&CommandScheduler::call_item, this, *itr));
|
||||
|
||||
return itr;
|
||||
}
|
||||
|
||||
@@ -39,13 +39,14 @@
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
#include <tr1/functional>
|
||||
#include <torrent/object.h>
|
||||
|
||||
namespace rpc {
|
||||
|
||||
class CommandSchedulerItem {
|
||||
public:
|
||||
typedef rak::function0<void> Slot;
|
||||
typedef std::tr1::function<void ()> slot_void;
|
||||
|
||||
CommandSchedulerItem(const std::string& key) : m_key(key), m_interval(0) {}
|
||||
~CommandSchedulerItem();
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
rak::timer time_scheduled() const { return m_timeScheduled; }
|
||||
rak::timer next_time_scheduled() const;
|
||||
|
||||
void set_slot(Slot::base_type* s) { m_task.set_slot(s); }
|
||||
void set_slot(const slot_void& s) { m_task.set_slot(s); }
|
||||
|
||||
private:
|
||||
CommandSchedulerItem(const CommandSchedulerItem&);
|
||||
|
||||
@@ -246,7 +246,7 @@ object_storage::rlookup_list(const std::string& cmd_key) {
|
||||
|
||||
if (r_itr != m_rlookup.end())
|
||||
std::transform(r_itr->second.begin(), r_itr->second.end(), std::back_inserter(result),
|
||||
std::bind(&key_type::c_str, std::bind(rak::mem_ptr(&value_type::first), std::placeholders::_1)));
|
||||
std::tr1::bind(&key_type::c_str, std::tr1::bind(rak::mem_ptr(&value_type::first), std::tr1::placeholders::_1)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ struct object_storage_node {
|
||||
char flags;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<fixed_key_type<64>, object_storage_node, hash_fixed_key_type> object_storage_base_type;
|
||||
typedef std::tr1::unordered_map<fixed_key_type<64>, object_storage_node, hash_fixed_key_type> object_storage_base_type;
|
||||
|
||||
class object_storage : private object_storage_base_type {
|
||||
public:
|
||||
|
||||
+6
-6
@@ -156,7 +156,7 @@ xmlrpc_to_target(xmlrpc_env* env, xmlrpc_value* value) {
|
||||
throw xmlrpc_error(XMLRPC_TYPE_ERROR, "Unsupported target type found.");
|
||||
}
|
||||
|
||||
core::Download* download = xmlrpc.get_slot_find_download()(str);
|
||||
core::Download* download = xmlrpc.slot_find_download()(str);
|
||||
|
||||
if (download == NULL) {
|
||||
::free((void*)str);
|
||||
@@ -186,7 +186,7 @@ xmlrpc_to_target(xmlrpc_env* env, xmlrpc_value* value) {
|
||||
if (*str == '\0' || *end_ptr != '\0')
|
||||
throw xmlrpc_error(XMLRPC_TYPE_ERROR, "Invalid index.");
|
||||
|
||||
target = rpc::make_target(XmlRpc::call_file, xmlrpc.get_slot_find_file()(download, index));
|
||||
target = rpc::make_target(XmlRpc::call_file, xmlrpc.slot_find_file()(download, index));
|
||||
break;
|
||||
|
||||
case 't':
|
||||
@@ -195,7 +195,7 @@ xmlrpc_to_target(xmlrpc_env* env, xmlrpc_value* value) {
|
||||
if (*str == '\0' || *end_ptr != '\0')
|
||||
throw xmlrpc_error(XMLRPC_TYPE_ERROR, "Invalid index.");
|
||||
|
||||
target = rpc::make_target(XmlRpc::call_tracker, xmlrpc.get_slot_find_tracker()(download, index));
|
||||
target = rpc::make_target(XmlRpc::call_tracker, xmlrpc.slot_find_tracker()(download, index));
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
@@ -206,7 +206,7 @@ xmlrpc_to_target(xmlrpc_env* env, xmlrpc_value* value) {
|
||||
if (hash_end == end_ptr || *hash_end != '\0')
|
||||
throw xmlrpc_error(XMLRPC_TYPE_ERROR, "Not a hash string.");
|
||||
|
||||
target = rpc::make_target(XmlRpc::call_peer, xmlrpc.get_slot_find_peer()(download, hash));
|
||||
target = rpc::make_target(XmlRpc::call_peer, xmlrpc.slot_find_peer()(download, hash));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -233,8 +233,8 @@ xmlrpc_to_index_type(int index, int callType, core::Download* download) {
|
||||
void* result;
|
||||
|
||||
switch (callType) {
|
||||
case XmlRpc::call_file: result = xmlrpc.get_slot_find_file()(download, index); break;
|
||||
case XmlRpc::call_tracker: result = xmlrpc.get_slot_find_tracker()(download, index); break;
|
||||
case XmlRpc::call_file: result = xmlrpc.slot_find_file()(download, index); break;
|
||||
case XmlRpc::call_tracker: result = xmlrpc.slot_find_tracker()(download, index); break;
|
||||
default: result = NULL; break;
|
||||
}
|
||||
|
||||
|
||||
+14
-21
@@ -37,7 +37,7 @@
|
||||
#ifndef RTORRENT_RPC_XMLRPC_H
|
||||
#define RTORRENT_RPC_XMLRPC_H
|
||||
|
||||
#include <rak/functional_fun.h>
|
||||
#include <tr1/functional>
|
||||
#include <torrent/hash_string.h>
|
||||
|
||||
namespace core {
|
||||
@@ -54,11 +54,11 @@ namespace rpc {
|
||||
|
||||
class XmlRpc {
|
||||
public:
|
||||
typedef rak::function1<core::Download*, const char*> slot_find_download;
|
||||
typedef rak::function2<torrent::File*, core::Download*, uint32_t> slot_find_file;
|
||||
typedef rak::function2<torrent::Tracker*, core::Download*, uint32_t> slot_find_tracker;
|
||||
typedef rak::function2<torrent::Peer*, core::Download*, const torrent::HashString&> slot_find_peer;
|
||||
typedef rak::function2<bool, const char*, uint32_t> slot_write;
|
||||
typedef std::tr1::function<core::Download* (const char*)> slot_download;
|
||||
typedef std::tr1::function<torrent::File* (core::Download*, uint32_t)> slot_file;
|
||||
typedef std::tr1::function<torrent::Tracker* (core::Download*, uint32_t)> slot_tracker;
|
||||
typedef std::tr1::function<torrent::Peer* (core::Download*, const torrent::HashString&)> slot_peer;
|
||||
typedef std::tr1::function<bool (const char*, uint32_t)> slot_write;
|
||||
|
||||
static const int dialect_generic = 0;
|
||||
static const int dialect_i8 = 1;
|
||||
@@ -87,17 +87,10 @@ public:
|
||||
int dialect() { return m_dialect; }
|
||||
void set_dialect(int dialect);
|
||||
|
||||
slot_find_download& get_slot_find_download() { return m_slotFindDownload; }
|
||||
void set_slot_find_download(slot_find_download::base_type* slot) { m_slotFindDownload.set(slot); }
|
||||
|
||||
slot_find_file& get_slot_find_file() { return m_slotFindFile; }
|
||||
void set_slot_find_file(slot_find_file::base_type* slot) { m_slotFindFile.set(slot); }
|
||||
|
||||
slot_find_tracker& get_slot_find_tracker() { return m_slotFindTracker; }
|
||||
void set_slot_find_tracker(slot_find_tracker::base_type* slot) { m_slotFindTracker.set(slot); }
|
||||
|
||||
slot_find_peer& get_slot_find_peer() { return m_slotFindPeer; }
|
||||
void set_slot_find_peer(slot_find_peer::base_type* slot) { m_slotFindPeer.set(slot); }
|
||||
slot_download& slot_find_download() { return m_slotFindDownload; }
|
||||
slot_file& slot_find_file() { return m_slotFindFile; }
|
||||
slot_tracker& slot_find_tracker() { return m_slotFindTracker; }
|
||||
slot_peer& slot_find_peer() { return m_slotFindPeer; }
|
||||
|
||||
static int64_t size_limit();
|
||||
static void set_size_limit(uint64_t size);
|
||||
@@ -108,10 +101,10 @@ private:
|
||||
|
||||
int m_dialect;
|
||||
|
||||
slot_find_download m_slotFindDownload;
|
||||
slot_find_file m_slotFindFile;
|
||||
slot_find_tracker m_slotFindTracker;
|
||||
slot_find_peer m_slotFindPeer;
|
||||
slot_download m_slotFindDownload;
|
||||
slot_file m_slotFindFile;
|
||||
slot_tracker m_slotFindTracker;
|
||||
slot_peer m_slotFindPeer;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user