From 0961a3d1baa97fc0137ee6c85f07870915a522a6 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 2 Jan 2015 11:48:04 +0000 Subject: [PATCH] fix python build without deprecated functions --- bindings/python/src/alert.cpp | 4 ++++ bindings/python/src/create_torrent.cpp | 6 ++++-- bindings/python/src/session.cpp | 9 +++------ bindings/python/src/torrent_handle.cpp | 4 ++-- bindings/python/src/torrent_info.cpp | 16 ++++------------ 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/bindings/python/src/alert.cpp b/bindings/python/src/alert.cpp index e6e9158b1..bb2194009 100644 --- a/bindings/python/src/alert.cpp +++ b/bindings/python/src/alert.cpp @@ -502,13 +502,17 @@ void bind_alert() .value("upload_payload", stats_alert::upload_payload) .value("upload_protocol", stats_alert::upload_protocol) .value("upload_ip_protocol", stats_alert::upload_ip_protocol) +#ifndef TORRENT_NO_DEPRECATE .value("upload_dht_protocol", stats_alert::upload_dht_protocol) .value("upload_tracker_protocol", stats_alert::upload_tracker_protocol) +#endif .value("download_payload", stats_alert::download_payload) .value("download_protocol", stats_alert::download_protocol) .value("download_ip_protocol", stats_alert::download_ip_protocol) +#ifndef TORRENT_NO_DEPRECATE .value("download_dht_protocol", stats_alert::download_dht_protocol) .value("download_tracker_protocol", stats_alert::download_tracker_protocol) +#endif ; class_, noncopyable>( diff --git a/bindings/python/src/create_torrent.cpp b/bindings/python/src/create_torrent.cpp index cf93c7e76..431efe14e 100644 --- a/bindings/python/src/create_torrent.cpp +++ b/bindings/python/src/create_torrent.cpp @@ -76,9 +76,9 @@ namespace void bind_create_torrent() { - void (file_storage::*add_file0)(std::string const&, size_type, int, std::time_t, std::string const&) = &file_storage::add_file; + void (file_storage::*add_file0)(std::string const&, boost::int64_t, int, std::time_t, std::string const&) = &file_storage::add_file; #if TORRENT_USE_WSTRING && !defined TORRENT_NO_DEPRECATE - void (file_storage::*add_file1)(std::wstring const&, size_type, int, std::time_t, std::string const&) = &file_storage::add_file; + void (file_storage::*add_file1)(std::wstring const&, boost::int64_t, int, std::time_t, std::string const&) = &file_storage::add_file; #endif void (file_storage::*set_name0)(std::string const&) = &file_storage::set_name; @@ -155,7 +155,9 @@ void bind_create_torrent() .value("merkle", create_torrent::merkle) .value("modification_time", create_torrent::modification_time) .value("symlinks", create_torrent::symlinks) +#if !defined TORRENT_NO_DEPRECATE .value("calculate_file_hashes", create_torrent::calculate_file_hashes) +#endif ; def("add_files", add_files0, (arg("fs"), arg("path"), arg("flags") = 0)); diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 9a6910198..4fca11fd7 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -612,12 +612,10 @@ void bind_session() .def_readonly("reads", &cache_status::reads) .def_readonly("queued_bytes", &cache_status::queued_bytes) .def_readonly("cache_size", &cache_status::cache_size) -#endif .def_readonly("write_cache_size", &cache_status::write_cache_size) .def_readonly("read_cache_size", &cache_status::read_cache_size) .def_readonly("pinned_blocks", &cache_status::pinned_blocks) .def_readonly("total_used_buffers", &cache_status::total_used_buffers) -#ifndef TORRENT_NO_DEPRECATE .def_readonly("average_read_time", &cache_status::average_read_time) .def_readonly("average_write_time", &cache_status::average_write_time) .def_readonly("average_hash_time", &cache_status::average_hash_time) @@ -627,7 +625,6 @@ void bind_session() .def_readonly("cumulative_write_time", &cache_status::cumulative_write_time) .def_readonly("cumulative_hash_time", &cache_status::cumulative_hash_time) .def_readonly("total_read_back", &cache_status::total_read_back) -#endif .def_readonly("read_queue_size", &cache_status::read_queue_size) .def_readonly("blocked_jobs", &cache_status::blocked_jobs) .def_readonly("queued_jobs", &cache_status::queued_jobs) @@ -640,13 +637,13 @@ void bind_session() .def_readonly("arc_mru_ghost_size", &cache_status::arc_mru_ghost_size) .def_readonly("arc_mfu_size", &cache_status::arc_mfu_size) .def_readonly("arc_mfu_ghost_size", &cache_status::arc_mfu_ghost_size) +#endif ; class_("session", no_init) .def( - init(( + init(( arg("settings") - , arg("fingerprint")=fingerprint("LT",0,1,0,0) , arg("flags")=lt::session::start_default_features | lt::session::add_default_plugins)) ) .def( @@ -769,8 +766,8 @@ void bind_session() .def("stop_natpmp", allow_threads(<::session::stop_natpmp)) .def("get_cache_status", &get_cache_status) .def("get_cache_info", &get_cache_info2) -#endif .def("set_peer_id", allow_threads(<::session::set_peer_id)) +#endif // TORRENT_NO_DEPRECATE ; enum_("save_state_flags_t") diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index b6ce3489f..c398b47f9 100644 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -79,7 +79,7 @@ namespace list file_progress(torrent_handle& handle, int flags) { - std::vector p; + std::vector p; { allow_threading_guard guard; @@ -89,7 +89,7 @@ list file_progress(torrent_handle& handle, int flags) list result; - for (std::vector::iterator i(p.begin()), e(p.end()); i != e; ++i) + for (std::vector::iterator i(p.begin()), e(p.end()); i != e; ++i) result.append(*i); return result; diff --git a/bindings/python/src/torrent_info.cpp b/bindings/python/src/torrent_info.cpp index d64517104..58838eb6b 100644 --- a/bindings/python/src/torrent_info.cpp +++ b/bindings/python/src/torrent_info.cpp @@ -57,14 +57,6 @@ namespace d["type"] = i->type; d["auth"] = i->auth; d["extra_headers"] = i->extra_headers; - d["retry"] = total_seconds(i->retry - min_time()); - d["resolving"] = i->resolving; - d["removed"] = i->removed; - list endpoints; - for (std::vector::const_iterator k = i->endpoints.begin() - , end(i->endpoints.end()); k != end; ++k) - endpoints.append(make_tuple(print_address(k->address()), k->port())); - d["endpoints"] = endpoints; ret.append(d); } @@ -142,7 +134,7 @@ namespace return result; } - list map_block(torrent_info& ti, int piece, size_type offset, int size) + list map_block(torrent_info& ti, int piece, boost::int64_t offset, int size) { std::vector p = ti.map_block(piece, offset, size); list result; @@ -166,9 +158,9 @@ namespace bool get_send_stats(announce_entry const& ae) { return ae.send_stats; } - size_type get_size(file_entry const& fe) { return fe.size; } - size_type get_offset(file_entry const& fe) { return fe.offset; } - size_type get_file_base(file_entry const& fe) { return fe.file_base; } + 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; } void set_file_base(file_entry& fe, int b) { fe.file_base = b; } bool get_pad_file(file_entry const& fe) { return fe.pad_file; } bool get_executable_attribute(file_entry const& fe) { return fe.executable_attribute; }