make deprecation ifdefs more uniform

This commit is contained in:
arvidn 2016-11-02 23:40:48 -04:00
parent 21d05945f2
commit c1fbd31bf1
3 changed files with 11 additions and 7 deletions

View File

@ -54,7 +54,7 @@ namespace
ct.add_node(std::make_pair(addr, port));
}
#if !defined TORRENT_NO_DEPRECATE
#ifndef TORRENT_NO_DEPRECATE
void add_file(file_storage& ct, file_entry const& fe)
{
ct.add_file(fe);
@ -121,7 +121,7 @@ void bind_create_torrent()
{
void (file_storage::*add_file0)(std::string const&, boost::int64_t
, int, std::time_t, std::string const&) = &file_storage::add_file;
#if !defined TORRENT_NO_DEPRECATE
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_USE_WSTRING
void (file_storage::*add_file1)(std::wstring const&, boost::int64_t
, int, std::time_t, std::string const&) = &file_storage::add_file;
@ -147,7 +147,7 @@ void bind_create_torrent()
boost::int64_t (file_storage::*file_storage_file_offset)(int) const = &file_storage::file_offset;
int (file_storage::*file_storage_file_flags)(int) const = &file_storage::file_flags;
#if !defined TORRENT_NO_DEPRECATE
#ifndef TORRENT_NO_DEPRECATE
file_entry (file_storage::*at)(int) const = &file_storage::at;
#endif
@ -159,7 +159,7 @@ void bind_create_torrent()
.def("add_file", add_file1, (arg("path"), arg("size"), arg("flags") = 0, arg("mtime") = 0, arg("linkpath") = ""))
#endif
.def("num_files", &file_storage::num_files)
#if !defined TORRENT_NO_DEPRECATE
#ifndef TORRENT_NO_DEPRECATE
.def("at", at)
.def("add_file", add_file, arg("entry"))
.def("__iter__", boost::python::range(&begin_files, &end_files))

View File

@ -71,11 +71,13 @@ namespace
s.add_dht_node(std::make_pair(ip, port));
}
#ifndef TORRENT_NO_DEPRECATE
void add_dht_router(lt::session& s, std::string router_, int port_)
{
allow_threading_guard guard;
return s.add_dht_router(std::make_pair(router_, port_));
}
#endif
#endif // TORRENT_DISABLE_DHT
@ -779,10 +781,12 @@ void bind_session()
.def("listen_port", allow_threads(&lt::session::listen_port))
#ifndef TORRENT_DISABLE_DHT
.def("add_dht_node", &add_dht_node)
#ifndef TORRENT_NO_DEPRECATE
.def(
"add_dht_router", &add_dht_router
, (arg("router"), "port")
)
#endif // TORRENT_NO_DEPRECATE
.def("is_dht_running", allow_threads(&lt::session::is_dht_running))
.def("set_dht_settings", allow_threads(&lt::session::set_dht_settings))
.def("get_dht_settings", allow_threads(&lt::session::get_dht_settings))

View File

@ -123,7 +123,7 @@ namespace
bool get_complete_sent(announce_entry const& ae) { return ae.complete_sent; }
bool get_send_stats(announce_entry const& ae) { return ae.send_stats; }
#if !defined TORRENT_NO_DEPRECATE
#ifndef TORRENT_NO_DEPRECATE
boost::int64_t get_size(file_entry const& fe) { return fe.size; }
boost::int64_t get_offset(file_entry const& fe) { return fe.offset; }
boost::int64_t get_file_base(file_entry const& fe) { return fe.file_base; }
@ -246,7 +246,7 @@ void bind_torrent_info()
.def("remap_files", &torrent_info::remap_files)
.def("files", &torrent_info::files, return_internal_reference<>())
.def("orig_files", &torrent_info::orig_files, return_internal_reference<>())
#if !defined TORRENT_NO_DEPRECATE
#ifndef TORRENT_NO_DEPRECATE
.def("file_at", &torrent_info::file_at)
.def("file_at_offset", &torrent_info::file_at_offset)
#if TORRENT_USE_WSTRING
@ -267,7 +267,7 @@ void bind_torrent_info()
.def("map_file", &torrent_info::map_file)
;
#if !defined TORRENT_NO_DEPRECATE
#ifndef TORRENT_NO_DEPRECATE
class_<file_entry>("file_entry")
.def_readwrite("path", &file_entry::path)
.def_readwrite("symlink_path", &file_entry::symlink_path)