diff --git a/ChangeLog b/ChangeLog index 7c9b5ac05..da2cf9e6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * changes in public API to work with std::shared_ptr * extensions API changed to use span and std::shared_ptr * plugin API changed to handle DHT requests using string_view * removed support for lt_trackers and metadata_transfer extensions diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 203c15d46..75b0117c6 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -223,7 +223,7 @@ namespace // on the C++ side, it will end up freeing the python object // without holding the GIL and likely crash. // https://mail.python.org/pipermail/cplusplus-sig/2007-June/012130.html - p.ti = boost::make_shared( + p.ti = std::make_shared( extract(params["ti"])); } diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index c67783ba3..da851a37b 100644 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -95,7 +95,7 @@ list file_progress(torrent_handle& handle, int flags) { allow_threading_guard guard; - boost::shared_ptr ti = handle.torrent_file(); + std::shared_ptr ti = handle.torrent_file(); if (ti) { p.reserve(ti->num_files()); @@ -310,7 +310,7 @@ void set_metadata(torrent_handle& handle, std::string const& buf) #ifndef TORRENT_NO_DEPRECATE #if BOOST_VERSION > 104200 -boost::shared_ptr get_torrent_info(torrent_handle const& h) +std::shared_ptr get_torrent_info(torrent_handle const& h) { allow_threading_guard guard; return h.torrent_file(); @@ -318,13 +318,13 @@ boost::shared_ptr get_torrent_info(torrent_handle const& h) #else -boost::shared_ptr get_torrent_info(torrent_handle const& h) +std::shared_ptr get_torrent_info(torrent_handle const& h) { // I can't figure out how to expose shared_ptr // as well as supporting mutable instances. So, this hack is better // than compilation errors. It seems to work on newer versions of boost though allow_threading_guard guard; - return boost::const_pointer_cast(h.torrent_file()); + return std::const_pointer_cast(h.torrent_file()); } #endif diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 2e32afac2..3d20e58db 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -952,7 +952,7 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a torrent_handle h = p->handle; if (h.is_valid()) { - boost::shared_ptr ti = h.torrent_file(); + std::shared_ptr ti = h.torrent_file(); create_torrent ct(*ti); entry te = ct.generate(); std::vector buffer; @@ -2024,7 +2024,7 @@ int main(int argc, char* argv[]) std::vector file_status = h.file_status(); std::vector file_prio = h.file_priorities(); std::vector::iterator f = file_status.begin(); - boost::shared_ptr ti = h.torrent_file(); + std::shared_ptr ti = h.torrent_file(); int p = 0; // this is horizontal position for (int i = 0; i < ti->num_files(); ++i) diff --git a/examples/simple_client.cpp b/examples/simple_client.cpp index eae8101a6..d143377fd 100644 --- a/examples/simple_client.cpp +++ b/examples/simple_client.cpp @@ -36,17 +36,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/session.hpp" #include "libtorrent/torrent_info.hpp" -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated" -#endif - -#include - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif - int main(int argc, char* argv[]) { using namespace libtorrent; @@ -70,7 +59,7 @@ int main(int argc, char* argv[]) } add_torrent_params p; p.save_path = "./"; - p.ti = boost::make_shared(std::string(argv[1]), std::ref(ec), 0); + p.ti = std::make_shared(std::string(argv[1]), std::ref(ec), 0); if (ec) { std::fprintf(stderr, "%s\n", ec.message().c_str()); diff --git a/include/libtorrent/add_torrent_params.hpp b/include/libtorrent/add_torrent_params.hpp index ce2979e76..04699f495 100644 --- a/include/libtorrent/add_torrent_params.hpp +++ b/include/libtorrent/add_torrent_params.hpp @@ -38,10 +38,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include "libtorrent/aux_/disable_warnings_push.hpp" -#include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include "libtorrent/storage_defs.hpp" #include "libtorrent/peer_id.hpp" // sha1_hash #include "libtorrent/version.hpp" @@ -289,7 +285,7 @@ namespace libtorrent // torrent_info object with the torrent to add. Unless the url or // info_hash is set, this is required to be initialized. - boost::shared_ptr ti; + std::shared_ptr ti; // If the torrent doesn't have a tracker, but relies on the DHT to find // peers, the ``trackers`` can specify tracker URLs for the torrent. diff --git a/include/libtorrent/alert_manager.hpp b/include/libtorrent/alert_manager.hpp index 39b4ec471..94064196f 100644 --- a/include/libtorrent/alert_manager.hpp +++ b/include/libtorrent/alert_manager.hpp @@ -38,19 +38,12 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/heterogeneous_queue.hpp" #include "libtorrent/stack_allocator.hpp" -#include "libtorrent/aux_/disable_warnings_push.hpp" - -#include -#include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include #include #include // for std::forward #include #include - namespace libtorrent { #ifndef TORRENT_DISABLE_EXTENSIONS diff --git a/include/libtorrent/disk_interface.hpp b/include/libtorrent/disk_interface.hpp index ff2493edc..88b4089f6 100644 --- a/include/libtorrent/disk_interface.hpp +++ b/include/libtorrent/disk_interface.hpp @@ -33,9 +33,6 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_DISK_INTERFACE_HPP #define TORRENT_DISK_INTERFACE_HPP -#include -#include - #include "libtorrent/bdecode.hpp" #include @@ -114,4 +111,3 @@ namespace libtorrent } #endif - diff --git a/include/libtorrent/disk_io_job.hpp b/include/libtorrent/disk_io_job.hpp index f5c478bb0..f6e8d0451 100644 --- a/include/libtorrent/disk_io_job.hpp +++ b/include/libtorrent/disk_io_job.hpp @@ -38,12 +38,12 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/tailqueue.hpp" #include "libtorrent/peer_id.hpp" +#include + #include "libtorrent/aux_/disable_warnings_push.hpp" -#include #include #include -#include #include "libtorrent/aux_/disable_warnings_pop.hpp" @@ -241,4 +241,3 @@ namespace libtorrent } #endif // TORRENT_DISK_IO_JOB_HPP - diff --git a/include/libtorrent/resolve_links.hpp b/include/libtorrent/resolve_links.hpp index 3f462b4c5..cec4c67a8 100644 --- a/include/libtorrent/resolve_links.hpp +++ b/include/libtorrent/resolve_links.hpp @@ -34,14 +34,12 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_RESOLVE_LINKS_HPP #include "libtorrent/aux_/disable_warnings_push.hpp" - -#include #include +#include "libtorrent/aux_/disable_warnings_pop.hpp" + #include #include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include "libtorrent/export.hpp" namespace libtorrent @@ -55,15 +53,15 @@ namespace libtorrent { struct TORRENT_EXTRA_EXPORT link_t { - boost::shared_ptr ti; + std::shared_ptr ti; std::string save_path; int file_idx; }; - resolve_links(boost::shared_ptr ti); + resolve_links(std::shared_ptr ti); // check to see if any files are shared with this torrent - void match(boost::shared_ptr const& ti + void match(std::shared_ptr const& ti , std::string const& save_path); std::vector const& get_links() const @@ -71,7 +69,7 @@ namespace libtorrent private: // this is the torrent we're trying to find files for. - boost::shared_ptr m_torrent_file; + std::shared_ptr m_torrent_file; // each file in m_torrent_file has an entry in this vector. Any file // that also exists somewhere else, is filled in with the corresponding @@ -86,4 +84,3 @@ namespace libtorrent } #endif - diff --git a/include/libtorrent/session_handle.hpp b/include/libtorrent/session_handle.hpp index 2c85fd7ed..dfade87c6 100644 --- a/include/libtorrent/session_handle.hpp +++ b/include/libtorrent/session_handle.hpp @@ -444,13 +444,13 @@ namespace libtorrent // This function adds an extension to this session. The argument is a // function object that is called with a ``torrent_handle`` and which should - // return a ``boost::shared_ptr``. To write custom + // return a ``std::shared_ptr``. To write custom // plugins, see `libtorrent plugins`_. For the typical bittorrent client // all of these extensions should be added. The main plugins implemented // in libtorrent are: // // uTorrent metadata - // Allows peers to download the metadata (.torren files) from the swarm + // Allows peers to download the metadata (.torrent files) from the swarm // directly. Makes it possible to join a swarm with just a tracker and // info-hash. // diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 71b0bfc20..7a403069f 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -188,7 +188,7 @@ namespace libtorrent // TODO: make this a raw pointer. perhaps keep the shared_ptr // around further down the object to maintain an owner - boost::shared_ptr m_torrent_file; + std::shared_ptr m_torrent_file; // a back reference to the session // this torrent belongs to. @@ -945,7 +945,7 @@ namespace libtorrent torrent_info const& torrent_file() const { return *m_torrent_file; } - boost::shared_ptr get_torrent_copy(); + std::shared_ptr get_torrent_copy(); #ifndef TORRENT_NO_DEPRECATE // deprecated in 1.2 diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 29fa450d8..ca6f17476 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -881,7 +881,7 @@ namespace libtorrent // without metadata only if it was started without a .torrent file, e.g. // by using the libtorrent extension of just supplying a tracker and // info-hash. - boost::shared_ptr torrent_file() const; + std::shared_ptr torrent_file() const; #ifndef TORRENT_NO_DEPRECATE diff --git a/include/libtorrent/torrent_status.hpp b/include/libtorrent/torrent_status.hpp index 5e7f32a92..2e8b43223 100644 --- a/include/libtorrent/torrent_status.hpp +++ b/include/libtorrent/torrent_status.hpp @@ -161,7 +161,7 @@ namespace libtorrent // set to point to the ``torrent_info`` object for this torrent. It's // only included if the torrent status is queried with // ``torrent_handle::query_torrent_file``. - boost::weak_ptr torrent_file; + std::weak_ptr torrent_file; // the time until the torrent will announce itself to the tracker. time_duration next_announce; diff --git a/simulation/test_socks5.cpp b/simulation/test_socks5.cpp index f3abb2744..9e661c4e4 100644 --- a/simulation/test_socks5.cpp +++ b/simulation/test_socks5.cpp @@ -119,7 +119,7 @@ TORRENT_TEST(socks5_tcp_accept) } }, [](sim::simulation& sim, lt::session& - , boost::shared_ptr ti) + , std::shared_ptr ti) { // test connecting to the client via its socks5 listen port // TODO: maybe we could use peer_conn here instead @@ -161,7 +161,7 @@ TORRENT_TEST(socks4_tcp_accept) } }, [](sim::simulation& sim, lt::session& - , boost::shared_ptr ti) + , std::shared_ptr ti) { fake_peer peer1(sim, "60.0.0.0"); @@ -200,7 +200,7 @@ TORRENT_TEST(socks4_tcp_listen_alert) } }, [](sim::simulation& sim, lt::session& - , boost::shared_ptr ti) + , std::shared_ptr ti) { sim.run(); } @@ -230,7 +230,7 @@ TORRENT_TEST(socks5_tcp_listen_alert) } }, [](sim::simulation& sim, lt::session& - , boost::shared_ptr ti) + , std::shared_ptr ti) { sim.run(); } @@ -265,7 +265,7 @@ TORRENT_TEST(socks5_tcp_announce) } }, [&tracker_port](sim::simulation& sim, lt::session& - , boost::shared_ptr ti) + , std::shared_ptr ti) { sim::asio::io_service web_server(sim, address_v4::from_string("2.2.2.2")); // listen on port 8080 diff --git a/simulation/test_tracker.cpp b/simulation/test_tracker.cpp index 0c9f97a6d..57e802f7b 100644 --- a/simulation/test_tracker.cpp +++ b/simulation/test_tracker.cpp @@ -696,7 +696,7 @@ TORRENT_TEST(try_next) TEST_EQUAL(got_announce, true); } -boost::shared_ptr make_torrent(bool priv) +std::shared_ptr make_torrent(bool priv) { file_storage fs; fs.add_file("foobar", 13241); @@ -713,7 +713,7 @@ boost::shared_ptr make_torrent(bool priv) std::vector buf; bencode(std::back_inserter(buf), e); error_code ec; - return boost::make_shared(buf.data(), buf.size(), ec); + return std::make_shared(buf.data(), int(buf.size()), ec); } // make sure we _do_ send our IPv6 address to trackers for private torrents diff --git a/simulation/test_web_seed.cpp b/simulation/test_web_seed.cpp index 11f32e961..790069390 100644 --- a/simulation/test_web_seed.cpp +++ b/simulation/test_web_seed.cpp @@ -48,7 +48,7 @@ using namespace libtorrent; namespace lt = libtorrent; -boost::shared_ptr create_torrent(file_storage& fs) +std::shared_ptr create_torrent(file_storage& fs) { int const piece_size = 0x4000; libtorrent::create_torrent t(fs, piece_size); @@ -70,8 +70,8 @@ boost::shared_ptr create_torrent(file_storage& fs) bencode(out, tor); error_code ec; - return boost::make_shared( - &tmp[0], tmp.size(), std::ref(ec), 0); + return std::make_shared( + &tmp[0], int(tmp.size()), std::ref(ec), 0); } // this is the general template for these tests. create the session with custom // settings (Settings), set up the test, by adding torrents with certain diff --git a/src/read_resume_data.cpp b/src/read_resume_data.cpp index 24b3cbcbc..fb1791c8f 100644 --- a/src/read_resume_data.cpp +++ b/src/read_resume_data.cpp @@ -105,7 +105,7 @@ namespace libtorrent // only require the info-hash to match if we actually passed in one if (resume_ih == ret.info_hash) { - ret.ti = boost::make_shared(resume_ih); + ret.ti = std::make_shared(resume_ih); error_code err; if (!ret.ti->parse_info_section(info, err, 0)) diff --git a/src/resolve_links.cpp b/src/resolve_links.cpp index 56999b5e9..3d975a920 100644 --- a/src/resolve_links.cpp +++ b/src/resolve_links.cpp @@ -31,18 +31,13 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "libtorrent/resolve_links.hpp" - #include "libtorrent/torrent_info.hpp" -#include "libtorrent/aux_/disable_warnings_push.hpp" -#include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - namespace libtorrent { #ifndef TORRENT_DISABLE_MUTABLE_TORRENTS -resolve_links::resolve_links(boost::shared_ptr ti) +resolve_links::resolve_links(std::shared_ptr ti) : m_torrent_file(ti) { TORRENT_ASSERT(ti); @@ -65,7 +60,7 @@ resolve_links::resolve_links(boost::shared_ptr ti) m_links.resize(m_torrent_file->num_files()); } -void resolve_links::match(boost::shared_ptr const& ti +void resolve_links::match(std::shared_ptr const& ti , std::string const& save_path) { if (!ti) return; @@ -138,4 +133,3 @@ void resolve_links::match(boost::shared_ptr const& ti #endif // TORRENT_DISABLE_MUTABLE_TORRENTS } // namespace libtorrent - diff --git a/src/session_handle.cpp b/src/session_handle.cpp index 904e26910..511ef7cca 100644 --- a/src/session_handle.cpp +++ b/src/session_handle.cpp @@ -327,9 +327,8 @@ namespace libtorrent , bool paused , storage_constructor_type sc) { - boost::shared_ptr tip(boost::make_shared(ti)); add_torrent_params p(sc); - p.ti = tip; + p.ti = std::make_shared(ti); p.save_path = save_path; if (resume_data.type() != entry::undefined_t) { diff --git a/src/session_impl.cpp b/src/session_impl.cpp index c9c2ca4dd..44e3510bc 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -4615,7 +4615,7 @@ namespace aux { else { params->url.clear(); - params->ti = boost::shared_ptr(j->buffer.torrent_file); + params->ti = std::shared_ptr(j->buffer.torrent_file); handle = add_torrent(*params, ec); } @@ -4783,7 +4783,7 @@ namespace aux { if (string_begins_no_case("file://", params.url.c_str()) && !params.ti) { std::string const filename = resolve_file_url(params.url); - boost::shared_ptr t = boost::make_shared(filename, std::ref(ec), 0); + auto t = std::make_shared(filename, std::ref(ec), 0); if (ec) return std::make_pair(ptr_t(), false); params.url.clear(); params.ti = t; diff --git a/src/torrent.cpp b/src/torrent.cpp index eb70058b7..800b75332 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -307,7 +307,7 @@ namespace libtorrent } if (!m_torrent_file) - m_torrent_file = (p.ti ? p.ti : boost::make_shared(info_hash)); + m_torrent_file = (p.ti ? p.ti : std::make_shared(info_hash)); // --- WEB SEEDS --- @@ -462,7 +462,7 @@ namespace libtorrent } error_code e; - boost::shared_ptr tf(boost::make_shared(data, size, std::ref(e), 0)); + auto tf = std::make_shared(data, size, std::ref(e), 0); if (e) { set_error(e, torrent_status::error_file_url); @@ -2138,7 +2138,7 @@ namespace libtorrent // as soon as the user is done with its copy of torrent_info // it will be freed, and we'll have the unloaded version left if (!m_torrent_file.unique()) - m_torrent_file = boost::make_shared(*m_torrent_file); + m_torrent_file = std::make_shared(*m_torrent_file); m_torrent_file->unload(); inc_stats_counter(counters::num_loaded_torrents, -1); @@ -6316,10 +6316,10 @@ namespace libtorrent } } - boost::shared_ptr torrent::get_torrent_copy() + std::shared_ptr torrent::get_torrent_copy() { - if (!m_torrent_file->is_valid()) return boost::shared_ptr(); - if (!need_loaded()) return boost::shared_ptr(); + if (!m_torrent_file->is_valid()) return std::shared_ptr(); + if (!need_loaded()) return std::shared_ptr(); return m_torrent_file; } diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index f6b153e8b..aec49254d 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -592,10 +592,10 @@ namespace libtorrent return !m_torrent.expired(); } - boost::shared_ptr torrent_handle::torrent_file() const + std::shared_ptr torrent_handle::torrent_file() const { - return sync_call_ret>( - boost::shared_ptr(), &torrent::get_torrent_copy); + return sync_call_ret>( + std::shared_ptr(), &torrent::get_torrent_copy); } #ifndef TORRENT_NO_DEPRECATE @@ -604,11 +604,11 @@ namespace libtorrent // forces the torrent to stay loaded while the client holds it torrent_info const& torrent_handle::get_torrent_info() const { - static boost::shared_ptr holder[4]; + static std::shared_ptr holder[4]; static int cursor = 0; static std::mutex holder_mutex; - boost::shared_ptr r = torrent_file(); + std::shared_ptr r = torrent_file(); std::lock_guard l(holder_mutex); holder[cursor++] = r; diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index a4def102d..8898b9a06 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -55,16 +55,12 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/lazy_entry.hpp" #endif -#include "libtorrent/aux_/disable_warnings_push.hpp" - #include #include #include #include #include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - namespace libtorrent { diff --git a/test/make_torrent.cpp b/test/make_torrent.cpp index 865025378..96067295b 100644 --- a/test/make_torrent.cpp +++ b/test/make_torrent.cpp @@ -30,10 +30,6 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "libtorrent/aux_/disable_warnings_push.hpp" -#include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include #include "make_torrent.hpp" @@ -46,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. using namespace libtorrent; -boost::shared_ptr make_test_torrent( +std::shared_ptr make_test_torrent( torrent_args const& args) { entry e; @@ -163,7 +159,7 @@ boost::shared_ptr make_test_torrent( fwrite(&tmp[0], 1, tmp.size(), f); fclose(f); - return boost::make_shared(&tmp[0], int(tmp.size())); + return std::make_shared(&tmp[0], int(tmp.size())); } void generate_files(libtorrent::torrent_info const& ti, std::string const& path diff --git a/test/make_torrent.hpp b/test/make_torrent.hpp index a385170a8..3dadf28eb 100644 --- a/test/make_torrent.hpp +++ b/test/make_torrent.hpp @@ -34,7 +34,6 @@ POSSIBILITY OF SUCH DAMAGE. #define MAKE_TORRENT_HPP #include "libtorrent/torrent_info.hpp" -#include #include #include #include "test.hpp" @@ -60,10 +59,9 @@ struct torrent_args std::string m_http_seed; }; -EXPORT boost::shared_ptr +EXPORT std::shared_ptr make_test_torrent(torrent_args const& args); EXPORT void generate_files(libtorrent::torrent_info const& ti, std::string const& path, bool random = false); #endif - diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index 9ddeff446..3103613e5 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -51,8 +51,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/broadcast_socket.hpp" // for supports_ipv6() #include "libtorrent/hex.hpp" // to_hex -#include - #include "test.hpp" #include "test_utils.hpp" #include "setup_transfer.hpp" @@ -595,9 +593,9 @@ int start_proxy(int proxy_type) using namespace libtorrent; template -boost::shared_ptr clone_ptr(boost::shared_ptr const& ptr) +std::shared_ptr clone_ptr(std::shared_ptr const& ptr) { - return boost::make_shared(*ptr); + return std::make_shared(*ptr); } unsigned char random_byte() @@ -640,7 +638,7 @@ lt::file_storage make_file_storage(const int file_sizes[], int num_files return fs; } -boost::shared_ptr make_torrent(const int file_sizes[] +std::shared_ptr make_torrent(const int file_sizes[] , int const num_files, int const piece_size) { using namespace libtorrent; @@ -658,7 +656,7 @@ boost::shared_ptr make_torrent(const int file_sizes[] std::vector buf; bencode(std::back_inserter(buf), ct.generate()); error_code ec; - return boost::make_shared(&buf[0], int(buf.size()), ec); + return std::make_shared(&buf[0], int(buf.size()), ec); } void create_random_files(std::string const& path, const int file_sizes[], int num_files) @@ -696,11 +694,11 @@ void create_random_files(std::string const& path, const int file_sizes[], int nu free(random_data); } -boost::shared_ptr create_torrent(std::ostream* file +std::shared_ptr create_torrent(std::ostream* file , char const* name, int piece_size , int num_pieces, bool add_tracker, std::string ssl_certificate) { - // excercise the path when encountering invalid urls + // exercise the path when encountering invalid urls char const* invalid_tracker_url = "http:"; char const* invalid_tracker_protocol = "foo://non/existent-name.com/announce"; @@ -757,17 +755,17 @@ boost::shared_ptr create_torrent(std::ostream* file bencode(out, tor); error_code ec; - return boost::make_shared( - &tmp[0], tmp.size(), std::ref(ec), 0); + return std::make_shared( + &tmp[0], int(tmp.size()), std::ref(ec), 0); } std::tuple setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3 , bool clear_files, bool use_metadata_transfer, bool connect_peers , std::string suffix, int piece_size - , boost::shared_ptr* torrent, bool super_seeding + , std::shared_ptr* torrent, bool super_seeding , add_torrent_params const* p, bool stop_lsd, bool use_ssl_ports - , boost::shared_ptr* torrent2) + , std::shared_ptr* torrent2) { TORRENT_ASSERT(ses1); TORRENT_ASSERT(ses2); @@ -820,7 +818,7 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3 TORRENT_ASSERT(ses1->id() != ses2->id()); if (ses3) TORRENT_ASSERT(ses3->id() != ses2->id()); - boost::shared_ptr t; + std::shared_ptr t; if (torrent == nullptr) { error_code ec; diff --git a/test/setup_transfer.hpp b/test/setup_transfer.hpp index 0424d2aba..1c2e23534 100644 --- a/test/setup_transfer.hpp +++ b/test/setup_transfer.hpp @@ -84,12 +84,12 @@ EXPORT void wait_for_downloading(libtorrent::session& ses, char const* name); EXPORT std::vector generate_piece(int idx, int const piece_size = 0x4000); EXPORT libtorrent::file_storage make_file_storage(const int file_sizes[], int num_files , int const piece_size, std::string base_name = "test_dir-"); -EXPORT boost::shared_ptr make_torrent(const int file_sizes[] +EXPORT std::shared_ptr make_torrent(const int file_sizes[] , int num_files, int piece_size); EXPORT void create_random_files(std::string const& path, const int file_sizes[] , int num_files); -EXPORT boost::shared_ptr create_torrent(std::ostream* file = 0 +EXPORT std::shared_ptr create_torrent(std::ostream* file = 0 , char const* name = "temporary", int piece_size = 16 * 1024, int num_pieces = 13 , bool add_tracker = true, std::string ssl_certificate = ""); @@ -99,9 +99,9 @@ EXPORT std::tuple* torrent = 0, bool super_seeding = false + , std::shared_ptr* torrent = 0, bool super_seeding = false , libtorrent::add_torrent_params const* p = 0, bool stop_lsd = true, bool use_ssl_ports = false - , boost::shared_ptr* torrent2 = 0); + , std::shared_ptr* torrent2 = 0); EXPORT int start_web_server(bool ssl = false, bool chunked = false , bool keepalive = true); diff --git a/test/test_checking.cpp b/test/test_checking.cpp index 67eadfb49..6e1e2a2f8 100644 --- a/test/test_checking.cpp +++ b/test/test_checking.cpp @@ -114,7 +114,7 @@ void test_checking(int flags = read_only_files) std::vector buf; bencode(std::back_inserter(buf), t.generate()); - boost::shared_ptr ti(new torrent_info(&buf[0], int(buf.size()), ec)); + auto ti = std::make_shared(&buf[0], int(buf.size()), ec); std::fprintf(stderr, "generated torrent: %s tmp1_checking/test_torrent_dir\n" , aux::to_hex(ti->info_hash()).c_str()); diff --git a/test/test_fast_extension.cpp b/test/test_fast_extension.cpp index 2ae38b83c..7b48f6197 100644 --- a/test/test_fast_extension.cpp +++ b/test/test_fast_extension.cpp @@ -404,11 +404,11 @@ entry read_ut_metadata_msg(tcp::socket& s, char* recv_buffer, int size) } } -boost::shared_ptr setup_peer(tcp::socket& s, sha1_hash& ih +std::shared_ptr setup_peer(tcp::socket& s, sha1_hash& ih , boost::shared_ptr& ses, bool incoming = true , int flags = 0, torrent_handle* th = nullptr) { - boost::shared_ptr t = ::create_torrent(); + std::shared_ptr t = ::create_torrent(); ih = t->info_hash(); settings_pack sett; sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48900"); @@ -724,7 +724,7 @@ TORRENT_TEST(multiple_bitfields) boost::shared_ptr ses; io_service ios; tcp::socket s(ios); - boost::shared_ptr ti = setup_peer(s, ih, ses); + std::shared_ptr ti = setup_peer(s, ih, ses); print_session_log(*ses); char recv_buffer[1000]; @@ -758,7 +758,7 @@ TORRENT_TEST(multiple_have_all) boost::shared_ptr ses; io_service ios; tcp::socket s(ios); - boost::shared_ptr ti = setup_peer(s, ih, ses); + std::shared_ptr ti = setup_peer(s, ih, ses); char recv_buffer[1000]; do_handshake(s, ih, recv_buffer); @@ -793,7 +793,7 @@ TORRENT_TEST(dont_have) boost::shared_ptr ses; io_service ios; tcp::socket s(ios); - boost::shared_ptr ti = setup_peer(s, ih, ses, true, 0, &th); + std::shared_ptr ti = setup_peer(s, ih, ses, true, 0, &th); char recv_buffer[1000]; do_handshake(s, ih, recv_buffer); @@ -895,7 +895,7 @@ TORRENT_TEST(invalid_metadata_request) boost::shared_ptr ses; io_service ios; tcp::socket s(ios); - boost::shared_ptr ti = setup_peer(s, ih, ses); + std::shared_ptr ti = setup_peer(s, ih, ses); char recv_buffer[1000]; do_handshake(s, ih, recv_buffer); diff --git a/test/test_priority.cpp b/test/test_priority.cpp index 9d217d98e..945bee1df 100644 --- a/test/test_priority.cpp +++ b/test/test_priority.cpp @@ -119,7 +119,7 @@ void test_transfer(settings_pack const& sett, bool test_deprecated = false) error_code ec; create_directory("tmp1_priority", ec); std::ofstream file("tmp1_priority/temporary"); - boost::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); + std::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); file.close(); add_torrent_params addp; diff --git a/test/test_privacy.cpp b/test/test_privacy.cpp index 84c4808e7..9dbf5e1d4 100644 --- a/test/test_privacy.cpp +++ b/test/test_privacy.cpp @@ -139,7 +139,7 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags) remove_all("tmp1_privacy", ec); create_directory("tmp1_privacy", ec); std::ofstream file(combine_path("tmp1_privacy", "temporary").c_str()); - boost::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); + std::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); file.close(); char http_tracker_url[200]; diff --git a/test/test_read_piece.cpp b/test/test_read_piece.cpp index 983165d79..060bff56e 100644 --- a/test/test_read_piece.cpp +++ b/test/test_read_piece.cpp @@ -84,7 +84,7 @@ void test_read_piece(int flags) std::vector buf; bencode(std::back_inserter(buf), t.generate()); - boost::shared_ptr ti(new torrent_info(&buf[0], int(buf.size()), ec)); + auto ti = std::make_shared(&buf[0], int(buf.size()), ec); std::fprintf(stderr, "generated torrent: %s tmp1_read_piece/test_torrent\n" , aux::to_hex(ti->info_hash()).c_str()); diff --git a/test/test_recheck.cpp b/test/test_recheck.cpp index b7c66d272..2cdc1f399 100644 --- a/test/test_recheck.cpp +++ b/test/test_recheck.cpp @@ -89,7 +89,7 @@ TORRENT_TEST(recheck) create_directory("tmp1_recheck", ec); if (ec) std::fprintf(stderr, "create_directory: %s\n", ec.message().c_str()); std::ofstream file("tmp1_recheck/temporary"); - boost::shared_ptr t = ::create_torrent(&file, "temporary", 4 * 1024 * 1024 + std::shared_ptr t = ::create_torrent(&file, "temporary", 4 * 1024 * 1024 , 7, false); file.close(); diff --git a/test/test_resolve_links.cpp b/test/test_resolve_links.cpp index aa64170e6..64ab7ba46 100644 --- a/test/test_resolve_links.cpp +++ b/test/test_resolve_links.cpp @@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/resolve_links.hpp" #include "libtorrent/file.hpp" // for combine_path #include "libtorrent/hex.hpp" // to_hex -#include + #include using namespace libtorrent; @@ -98,11 +98,11 @@ TORRENT_TEST(resolve_links) std::string p = combine_path(path, e.filename1) + ".torrent"; std::fprintf(stderr, "loading %s\n", p.c_str()); - boost::shared_ptr ti1 = boost::make_shared(p); + std::shared_ptr ti1 = std::make_shared(p); p = combine_path(path, e.filename2) + ".torrent"; std::fprintf(stderr, "loading %s\n", p.c_str()); - boost::shared_ptr ti2 = boost::make_shared(p); + std::shared_ptr ti2 = std::make_shared(p); std::fprintf(stderr, "resolving\n"); resolve_links l(ti1); diff --git a/test/test_resume.cpp b/test/test_resume.cpp index e809e8d13..859398927 100644 --- a/test/test_resume.cpp +++ b/test/test_resume.cpp @@ -40,8 +40,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/bencode.hpp" #include "libtorrent/read_resume_data.hpp" -#include - #include "test.hpp" #include "settings.hpp" #include "setup_transfer.hpp" @@ -49,7 +47,7 @@ POSSIBILITY OF SUCH DAMAGE. using namespace libtorrent; namespace lt = libtorrent; -boost::shared_ptr generate_torrent() +std::shared_ptr generate_torrent() { file_storage fs; fs.add_file("test_resume/tmp1", 128 * 1024 * 8); @@ -71,7 +69,7 @@ boost::shared_ptr generate_torrent() std::vector buf; bencode(std::back_inserter(buf), t.generate()); - return boost::make_shared(&buf[0], buf.size()); + return std::make_shared(&buf[0], int(buf.size())); } std::vector generate_resume_data(torrent_info* ti @@ -136,7 +134,7 @@ torrent_handle test_resume_flags(lt::session& ses, int flags , char const* file_priorities = "1111", char const* resume_file_prio = "" , bool const test_deprecated = false) { - boost::shared_ptr ti = generate_torrent(); + std::shared_ptr ti = generate_torrent(); add_torrent_params p; std::vector rd = generate_resume_data(ti.get(), resume_file_prio); @@ -203,7 +201,7 @@ void test_piece_priorities(bool test_deprecated = false) { settings_pack sett = settings(); lt::session ses(sett); - boost::shared_ptr ti = generate_torrent(); + std::shared_ptr ti = generate_torrent(); add_torrent_params p; p.ti = ti; p.save_path = "."; @@ -717,7 +715,7 @@ void test_zero_file_prio(bool test_deprecated = false) std::fprintf(stderr, "test_file_prio\n"); lt::session ses; - boost::shared_ptr ti = generate_torrent(); + std::shared_ptr ti = generate_torrent(); add_torrent_params p; p.ti = ti; p.save_path = "."; @@ -785,7 +783,7 @@ void test_seed_mode(bool const file_prio, bool const pieces_have, bool const pie settings_pack sett = settings(); lt::session ses(sett); - boost::shared_ptr ti = generate_torrent(); + std::shared_ptr ti = generate_torrent(); add_torrent_params p; p.ti = ti; p.save_path = "."; diff --git a/test/test_session.cpp b/test/test_session.cpp index 3bc81c560..4c31628b8 100644 --- a/test/test_session.cpp +++ b/test/test_session.cpp @@ -154,7 +154,7 @@ TORRENT_TEST(load_empty_file) add_torrent_params atp; error_code ignore_errors; - atp.ti = boost::make_shared("", 0, std::ref(ignore_errors)); + atp.ti = std::make_shared("", 0, std::ref(ignore_errors)); atp.save_path = "."; error_code ec; torrent_handle h = ses.add_torrent(atp, ec); diff --git a/test/test_ssl.cpp b/test/test_ssl.cpp index 2ca860536..659973c41 100644 --- a/test/test_ssl.cpp +++ b/test/test_ssl.cpp @@ -183,7 +183,7 @@ void test_ssl(int test_idx, bool use_utp) create_directory("tmp1_ssl", ec); std::ofstream file("tmp1_ssl/temporary"); - boost::shared_ptr t = ::create_torrent(&file, "temporary" + std::shared_ptr t = ::create_torrent(&file, "temporary" , 16 * 1024, 13, false, combine_path("..", combine_path("ssl", "root_ca_cert.pem"))); file.close(); @@ -345,7 +345,7 @@ attack_t attacks[] = const int num_attacks = sizeof(attacks)/sizeof(attacks[0]); bool try_connect(libtorrent::session& ses1, int port - , boost::shared_ptr const& t, std::uint32_t flags) + , std::shared_ptr const& t, std::uint32_t flags) { using boost::asio::ssl::context; @@ -565,7 +565,7 @@ void test_malicious_peer() // create torrent create_directory("tmp3_ssl", ec); std::ofstream file("tmp3_ssl/temporary"); - boost::shared_ptr t = ::create_torrent(&file, "temporary" + std::shared_ptr t = ::create_torrent(&file, "temporary" , 16 * 1024, 13, false, combine_path("..", combine_path("ssl", "root_ca_cert.pem"))); file.close(); diff --git a/test/test_storage.cpp b/test/test_storage.cpp index f13e1b00b..cbbb9b248 100644 --- a/test/test_storage.cpp +++ b/test/test_storage.cpp @@ -138,8 +138,8 @@ boost::shared_ptr setup_torrent(file_storage& fs bencode(std::back_inserter(buf), t.generate()); error_code ec; - boost::shared_ptr info(boost::make_shared(&buf[0] - , buf.size(), std::ref(ec), 0)); + auto info = std::make_shared(&buf[0] + , int(buf.size()), std::ref(ec), 0); if (ec) { @@ -174,7 +174,7 @@ std::vector new_piece(int size) return ret; } -void run_storage_tests(boost::shared_ptr info +void run_storage_tests(std::shared_ptr info , file_storage& fs , std::string const& test_path , libtorrent::storage_mode_t storage_mode @@ -410,7 +410,7 @@ void test_check_files(std::string const& test_path , libtorrent::storage_mode_t storage_mode , bool unbuffered) { - boost::shared_ptr info; + std::shared_ptr info; error_code ec; const int piece_size = 16 * 1024; @@ -447,7 +447,7 @@ void test_check_files(std::string const& test_path std::vector buf; bencode(std::back_inserter(buf), t.generate()); - info = boost::make_shared(&buf[0], buf.size(), std::ref(ec), 0); + info = std::make_shared(&buf[0], int(buf.size()), std::ref(ec), 0); aux::session_settings set; file_pool fp; @@ -484,7 +484,7 @@ void run_test(bool unbuffered) std::string test_path = current_working_directory(); std::cerr << "\n=== " << test_path << " ===\n" << std::endl; - boost::shared_ptr info; + std::shared_ptr info; std::vector piece0 = new_piece(piece_size); std::vector piece1 = new_piece(piece_size); @@ -523,7 +523,7 @@ void run_test(bool unbuffered) std::vector buf; bencode(std::back_inserter(buf), t.generate()); - info = boost::make_shared(&buf[0], buf.size(), std::ref(ec), 0); + info = std::make_shared(&buf[0], int(buf.size()), std::ref(ec), 0); std::cerr << "=== test 1 === " << (unbuffered?"unbuffered":"buffered") << std::endl; // run_storage_tests writes piece 0, 1 and 2. not 3 @@ -567,7 +567,7 @@ void run_test(bool unbuffered) std::vector buf; bencode(std::back_inserter(buf), t.generate()); - info = boost::make_shared(&buf[0], buf.size(), std::ref(ec), 0); + info = std::make_shared(&buf[0], int(buf.size()), std::ref(ec), 0); std::cerr << "=== test 3 ===" << std::endl; @@ -623,7 +623,7 @@ void test_fastresume(bool const test_deprecated) if (ec) std::cerr << "create_directory '" << combine_path(test_path, "tmp1") << "': " << ec.message() << std::endl; std::ofstream file(combine_path(test_path, "tmp1/temporary").c_str()); - boost::shared_ptr t = ::create_torrent(&file); + std::shared_ptr t = ::create_torrent(&file); file.close(); TEST_CHECK(exists(combine_path(test_path, "tmp1/temporary"))); if (!exists(combine_path(test_path, "tmp1/temporary"))) @@ -637,7 +637,7 @@ void test_fastresume(bool const test_deprecated) error_code ec; add_torrent_params p; - p.ti = boost::make_shared(boost::cref(*t)); + p.ti = std::make_shared(std::cref(*t)); p.save_path = combine_path(test_path, "tmp1"); p.storage_mode = storage_mode_sparse; torrent_handle h = ses.add_torrent(p, ec); @@ -702,7 +702,7 @@ void test_fastresume(bool const test_deprecated) p.flags &= ~add_torrent_params::flag_paused; p.flags &= ~add_torrent_params::flag_auto_managed; - p.ti = boost::make_shared(boost::cref(*t)); + p.ti = std::make_shared(std::cref(*t)); p.save_path = combine_path(test_path, "tmp1"); p.storage_mode = storage_mode_sparse; torrent_handle h = ses.add_torrent(p, ec); @@ -749,7 +749,7 @@ void test_rename_file_fastresume(bool test_deprecated) create_directory(combine_path(test_path, "tmp2"), ec); if (ec) std::cerr << "create_directory: " << ec.message() << std::endl; std::ofstream file(combine_path(test_path, "tmp2/temporary").c_str()); - boost::shared_ptr t = ::create_torrent(&file); + std::shared_ptr t = ::create_torrent(&file); file.close(); TEST_CHECK(exists(combine_path(test_path, "tmp2/temporary"))); @@ -759,7 +759,7 @@ void test_rename_file_fastresume(bool test_deprecated) lt::session ses(pack); add_torrent_params p; - p.ti = boost::make_shared(boost::cref(*t)); + p.ti = std::make_shared(std::cref(*t)); p.save_path = combine_path(test_path, "tmp2"); p.storage_mode = storage_mode_sparse; torrent_handle h = ses.add_torrent(p, ec); @@ -810,7 +810,7 @@ void test_rename_file_fastresume(bool test_deprecated) p = read_resume_data(&resume_data[0], int(resume_data.size()), ec); TEST_CHECK(!ec); } - p.ti = boost::make_shared(boost::cref(*t)); + p.ti = std::make_shared(std::cref(*t)); p.save_path = combine_path(test_path, "tmp2"); p.storage_mode = storage_mode_sparse; torrent_handle h = ses.add_torrent(p, ec); diff --git a/test/test_torrent.cpp b/test/test_torrent.cpp index 8acc05676..fd3945021 100644 --- a/test/test_torrent.cpp +++ b/test/test_torrent.cpp @@ -42,17 +42,13 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include "libtorrent/aux_/disable_warnings_push.hpp" -#include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include "test.hpp" #include "setup_transfer.hpp" using namespace libtorrent; namespace lt = libtorrent; -void test_running_torrent(boost::shared_ptr info, std::int64_t file_size) +void test_running_torrent(std::shared_ptr info, std::int64_t file_size) { settings_pack pack; pack.set_int(settings_pack::alert_mask, alert::storage_notification); @@ -171,7 +167,7 @@ TORRENT_TEST(long_names) std::vector buf; bencode(std::back_inserter(buf), torrent); error_code ec; - boost::shared_ptr ti(boost::make_shared(&buf[0], buf.size(), std::ref(ec))); + auto ti = std::make_shared(&buf[0], int(buf.size()), std::ref(ec)); TEST_CHECK(!ec); } @@ -188,8 +184,8 @@ TORRENT_TEST(total_wanted) std::vector tmp; bencode(std::back_inserter(tmp), t.generate()); error_code ec; - boost::shared_ptr info(boost::make_shared( - &tmp[0], tmp.size(), std::ref(ec))); + auto info = std::make_shared( + &tmp[0], int(tmp.size()), std::ref(ec)); settings_pack pack; pack.set_int(settings_pack::alert_mask, alert::storage_notification); @@ -226,8 +222,8 @@ TORRENT_TEST(added_peers) std::vector tmp; bencode(std::back_inserter(tmp), t.generate()); error_code ec; - boost::shared_ptr info(boost::make_shared( - &tmp[0], tmp.size(), std::ref(ec))); + auto info = std::make_shared( + &tmp[0], int(tmp.size()), std::ref(ec)); settings_pack pack; pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48130"); @@ -275,7 +271,7 @@ TORRENT_TEST(torrent) std::back_insert_iterator > out(tmp); bencode(out, t.generate()); error_code ec; - boost::shared_ptr info(boost::make_shared(&tmp[0], tmp.size(), std::ref(ec), 0)); + auto info = std::make_shared(&tmp[0], int(tmp.size()), std::ref(ec), 0); TEST_CHECK(info->num_pieces() > 0); test_running_torrent(info, file_size); @@ -299,10 +295,10 @@ TORRENT_TEST(torrent) t.set_hash(i, ph); std::vector tmp; - std::back_insert_iterator > out(tmp); + std::back_insert_iterator> out(tmp); bencode(out, t.generate()); error_code ec; - boost::shared_ptr info(boost::make_shared(&tmp[0], tmp.size(), std::ref(ec), 0)); + auto info = std::make_shared(&tmp[0], int(tmp.size()), std::ref(ec), 0); test_running_torrent(info, 1024); } } @@ -351,7 +347,7 @@ TORRENT_TEST(duplicate_is_not_error) plugin_creator creator(called); add_torrent_params p; - p.ti = boost::make_shared(&tmp[0], tmp.size(), std::ref(ec), 0); + p.ti = std::make_shared(&tmp[0], int(tmp.size()), std::ref(ec), 0); p.flags &= ~add_torrent_params::flag_paused; p.flags &= ~add_torrent_params::flag_auto_managed; p.flags &= ~add_torrent_params::flag_duplicate_is_error; @@ -402,10 +398,10 @@ TORRENT_TEST(rename_file) libtorrent::create_torrent t(fs, 128 * 1024, 6); std::vector tmp; - std::back_insert_iterator > out(tmp); + std::back_insert_iterator> out(tmp); bencode(out, t.generate()); error_code ec; - boost::shared_ptr info(boost::make_shared(&tmp[0], tmp.size(), std::ref(ec), 0)); + auto info = std::make_shared(&tmp[0], int(tmp.size()), std::ref(ec), 0); TEST_EQUAL(info->files().file_path(0), combine_path("test3","tmp1")); diff --git a/test/test_tracker.cpp b/test/test_tracker.cpp index 142539096..ce4f22a96 100644 --- a/test/test_tracker.cpp +++ b/test/test_tracker.cpp @@ -331,7 +331,7 @@ TORRENT_TEST(udp_tracker) remove_all("tmp1_tracker", ec); create_directory("tmp1_tracker", ec); std::ofstream file(combine_path("tmp1_tracker", "temporary").c_str()); - boost::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); + std::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); file.close(); char tracker_url[200]; @@ -405,7 +405,7 @@ TORRENT_TEST(http_peers) remove_all("tmp2_tracker", ec); create_directory("tmp2_tracker", ec); std::ofstream file(combine_path("tmp2_tracker", "temporary").c_str()); - boost::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); + std::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); file.close(); char tracker_url[200]; @@ -482,7 +482,7 @@ TORRENT_TEST(current_tracker) remove_all("tmp3_tracker", ec); create_directory("tmp3_tracker", ec); std::ofstream file(combine_path("tmp3_tracker", "temporary").c_str()); - boost::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); + std::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); file.close(); char tracker_url[200]; @@ -541,7 +541,7 @@ void test_proxy(bool proxy_trackers) remove_all("tmp2_tracker", ec); create_directory("tmp2_tracker", ec); std::ofstream file(combine_path("tmp2_tracker", "temporary").c_str()); - boost::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); + std::shared_ptr t = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); file.close(); char tracker_url[200]; diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 4430b7538..f783139ff 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -227,7 +227,7 @@ void test_transfer(int proxy_type, settings_pack const& sett create_directory("tmp1_transfer", ec); std::ofstream file("tmp1_transfer/temporary"); - boost::shared_ptr t = ::create_torrent(&file, "temporary", 32 * 1024, 13, false); + std::shared_ptr t = ::create_torrent(&file, "temporary", 32 * 1024, 13, false); file.close(); TEST_CHECK(exists(combine_path("tmp1_transfer", "temporary"))); diff --git a/test/test_utp.cpp b/test/test_utp.cpp index 5fbc48f31..cf0498acb 100644 --- a/test/test_utp.cpp +++ b/test/test_utp.cpp @@ -91,7 +91,7 @@ void test_transfer() create_directory("./tmp1_utp", ec); std::ofstream file("./tmp1_utp/temporary"); - boost::shared_ptr t = ::create_torrent(&file, "temporary", 128 * 1024, 6, false); + std::shared_ptr t = ::create_torrent(&file, "temporary", 128 * 1024, 6, false); file.close(); // for performance testing diff --git a/test/test_web_seed_redirect.cpp b/test/test_web_seed_redirect.cpp index aeee6af1d..bcfb79a5b 100644 --- a/test/test_web_seed_redirect.cpp +++ b/test/test_web_seed_redirect.cpp @@ -84,8 +84,8 @@ TORRENT_TEST(web_seed_redirect) std::vector buf; bencode(std::back_inserter(buf), t.generate()); - boost::shared_ptr torrent_file(new torrent_info(&buf[0] - , int(buf.size()), ec)); + auto torrent_file = std::make_shared(&buf[0] + , int(buf.size()), ec); { settings_pack settings; diff --git a/test/web_seed_suite.cpp b/test/web_seed_suite.cpp index 20b6e43f0..ce2d1cd48 100644 --- a/test/web_seed_suite.cpp +++ b/test/web_seed_suite.cpp @@ -47,7 +47,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "make_torrent.hpp" #include -#include #include #include "setup_transfer.hpp" @@ -75,7 +74,7 @@ static char const* proxy_name[] = {"", "_socks4", "_socks5", "_socks5_pw", "_htt } // anonymous namespace // proxy: 0=none, 1=socks4, 2=socks5, 3=socks5_pw 4=http 5=http_pw -void test_transfer(lt::session& ses, boost::shared_ptr torrent_file +void test_transfer(lt::session& ses, std::shared_ptr torrent_file , int proxy, char const* protocol, bool url_seed , bool chunked_encoding, bool test_ban, bool keepalive, bool proxy_peers) { @@ -377,7 +376,7 @@ int EXPORT run_http_suite(int proxy, char const* protocol, bool test_url_seed { std::fprintf(stderr, "\n\n ==== test case %d ====\n\n\n", a); - boost::shared_ptr torrent_file = make_test_torrent(test_cases[a]); + std::shared_ptr torrent_file = make_test_torrent(test_cases[a]); // if test_ban is true, we create the files with alternate content (that // doesn't match the hashes in the .torrent file) diff --git a/test/web_seed_suite.hpp b/test/web_seed_suite.hpp index b88b02a72..e5181ba8d 100644 --- a/test/web_seed_suite.hpp +++ b/test/web_seed_suite.hpp @@ -37,7 +37,7 @@ int EXPORT run_http_suite(int proxy, char const* protocol , bool keepalive = true, bool test_rename = false, bool proxy_peers = true); void EXPORT test_transfer(libtorrent::session& ses - , boost::shared_ptr torrent_file + , std::shared_ptr torrent_file , int proxy = 0, char const* protocol = "http" , bool url_seed = true, bool chunked_encoding = false , bool test_ban = false, bool keepalive = true, bool proxy_peers = true);