ports/185295: [PATCH] Fix net-p2p/libtorrent build with clang on >10.x
Philip Paeps
philip at freebsd.org
Mon Dec 30 15:00:01 UTC 2013
>Number: 185295
>Category: ports
>Synopsis: [PATCH] Fix net-p2p/libtorrent build with clang on >10.x
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Dec 30 15:00:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Philip Paeps
>Release: FreeBSD 10.0-PRERELEASE amd64
>Organization:
Happily disorganised
>Environment:
System: FreeBSD rincewind.paeps.cx 10.0-PRERELEASE FreeBSD 10.0-PRERELEASE #16 r260042: Sun Dec 29 19:44:44 CET 2013 philip at rincewind:/usr/obj/usr/src/sys/RINCEWIND amd64
>Description:
The devel/libtorrent-devel port depends on gcc on FreeBSD >10.x to work
around C++ bugs in the code. It is (fairly) trivial to fix the bugs
themselves though. The included patch was produced mostly with sed.
>How-To-Repeat:
Build devel/libtorrent-devel on FreeBSD >10.x
>Fix:
Index: Makefile
===================================================================
--- Makefile (revision 336929)
+++ Makefile (working copy)
@@ -38,9 +38,9 @@
CONFIGURE_ARGS+= --disable-debug
-# Workaround to build on > 10.x
.if ${OSVERSION} >= 1000000
-USE_GCC= yes
+CXXFLAGS+=-std=c++11
+EXTRA_PATCHES+=${PATCHDIR}/extra-patch-fix-clang-build.diff
.endif
post-patch:
Index: files/extra-patch-fix-clang-build.diff
===================================================================
--- files/extra-patch-fix-clang-build.diff (revision 0)
+++ files/extra-patch-fix-clang-build.diff (working copy)
@@ -0,0 +1,1852 @@
+--- rak/priority_queue_default.h
++++ rak/priority_queue_default.h
+@@ -37,7 +37,7 @@
+ #ifndef RAK_PRIORITY_QUEUE_DEFAULT_H
+ #define RAK_PRIORITY_QUEUE_DEFAULT_H
+
+-#include <tr1/functional>
++#include <functional>
+ #include <rak/allocators.h>
+ #include <rak/priority_queue.h>
+ #include <rak/timer.h>
+@@ -48,7 +48,7 @@ namespace rak {
+
+ class priority_item {
+ public:
+- typedef std::tr1::function<void (void)> slot_void;
++ typedef std::function<void (void)> slot_void;
+
+ priority_item() {}
+ ~priority_item() {
+--- src/data/chunk_list.h
++++ src/data/chunk_list.h
+@@ -39,7 +39,7 @@
+
+ #include <string>
+ #include <vector>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "chunk.h"
+ #include "chunk_handle.h"
+@@ -59,9 +59,9 @@ public:
+ typedef std::vector<ChunkListNode> base_type;
+ typedef std::vector<ChunkListNode*> Queue;
+
+- typedef std::tr1::function<Chunk* (uint32_t, int)> slot_chunk_index;
+- typedef std::tr1::function<uint64_t ()> slot_value;
+- typedef std::tr1::function<void (const std::string&)> slot_string;
++ typedef std::function<Chunk* (uint32_t, int)> slot_chunk_index;
++ typedef std::function<uint64_t ()> slot_value;
++ typedef std::function<void (const std::string&)> slot_string;
+
+ using base_type::value_type;
+ using base_type::reference;
+--- src/data/hash_check_queue.h
++++ src/data/hash_check_queue.h
+@@ -39,7 +39,7 @@
+
+ #include <deque>
+ #include <pthread.h>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "rak/allocators.h"
+
+@@ -51,7 +51,7 @@ class HashChunk;
+ class lt_cacheline_aligned HashCheckQueue : private std::deque<HashChunk*, rak::cacheline_allocator<HashChunk*> > {
+ public:
+ typedef std::deque<HashChunk*, rak::cacheline_allocator<HashChunk*> > base_type;
+- typedef std::tr1::function<void (HashChunk*, const HashString&)> slot_chunk_handle;
++ typedef std::function<void (HashChunk*, const HashString&)> slot_chunk_handle;
+
+ using base_type::iterator;
+
+--- src/data/hash_queue.cc
++++ src/data/hash_queue.cc
+@@ -57,7 +57,6 @@
+ #define LT_LOG_DATA(data, log_level, log_fmt, ...) \
+ lt_log_print_data(LOG_STORAGE_##log_level, data, "hash_queue", log_fmt, __VA_ARGS__);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -87,7 +86,7 @@ HashQueue::HashQueue(thread_disk* thread) :
+ m_thread_disk(thread) {
+
+ pthread_mutex_init(&m_done_chunks_lock, NULL);
+- m_thread_disk->hash_queue()->slot_chunk_done() = tr1::bind(&HashQueue::chunk_done, this, tr1::placeholders::_1, tr1::placeholders::_2);
++ m_thread_disk->hash_queue()->slot_chunk_done() = std::bind(&HashQueue::chunk_done, this, std::placeholders::_1, std::placeholders::_2);
+ }
+
+
+@@ -176,9 +175,9 @@ HashQueue::work() {
+ // TODO: This is not optimal as we jump around... Check for front
+ // of HashQueue in done_chunks instead.
+
+- iterator itr = std::find_if(begin(), end(), tr1::bind(std::equal_to<HashChunk*>(),
++ iterator itr = std::find_if(begin(), end(), std::bind(std::equal_to<HashChunk*>(),
+ hash_chunk,
+- tr1::bind(&HashQueueNode::get_chunk, tr1::placeholders::_1)));
++ std::bind(&HashQueueNode::get_chunk, std::placeholders::_1)));
+
+ // TODO: Fix this...
+ if (itr == end())
+--- src/data/hash_queue.h
++++ src/data/hash_queue.h
+@@ -40,7 +40,7 @@
+ #include <deque>
+ #include <map>
+ #include <pthread.h>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "torrent/hash_string.h"
+ #include "hash_queue_node.h"
+@@ -63,7 +63,7 @@ public:
+ typedef std::map<HashChunk*, torrent::HashString> done_chunks_type;
+
+ typedef HashQueueNode::slot_done_type slot_done_type;
+- typedef std::tr1::function<void (bool)> slot_bool;
++ typedef std::function<void (bool)> slot_bool;
+
+ using base_type::iterator;
+
+--- src/data/hash_queue_node.h
++++ src/data/hash_queue_node.h
+@@ -38,7 +38,7 @@
+ #define LIBTORRENT_DATA_HASH_QUEUE_NODE_H
+
+ #include <string>
+-#include <tr1/functional>
++#include <functional>
+ #include <inttypes.h>
+
+ #include "chunk_handle.h"
+@@ -50,7 +50,7 @@ class download_data;
+
+ class HashQueueNode {
+ public:
+- typedef std::tr1::function<void (ChunkHandle, const char*)> slot_done_type;
++ typedef std::function<void (ChunkHandle, const char*)> slot_done_type;
+ typedef download_data* id_type;
+
+ HashQueueNode(id_type id, HashChunk* c, slot_done_type d) :
+--- src/dht/dht_hash_map.h
++++ src/dht/dht_hash_map.h
+@@ -40,7 +40,7 @@
+ #include "config.h"
+
+ #if HAVE_TR1
+-#include <tr1/unordered_map>
++#include <unordered_map>
+ #else
+ #include <map>
+ #endif
+@@ -104,9 +104,9 @@ struct hashstring_ptr_equal : public std::binary_function<const HashString*, con
+ { return *one == *two; }
+ };
+
+-class DhtNodeList : public std::tr1::unordered_map<const HashString*, DhtNode*, hashstring_ptr_hash, hashstring_ptr_equal> {
++class DhtNodeList : public std::unordered_map<const HashString*, DhtNode*, hashstring_ptr_hash, hashstring_ptr_equal> {
+ public:
+- typedef std::tr1::unordered_map<const HashString*, DhtNode*, hashstring_ptr_hash, hashstring_ptr_equal> base_type;
++ typedef std::unordered_map<const HashString*, DhtNode*, hashstring_ptr_hash, hashstring_ptr_equal> base_type;
+
+ // Define accessor iterator with more convenient access to the key and
+ // element values. Allows changing the map definition more easily if needed.
+@@ -125,9 +125,9 @@ public:
+
+ };
+
+-class DhtTrackerList : public std::tr1::unordered_map<HashString, DhtTracker*, hashstring_hash> {
++class DhtTrackerList : public std::unordered_map<HashString, DhtTracker*, hashstring_hash> {
+ public:
+- typedef std::tr1::unordered_map<HashString, DhtTracker*, hashstring_hash> base_type;
++ typedef std::unordered_map<HashString, DhtTracker*, hashstring_hash> base_type;
+
+ template<typename T>
+ struct accessor_wrapper : public T {
+--- src/dht/dht_router.cc
++++ src/dht/dht_router.cc
+@@ -131,7 +131,7 @@ DhtRouter::start(int port) {
+ m_server.start(port);
+
+ // Set timeout slot and schedule it to be called immediately for initial bootstrapping if necessary.
+- m_taskTimeout.slot() = std::tr1::bind(&DhtRouter::receive_timeout_bootstrap, this);
++ m_taskTimeout.slot() = std::bind(&DhtRouter::receive_timeout_bootstrap, this);
+ priority_queue_insert(&taskScheduler, &m_taskTimeout, (cachedTime + rak::timer::from_seconds(1)).round_seconds());
+ }
+
+@@ -410,7 +410,7 @@ DhtRouter::receive_timeout_bootstrap() {
+ delete m_contacts;
+ m_contacts = NULL;
+
+- m_taskTimeout.slot() = std::tr1::bind(&DhtRouter::receive_timeout, this);
++ m_taskTimeout.slot() = std::bind(&DhtRouter::receive_timeout, this);
+
+ if (!m_numRefresh) {
+ // If we're still in the startup, do the usual refreshing too.
+--- src/dht/dht_server.cc
++++ src/dht/dht_server.cc
+@@ -154,7 +154,7 @@ DhtServer::start(int port) {
+ throw;
+ }
+
+- m_taskTimeout.slot() = std::tr1::bind(&DhtServer::receive_timeout, this);
++ m_taskTimeout.slot() = std::bind(&DhtServer::receive_timeout, this);
+
+ m_uploadNode.set_list_iterator(m_uploadThrottle->end());
+ m_uploadNode.slot_activate(rak::make_mem_fun(static_cast<SocketBase*>(this), &SocketBase::receive_throttle_up_activate));
+--- src/download/download_main.cc
++++ src/download/download_main.cc
+@@ -64,7 +64,6 @@
+ #include "download_main.h"
+ #include "download_wrapper.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -103,11 +102,11 @@ DownloadMain::DownloadMain() :
+ m_tracker_list = new TrackerList();
+ m_tracker_controller = new TrackerController(m_tracker_list);
+
+- m_tracker_list->slot_success() = tr1::bind(&TrackerController::receive_success, m_tracker_controller, tr1::placeholders::_1, tr1::placeholders::_2);
+- m_tracker_list->slot_failure() = tr1::bind(&TrackerController::receive_failure, m_tracker_controller, tr1::placeholders::_1, tr1::placeholders::_2);
+- m_tracker_list->slot_scrape_success() = tr1::bind(&TrackerController::receive_scrape, m_tracker_controller, tr1::placeholders::_1);
+- m_tracker_list->slot_tracker_enabled() = tr1::bind(&TrackerController::receive_tracker_enabled, m_tracker_controller, tr1::placeholders::_1);
+- m_tracker_list->slot_tracker_disabled() = tr1::bind(&TrackerController::receive_tracker_disabled, m_tracker_controller, tr1::placeholders::_1);
++ m_tracker_list->slot_success() = std::bind(&TrackerController::receive_success, m_tracker_controller, std::placeholders::_1, std::placeholders::_2);
++ m_tracker_list->slot_failure() = std::bind(&TrackerController::receive_failure, m_tracker_controller, std::placeholders::_1, std::placeholders::_2);
++ m_tracker_list->slot_scrape_success() = std::bind(&TrackerController::receive_scrape, m_tracker_controller, std::placeholders::_1);
++ m_tracker_list->slot_tracker_enabled() = std::bind(&TrackerController::receive_tracker_enabled, m_tracker_controller, std::placeholders::_1);
++ m_tracker_list->slot_tracker_disabled() = std::bind(&TrackerController::receive_tracker_disabled, m_tracker_controller, std::placeholders::_1);
+
+ m_connectionList = new ConnectionList(this);
+
+@@ -119,12 +118,12 @@ DownloadMain::DownloadMain() :
+ m_delegator.transfer_list()->slot_completed(std::bind1st(std::mem_fun(&DownloadMain::receive_chunk_done), this));
+ m_delegator.transfer_list()->slot_corrupt(std::bind1st(std::mem_fun(&DownloadMain::receive_corrupt_chunk), this));
+
+- m_delayDisconnectPeers.slot() = std::tr1::bind(&ConnectionList::disconnect_queued, m_connectionList);
+- m_taskTrackerRequest.slot() = std::tr1::bind(&DownloadMain::receive_tracker_request, this);
++ m_delayDisconnectPeers.slot() = std::bind(&ConnectionList::disconnect_queued, m_connectionList);
++ m_taskTrackerRequest.slot() = std::bind(&DownloadMain::receive_tracker_request, this);
+
+ m_chunkList->set_data(file_list()->mutable_data());
+- m_chunkList->slot_create_chunk() = tr1::bind(&FileList::create_chunk_index, file_list(), tr1::placeholders::_1, tr1::placeholders::_2);
+- m_chunkList->slot_free_diskspace() = tr1::bind(&FileList::free_diskspace, file_list());
++ m_chunkList->slot_create_chunk() = std::bind(&FileList::create_chunk_index, file_list(), std::placeholders::_1, std::placeholders::_2);
++ m_chunkList->slot_free_diskspace() = std::bind(&FileList::free_diskspace, file_list());
+ }
+
+ DownloadMain::~DownloadMain() {
+--- src/download/download_wrapper.cc
++++ src/download/download_wrapper.cc
+@@ -61,7 +61,6 @@
+
+ #include "download_wrapper.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -72,13 +71,13 @@ DownloadWrapper::DownloadWrapper() :
+ m_hashChecker(NULL),
+ m_connectionType(0) {
+
+- m_main->delay_download_done().slot() = std::tr1::bind(&download_data::call_download_done, data());
++ m_main->delay_download_done().slot() = std::bind(&download_data::call_download_done, data());
+
+ m_main->tracker_list()->set_info(info());
+- m_main->tracker_controller()->slot_success() = tr1::bind(&DownloadWrapper::receive_tracker_success, this, tr1::placeholders::_1);
+- m_main->tracker_controller()->slot_failure() = tr1::bind(&DownloadWrapper::receive_tracker_failed, this, tr1::placeholders::_1);
++ m_main->tracker_controller()->slot_success() = std::bind(&DownloadWrapper::receive_tracker_success, this, std::placeholders::_1);
++ m_main->tracker_controller()->slot_failure() = std::bind(&DownloadWrapper::receive_tracker_failed, this, std::placeholders::_1);
+
+- m_main->chunk_list()->slot_storage_error() = tr1::bind(&DownloadWrapper::receive_storage_error, this, tr1::placeholders::_1);
++ m_main->chunk_list()->slot_storage_error() = std::bind(&DownloadWrapper::receive_storage_error, this, std::placeholders::_1);
+ }
+
+ DownloadWrapper::~DownloadWrapper() {
+@@ -107,8 +106,8 @@ DownloadWrapper::initialize(const std::string& hash, const std::string& id) {
+
+ info()->mutable_local_id().assign(id.c_str());
+
+- info()->slot_left() = tr1::bind(&FileList::left_bytes, m_main->file_list());
+- info()->slot_completed() = tr1::bind(&FileList::completed_bytes, m_main->file_list());
++ info()->slot_left() = std::bind(&FileList::left_bytes, m_main->file_list());
++ info()->slot_completed() = std::bind(&FileList::completed_bytes, m_main->file_list());
+
+ file_list()->mutable_data()->mutable_hash().assign(hash.c_str());
+
+@@ -121,7 +120,7 @@ DownloadWrapper::initialize(const std::string& hash, const std::string& id) {
+ m_hashChecker->slot_check(rak::make_mem_fun(this, &DownloadWrapper::check_chunk_hash));
+ // m_hashChecker->slot_storage_error(rak::make_mem_fun(this, &DownloadWrapper::receive_storage_error));
+
+- m_hashChecker->delay_checked().slot() = std::tr1::bind(&DownloadWrapper::receive_initial_hash, this);
++ m_hashChecker->delay_checked().slot() = std::bind(&DownloadWrapper::receive_initial_hash, this);
+ }
+
+ void
+@@ -240,7 +239,7 @@ DownloadWrapper::check_chunk_hash(ChunkHandle handle) {
+ ChunkHandle new_handle = m_main->chunk_list()->get(handle.index(), ChunkList::get_blocking);
+ m_main->chunk_list()->release(&handle);
+
+- hash_queue()->push_back(new_handle, data(), tr1::bind(&DownloadWrapper::receive_hash_done, this, tr1::placeholders::_1, tr1::placeholders::_2));
++ hash_queue()->push_back(new_handle, data(), std::bind(&DownloadWrapper::receive_hash_done, this, std::placeholders::_1, std::placeholders::_2));
+ }
+
+ void
+--- src/manager.cc
++++ src/manager.cc
+@@ -59,7 +59,6 @@
+
+ #include "manager.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -83,12 +82,12 @@ Manager::Manager() :
+
+ m_hashQueue = new HashQueue(&m_main_thread_disk);
+ m_hashQueue->slot_has_work() =
+- tr1::bind(&thread_base::send_event_signal,
++ std::bind(&thread_base::send_event_signal,
+ &m_main_thread_main,
+- m_main_thread_main.signal_bitfield()->add_signal(tr1::bind(&HashQueue::work, m_hashQueue)),
+- tr1::placeholders::_1);
++ m_main_thread_main.signal_bitfield()->add_signal(std::bind(&HashQueue::work, m_hashQueue)),
++ std::placeholders::_1);
+
+- m_taskTick.slot() = std::tr1::bind(&Manager::receive_tick, this);
++ m_taskTick.slot() = std::bind(&Manager::receive_tick, this);
+
+ priority_queue_insert(&taskScheduler, &m_taskTick, cachedTime.round_seconds());
+
+--- src/net/throttle_internal.cc
++++ src/net/throttle_internal.cc
+@@ -62,7 +62,7 @@ ThrottleInternal::ThrottleInternal(int flags) :
+ m_timeLastTick(cachedTime) {
+
+ if (is_root())
+- m_taskTick.slot() = std::tr1::bind(&ThrottleInternal::receive_tick, this);
++ m_taskTick.slot() = std::bind(&ThrottleInternal::receive_tick, this);
+ }
+
+ ThrottleInternal::~ThrottleInternal() {
+--- src/protocol/handshake.cc
++++ src/protocol/handshake.cc
+@@ -100,7 +100,7 @@ Handshake::Handshake(SocketFd fd, HandshakeManager* m, int encryptionOptions) :
+ m_writeBuffer.reset();
+
+ m_taskTimeout.clear_time();
+- m_taskTimeout.slot() = std::tr1::bind(&HandshakeManager::receive_timeout, m, this);
++ m_taskTimeout.slot() = std::bind(&HandshakeManager::receive_timeout, m, this);
+ }
+
+ Handshake::~Handshake() {
+--- src/torrent/connection_manager.cc
++++ src/torrent/connection_manager.cc
+@@ -47,7 +47,6 @@
+ #include "error.h"
+ #include "exceptions.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -90,11 +89,11 @@ ConnectionManager::ConnectionManager() :
+ m_proxyAddress = (new rak::socket_address())->c_sockaddr();
+ rak::socket_address::cast_from(m_proxyAddress)->sa_inet()->clear();
+
+- m_slot_resolver = tr1::bind(&resolve_host,
+- tr1::placeholders::_1,
+- tr1::placeholders::_2,
+- tr1::placeholders::_3,
+- tr1::placeholders::_4);
++ m_slot_resolver = std::bind(&resolve_host,
++ std::placeholders::_1,
++ std::placeholders::_2,
++ std::placeholders::_3,
++ std::placeholders::_4);
+ }
+
+ ConnectionManager::~ConnectionManager() {
+--- src/torrent/connection_manager.h
++++ src/torrent/connection_manager.h
+@@ -47,7 +47,7 @@
+ #include <netinet/in_systm.h>
+ #include <netinet/ip.h>
+ #include <sys/socket.h>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -99,12 +99,12 @@ public:
+ handshake_retry_encrypted = 9
+ };
+
+- typedef std::tr1::function<uint32_t (const sockaddr*)> slot_filter_type;
+- typedef std::tr1::function<ThrottlePair (const sockaddr*)> slot_throttle_type;
++ typedef std::function<uint32_t (const sockaddr*)> slot_filter_type;
++ typedef std::function<ThrottlePair (const sockaddr*)> slot_throttle_type;
+
+ // The sockaddr argument in the result slot call is NULL if the resolve failed, and the int holds the errno.
+- typedef std::tr1::function<void (const sockaddr*, int)> slot_resolver_result_type;
+- typedef std::tr1::function<slot_resolver_result_type* (const char*, int, int, slot_resolver_result_type)> slot_resolver_type;
++ typedef std::function<void (const sockaddr*, int)> slot_resolver_result_type;
++ typedef std::function<slot_resolver_result_type* (const char*, int, int, slot_resolver_result_type)> slot_resolver_type;
+
+ ConnectionManager();
+ ~ConnectionManager();
+--- src/torrent/data/download_data.h
++++ src/torrent/data/download_data.h
+@@ -37,7 +37,7 @@
+ #ifndef LIBTORRENT_DATA_DOWNLOAD_DATA_H
+ #define LIBTORRENT_DATA_DOWNLOAD_DATA_H
+
+-#include <tr1/functional>
++#include <functional>
+
+ #include <torrent/common.h>
+ #include <torrent/bitfield.h>
+@@ -57,7 +57,7 @@ public:
+
+ typedef void (function_void)(void);
+
+- typedef std::tr1::function<function_void> slot_void;
++ typedef std::function<function_void> slot_void;
+
+ download_data() : m_wanted_chunks(0) {}
+
+--- src/torrent/download/choke_group.cc
++++ src/torrent/download/choke_group.cc
+@@ -37,7 +37,7 @@
+ #include "config.h"
+
+ #include <algorithm>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "choke_group.h"
+ #include "choke_queue.h"
+@@ -48,7 +48,6 @@
+ #include "torrent/exceptions.h"
+ #include "download/download_main.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -61,14 +60,14 @@ uint64_t
+ choke_group::up_rate() const {
+ return
+ std::for_each(m_first, m_last,
+- rak::accumulate((uint64_t)0, tr1::bind(&Rate::rate, tr1::bind(&resource_manager_entry::up_rate, tr1::placeholders::_1)))).result;
++ rak::accumulate((uint64_t)0, std::bind(&Rate::rate, std::bind(&resource_manager_entry::up_rate, std::placeholders::_1)))).result;
+ }
+
+ uint64_t
+ choke_group::down_rate() const {
+ return
+ std::for_each(m_first, m_last,
+- rak::accumulate((uint64_t)0, tr1::bind(&Rate::rate, tr1::bind(&resource_manager_entry::down_rate, tr1::placeholders::_1)))).result;
++ rak::accumulate((uint64_t)0, std::bind(&Rate::rate, std::bind(&resource_manager_entry::down_rate, std::placeholders::_1)))).result;
+ }
+
+ }
+--- src/torrent/download/choke_queue.cc
++++ src/torrent/download/choke_queue.cc
+@@ -40,7 +40,7 @@
+ #include <functional>
+ #include <numeric>
+ #include <cstdlib>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "protocol/peer_connection_base.h"
+ #include "torrent/download/group_entry.h"
+--- src/torrent/download/choke_queue.h
++++ src/torrent/download/choke_queue.h
+@@ -42,7 +42,7 @@
+ #include <list>
+ #include <vector>
+ #include <inttypes.h>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/download/group_entry.h>
+
+ namespace torrent {
+@@ -66,9 +66,9 @@ struct group_stats {
+
+ class LIBTORRENT_EXPORT choke_queue {
+ public:
+- typedef std::tr1::function<void (int)> slot_unchoke;
+- typedef std::tr1::function<int ()> slot_can_unchoke;
+- typedef std::tr1::function<bool (PeerConnectionBase*, bool)> slot_connection;
++ typedef std::function<void (int)> slot_unchoke;
++ typedef std::function<int ()> slot_can_unchoke;
++ typedef std::function<bool (PeerConnectionBase*, bool)> slot_connection;
+
+ typedef std::vector<weighted_connection> container_type;
+ typedef container_type::value_type value_type;
+--- src/torrent/download/group_entry.h
++++ src/torrent/download/group_entry.h
+@@ -39,7 +39,7 @@
+
+ #include <algorithm>
+ #include <vector>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/common.h>
+ #include <torrent/exceptions.h>
+
+@@ -104,7 +104,7 @@ private:
+
+ inline void group_entry::connection_unchoked(PeerConnectionBase* pcb) {
+ container_type::iterator itr = std::find_if(m_unchoked.begin(), m_unchoked.end(),
+- std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++ std::bind(&weighted_connection::operator==, std::placeholders::_1, pcb));
+
+ if (itr != m_unchoked.end()) throw internal_error("group_entry::connection_unchoked(pcb) failed.");
+
+@@ -113,7 +113,7 @@ inline void group_entry::connection_unchoked(PeerConnectionBase* pcb) {
+
+ inline void group_entry::connection_queued(PeerConnectionBase* pcb) {
+ container_type::iterator itr = std::find_if(m_queued.begin(), m_queued.end(),
+- std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++ std::bind(&weighted_connection::operator==, std::placeholders::_1, pcb));
+
+ if (itr != m_queued.end()) throw internal_error("group_entry::connection_queued(pcb) failed.");
+
+@@ -123,7 +123,7 @@ inline void group_entry::connection_queued(PeerConnectionBase* pcb) {
+ inline void
+ group_entry::connection_choked(PeerConnectionBase* pcb) {
+ container_type::iterator itr = std::find_if(m_unchoked.begin(), m_unchoked.end(),
+- std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++ std::bind(&weighted_connection::operator==, std::placeholders::_1, pcb));
+
+ if (itr == m_unchoked.end()) throw internal_error("group_entry::connection_choked(pcb) failed.");
+
+@@ -134,7 +134,7 @@ group_entry::connection_choked(PeerConnectionBase* pcb) {
+ inline void
+ group_entry::connection_unqueued(PeerConnectionBase* pcb) {
+ container_type::iterator itr = std::find_if(m_queued.begin(), m_queued.end(),
+- std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++ std::bind(&weighted_connection::operator==, std::placeholders::_1, pcb));
+
+ if (itr == m_queued.end()) throw internal_error("group_entry::connection_unqueued(pcb) failed.");
+
+--- src/torrent/download/resource_manager.cc
++++ src/torrent/download/resource_manager.cc
+@@ -38,7 +38,7 @@
+
+ #include <algorithm>
+ #include <functional>
+-#include <tr1/functional>
++#include <functional>
+ #include <limits>
+ #include <rak/functional.h>
+
+@@ -51,7 +51,6 @@
+ #include "choke_queue.h"
+ #include "resource_manager.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -73,12 +72,12 @@ ResourceManager::ResourceManager() :
+ choke_base_type::back()->up_queue()->set_heuristics(choke_queue::HEURISTICS_UPLOAD_LEECH);
+ choke_base_type::back()->down_queue()->set_heuristics(choke_queue::HEURISTICS_DOWNLOAD_LEECH);
+
+- choke_base_type::back()->up_queue()->set_slot_unchoke(tr1::bind(&ResourceManager::receive_upload_unchoke, this, tr1::placeholders::_1));
+- choke_base_type::back()->down_queue()->set_slot_unchoke(tr1::bind(&ResourceManager::receive_download_unchoke, this, tr1::placeholders::_1));
+- choke_base_type::back()->up_queue()->set_slot_can_unchoke(tr1::bind(&ResourceManager::retrieve_upload_can_unchoke, this));
+- choke_base_type::back()->down_queue()->set_slot_can_unchoke(tr1::bind(&ResourceManager::retrieve_download_can_unchoke, this));
+- choke_base_type::back()->up_queue()->set_slot_connection(tr1::bind(&PeerConnectionBase::receive_upload_choke, tr1::placeholders::_1, tr1::placeholders::_2));
+- choke_base_type::back()->down_queue()->set_slot_connection(tr1::bind(&PeerConnectionBase::receive_download_choke, tr1::placeholders::_1, tr1::placeholders::_2));
++ choke_base_type::back()->up_queue()->set_slot_unchoke(std::bind(&ResourceManager::receive_upload_unchoke, this, std::placeholders::_1));
++ choke_base_type::back()->down_queue()->set_slot_unchoke(std::bind(&ResourceManager::receive_download_unchoke, this, std::placeholders::_1));
++ choke_base_type::back()->up_queue()->set_slot_can_unchoke(std::bind(&ResourceManager::retrieve_upload_can_unchoke, this));
++ choke_base_type::back()->down_queue()->set_slot_can_unchoke(std::bind(&ResourceManager::retrieve_download_can_unchoke, this));
++ choke_base_type::back()->up_queue()->set_slot_connection(std::bind(&PeerConnectionBase::receive_upload_choke, std::placeholders::_1, std::placeholders::_2));
++ choke_base_type::back()->down_queue()->set_slot_connection(std::bind(&PeerConnectionBase::receive_download_choke, std::placeholders::_1, std::placeholders::_2));
+ }
+
+ ResourceManager::~ResourceManager() {
+--- src/torrent/download_info.h
++++ src/torrent/download_info.h
+@@ -40,7 +40,7 @@
+ #include <list>
+ #include <string>
+ #include <inttypes.h>
+-#include <tr1/functional>
++#include <functional>
+
+ #include <torrent/rate.h>
+ #include <torrent/hash_string.h>
+@@ -54,13 +54,13 @@ class DownloadMain;
+
+ class DownloadInfo {
+ public:
+- typedef std::tr1::function<uint64_t ()> slot_stat_type;
+- typedef std::tr1::function<void (uint32_t)> slot_chunk_type;
++ typedef std::function<uint64_t ()> slot_stat_type;
++ typedef std::function<void (uint32_t)> slot_chunk_type;
+
+- typedef std::list<std::tr1::function<void ()> > signal_void_type;
+- typedef std::list<std::tr1::function<void (const std::string&)> > signal_string_type;
++ typedef std::list<std::function<void ()> > signal_void_type;
++ typedef std::list<std::function<void (const std::string&)> > signal_string_type;
+ typedef std::list<slot_chunk_type> signal_chunk_type;
+- typedef std::list<std::tr1::function<void (const std::string&, const char*, size_t)> > signal_dump_type;
++ typedef std::list<std::function<void (const std::string&, const char*, size_t)> > signal_dump_type;
+
+ enum State {
+ NONE,
+--- src/torrent/http.h
++++ src/torrent/http.h
+@@ -40,7 +40,7 @@
+ #include <string>
+ #include <iosfwd>
+ #include <list>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -51,9 +51,9 @@ namespace torrent {
+ // Keep in mind that these objects get reused.
+ class LIBTORRENT_EXPORT Http {
+ public:
+- typedef std::tr1::function<void ()> slot_void;
+- typedef std::tr1::function<void (const std::string&)> slot_string;
+- typedef std::tr1::function<Http* (void)> slot_http;
++ typedef std::function<void ()> slot_void;
++ typedef std::function<void (const std::string&)> slot_string;
++ typedef std::function<Http* (void)> slot_http;
+
+ typedef std::list<slot_void> signal_void;
+ typedef std::list<slot_string> signal_string;
+--- src/torrent/peer/client_list.cc
++++ src/torrent/peer/client_list.cc
+@@ -38,7 +38,7 @@
+
+ #include <algorithm>
+ #include <rak/string_manip.h>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "client_list.h"
+ #include "exceptions.h"
+@@ -227,7 +227,7 @@ ClientList::retrieve_id(ClientInfo* dest, const HashString& id) const {
+ return false;
+ }
+
+- const_iterator itr = std::find_if(begin() + 1, end(), std::tr1::bind(&ClientInfo::intersects, *dest, std::tr1::placeholders::_1));
++ const_iterator itr = std::find_if(begin() + 1, end(), std::bind(&ClientInfo::intersects, *dest, std::placeholders::_1));
+
+ if (itr == end())
+ dest->set_info(begin()->info());
+--- src/torrent/peer/connection_list.h
++++ src/torrent/peer/connection_list.h
+@@ -39,7 +39,7 @@
+
+ #include <list>
+ #include <vector>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/common.h>
+ #include <torrent/hash_string.h>
+
+@@ -66,7 +66,7 @@ public:
+ typedef std::vector<Peer*> base_type;
+ typedef std::vector<HashString> queue_type;
+ typedef uint32_t size_type;
+- typedef std::tr1::function<void (Peer*)> slot_peer_type;
++ typedef std::function<void (Peer*)> slot_peer_type;
+ typedef std::list<slot_peer_type> signal_peer_type;
+
+ typedef PeerConnectionBase* (*slot_new_conn_type)(bool encrypted);
+--- src/torrent/poll.h
++++ src/torrent/poll.h
+@@ -37,7 +37,7 @@
+ #ifndef LIBTORRENT_TORRENT_POLL_H
+ #define LIBTORRENT_TORRENT_POLL_H
+
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -46,7 +46,7 @@ class Event;
+
+ class LIBTORRENT_EXPORT Poll {
+ public:
+- typedef std::tr1::function<Poll* ()> slot_poll;
++ typedef std::function<Poll* ()> slot_poll;
+
+ static const int poll_worker_thread = 0x1;
+ static const uint32_t flag_waive_global_lock = 0x1;
+--- src/torrent/tracker_controller.cc
++++ src/torrent/tracker_controller.cc
+@@ -50,7 +50,6 @@
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...) \
+ lt_log_print_info(LOG_TRACKER_##log_level, m_tracker_list->info(), "tracker_controller", log_fmt, __VA_ARGS__);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -91,8 +90,8 @@ TrackerController::TrackerController(TrackerList* trackers) :
+ m_tracker_list(trackers),
+ m_private(new tracker_controller_private) {
+
+- m_private->task_timeout.slot() = std::tr1::bind(&TrackerController::do_timeout, this);
+- m_private->task_scrape.slot() = std::tr1::bind(&TrackerController::do_scrape, this);
++ m_private->task_timeout.slot() = std::bind(&TrackerController::do_timeout, this);
++ m_private->task_scrape.slot() = std::bind(&TrackerController::do_scrape, this);
+ }
+
+ TrackerController::~TrackerController() {
+--- src/torrent/tracker_controller.h
++++ src/torrent/tracker_controller.h
+@@ -38,7 +38,7 @@
+ #define LIBTORRENT_TRACKER_CONTROLLER_H
+
+ #include <string>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/common.h>
+ #include <torrent/tracker.h>
+
+@@ -55,10 +55,10 @@ class LIBTORRENT_EXPORT TrackerController {
+ public:
+ typedef AddressList address_list;
+
+- typedef std::tr1::function<void (void)> slot_void;
+- typedef std::tr1::function<void (const std::string&)> slot_string;
+- typedef std::tr1::function<uint32_t (AddressList*)> slot_address_list;
+- typedef std::tr1::function<void (Tracker*)> slot_tracker;
++ typedef std::function<void (void)> slot_void;
++ typedef std::function<void (const std::string&)> slot_string;
++ typedef std::function<uint32_t (AddressList*)> slot_address_list;
++ typedef std::function<void (Tracker*)> slot_tracker;
+
+ static const int flag_send_update = 0x1;
+ static const int flag_send_completed = 0x2;
+--- src/torrent/tracker_list.cc
++++ src/torrent/tracker_list.cc
+@@ -56,7 +56,6 @@
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...) \
+ lt_log_print_info(LOG_TRACKER_##log_level, info(), "tracker_list", log_fmt, __VA_ARGS__);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -221,8 +220,8 @@ TrackerList::insert_url(unsigned int group, const std::string& url, bool extra_t
+
+ TrackerList::iterator
+ TrackerList::find_url(const std::string& url) {
+- return std::find_if(begin(), end(), tr1::bind(std::equal_to<std::string>(), url,
+- tr1::bind(&Tracker::url, tr1::placeholders::_1)));
++ return std::find_if(begin(), end(), std::bind(std::equal_to<std::string>(), url,
++ std::bind(&Tracker::url, std::placeholders::_1)));
+ }
+
+ TrackerList::iterator
+--- src/torrent/tracker_list.h
++++ src/torrent/tracker_list.h
+@@ -41,7 +41,7 @@
+ #include <string>
+ #include <vector>
+ #include <torrent/common.h>
+-#include <tr1/functional>
++#include <functional>
+
+ namespace torrent {
+
+@@ -64,9 +64,9 @@ public:
+ typedef std::vector<Tracker*> base_type;
+ typedef AddressList address_list;
+
+- typedef std::tr1::function<void (Tracker*)> slot_tracker;
+- typedef std::tr1::function<void (Tracker*, const std::string&)> slot_string;
+- typedef std::tr1::function<uint32_t (Tracker*, AddressList*)> slot_address_list;
++ typedef std::function<void (Tracker*)> slot_tracker;
++ typedef std::function<void (Tracker*, const std::string&)> slot_string;
++ typedef std::function<uint32_t (Tracker*, AddressList*)> slot_address_list;
+
+ using base_type::value_type;
+
+--- src/torrent/utils/extents.h
++++ src/torrent/utils/extents.h
+@@ -37,7 +37,7 @@
+ #ifndef LIBTORRENT_UTILS_EXTENTS_H
+ #define LIBTORRENT_UTILS_EXTENTS_H
+
+-#include <tr1/array>
++#include <array>
+
+ namespace torrent {
+
+@@ -48,7 +48,7 @@ struct extents_base {
+ typedef std::pair<extents_base*, Tp> mapped_type;
+ typedef Tp mapped_value_type;
+
+- typedef std::tr1::array<mapped_type, TableSize> table_type;
++ typedef std::array<mapped_type, TableSize> table_type;
+
+ extents_base(key_type pos, unsigned int mb, mapped_value_type val) :
+ mask_bits(mb), position(pos) { table.assign(mapped_type(NULL, mapped_value_type())); }
+--- src/torrent/utils/log.cc
++++ src/torrent/utils/log.cc
+@@ -54,10 +54,9 @@
+ #include <fstream>
+ #include <functional>
+ #include <memory>
+-#include <tr1/functional>
+-#include <tr1/memory>
++#include <functional>
++#include <memory>
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -134,7 +133,7 @@ log_rebuild_cache() {
+
+ log_cache_list::iterator cache_itr =
+ std::find_if(log_cache.begin(), log_cache.end(),
+- tr1::bind(&log_cache_entry::equal_outputs, tr1::placeholders::_1, use_outputs));
++ std::bind(&log_cache_entry::equal_outputs, std::placeholders::_1, use_outputs));
+
+ if (cache_itr == log_cache.end()) {
+ cache_itr = log_cache.insert(log_cache.end(), log_cache_entry());
+@@ -174,14 +173,14 @@ log_group::internal_print(const HashString* hash, const char* subsystem, const v
+ return;
+
+ pthread_mutex_lock(&log_mutex);
+- std::for_each(m_first, m_last, tr1::bind(&log_slot::operator(),
+- tr1::placeholders::_1,
++ std::for_each(m_first, m_last, std::bind(&log_slot::operator(),
++ std::placeholders::_1,
+ buffer,
+ std::distance(buffer, first),
+ std::distance(log_groups.begin(), this)));
+ if (dump_data != NULL)
+ std::for_each(m_first, m_last,
+- tr1::bind(&log_slot::operator(), tr1::placeholders::_1, (const char*)dump_data, dump_size, -1));
++ std::bind(&log_slot::operator(), std::placeholders::_1, (const char*)dump_data, dump_size, -1));
+ pthread_mutex_unlock(&log_mutex);
+ }
+
+@@ -325,7 +324,7 @@ log_remove_child(int group, int child) {
+ const char log_level_char[] = { 'C', 'E', 'W', 'N', 'I', 'D' };
+
+ void
+-log_file_write(tr1::shared_ptr<std::ofstream>& outfile, const char* data, size_t length, int group) {
++log_file_write(std::shared_ptr<std::ofstream>& outfile, const char* data, size_t length, int group) {
+ // Add group name, data, etc as flags.
+
+ // Normal groups are nul-terminated strings.
+@@ -345,14 +344,14 @@ log_file_write(tr1::shared_ptr<std::ofstream>& outfile, const char* data, size_t
+ // etc.
+ void
+ log_open_file_output(const char* name, const char* filename) {
+- tr1::shared_ptr<std::ofstream> outfile(new std::ofstream(filename));
++ std::shared_ptr<std::ofstream> outfile(new std::ofstream(filename));
+
+ if (!outfile->good())
+ throw input_error("Could not open log file '" + std::string(filename) + "'.");
+
+- // log_open_output(name, tr1::bind(&std::ofstream::write, outfile, tr1::placeholders::_1, tr1::placeholders::_2));
+- log_open_output(name, tr1::bind(&log_file_write, outfile,
+- tr1::placeholders::_1, tr1::placeholders::_2, tr1::placeholders::_3));
++ // log_open_output(name, std::bind(&std::ofstream::write, outfile, std::placeholders::_1, std::placeholders::_2));
++ log_open_output(name, std::bind(&log_file_write, outfile,
++ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+ }
+
+ log_buffer*
+@@ -360,8 +359,8 @@ log_open_log_buffer(const char* name) {
+ log_buffer* buffer = new log_buffer;
+
+ try {
+- log_open_output(name, tr1::bind(&log_buffer::lock_and_push_log, buffer,
+- tr1::placeholders::_1, tr1::placeholders::_2, tr1::placeholders::_3));
++ log_open_output(name, std::bind(&log_buffer::lock_and_push_log, buffer,
++ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+ return buffer;
+
+ } catch (torrent::input_error& e) {
+--- src/torrent/utils/log.h
++++ src/torrent/utils/log.h
+@@ -39,8 +39,8 @@
+
+ #include <string>
+ #include <vector>
+-#include <tr1/array>
+-#include <tr1/functional>
++#include <array>
++#include <functional>
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -147,7 +147,7 @@ class DownloadInfo;
+ class download_data;
+ class log_buffer;
+
+-typedef std::tr1::function<void (const char*, unsigned int, int)> log_slot;
++typedef std::function<void (const char*, unsigned int, int)> log_slot;
+ typedef std::vector<std::pair<std::string, log_slot> > log_output_list;
+
+ class LIBTORRENT_EXPORT log_group {
+@@ -185,7 +185,7 @@ private:
+ log_slot* m_last;
+ };
+
+-typedef std::tr1::array<log_group, LOG_GROUP_MAX_SIZE> log_group_list;
++typedef std::array<log_group, LOG_GROUP_MAX_SIZE> log_group_list;
+
+ extern log_group_list log_groups LIBTORRENT_EXPORT;
+ extern log_output_list log_outputs LIBTORRENT_EXPORT;
+--- src/torrent/utils/log_buffer.cc
++++ src/torrent/utils/log_buffer.cc
+@@ -39,11 +39,10 @@
+ #include "log_buffer.h"
+
+ #include <functional>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "globals.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -53,7 +52,7 @@ log_buffer::find_older(int32_t older_than) {
+ if (empty() || !back().is_younger_than(older_than))
+ return end();
+
+- return std::find_if(begin(), end(), tr1::bind(&log_entry::is_younger_or_same, tr1::placeholders::_1, older_than));
++ return std::find_if(begin(), end(), std::bind(&log_entry::is_younger_or_same, std::placeholders::_1, older_than));
+ }
+
+ void
+--- src/torrent/utils/log_buffer.h
++++ src/torrent/utils/log_buffer.h
+@@ -40,7 +40,7 @@
+ #include <string>
+ #include <deque>
+ #include <pthread.h>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -60,7 +60,7 @@ struct log_entry {
+ class LIBTORRENT_EXPORT log_buffer : private std::deque<log_entry> {
+ public:
+ typedef std::deque<log_entry> base_type;
+- typedef std::tr1::function<void ()> slot_void;
++ typedef std::function<void ()> slot_void;
+
+ using base_type::iterator;
+ using base_type::const_iterator;
+--- src/torrent/utils/net.h
++++ src/torrent/utils/net.h
+@@ -38,12 +38,12 @@
+ #define LIBTORRENT_UTILS_NET_H
+
+ #include <netdb.h>
+-#include <tr1/functional>
++#include <functional>
+
+ namespace torrent {
+
+-typedef std::tr1::function<void (sockaddr*, socklen_t)> slot_ai_success;
+-//typedef std::tr1::function<void (const char*, int)> slot_ai_failure;
++typedef std::function<void (sockaddr*, socklen_t)> slot_ai_success;
++//typedef std::function<void (const char*, int)> slot_ai_failure;
+
+ // Throws address_info_error on lookup failure.
+ addrinfo* address_info_lookup(const char* hostname, int family, int socktype);
+--- src/torrent/utils/signal_bitfield.h
++++ src/torrent/utils/signal_bitfield.h
+@@ -37,7 +37,7 @@
+ #ifndef LIBTORRENT_UTILS_SIGNAL_BITFIELD_H
+ #define LIBTORRENT_UTILS_SIGNAL_BITFIELD_H
+
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -45,7 +45,7 @@ namespace torrent {
+ class LIBTORRENT_EXPORT lt_cacheline_aligned signal_bitfield {
+ public:
+ typedef uint32_t bitfield_type;
+- typedef std::tr1::function<void ()> slot_type;
++ typedef std::function<void ()> slot_type;
+
+ static const unsigned int max_size = 32;
+
+--- src/torrent/utils/thread_base.h
++++ src/torrent/utils/thread_base.h
+@@ -41,7 +41,7 @@
+ #include <sys/types.h>
+ #include <torrent/common.h>
+ #include <torrent/utils/signal_bitfield.h>
+-#include <tr1/functional>
++#include <functional>
+
+ namespace torrent {
+
+@@ -50,8 +50,8 @@ class Poll;
+ class LIBTORRENT_EXPORT lt_cacheline_aligned thread_base {
+ public:
+ typedef void* (*pthread_func)(void*);
+- typedef std::tr1::function<void ()> slot_void;
+- typedef std::tr1::function<uint64_t ()> slot_timer;
++ typedef std::function<void ()> slot_void;
++ typedef std::function<uint64_t ()> slot_timer;
+ typedef class signal_bitfield signal_type;
+
+ enum state_type {
+--- src/tracker/tracker_http.cc
++++ src/tracker/tracker_http.cc
+@@ -64,7 +64,6 @@
+ #define LT_LOG_TRACKER_DUMP(log_level, log_dump_data, log_dump_size, log_fmt, ...) \
+ lt_log_print_info_dump(LOG_TRACKER_##log_level, log_dump_data, log_dump_size, m_parent->info(), "tracker", "[%u] " log_fmt, group(), __VA_ARGS__);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ namespace torrent {
+
+@@ -74,8 +73,8 @@ TrackerHttp::TrackerHttp(TrackerList* parent, const std::string& url, int flags)
+ m_get(Http::slot_factory()()),
+ m_data(NULL) {
+
+- m_get->signal_done().push_back(tr1::bind(&TrackerHttp::receive_done, this));
+- m_get->signal_failed().push_back(tr1::bind(&TrackerHttp::receive_failed, this, tr1::placeholders::_1));
++ m_get->signal_done().push_back(std::bind(&TrackerHttp::receive_done, this));
++ m_get->signal_failed().push_back(std::bind(&TrackerHttp::receive_failed, this, std::placeholders::_1));
+
+ // Haven't considered if this needs any stronger error detection,
+ // can dropping the '?' be used for malicious purposes?
+--- src/tracker/tracker_udp.cc
++++ src/tracker/tracker_udp.cc
+@@ -55,7 +55,6 @@
+ #include "tracker_udp.h"
+ #include "manager.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...) \
+ lt_log_print_info(LOG_TRACKER_##log_level, m_parent->info(), "tracker", "[%u] " log_fmt, group(), __VA_ARGS__);
+@@ -72,7 +71,7 @@ TrackerUdp::TrackerUdp(TrackerList* parent, const std::string& url, int flags) :
+ m_readBuffer(NULL),
+ m_writeBuffer(NULL) {
+
+- m_taskTimeout.slot() = std::tr1::bind(&TrackerUdp::receive_timeout, this);
++ m_taskTimeout.slot() = std::bind(&TrackerUdp::receive_timeout, this);
+ }
+
+ TrackerUdp::~TrackerUdp() {
+@@ -110,10 +109,10 @@ TrackerUdp::send_state(int state) {
+
+ m_sendState = state;
+ m_slot_resolver = manager->connection_manager()->resolver()(hostname, PF_INET, SOCK_DGRAM,
+- tr1::bind(&TrackerUdp::start_announce,
++ std::bind(&TrackerUdp::start_announce,
+ this,
+- tr1::placeholders::_1,
+- tr1::placeholders::_2));
++ std::placeholders::_1,
++ std::placeholders::_2));
+ }
+
+ void
+--- test/data/chunk_list_test.cc
++++ test/data/chunk_list_test.cc
+@@ -7,7 +7,6 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(ChunkListTest);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ torrent::Chunk*
+ func_create_chunk(uint32_t index, int prot_flags) {
+--- test/data/chunk_list_test.h
++++ test/data/chunk_list_test.h
+@@ -26,9 +26,9 @@ void func_storage_error(torrent::ChunkList* chunk_list, const std::st
+ torrent::ChunkManager* chunk_manager = new torrent::ChunkManager; \
+ torrent::ChunkList* chunk_list = new torrent::ChunkList; \
+ chunk_list->set_manager(chunk_manager); \
+- chunk_list->slot_create_chunk() = tr1::bind(&func_create_chunk, tr1::placeholders::_1, tr1::placeholders::_2); \
+- chunk_list->slot_free_diskspace() = tr1::bind(&func_free_diskspace, chunk_list); \
+- chunk_list->slot_storage_error() = tr1::bind(&func_storage_error, chunk_list, tr1::placeholders::_1); \
++ chunk_list->slot_create_chunk() = std::bind(&func_create_chunk, std::placeholders::_1, std::placeholders::_2); \
++ chunk_list->slot_free_diskspace() = std::bind(&func_free_diskspace, chunk_list); \
++ chunk_list->slot_storage_error() = std::bind(&func_storage_error, chunk_list, std::placeholders::_1); \
+ chunk_list->set_chunk_size(1 << 16); \
+ chunk_list->resize(32);
+
+--- test/data/hash_check_queue_test.cc
++++ test/data/hash_check_queue_test.cc
+@@ -1,7 +1,7 @@
+ #include "config.h"
+
+ #include <signal.h>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "data/hash_queue_node.h"
+ #include "utils/sha1.h"
+@@ -16,7 +16,6 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(HashCheckQueueTest);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ pthread_mutex_t done_chunks_lock = PTHREAD_MUTEX_INITIALIZER;
+
+@@ -71,7 +70,7 @@ static void do_nothing() {}
+
+ void
+ HashCheckQueueTest::setUp() {
+- torrent::Poll::slot_create_poll() = tr1::bind(&create_select_poll);
++ torrent::Poll::slot_create_poll() = std::bind(&create_select_poll);
+
+ signal(SIGUSR1, (sig_t)&do_nothing);
+ }
+@@ -90,7 +89,7 @@ HashCheckQueueTest::test_single() {
+ torrent::HashCheckQueue hash_queue;
+
+ done_chunks_type done_chunks;
+- hash_queue.slot_chunk_done() = tr1::bind(&chunk_done, &done_chunks, tr1::placeholders::_1, tr1::placeholders::_2);
++ hash_queue.slot_chunk_done() = std::bind(&chunk_done, &done_chunks, std::placeholders::_1, std::placeholders::_2);
+
+ torrent::ChunkHandle handle_0 = chunk_list->get(0, torrent::ChunkList::get_blocking);
+
+@@ -117,7 +116,7 @@ HashCheckQueueTest::test_multiple() {
+ torrent::HashCheckQueue hash_queue;
+
+ done_chunks_type done_chunks;
+- hash_queue.slot_chunk_done() = tr1::bind(&chunk_done, &done_chunks, tr1::placeholders::_1, tr1::placeholders::_2);
++ hash_queue.slot_chunk_done() = std::bind(&chunk_done, &done_chunks, std::placeholders::_1, std::placeholders::_2);
+
+ handle_list handles;
+
+@@ -150,7 +149,7 @@ HashCheckQueueTest::test_erase() {
+ // torrent::HashCheckQueue hash_queue;
+
+ // done_chunks_type done_chunks;
+- // hash_queue.slot_chunk_done() = tr1::bind(&chunk_done, &done_chunks, tr1::placeholders::_1, tr1::placeholders::_2);
++ // hash_queue.slot_chunk_done() = std::bind(&chunk_done, &done_chunks, std::placeholders::_1, std::placeholders::_2);
+
+ // handle_list handles;
+
+@@ -186,7 +185,7 @@ HashCheckQueueTest::test_thread() {
+ torrent::HashCheckQueue* hash_queue = thread_disk->hash_queue();
+
+ done_chunks_type done_chunks;
+- hash_queue->slot_chunk_done() = tr1::bind(&chunk_done, &done_chunks, tr1::placeholders::_1, tr1::placeholders::_2);
++ hash_queue->slot_chunk_done() = std::bind(&chunk_done, &done_chunks, std::placeholders::_1, std::placeholders::_2);
+
+ for (int i = 0; i < 1000; i++) {
+ pthread_mutex_lock(&done_chunks_lock);
+@@ -198,7 +197,7 @@ HashCheckQueueTest::test_thread() {
+ hash_queue->push_back(new torrent::HashChunk(handle_0));
+ thread_disk->interrupt();
+
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&verify_hash, &done_chunks, 0, hash_for_index(0))));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&verify_hash, &done_chunks, 0, hash_for_index(0))));
+ chunk_list->release(&handle_0);
+ }
+
+--- test/data/hash_queue_test.cc
++++ test/data/hash_queue_test.cc
+@@ -1,7 +1,7 @@
+ #include "config.h"
+
+ #include <signal.h>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "data/hash_queue_node.h"
+ #include "torrent/chunk_manager.h"
+@@ -18,7 +18,6 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(HashQueueTest);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ typedef std::map<int, torrent::HashString> done_chunks_type;
+
+@@ -44,7 +43,7 @@ void
+ HashQueueTest::setUp() {
+ CPPUNIT_ASSERT(torrent::taskScheduler.empty());
+
+- torrent::Poll::slot_create_poll() = tr1::bind(&create_select_poll);
++ torrent::Poll::slot_create_poll() = std::bind(&create_select_poll);
+ signal(SIGUSR1, (sig_t)&do_nothing);
+ }
+
+@@ -82,10 +81,10 @@ HashQueueTest::test_single() {
+
+ done_chunks_type done_chunks;
+ torrent::HashQueue* hash_queue = new torrent::HashQueue(thread_disk);
+- hash_queue->slot_has_work() = tr1::bind(&fill_queue);
++ hash_queue->slot_has_work() = std::bind(&fill_queue);
+
+ torrent::ChunkHandle handle_0 = chunk_list->get(0, torrent::ChunkList::get_blocking);
+- hash_queue->push_back(handle_0, NULL, tr1::bind(&chunk_done, chunk_list, &done_chunks, tr1::placeholders::_1, tr1::placeholders::_2));
++ hash_queue->push_back(handle_0, NULL, std::bind(&chunk_done, chunk_list, &done_chunks, std::placeholders::_1, std::placeholders::_2));
+
+ CPPUNIT_ASSERT(hash_queue->size() == 1);
+ CPPUNIT_ASSERT(hash_queue->front().handle().is_blocking());
+@@ -93,7 +92,7 @@ HashQueueTest::test_single() {
+
+ hash_queue->work();
+
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&check_for_chunk_done, hash_queue, &done_chunks, 0)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&check_for_chunk_done, hash_queue, &done_chunks, 0)));
+ CPPUNIT_ASSERT(done_chunks[0] == hash_for_index(0));
+
+ // chunk_list->release(&handle_0);
+@@ -114,11 +113,11 @@ HashQueueTest::test_multiple() {
+
+ done_chunks_type done_chunks;
+ torrent::HashQueue* hash_queue = new torrent::HashQueue(thread_disk);
+- hash_queue->slot_has_work() = tr1::bind(&fill_queue);
++ hash_queue->slot_has_work() = std::bind(&fill_queue);
+
+ for (unsigned int i = 0; i < 20; i++) {
+ hash_queue->push_back(chunk_list->get(i, torrent::ChunkList::get_blocking),
+- NULL, tr1::bind(&chunk_done, chunk_list, &done_chunks, tr1::placeholders::_1, tr1::placeholders::_2));
++ NULL, std::bind(&chunk_done, chunk_list, &done_chunks, std::placeholders::_1, std::placeholders::_2));
+
+ CPPUNIT_ASSERT(hash_queue->size() == i + 1);
+ CPPUNIT_ASSERT(hash_queue->back().handle().is_blocking());
+@@ -126,7 +125,7 @@ HashQueueTest::test_multiple() {
+ }
+
+ for (unsigned int i = 0; i < 20; i++) {
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&check_for_chunk_done, hash_queue, &done_chunks, i)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&check_for_chunk_done, hash_queue, &done_chunks, i)));
+ CPPUNIT_ASSERT(done_chunks[i] == hash_for_index(i));
+ }
+
+@@ -144,13 +143,13 @@ HashQueueTest::test_erase() {
+ SETUP_THREAD();
+
+ torrent::HashQueue* hash_queue = new torrent::HashQueue(thread_disk);
+- hash_queue->slot_has_work() = tr1::bind(&fill_queue);
++ hash_queue->slot_has_work() = std::bind(&fill_queue);
+
+ done_chunks_type done_chunks;
+
+ for (unsigned int i = 0; i < 20; i++) {
+ hash_queue->push_back(chunk_list->get(i, torrent::ChunkList::get_blocking),
+- NULL, tr1::bind(&chunk_done, chunk_list, &done_chunks, tr1::placeholders::_1, tr1::placeholders::_2));
++ NULL, std::bind(&chunk_done, chunk_list, &done_chunks, std::placeholders::_1, std::placeholders::_2));
+
+ CPPUNIT_ASSERT(hash_queue->size() == i + 1);
+ }
+@@ -172,14 +171,14 @@ HashQueueTest::test_erase_stress() {
+ thread_disk->start_thread();
+
+ torrent::HashQueue* hash_queue = new torrent::HashQueue(thread_disk);
+- hash_queue->slot_has_work() = tr1::bind(&fill_queue);
++ hash_queue->slot_has_work() = std::bind(&fill_queue);
+
+ done_chunks_type done_chunks;
+
+ for (unsigned int i = 0; i < 1000; i++) {
+ for (unsigned int i = 0; i < 20; i++) {
+ hash_queue->push_back(chunk_list->get(i, torrent::ChunkList::get_blocking),
+- NULL, tr1::bind(&chunk_done, chunk_list, &done_chunks, tr1::placeholders::_1, tr1::placeholders::_2));
++ NULL, std::bind(&chunk_done, chunk_list, &done_chunks, std::placeholders::_1, std::placeholders::_2));
+
+ CPPUNIT_ASSERT(hash_queue->size() == i + 1);
+ }
+--- test/torrent/http_test.cc
++++ test/torrent/http_test.cc
+@@ -18,8 +18,8 @@ CPPUNIT_TEST_SUITE_REGISTRATION(HttpTest);
+ int failed_counter = 0; \
+ \
+ http->set_stream(http_stream); \
+- http->signal_done().push_back(std::tr1::bind(&increment_value, &done_counter)); \
+- http->signal_failed().push_back(std::tr1::bind(&increment_value, &failed_counter));
++ http->signal_done().push_back(std::bind(&increment_value, &done_counter)); \
++ http->signal_failed().push_back(std::bind(&increment_value, &failed_counter));
+
+ class StringStream : public std::stringstream {
+ public:
+@@ -73,7 +73,7 @@ static void increment_value(int* value) { (*value)++; }
+
+ void
+ HttpTest::test_basic() {
+- torrent::Http::slot_factory() = std::tr1::bind(&create_test_http);
++ torrent::Http::slot_factory() = std::bind(&create_test_http);
+
+ torrent::Http* http = torrent::Http::slot_factory()();
+ std::stringstream* http_stream = new std::stringstream;
+--- test/torrent/tracker_controller_features.cc
++++ test/torrent/tracker_controller_features.cc
+@@ -1,7 +1,7 @@
+ #include "config.h"
+
+ #include <iostream>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "rak/priority_queue_default.h"
+
+@@ -9,7 +9,6 @@
+ #include "tracker_list_test.h"
+ #include "tracker_controller_features.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(tracker_controller_features);
+
+--- test/torrent/tracker_controller_requesting.cc
++++ test/torrent/tracker_controller_requesting.cc
+@@ -1,7 +1,7 @@
+ #include "config.h"
+
+ #include <iostream>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "rak/priority_queue_default.h"
+
+@@ -9,7 +9,6 @@
+ #include "tracker_list_test.h"
+ #include "tracker_controller_requesting.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(tracker_controller_requesting);
+
+--- test/torrent/tracker_controller_test.cc
++++ test/torrent/tracker_controller_test.cc
+@@ -1,7 +1,7 @@
+ #include "config.h"
+
+ #include <iostream>
+-#include <tr1/functional>
++#include <functional>
+
+ #include "rak/priority_queue_default.h"
+
+@@ -9,7 +9,6 @@
+ #include "tracker_list_test.h"
+ #include "tracker_controller_test.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(tracker_controller_test);
+
+--- test/torrent/tracker_controller_test.h
++++ test/torrent/tracker_controller_test.h
+@@ -78,16 +78,16 @@ public:
+ int enabled_counter = 0; \
+ int disabled_counter = 0; \
+ \
+- tracker_controller.slot_success() = tr1::bind(&increment_value, &success_counter); \
+- tracker_controller.slot_failure() = tr1::bind(&increment_value, &failure_counter); \
+- tracker_controller.slot_timeout() = tr1::bind(&increment_value, &timeout_counter); \
+- tracker_controller.slot_tracker_enabled() = tr1::bind(&increment_value, &enabled_counter); \
+- tracker_controller.slot_tracker_disabled() = tr1::bind(&increment_value, &disabled_counter); \
++ tracker_controller.slot_success() = std::bind(&increment_value, &success_counter); \
++ tracker_controller.slot_failure() = std::bind(&increment_value, &failure_counter); \
++ tracker_controller.slot_timeout() = std::bind(&increment_value, &timeout_counter); \
++ tracker_controller.slot_tracker_enabled() = std::bind(&increment_value, &enabled_counter); \
++ tracker_controller.slot_tracker_disabled() = std::bind(&increment_value, &disabled_counter); \
+ \
+- tracker_list.slot_success() = tr1::bind(&torrent::TrackerController::receive_success, &tracker_controller, tr1::placeholders::_1, tr1::placeholders::_2); \
+- tracker_list.slot_failure() = tr1::bind(&torrent::TrackerController::receive_failure, &tracker_controller, tr1::placeholders::_1, tr1::placeholders::_2); \
+- tracker_list.slot_tracker_enabled() = tr1::bind(&torrent::TrackerController::receive_tracker_enabled, &tracker_controller, tr1::placeholders::_1); \
+- tracker_list.slot_tracker_disabled() = tr1::bind(&torrent::TrackerController::receive_tracker_disabled, &tracker_controller, tr1::placeholders::_1);
++ tracker_list.slot_success() = std::bind(&torrent::TrackerController::receive_success, &tracker_controller, std::placeholders::_1, std::placeholders::_2); \
++ tracker_list.slot_failure() = std::bind(&torrent::TrackerController::receive_failure, &tracker_controller, std::placeholders::_1, std::placeholders::_2); \
++ tracker_list.slot_tracker_enabled() = std::bind(&torrent::TrackerController::receive_tracker_enabled, &tracker_controller, std::placeholders::_1); \
++ tracker_list.slot_tracker_disabled() = std::bind(&torrent::TrackerController::receive_tracker_disabled, &tracker_controller, std::placeholders::_1);
+
+ #define TEST_SINGLE_BEGIN() \
+ TRACKER_CONTROLLER_SETUP(); \
+--- test/torrent/tracker_list_features_test.cc
++++ test/torrent/tracker_list_features_test.cc
+@@ -1,6 +1,6 @@
+ #include "config.h"
+
+-#include <tr1/functional>
++#include <functional>
+
+ #include "torrent/http.h"
+ #include "net/address_list.h"
+@@ -9,7 +9,6 @@
+ #include "tracker_list_test.h"
+ #include "tracker_list_features_test.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(tracker_list_features_test);
+
+@@ -182,7 +181,7 @@ tracker_list_features_test::test_count_active() {
+
+
+ bool
+-verify_did_internal_error(tr1::function<void ()> func, bool should_throw) {
++verify_did_internal_error(std::function<void ()> func, bool should_throw) {
+ bool did_throw = false;
+
+ try {
+@@ -203,28 +202,28 @@ tracker_list_features_test::test_request_safeguard() {
+ TRACKER_INSERT(0, tracker_foo);
+
+ for (unsigned int i = 0; i < 9; i++) {
+- CPPUNIT_ASSERT(verify_did_internal_error(tr1::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_1, 1), false));
++ CPPUNIT_ASSERT(verify_did_internal_error(std::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_1, 1), false));
+ CPPUNIT_ASSERT(tracker_1->trigger_success());
+ CPPUNIT_ASSERT(tracker_1->success_counter() == (i + 1));
+ }
+
+- CPPUNIT_ASSERT(verify_did_internal_error(tr1::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_1, 1), true));
++ CPPUNIT_ASSERT(verify_did_internal_error(std::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_1, 1), true));
+ CPPUNIT_ASSERT(tracker_1->trigger_success());
+
+ torrent::cachedTime += rak::timer::from_seconds(1000);
+
+ for (unsigned int i = 0; i < 9; i++) {
+- CPPUNIT_ASSERT(verify_did_internal_error(tr1::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_foo, 1), false));
++ CPPUNIT_ASSERT(verify_did_internal_error(std::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_foo, 1), false));
+ CPPUNIT_ASSERT(tracker_foo->trigger_success());
+ CPPUNIT_ASSERT(tracker_foo->success_counter() == (i + 1));
+ CPPUNIT_ASSERT(tracker_foo->is_usable());
+ }
+
+- CPPUNIT_ASSERT(verify_did_internal_error(tr1::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_foo, 1), true));
++ CPPUNIT_ASSERT(verify_did_internal_error(std::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_foo, 1), true));
+ CPPUNIT_ASSERT(tracker_foo->trigger_success());
+
+ for (unsigned int i = 0; i < 40; i++) {
+- CPPUNIT_ASSERT(verify_did_internal_error(tr1::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_2, 1), false));
++ CPPUNIT_ASSERT(verify_did_internal_error(std::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_2, 1), false));
+ CPPUNIT_ASSERT(tracker_2->trigger_success());
+ CPPUNIT_ASSERT(tracker_2->success_counter() == (i + 1));
+
+@@ -232,7 +231,7 @@ tracker_list_features_test::test_request_safeguard() {
+ }
+
+ for (unsigned int i = 0; i < 17; i++) {
+- CPPUNIT_ASSERT(verify_did_internal_error(tr1::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_3, 1), false));
++ CPPUNIT_ASSERT(verify_did_internal_error(std::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_3, 1), false));
+ CPPUNIT_ASSERT(tracker_3->trigger_success());
+ CPPUNIT_ASSERT(tracker_3->success_counter() == (i + 1));
+
+@@ -240,6 +239,6 @@ tracker_list_features_test::test_request_safeguard() {
+ torrent::cachedTime += rak::timer::from_seconds(1);
+ }
+
+- CPPUNIT_ASSERT(verify_did_internal_error(tr1::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_3, 1), true));
++ CPPUNIT_ASSERT(verify_did_internal_error(std::bind(&torrent::TrackerList::send_state, &tracker_list, tracker_3, 1), true));
+ CPPUNIT_ASSERT(tracker_3->trigger_success());
+ }
+--- test/torrent/tracker_list_test.cc
++++ test/torrent/tracker_list_test.cc
+@@ -6,7 +6,6 @@
+ #include "globals.h"
+ #include "tracker_list_test.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(tracker_list_test);
+
+@@ -101,8 +100,8 @@ tracker_list_test::test_enable() {
+ int enabled_counter = 0;
+ int disabled_counter = 0;
+
+- tracker_list.slot_tracker_enabled() = tr1::bind(&increment_value, &enabled_counter);
+- tracker_list.slot_tracker_disabled() = tr1::bind(&increment_value, &disabled_counter);
++ tracker_list.slot_tracker_enabled() = std::bind(&increment_value, &enabled_counter);
++ tracker_list.slot_tracker_disabled() = std::bind(&increment_value, &disabled_counter);
+
+ TRACKER_INSERT(0, tracker_0);
+ TRACKER_INSERT(1, tracker_1);
+@@ -208,7 +207,7 @@ tracker_list_test::test_find_url() {
+ void
+ tracker_list_test::test_can_scrape() {
+ TRACKER_SETUP();
+- torrent::Http::slot_factory() = std::tr1::bind(&http_factory);
++ torrent::Http::slot_factory() = std::bind(&http_factory);
+
+ tracker_list.insert_url(0, "http://example.com/announce");
+ CPPUNIT_ASSERT((tracker_list.back()->flags() & torrent::Tracker::flag_can_scrape));
+--- test/torrent/tracker_list_test.h
++++ test/torrent/tracker_list_test.h
+@@ -107,10 +107,10 @@ bool check_has_active_in_group(const torrent::TrackerList* tracker_list, const c
+ int failure_counter = 0; \
+ int scrape_success_counter = 0; \
+ int scrape_failure_counter = 0; \
+- tracker_list.slot_success() = tr1::bind(&increment_value, &success_counter); \
+- tracker_list.slot_failure() = tr1::bind(&increment_value, &failure_counter); \
+- tracker_list.slot_scrape_success() = tr1::bind(&increment_value, &scrape_success_counter); \
+- tracker_list.slot_scrape_failure() = tr1::bind(&increment_value, &scrape_failure_counter);
++ tracker_list.slot_success() = std::bind(&increment_value, &success_counter); \
++ tracker_list.slot_failure() = std::bind(&increment_value, &failure_counter); \
++ tracker_list.slot_scrape_success() = std::bind(&increment_value, &scrape_success_counter); \
++ tracker_list.slot_scrape_failure() = std::bind(&increment_value, &scrape_failure_counter);
+
+ #define TRACKER_INSERT(group, name) \
+ TrackerTest* name = new TrackerTest(&tracker_list, ""); \
+--- test/torrent/tracker_timeout_test.cc
++++ test/torrent/tracker_timeout_test.cc
+@@ -9,7 +9,6 @@
+ #include "tracker_list_test.h"
+ #include "tracker_timeout_test.h"
+
+-namespace tr1 { using namespace std::tr1; }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(tracker_timeout_test);
+
+--- test/torrent/utils/log_buffer_test.cc
++++ test/torrent/utils/log_buffer_test.cc
+@@ -7,7 +7,6 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(utils_log_buffer_test);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ void
+ utils_log_buffer_test::setUp() {
+--- test/torrent/utils/log_test.cc
++++ test/torrent/utils/log_test.cc
+@@ -4,7 +4,7 @@
+ #include <cstring>
+ #include <fstream>
+ #include <iostream>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/exceptions.h>
+ #include <torrent/utils/log.h>
+
+@@ -12,7 +12,6 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(utils_log_test);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ const char* expected_output = NULL;
+ unsigned int output_mask;
+@@ -47,12 +46,12 @@ utils_log_test::test_basic() {
+ CPPUNIT_ASSERT(torrent::log_groups.size() == torrent::LOG_GROUP_MAX_SIZE);
+
+ CPPUNIT_ASSERT(std::find_if(torrent::log_groups.begin(), torrent::log_groups.end(),
+- tr1::bind(&torrent::log_group::valid, tr1::placeholders::_1)) == torrent::log_groups.end());
++ std::bind(&torrent::log_group::valid, std::placeholders::_1)) == torrent::log_groups.end());
+ }
+
+ inline void
+ open_output(const char* name, int mask = 0) {
+- torrent::log_open_output(name, tr1::bind(&::test_output, tr1::placeholders::_1, tr1::placeholders::_2, mask));
++ torrent::log_open_output(name, std::bind(&::test_output, std::placeholders::_1, std::placeholders::_2, mask));
+ }
+
+ void
+--- test/torrent/utils/net_test.cc
++++ test/torrent/utils/net_test.cc
+@@ -7,13 +7,12 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(utils_net_test);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ static void inc_value(int* value) { (*value)++; }
+
+ #define LTUNIT_AI_CALL(lt_ai, lt_flags) { \
+ int test_value = 0; \
+- CPPUNIT_ASSERT(torrent::address_info_call(ai, 0, tr1::bind(&inc_value, &test_value))); \
++ CPPUNIT_ASSERT(torrent::address_info_call(ai, 0, std::bind(&inc_value, &test_value))); \
+ CPPUNIT_ASSERT(test_value); } \
+
+ void
+--- test/torrent/utils/option_strings_test.cc
++++ test/torrent/utils/option_strings_test.cc
+@@ -2,7 +2,7 @@
+
+ #include <fstream>
+ #include <iostream>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/exceptions.h>
+ #include <torrent/utils/option_strings.h>
+
+@@ -17,7 +17,6 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(option_strings_test);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ void
+ option_strings_test::test_basic() {
+--- test/torrent/utils/signal_bitfield_test.cc
++++ test/torrent/utils/signal_bitfield_test.cc
+@@ -9,7 +9,6 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(utils_signal_bitfield_test);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ static void
+ mark_index(uint32_t* bitfield, unsigned int index) {
+@@ -32,7 +31,7 @@ utils_signal_bitfield_test::tearDown() {
+ }
+
+ static bool
+-verify_did_internal_error(tr1::function<void ()> func, bool should_throw) {
++verify_did_internal_error(std::function<void ()> func, bool should_throw) {
+ bool did_throw = false;
+
+ try {
+@@ -50,7 +49,7 @@ verify_did_internal_error(tr1::function<void ()> func, bool should_throw) {
+
+
+ #define SIGNAL_BITFIELD_DID_INTERNAL_ERROR(verify_slot, did_throw) \
+- CPPUNIT_ASSERT(verify_did_internal_error(tr1::bind(&torrent::signal_bitfield::add_signal, \
++ CPPUNIT_ASSERT(verify_did_internal_error(std::bind(&torrent::signal_bitfield::add_signal, \
+ &signal_bitfield, \
+ torrent::signal_bitfield::slot_type(verify_slot)), \
+ did_throw));
+@@ -64,16 +63,16 @@ utils_signal_bitfield_test::test_basic() {
+ SIGNAL_BITFIELD_DID_INTERNAL_ERROR(torrent::signal_bitfield::slot_type(), true);
+
+ for (unsigned int i = 0; i < torrent::signal_bitfield::max_size; i++)
+- CPPUNIT_ASSERT(signal_bitfield.add_signal(tr1::bind(&mark_index, &marked_bitfield, i)) == i);
++ CPPUNIT_ASSERT(signal_bitfield.add_signal(std::bind(&mark_index, &marked_bitfield, i)) == i);
+
+- SIGNAL_BITFIELD_DID_INTERNAL_ERROR(tr1::bind(&mark_index, &marked_bitfield, torrent::signal_bitfield::max_size), true);
++ SIGNAL_BITFIELD_DID_INTERNAL_ERROR(std::bind(&mark_index, &marked_bitfield, torrent::signal_bitfield::max_size), true);
+ }
+
+ void
+ utils_signal_bitfield_test::test_single() {
+ SETUP_SIGNAL_BITFIELD();
+
+- CPPUNIT_ASSERT(signal_bitfield.add_signal(tr1::bind(&mark_index, &marked_bitfield, 0)) == 0);
++ CPPUNIT_ASSERT(signal_bitfield.add_signal(std::bind(&mark_index, &marked_bitfield, 0)) == 0);
+
+ signal_bitfield.signal(0);
+ CPPUNIT_ASSERT(marked_bitfield == 0x0);
+@@ -92,7 +91,7 @@ utils_signal_bitfield_test::test_multiple() {
+ SETUP_SIGNAL_BITFIELD();
+
+ for (unsigned int i = 0; i < torrent::signal_bitfield::max_size; i++)
+- CPPUNIT_ASSERT(signal_bitfield.add_signal(tr1::bind(&mark_index, &marked_bitfield, i)) == i);
++ CPPUNIT_ASSERT(signal_bitfield.add_signal(std::bind(&mark_index, &marked_bitfield, i)) == i);
+
+ signal_bitfield.signal(2);
+ signal_bitfield.signal(31);
+@@ -114,7 +113,7 @@ utils_signal_bitfield_test::test_thread() {
+ // thread->set_test_flag(thread_test::test_flag_long_timeout);
+
+ for (unsigned int i = 0; i < torrent::signal_bitfield::max_size; i++)
+- CPPUNIT_ASSERT(thread->signal_bitfield()->add_signal(tr1::bind(&mark_index, &marked_bitfield, i)) == i);
++ CPPUNIT_ASSERT(thread->signal_bitfield()->add_signal(std::bind(&mark_index, &marked_bitfield, i)) == i);
+
+ thread->init_thread();
+ thread->start_thread();
+@@ -128,12 +127,12 @@ utils_signal_bitfield_test::test_thread() {
+ thread->signal_bitfield()->signal(i % 20);
+ // thread->interrupt();
+
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&check_index, &marked_bitfield, i % 20)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&check_index, &marked_bitfield, i % 20)));
+ __sync_fetch_and_and(&marked_bitfield, ~uint32_t());
+ }
+
+ thread->stop_thread();
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&thread_test::is_state, thread, thread_test::STATE_INACTIVE)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&thread_test::is_state, thread, thread_test::STATE_INACTIVE)));
+
+ delete thread;
+ }
+--- test/torrent/utils/thread_base_test.cc
++++ test/torrent/utils/thread_base_test.cc
+@@ -1,7 +1,7 @@
+ #include "config.h"
+
+ #include <unistd.h>
+-#include <tr1/functional>
++#include <functional>
+ #include <torrent/exceptions.h>
+ #include <torrent/poll_select.h>
+ #include <torrent/utils/thread_base.h>
+@@ -10,7 +10,6 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(utils_thread_base_test);
+
+-namespace tr1 { using namespace std::tr1; }
+
+ void throw_shutdown_exception() { throw torrent::shutdown_exception(); }
+
+@@ -58,7 +57,7 @@ thread_test::call_events() {
+ }
+
+ bool
+-wait_for_true(std::tr1::function<bool ()> test_function) {
++wait_for_true(std::function<bool ()> test_function) {
+ int i = 100;
+
+ do {
+@@ -108,15 +107,15 @@ utils_thread_base_test::test_lifecycle() {
+ CPPUNIT_ASSERT(thread->test_state() == thread_test::TEST_PRE_START);
+
+ thread->set_pre_stop();
+- CPPUNIT_ASSERT(!wait_for_true(tr1::bind(&thread_test::is_test_state, thread, thread_test::TEST_PRE_STOP)));
++ CPPUNIT_ASSERT(!wait_for_true(std::bind(&thread_test::is_test_state, thread, thread_test::TEST_PRE_STOP)));
+
+ thread->start_thread();
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&thread_test::is_state, thread, thread_test::STATE_ACTIVE)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&thread_test::is_state, thread, thread_test::STATE_ACTIVE)));
+ CPPUNIT_ASSERT(thread->is_active());
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&thread_test::is_test_state, thread, thread_test::TEST_PRE_STOP)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&thread_test::is_test_state, thread, thread_test::TEST_PRE_STOP)));
+
+ thread->stop_thread();
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&thread_test::is_state, thread, thread_test::STATE_INACTIVE)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&thread_test::is_state, thread, thread_test::STATE_INACTIVE)));
+ CPPUNIT_ASSERT(thread->is_inactive());
+
+ delete thread;
+@@ -144,10 +143,10 @@ utils_thread_base_test::test_global_lock_basic() {
+ CPPUNIT_ASSERT(!torrent::thread_base::trylock_global_lock());
+
+ thread->set_acquire_global();
+- CPPUNIT_ASSERT(!wait_for_true(tr1::bind(&thread_test::is_test_flags, thread, thread_test::test_flag_has_global)));
++ CPPUNIT_ASSERT(!wait_for_true(std::bind(&thread_test::is_test_flags, thread, thread_test::test_flag_has_global)));
+
+ torrent::thread_base::release_global_lock();
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&thread_test::is_test_flags, thread, thread_test::test_flag_has_global)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&thread_test::is_test_flags, thread, thread_test::test_flag_has_global)));
+
+ CPPUNIT_ASSERT(!torrent::thread_base::trylock_global_lock());
+ torrent::thread_base::release_global_lock();
+@@ -159,7 +158,7 @@ utils_thread_base_test::test_global_lock_basic() {
+
+ torrent::thread_base::release_global_lock();
+ thread->stop_thread();
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&thread_test::is_state, thread, thread_test::STATE_INACTIVE)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&thread_test::is_state, thread, thread_test::STATE_INACTIVE)));
+
+ delete thread;
+ }
+@@ -182,11 +181,11 @@ utils_thread_base_test::test_interrupt() {
+ thread->interrupt();
+
+ // Wait for flag to clear.
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&thread_test::is_not_test_flags, thread, thread_test::test_flag_do_work)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&thread_test::is_not_test_flags, thread, thread_test::test_flag_do_work)));
+ }
+
+ thread->stop_thread();
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&thread_test::is_state, thread, thread_test::STATE_INACTIVE)));
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&thread_test::is_state, thread, thread_test::STATE_INACTIVE)));
+
+ delete thread;
+ }
+--- test/torrent/utils/thread_base_test.h
++++ test/torrent/utils/thread_base_test.h
+@@ -35,10 +35,10 @@ struct thread_management_type {
+ thread_disk->init_thread();
+
+ #define CLEANUP_THREAD() \
+- CPPUNIT_ASSERT(wait_for_true(tr1::bind(&torrent::thread_base::is_inactive, thread_disk))); \
++ CPPUNIT_ASSERT(wait_for_true(std::bind(&torrent::thread_base::is_inactive, thread_disk))); \
+ delete thread_disk;
+
+-bool wait_for_true(std::tr1::function<bool ()> test_function);
++bool wait_for_true(std::function<bool ()> test_function);
+
+ class thread_test : public torrent::thread_base {
+ public:
+--- src/torrent/utils/extents.h
++++ src/torrent/utils/extents.h
+@@ -51,9 +51,9 @@ struct extents_base {
+ typedef std::array<mapped_type, TableSize> table_type;
+
+ extents_base(key_type pos, unsigned int mb, mapped_value_type val) :
+- mask_bits(mb), position(pos) { table.assign(mapped_type(NULL, mapped_value_type())); }
++ mask_bits(mb), position(pos) { table.fill(mapped_type(NULL, mapped_value_type())); }
+ extents_base(extents_base* parent, typename table_type::const_iterator itr) :
+- mask_bits(parent->mask_bits - TableBits), position(parent->partition_pos(itr)) { table.assign(mapped_type(NULL, itr->second)); }
++ mask_bits(parent->mask_bits - TableBits), position(parent->partition_pos(itr)) { table.fill(mapped_type(NULL, itr->second)); }
+ ~extents_base();
+
+ bool is_divisible(key_type key) const { return key % mask_bits == 0; }
+--- src/torrent/utils/log.cc
++++ src/torrent/utils/log.cc
+@@ -237,7 +237,7 @@ void
+ log_cleanup() {
+ pthread_mutex_lock(&log_mutex);
+
+- log_groups.assign(log_group());
++ log_groups.fill(log_group());
+ log_outputs.clear();
+ log_children.clear();
+
+--- src/torrent/connection_manager.h
++++ src/torrent/connection_manager.h
+@@ -1,3 +1,4 @@
++#include <sys/types.h>
+ // libTorrent - BitTorrent library
+ // Copyright (C) 2005-2011, Jari Sundell
+ //
+--- src/torrent/utils/option_strings.cc
++++ src/torrent/utils/option_strings.cc
+@@ -1,3 +1,4 @@
++#include <sys/types.h>
+ // libTorrent - BitTorrent library
+ // Copyright (C) 2005-2011, Jari Sundell
+ //
+--- src/net/socket_set.h
++++ src/net/socket_set.h
+@@ -53,12 +53,12 @@ namespace torrent {
+
+ // Propably should rename to EventSet...
+
+-class SocketSet : private std::vector<Event*, rak::cacheline_allocator<> > {
++class SocketSet : private std::vector<Event*, rak::cacheline_allocator<Event*> > {
+ public:
+ typedef uint32_t size_type;
+
+- typedef std::vector<Event*, rak::cacheline_allocator<> > base_type;
+- typedef std::vector<size_type, rak::cacheline_allocator<> > Table;
++ typedef std::vector<Event*, rak::cacheline_allocator<Event*> > base_type;
++ typedef std::vector<size_type, rak::cacheline_allocator<size_type> > Table;
+
+ static const size_type npos = static_cast<size_type>(-1);
+
+--- src/torrent/utils/log.cc
++++ src/torrent/utils/log.cc
+@@ -175,7 +175,7 @@ log_group::internal_print(const HashString* hash, const char* subsystem, const v
+ pthread_mutex_lock(&log_mutex);
+ std::for_each(m_first, m_last, std::bind(&log_slot::operator(),
+ std::placeholders::_1,
+- buffer,
++ (const char*)buffer,
+ std::distance(buffer, first),
+ std::distance(log_groups.begin(), this)));
+ if (dump_data != NULL)
Property changes on: files/extra-patch-fix-clang-build.diff
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list