diff --git a/include/libtorrent/bencode.hpp b/include/libtorrent/bencode.hpp index 6a046d67c..a4f4cb420 100644 --- a/include/libtorrent/bencode.hpp +++ b/include/libtorrent/bencode.hpp @@ -78,6 +78,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/entry.hpp" #include "libtorrent/assert.hpp" #include "libtorrent/io.hpp" // for write_string +#include "libtorrent/string_util.hpp" // for is_digit namespace libtorrent { diff --git a/include/libtorrent/error.hpp b/include/libtorrent/error.hpp index 6be1d5a9d..3217bb073 100644 --- a/include/libtorrent/error.hpp +++ b/include/libtorrent/error.hpp @@ -33,7 +33,6 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_ERROR_HPP_INCLUDED #define TORRENT_ERROR_HPP_INCLUDED -#include #include "libtorrent/config.hpp" #if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN diff --git a/include/libtorrent/error_code.hpp b/include/libtorrent/error_code.hpp index 5c4e2195e..d101a8303 100644 --- a/include/libtorrent/error_code.hpp +++ b/include/libtorrent/error_code.hpp @@ -34,18 +34,10 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_ERROR_CODE_HPP_INCLUDED #include "libtorrent/config.hpp" -#include "libtorrent/string_util.hpp" // for allocate_string_copy #include "libtorrent/aux_/disable_warnings_push.hpp" - -#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN -// asio assumes that the windows error codes are defined already -#include -#endif - #include #include - #include "libtorrent/aux_/disable_warnings_pop.hpp" namespace libtorrent diff --git a/include/libtorrent/http_stream.hpp b/include/libtorrent/http_stream.hpp index 5935f7c5d..aa2b1e854 100644 --- a/include/libtorrent/http_stream.hpp +++ b/include/libtorrent/http_stream.hpp @@ -33,13 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_HTTP_STREAM_HPP_INCLUDED #define TORRENT_HTTP_STREAM_HPP_INCLUDED -#include "libtorrent/aux_/disable_warnings_push.hpp" - -#include #include -#include - -#include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/proxy_base.hpp" #include "libtorrent/string_util.hpp" @@ -96,7 +90,7 @@ public: // to avoid unnecessary copying of the handler, // store it in a shared_ptr - boost::shared_ptr h(new handler_type(handler)); + std::shared_ptr h(new handler_type(handler)); using std::placeholders::_1; using std::placeholders::_2; @@ -108,10 +102,10 @@ public: private: void name_lookup(error_code const& e, tcp::resolver::iterator i - , boost::shared_ptr h); - void connected(error_code const& e, boost::shared_ptr h); - void handshake1(error_code const& e, boost::shared_ptr h); - void handshake2(error_code const& e, boost::shared_ptr h); + , std::shared_ptr h); + void connected(error_code const& e, std::shared_ptr h); + void handshake1(error_code const& e, std::shared_ptr h); + void handshake2(error_code const& e, std::shared_ptr h); // send and receive buffer std::vector m_buffer; diff --git a/include/libtorrent/i2p_stream.hpp b/include/libtorrent/i2p_stream.hpp index efaec67a9..463759a3f 100644 --- a/include/libtorrent/i2p_stream.hpp +++ b/include/libtorrent/i2p_stream.hpp @@ -37,12 +37,6 @@ POSSIBILITY OF SUCH DAMAGE. #if TORRENT_USE_I2P -#include "libtorrent/aux_/disable_warnings_push.hpp" - -#include - -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include #include #include @@ -115,7 +109,7 @@ public: // to avoid unnecessary copying of the handler, // store it in a shared_ptr - boost::shared_ptr h(new handler_type(handler)); + std::shared_ptr h(new handler_type(handler)); using std::placeholders::_1; using std::placeholders::_2; @@ -127,20 +121,20 @@ public: std::string name_lookup() const { return m_name_lookup; } void set_name_lookup(char const* name) { m_name_lookup = name; } - void send_name_lookup(boost::shared_ptr h); + void send_name_lookup(std::shared_ptr h); private: // explicitly disallow assignment, to silence msvc warning i2p_stream& operator=(i2p_stream const&); void do_connect(error_code const& e, tcp::resolver::iterator i - , boost::shared_ptr h); - void connected(error_code const& e, boost::shared_ptr h); - void start_read_line(error_code const& e, boost::shared_ptr h); - void read_line(error_code const& e, boost::shared_ptr h); - void send_connect(boost::shared_ptr h); - void send_accept(boost::shared_ptr h); - void send_session_create(boost::shared_ptr h); + , std::shared_ptr h); + void connected(error_code const& e, std::shared_ptr h); + void start_read_line(error_code const& e, std::shared_ptr h); + void read_line(error_code const& e, std::shared_ptr h); + void send_connect(std::shared_ptr h); + void send_accept(std::shared_ptr h); + void send_session_create(std::shared_ptr h); // send and receive buffer std::vector m_buffer; @@ -192,18 +186,18 @@ private: i2p_connection& operator=(i2p_connection const&); void on_sam_connect(error_code const& ec, i2p_stream::handler_type const& h - , boost::shared_ptr); + , std::shared_ptr); void do_name_lookup(std::string const& name , name_lookup_handler const& h); void on_name_lookup(error_code const& ec , name_lookup_handler handler - , boost::shared_ptr); + , std::shared_ptr); void set_local_endpoint(error_code const& ec, char const* dest , i2p_stream::handler_type const& h); // to talk to i2p SAM bridge - boost::shared_ptr m_sam_socket; + std::shared_ptr m_sam_socket; std::string m_hostname; int m_port; diff --git a/include/libtorrent/peer_request.hpp b/include/libtorrent/peer_request.hpp index 64e49ca71..6d286db15 100644 --- a/include/libtorrent/peer_request.hpp +++ b/include/libtorrent/peer_request.hpp @@ -55,4 +55,3 @@ namespace libtorrent } #endif // TORRENT_PEER_REQUEST_HPP_INCLUDED - diff --git a/include/libtorrent/proxy_base.hpp b/include/libtorrent/proxy_base.hpp index 54a2fb13a..f46948043 100644 --- a/include/libtorrent/proxy_base.hpp +++ b/include/libtorrent/proxy_base.hpp @@ -39,11 +39,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/address.hpp" #include "libtorrent/error_code.hpp" -#include "libtorrent/aux_/disable_warnings_push.hpp" -#include -#include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - namespace libtorrent { class proxy_base : boost::noncopyable @@ -249,7 +244,7 @@ public: protected: - bool handle_error(error_code const& e, boost::shared_ptr const& h); + bool handle_error(error_code const& e, std::shared_ptr const& h); tcp::socket m_sock; std::string m_hostname; @@ -264,4 +259,3 @@ protected: } #endif - diff --git a/include/libtorrent/socks5_stream.hpp b/include/libtorrent/socks5_stream.hpp index a8a667531..8b2a3c70b 100644 --- a/include/libtorrent/socks5_stream.hpp +++ b/include/libtorrent/socks5_stream.hpp @@ -33,19 +33,13 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_SOCKS5_STREAM_HPP_INCLUDED #define TORRENT_SOCKS5_STREAM_HPP_INCLUDED -#include "libtorrent/aux_/disable_warnings_push.hpp" - -#include -#include - -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include #include "libtorrent/proxy_base.hpp" #include "libtorrent/broadcast_socket.hpp" // for is_ip_address #include "libtorrent/assert.hpp" #include "libtorrent/debug.hpp" +#include "libtorrent/string_util.hpp" // for to_string namespace libtorrent { namespace socks_error { @@ -122,7 +116,7 @@ public: #if defined TORRENT_ASIO_DEBUGGING add_outstanding_async("socks5_stream::connect1"); #endif - connect1(e, boost::make_shared(handler)); + connect1(e, std::make_shared(handler)); } template @@ -133,8 +127,8 @@ public: m_remote_endpoint = ep; // to avoid unnecessary copying of the handler, - // store it in a shaed_ptr - boost::shared_ptr h(new handler_type(handler)); + // store it in a shared_ptr + std::shared_ptr h(new handler_type(handler)); #if defined TORRENT_ASIO_DEBUGGING add_outstanding_async("socks5_stream::name_lookup"); @@ -206,8 +200,8 @@ public: // 4. send SOCKS command message // to avoid unnecessary copying of the handler, - // store it in a shaed_ptr - boost::shared_ptr h(new handler_type(handler)); + // store it in a shared_ptr + std::shared_ptr h(new handler_type(handler)); using std::placeholders::_1; using std::placeholders::_2; @@ -220,16 +214,16 @@ public: private: void name_lookup(error_code const& e, tcp::resolver::iterator i - , boost::shared_ptr h); - void connected(error_code const& e, boost::shared_ptr h); - void handshake1(error_code const& e, boost::shared_ptr h); - void handshake2(error_code const& e, boost::shared_ptr h); - void handshake3(error_code const& e, boost::shared_ptr h); - void handshake4(error_code const& e, boost::shared_ptr h); - void socks_connect(boost::shared_ptr h); - void connect1(error_code const& e, boost::shared_ptr h); - void connect2(error_code const& e, boost::shared_ptr h); - void connect3(error_code const& e, boost::shared_ptr h); + , std::shared_ptr h); + void connected(error_code const& e, std::shared_ptr h); + void handshake1(error_code const& e, std::shared_ptr h); + void handshake2(error_code const& e, std::shared_ptr h); + void handshake3(error_code const& e, std::shared_ptr h); + void handshake4(error_code const& e, std::shared_ptr h); + void socks_connect(std::shared_ptr h); + void connect1(error_code const& e, std::shared_ptr h); + void connect2(error_code const& e, std::shared_ptr h); + void connect3(error_code const& e, std::shared_ptr h); // send and receive buffer std::vector m_buffer; @@ -265,4 +259,3 @@ namespace boost { namespace system { } } #endif - diff --git a/src/announce_entry.cpp b/src/announce_entry.cpp index a418284c7..d0c110253 100644 --- a/src/announce_entry.cpp +++ b/src/announce_entry.cpp @@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/announce_entry.hpp" +#include "libtorrent/string_util.hpp" // for is_space #include "libtorrent/aux_/time.hpp" #include "libtorrent/aux_/session_settings.hpp" @@ -131,4 +132,3 @@ namespace libtorrent } } - diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 6c95859e9..ab6a3693e 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/storage.hpp" #include "libtorrent/disk_io_thread.hpp" +#include "libtorrent/string_util.hpp" // for allocate_string_copy #include "libtorrent/disk_buffer_holder.hpp" #include "libtorrent/alloca.hpp" #include "libtorrent/invariant_check.hpp" diff --git a/src/entry.cpp b/src/entry.cpp index 7964248ea..2e020c923 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -42,6 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/bdecode.hpp" #include "libtorrent/entry.hpp" #include "libtorrent/hex.hpp" +#include "libtorrent/string_util.hpp" namespace libtorrent { diff --git a/src/file.cpp b/src/file.cpp index f8e834f4a..ead51a206 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -63,6 +63,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/alloca.hpp" #include "libtorrent/file.hpp" +#include "libtorrent/string_util.hpp" #include "libtorrent/aux_/max_path.hpp" // for TORRENT_MAX_PATH #include diff --git a/src/http_parser.cpp b/src/http_parser.cpp index 9ecde37b1..93fdf396e 100644 --- a/src/http_parser.cpp +++ b/src/http_parser.cpp @@ -38,10 +38,9 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/http_parser.hpp" #include "libtorrent/assert.hpp" #include "libtorrent/parse_url.hpp" // for parse_url_components +#include "libtorrent/string_util.hpp" // for allocate_string_copy #include "libtorrent/aux_/escape_string.hpp" // for read_until -using namespace libtorrent; - namespace libtorrent { @@ -577,4 +576,3 @@ restart_response: return size; } } - diff --git a/src/http_stream.cpp b/src/http_stream.cpp index 2c8f0e50d..4c29635e0 100644 --- a/src/http_stream.cpp +++ b/src/http_stream.cpp @@ -42,7 +42,7 @@ namespace libtorrent { void http_stream::name_lookup(error_code const& e, tcp::resolver::iterator i - , boost::shared_ptr h) + , std::shared_ptr h) { if (handle_error(e, h)) return; @@ -50,7 +50,7 @@ namespace libtorrent &http_stream::connected, this, _1, h)); } - void http_stream::connected(error_code const& e, boost::shared_ptr h) + void http_stream::connected(error_code const& e, std::shared_ptr h) { if (handle_error(e, h)) return; @@ -85,7 +85,7 @@ namespace libtorrent , std::bind(&http_stream::handshake1, this, _1, h)); } - void http_stream::handshake1(error_code const& e, boost::shared_ptr h) + void http_stream::handshake1(error_code const& e, std::shared_ptr h) { if (handle_error(e, h)) return; @@ -95,7 +95,7 @@ namespace libtorrent , std::bind(&http_stream::handshake2, this, _1, h)); } - void http_stream::handshake2(error_code const& e, boost::shared_ptr h) + void http_stream::handshake2(error_code const& e, std::shared_ptr h) { if (handle_error(e, h)) return; diff --git a/src/i2p_stream.cpp b/src/i2p_stream.cpp index 1d490fcd7..eaaf9cc8d 100644 --- a/src/i2p_stream.cpp +++ b/src/i2p_stream.cpp @@ -145,7 +145,8 @@ namespace libtorrent , std::bind(&i2p_connection::on_sam_connect, this, _1, handler, m_sam_socket)); } - void i2p_connection::on_sam_connect(error_code const& ec, i2p_stream::handler_type const& h, boost::shared_ptr) + void i2p_connection::on_sam_connect(error_code const& ec + , i2p_stream::handler_type const& h, std::shared_ptr) { COMPLETE_ASYNC("i2p_stream::on_sam_connect"); m_state = sam_idle; @@ -185,13 +186,13 @@ namespace libtorrent TORRENT_ASSERT(m_state == sam_idle); m_state = sam_name_lookup; m_sam_socket->set_name_lookup(name.c_str()); - boost::shared_ptr h(new i2p_stream::handler_type( - std::bind(&i2p_connection::on_name_lookup, this, _1, handler, m_sam_socket))); + auto h = std::make_shared( + std::bind(&i2p_connection::on_name_lookup, this, _1, handler, m_sam_socket)); m_sam_socket->send_name_lookup(h); } void i2p_connection::on_name_lookup(error_code const& ec - , name_lookup_handler handler, boost::shared_ptr) + , name_lookup_handler handler, std::shared_ptr) { m_state = sam_idle; @@ -232,7 +233,7 @@ namespace libtorrent } void i2p_stream::do_connect(error_code const& e, tcp::resolver::iterator i - , boost::shared_ptr h) + , std::shared_ptr h) { TORRENT_ASSERT(m_magic == 0x1337); if (e || i == tcp::resolver::iterator()) @@ -248,7 +249,7 @@ namespace libtorrent &i2p_stream::connected, this, _1, h)); } - void i2p_stream::connected(error_code const& e, boost::shared_ptr h) + void i2p_stream::connected(error_code const& e, std::shared_ptr h) { TORRENT_ASSERT(m_magic == 0x1337); COMPLETE_ASYNC("i2p_stream::connected"); @@ -263,7 +264,7 @@ namespace libtorrent , std::bind(&i2p_stream::start_read_line, this, _1, h)); } - void i2p_stream::start_read_line(error_code const& e, boost::shared_ptr h) + void i2p_stream::start_read_line(error_code const& e, std::shared_ptr h) { TORRENT_ASSERT(m_magic == 0x1337); COMPLETE_ASYNC("i2p_stream::start_read_line"); @@ -275,7 +276,7 @@ namespace libtorrent , std::bind(&i2p_stream::read_line, this, _1, h)); } - void i2p_stream::read_line(error_code const& e, boost::shared_ptr h) + void i2p_stream::read_line(error_code const& e, std::shared_ptr h) { TORRENT_ASSERT(m_magic == 0x1337); COMPLETE_ASYNC("i2p_stream::read_line"); @@ -444,7 +445,7 @@ namespace libtorrent return; } - void i2p_stream::send_connect(boost::shared_ptr h) + void i2p_stream::send_connect(std::shared_ptr h) { TORRENT_ASSERT(m_magic == 0x1337); m_state = read_connect_response; @@ -456,7 +457,7 @@ namespace libtorrent , std::bind(&i2p_stream::start_read_line, this, _1, h)); } - void i2p_stream::send_accept(boost::shared_ptr h) + void i2p_stream::send_accept(std::shared_ptr h) { TORRENT_ASSERT(m_magic == 0x1337); m_state = read_accept_response; @@ -467,7 +468,7 @@ namespace libtorrent , std::bind(&i2p_stream::start_read_line, this, _1, h)); } - void i2p_stream::send_session_create(boost::shared_ptr h) + void i2p_stream::send_session_create(std::shared_ptr h) { TORRENT_ASSERT(m_magic == 0x1337); m_state = read_session_create_response; @@ -479,7 +480,7 @@ namespace libtorrent , std::bind(&i2p_stream::start_read_line, this, _1, h)); } - void i2p_stream::send_name_lookup(boost::shared_ptr h) + void i2p_stream::send_name_lookup(std::shared_ptr h) { TORRENT_ASSERT(m_magic == 0x1337); m_state = read_name_lookup_response; @@ -492,4 +493,3 @@ namespace libtorrent } #endif - diff --git a/src/parse_url.cpp b/src/parse_url.cpp index 1df4de91f..8d911404d 100644 --- a/src/parse_url.cpp +++ b/src/parse_url.cpp @@ -30,9 +30,11 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "libtorrent/parse_url.hpp" #include +#include "libtorrent/parse_url.hpp" +#include "libtorrent/string_util.hpp" + namespace libtorrent { @@ -131,4 +133,3 @@ exit: } } - diff --git a/src/proxy_base.cpp b/src/proxy_base.cpp index 4b267b6cf..ca802d59f 100644 --- a/src/proxy_base.cpp +++ b/src/proxy_base.cpp @@ -43,7 +43,7 @@ namespace libtorrent proxy_base::~proxy_base() = default; - bool proxy_base::handle_error(error_code const& e, boost::shared_ptr const& h) + bool proxy_base::handle_error(error_code const& e, std::shared_ptr const& h) { if (!e) return false; (*h)(e); @@ -52,4 +52,3 @@ namespace libtorrent return true; } } - diff --git a/src/socks5_stream.cpp b/src/socks5_stream.cpp index 5683bcabd..d71c4fc2f 100644 --- a/src/socks5_stream.cpp +++ b/src/socks5_stream.cpp @@ -31,11 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "libtorrent/socks5_stream.hpp" -#include "libtorrent/assert.hpp" #include "libtorrent/socket_io.hpp" -#include - using namespace std::placeholders; namespace libtorrent @@ -134,7 +131,7 @@ namespace libtorrent } void socks5_stream::name_lookup(error_code const& e, tcp::resolver::iterator i - , boost::shared_ptr h) + , std::shared_ptr h) { COMPLETE_ASYNC("socks5_stream::name_lookup"); if (handle_error(e, h)) return; @@ -153,7 +150,7 @@ namespace libtorrent &socks5_stream::connected, this, _1, h)); } - void socks5_stream::connected(error_code const& e, boost::shared_ptr h) + void socks5_stream::connected(error_code const& e, std::shared_ptr h) { COMPLETE_ASYNC("socks5_stream::connected"); if (handle_error(e, h)) return; @@ -190,7 +187,7 @@ namespace libtorrent } } - void socks5_stream::handshake1(error_code const& e, boost::shared_ptr h) + void socks5_stream::handshake1(error_code const& e, std::shared_ptr h) { COMPLETE_ASYNC("socks5_stream::handshake1"); if (handle_error(e, h)) return; @@ -201,7 +198,7 @@ namespace libtorrent , std::bind(&socks5_stream::handshake2, this, _1, h)); } - void socks5_stream::handshake2(error_code const& e, boost::shared_ptr h) + void socks5_stream::handshake2(error_code const& e, std::shared_ptr h) { COMPLETE_ASYNC("socks5_stream::handshake2"); if (handle_error(e, h)) return; @@ -253,7 +250,7 @@ namespace libtorrent } void socks5_stream::handshake3(error_code const& e - , boost::shared_ptr h) + , std::shared_ptr h) { COMPLETE_ASYNC("socks5_stream::handshake3"); if (handle_error(e, h)) return; @@ -265,7 +262,7 @@ namespace libtorrent } void socks5_stream::handshake4(error_code const& e - , boost::shared_ptr h) + , std::shared_ptr h) { COMPLETE_ASYNC("socks5_stream::handshake4"); if (handle_error(e, h)) return; @@ -292,7 +289,7 @@ namespace libtorrent socks_connect(h); } - void socks5_stream::socks_connect(boost::shared_ptr h) + void socks5_stream::socks_connect(std::shared_ptr h) { using namespace libtorrent::detail; @@ -354,7 +351,7 @@ namespace libtorrent , std::bind(&socks5_stream::connect1, this, _1, h)); } - void socks5_stream::connect1(error_code const& e, boost::shared_ptr h) + void socks5_stream::connect1(error_code const& e, std::shared_ptr h) { COMPLETE_ASYNC("socks5_stream::connect1"); if (handle_error(e, h)) return; @@ -369,7 +366,7 @@ namespace libtorrent , std::bind(&socks5_stream::connect2, this, _1, h)); } - void socks5_stream::connect2(error_code const& e, boost::shared_ptr h) + void socks5_stream::connect2(error_code const& e, std::shared_ptr h) { COMPLETE_ASYNC("socks5_stream::connect2"); if (handle_error(e, h)) return; @@ -497,7 +494,7 @@ namespace libtorrent } } - void socks5_stream::connect3(error_code const& e, boost::shared_ptr h) + void socks5_stream::connect3(error_code const& e, std::shared_ptr h) { COMPLETE_ASYNC("socks5_stream::connect3"); using namespace libtorrent::detail; @@ -520,4 +517,3 @@ namespace libtorrent (*h)(e); } } - diff --git a/test/test_file.cpp b/test/test_file.cpp index a78f2b0a8..b5a1b5a28 100644 --- a/test/test_file.cpp +++ b/test/test_file.cpp @@ -31,6 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "libtorrent/file.hpp" +#include "libtorrent/string_util.hpp" // for split_string #include "test.hpp" #include // for std::strcmp #include @@ -392,4 +393,3 @@ TORRENT_TEST(coalesce_buffer) TEST_CHECK(std::strcmp(test_buf2, "foobar") == 0); f.close(); } -