From 7c66c2911fedd0f635e29f9f7faca368df850a20 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 7 Sep 2013 21:27:07 +0000 Subject: [PATCH] merged fixes from RC_0_16 --- ChangeLog | 1 + bindings/python/src/torrent_handle.cpp | 16 +++++++++++++++- bindings/python/src/torrent_info.cpp | 2 ++ libtorrent-rasterbar.pc.in | 4 ++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81f310a91..af7a2e50f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * fix boost-1.42 support for python bindings * fix memory allocation issue (virtual addres space waste) on windows 0.16.11 release diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index 71f1c5bee..7d47a3a06 100644 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -311,11 +311,25 @@ void connect_peer(torrent_handle& th, tuple ip, int source) } #ifndef TORRENT_NO_DEPRECATE +#if BOOST_VERSION > 104200 + boost::intrusive_ptr get_torrent_info(torrent_handle const& h) { - return boost::intrusive_ptr(&h.get_torrent_info()); + return boost::intrusive_ptr(&h.get_torrent_info()); } +#else + +boost::intrusive_ptr get_torrent_info(torrent_handle const& h) +{ + // I can't figure out how to expose intrusive_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 + return boost::intrusive_ptr(const_cast(&h.get_torrent_info())); +} + +#endif + void set_peer_upload_limit(torrent_handle& th, tuple const& ip, int limit) { th.set_peer_upload_limit(tuple_to_endpoint(ip), limit); diff --git a/bindings/python/src/torrent_info.cpp b/bindings/python/src/torrent_info.cpp index d04ef843d..40dc656d4 100644 --- a/bindings/python/src/torrent_info.cpp +++ b/bindings/python/src/torrent_info.cpp @@ -285,7 +285,9 @@ void bind_torrent_info() .value("source_tex", announce_entry::source_tex) ; +#if BOOST_VERSION > 104200 implicitly_convertible, boost::intrusive_ptr >(); boost::python::register_ptr_to_python >(); +#endif } diff --git a/libtorrent-rasterbar.pc.in b/libtorrent-rasterbar.pc.in index 35dc57b8a..dc600c29d 100644 --- a/libtorrent-rasterbar.pc.in +++ b/libtorrent-rasterbar.pc.in @@ -11,6 +11,6 @@ package=@PACKAGE@ Name: libtorrent-rasterbar Description: Bittorrent library. Version: @VERSION@ -Libs: -L${libdir} -ltorrent-rasterbar -Libs.private: @LIBS@ @BOOST_SYSTEM_LIB@ @PTHREAD_LIBS@ @OPENSSL_LIBS@ +Libs: -L${libdir} -ltorrent-rasterbar @BOOST_SYSTEM_LIB@ +Libs.private: @LIBS@ @PTHREAD_LIBS@ @OPENSSL_LIBS@ Cflags: -I${includedir} -I${includedir}/libtorrent @COMPILETIME_OPTIONS@