C++11 compatibility fixes.

This commit is contained in:
rakshasa
2014-05-13 23:36:37 +09:00
parent e42ec54920
commit 3b39f37f49
77 changed files with 886 additions and 803 deletions
+3 -5
View File
@@ -41,14 +41,12 @@
#include <limits>
#include <inttypes.h>
#include <torrent/object.h>
#include <tr1/functional>
#include lt_tr1_functional
#include <torrent/object.h>
#include <torrent/data/file_list_iterator.h>
// Move into config.h or something.
namespace tr1 { using namespace std::tr1; }
namespace core {
class Download;
}
@@ -111,7 +109,7 @@ typedef rt_triple<int, void*, void*> target_type;
class command_base;
typedef const torrent::Object (*command_base_call_type)(command_base*, target_type, const torrent::Object&);
typedef tr1::function<torrent::Object (target_type, const torrent::Object&)> base_function;
typedef std::function<torrent::Object (target_type, const torrent::Object&)> base_function;
template <typename tmpl> struct command_base_is_valid {};
template <command_base_call_type tmpl_func> struct command_base_is_type {};
@@ -250,7 +248,7 @@ command_base::_call(command_base* cmd, target_type target, Args args) {
}
#define COMMAND_BASE_TEMPLATE_TYPE(func_type, func_parm) \
template <typename T, int proper = target_type_id<T>::proper_type> struct func_type { typedef tr1::function<func_parm> type; }; \
template <typename T, int proper = target_type_id<T>::proper_type> struct func_type { typedef std::function<func_parm> type; }; \
\
template <> struct command_base_is_valid<func_type<target_type>::type> { static const int value = 1; }; \
template <> struct command_base_is_valid<func_type<core::Download*>::type> { static const int value = 1; }; \
+1 -1
View File
@@ -71,7 +71,7 @@ CommandScheduler::insert(const std::string& key) {
delete *itr;
*itr = new CommandSchedulerItem(key);
(*itr)->slot() = std::tr1::bind(&CommandScheduler::call_item, this, *itr);
(*itr)->slot() = std::bind(&CommandScheduler::call_item, this, *itr);
return itr;
}
+2 -2
View File
@@ -39,14 +39,14 @@
#include "globals.h"
#include <tr1/functional>
#include lt_tr1_functional
#include <torrent/object.h>
namespace rpc {
class CommandSchedulerItem {
public:
typedef std::tr1::function<void ()> slot_void;
typedef std::function<void ()> slot_void;
CommandSchedulerItem(const std::string& key) : m_key(key), m_interval(0) {}
~CommandSchedulerItem();
+8
View File
@@ -50,6 +50,14 @@
namespace rpc {
const unsigned int ExecFile::max_args;
const unsigned int ExecFile::buffer_size;
const int ExecFile::flag_expand_tilde;
const int ExecFile::flag_throw;
const int ExecFile::flag_capture;
const int ExecFile::flag_background;
// Close m_logFd.
int
+18 -1
View File
@@ -44,6 +44,23 @@
namespace rpc {
const unsigned int object_storage::flag_generic_type;
const unsigned int object_storage::flag_bool_type;
const unsigned int object_storage::flag_value_type;
const unsigned int object_storage::flag_string_type;
const unsigned int object_storage::flag_list_type;
const unsigned int object_storage::flag_function_type;
const unsigned int object_storage::flag_multi_type;
const unsigned int object_storage::mask_type;
const unsigned int object_storage::flag_constant;
const unsigned int object_storage::flag_static;
const unsigned int object_storage::flag_private;
const unsigned int object_storage::flag_rlookup;
const size_t object_storage::key_size;
object_storage::local_iterator
object_storage::find_local(const torrent::raw_string& key) {
std::size_t n = hash_fixed_key_type::hash(key.data(), key.size()) % bucket_count();
@@ -245,7 +262,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::tr1::bind(&key_type::c_str, std::tr1::bind(rak::mem_ptr(&value_type::first), std::tr1::placeholders::_1)));
std::bind(&key_type::c_str, std::bind(rak::mem_ptr(&value_type::first), std::placeholders::_1)));
return result;
}
+2 -2
View File
@@ -42,7 +42,7 @@
#define RTORRENT_RPC_OBJECT_STORAGE_H
#include <cstring>
#include <tr1/unordered_map>
#include lt_tr1_unordered_map
#include <torrent/object.h>
#include "rak/unordered_vector.h"
@@ -56,7 +56,7 @@ struct object_storage_node {
char flags;
};
typedef std::tr1::unordered_map<fixed_key_type<64>, object_storage_node, hash_fixed_key_type> object_storage_base_type;
typedef std::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
View File
@@ -37,7 +37,7 @@
#ifndef RTORRENT_RPC_XMLRPC_H
#define RTORRENT_RPC_XMLRPC_H
#include <tr1/functional>
#include lt_tr1_functional
#include <torrent/hash_string.h>
namespace core {
@@ -54,11 +54,11 @@ namespace rpc {
class XmlRpc {
public:
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;
typedef std::function<core::Download* (const char*)> slot_download;
typedef std::function<torrent::File* (core::Download*, uint32_t)> slot_file;
typedef std::function<torrent::Tracker* (core::Download*, uint32_t)> slot_tracker;
typedef std::function<torrent::Peer* (core::Download*, const torrent::HashString&)> slot_peer;
typedef std::function<bool (const char*, uint32_t)> slot_write;
static const int dialect_generic = 0;
static const int dialect_i8 = 1;