From 01c42720e17c4dfdc165ed3309b2971ab7bafd3a Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 14 Oct 2013 02:25:21 +0000 Subject: [PATCH] fix some deprecation issues (use interfa) --- examples/client_test.cpp | 2 -- include/libtorrent/torrent_handle.hpp | 17 ++++++++--------- src/file_storage.cpp | 14 +++++++------- src/torrent_handle.cpp | 6 +++--- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/examples/client_test.cpp b/examples/client_test.cpp index d37c6077e..7e212f85f 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -1019,9 +1019,7 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a h.set_max_uploads(-1); h.set_upload_limit(torrent_upload_limit); h.set_download_limit(torrent_download_limit); -#ifndef TORRENT_NO_DEPRECATE h.use_interface(outgoing_interface.c_str()); -#endif #ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES h.resolve_countries(true); #endif diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 8c0bde18d..5f5edb103 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -760,15 +760,6 @@ namespace libtorrent TORRENT_DEPRECATED_PREFIX void filter_files(std::vector const& files) const TORRENT_DEPRECATED; - // ``use_interface()`` sets the network interface this torrent will use when it opens outgoing - // connections. By default, it uses the same interface as the session uses to listen on. The - // parameter must be a string containing one or more, comma separated, ip-address (either an - // IPv4 or IPv6 address). When specifying multiple interfaces, the torrent will round-robin - // which interface to use for each outgoing conneciton. This is useful for clients that are - // multi-homed. - TORRENT_DEPRECATED_PREFIX - void use_interface(const char* net_interface) const TORRENT_DEPRECATED; - // deprecated in 0.14 // use save_resume_data() instead. It is async. and // will return the resume data in an alert @@ -777,6 +768,14 @@ namespace libtorrent // ================ end deprecation ============ #endif + // ``use_interface()`` sets the network interface this torrent will use when it opens outgoing + // connections. By default, it uses the same interface as the session uses to listen on. The + // parameter must be a string containing one or more, comma separated, ip-address (either an + // IPv4 or IPv6 address). When specifying multiple interfaces, the torrent will round-robin + // which interface to use for each outgoing conneciton. This is useful for clients that are + // multi-homed. + void use_interface(const char* net_interface) const; + // Fills the specified ``std::vector`` with the availability for each // piece in this torrent. libtorrent does not keep track of availability for // seeds, so if the torrent is seeding the availability for all pieces is diff --git a/src/file_storage.cpp b/src/file_storage.cpp index 3613c0752..817df7c22 100644 --- a/src/file_storage.cpp +++ b/src/file_storage.cpp @@ -230,11 +230,6 @@ namespace libtorrent #ifndef TORRENT_NO_DEPRECATE file_storage::iterator file_storage::file_at_offset_deprecated(size_type offset) const - { - return file_at_offset(offset); - } - - file_storage::iterator file_storage::file_at_offset(size_type offset) const { // find the file iterator and file offset internal_file_entry target; @@ -242,12 +237,17 @@ namespace libtorrent TORRENT_ASSERT(!compare_file_offset(target, m_files.front())); std::vector::const_iterator file_iter = std::upper_bound( - begin(), end(), target, compare_file_offset); + begin_deprecated(), end_deprecated(), target, compare_file_offset); - TORRENT_ASSERT(file_iter != begin()); + TORRENT_ASSERT(file_iter != begin_deprecated()); --file_iter; return file_iter; } + + file_storage::iterator file_storage::file_at_offset(size_type offset) const + { + return file_at_offset_deprecated(offset); + } #endif int file_storage::file_index_at_offset(size_type offset) const diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index 0080ff45e..339c116d0 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -589,15 +589,15 @@ namespace libtorrent return ret; } -#ifndef TORRENT_NO_DEPRECATE -// ============ start deprecation =============== - void torrent_handle::use_interface(const char* net_interface) const { INVARIANT_CHECK; TORRENT_ASYNC_CALL1(use_interface, std::string(net_interface)); } +#ifndef TORRENT_NO_DEPRECATE +// ============ start deprecation =============== + #if !TORRENT_NO_FPU void torrent_handle::file_progress(std::vector& progress) const {