fix some build warnings in python binding

This commit is contained in:
arvidn 2016-04-07 22:45:23 -04:00
parent 445cf4be04
commit 5c17dc9f31
27 changed files with 74 additions and 49 deletions

View File

@ -21,6 +21,7 @@ EXTRA_DIST = \
src/module.cpp \
src/optional.hpp \
src/peer_info.cpp \
src/boost_python.hpp \
src/session.cpp \
src/session_settings.cpp \
src/string.cpp \

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <libtorrent/alert.hpp>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/piece_picker.hpp> // for piece_block

View File

@ -3,7 +3,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <libtorrent/sha1_hash.hpp>
#include <boost/python.hpp>
#include "boost_python.hpp"
#include "bytes.hpp"
long get_hash(boost::python::object o)

View File

@ -0,0 +1,13 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PYTHON_HPP
#define BOOST_PYTHON_HPP
#include <libtorrent/aux_/disable_warnings_push.hpp>
#include <boost/python.hpp>
#include <libtorrent/aux_/disable_warnings_pop.hpp>
#endif

View File

@ -9,16 +9,16 @@
struct bytes
{
bytes(char const* s, int len): arr(s, len) {}
bytes(std::string const& s): arr(s) {}
bytes(char const* s, int len): arr(s, len) {}
bytes(std::string const& s): arr(s) {}
#if __cplusplus >= 201103L
bytes(std::string&& s): arr(std::move(s)) {}
bytes(bytes const&) = default;
bytes(bytes&&) = default;
bytes& operator=(bytes&&) = default;
bytes(std::string&& s): arr(std::move(s)) {}
bytes(bytes const&) = default;
bytes(bytes&&) = default;
bytes& operator=(bytes&&) = default;
#endif
bytes() {}
std::string arr;
bytes() {}
std::string arr;
};
#endif

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include "boost_python.hpp"
using namespace boost::python;

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <libtorrent/create_torrent.hpp>
#include <libtorrent/file_storage.hpp>
#include "libtorrent/torrent_info.hpp"

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include "optional.hpp"
#include <boost/version.hpp>

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <libtorrent/session.hpp>
#include "bytes.hpp"

View File

@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <libtorrent/bdecode.hpp>
#include <libtorrent/upnp.hpp>
#include <libtorrent/socks5_stream.hpp>
#include <boost/python.hpp>
#include "boost_python.hpp"
using namespace boost::python;
using namespace libtorrent;

View File

@ -3,12 +3,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <libtorrent/fingerprint.hpp>
#include <libtorrent/aux_/disable_warnings_push.hpp>
#include <boost/python.hpp>
#include <libtorrent/aux_/disable_warnings_pop.hpp>
#include "boost_python.hpp"
void bind_fingerprint()
{

View File

@ -3,7 +3,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <libtorrent/ip_filter.hpp>
#include <boost/python.hpp>
#include "boost_python.hpp"
#include "gil.hpp"
using namespace boost::python;

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <libtorrent/session.hpp>
#include <libtorrent/torrent.hpp>
#include <libtorrent/magnet_uri.hpp>
@ -17,23 +17,23 @@ extern void dict_to_add_torrent_params(dict params, add_torrent_params& p);
namespace {
#ifndef TORRENT_NO_DEPRECATE
torrent_handle _add_magnet_uri(lt::session& s, std::string uri, dict params)
{
add_torrent_params p;
torrent_handle _add_magnet_uri(lt::session& s, std::string uri, dict params)
{
add_torrent_params p;
dict_to_add_torrent_params(params, p);
dict_to_add_torrent_params(params, p);
allow_threading_guard guard;
allow_threading_guard guard;
p.url = uri;
p.url = uri;
#ifndef BOOST_NO_EXCEPTIONS
return s.add_torrent(p);
return s.add_torrent(p);
#else
error_code ec;
return s.add_torrent(p, ec);
error_code ec;
return s.add_torrent(p, ec);
#endif
}
}
#endif
dict parse_magnet_uri_wrap(std::string const& uri)
@ -76,10 +76,10 @@ namespace {
void bind_magnet_uri()
{
#ifndef TORRENT_NO_DEPRECATE
def("add_magnet_uri", &_add_magnet_uri);
def("add_magnet_uri", &_add_magnet_uri);
#endif
def("make_magnet_uri", make_magnet_uri0);
def("make_magnet_uri", make_magnet_uri1);
def("parse_magnet_uri", parse_magnet_uri_wrap);
def("make_magnet_uri", make_magnet_uri0);
def("make_magnet_uri", make_magnet_uri1);
def("parse_magnet_uri", parse_magnet_uri_wrap);
}

View File

@ -5,7 +5,7 @@
#ifndef OPTIONAL_070108_HPP
# define OPTIONAL_070108_HPP
# include <boost/python.hpp>
# include "boost_python.hpp"
# include <boost/optional.hpp>
template <class T>

View File

@ -4,7 +4,7 @@
#include <libtorrent/peer_info.hpp>
#include <libtorrent/bitfield.hpp>
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <boost/python/iterator.hpp>
using namespace boost::python;

View File

@ -28,7 +28,7 @@
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/python.hpp>
#include "boost_python.hpp"
#include "libtorrent/aux_/disable_warnings_pop.hpp"

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <libtorrent/session.hpp>
using namespace boost::python;

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <string>
using namespace boost::python;

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <boost/python/tuple.hpp>
#include <boost/python/stl_iterator.hpp>
#include <libtorrent/torrent_handle.hpp>

View File

@ -4,7 +4,7 @@
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <boost/shared_ptr.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"

View File

@ -2,7 +2,7 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include "boost_python.hpp"
#include <libtorrent/torrent_status.hpp>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/bitfield.hpp>

View File

@ -4,7 +4,7 @@
#include <libtorrent/identify_client.hpp>
#include <libtorrent/bencode.hpp>
#include <boost/python.hpp>
#include "boost_python.hpp"
#include "bytes.hpp"
using namespace boost::python;

View File

@ -3,7 +3,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <libtorrent/version.hpp>
#include <boost/python.hpp>
#include "boost_python.hpp"
using namespace boost::python;
using libtorrent::version;

View File

@ -33,9 +33,13 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_BANDWIDTH_CHANNEL_HPP_INCLUDED
#define TORRENT_BANDWIDTH_CHANNEL_HPP_INCLUDED
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/integer_traits.hpp>
#include <boost/cstdint.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/assert.hpp"
namespace libtorrent {

View File

@ -33,12 +33,16 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_HASHER_HPP_INCLUDED
#define TORRENT_HASHER_HPP_INCLUDED
#include <boost/cstdint.hpp>
#include "libtorrent/peer_id.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/cstdint.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#ifdef TORRENT_USE_GCRYPT
#include <gcrypt.h>

View File

@ -33,7 +33,10 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_IO_HPP_INCLUDED
#define TORRENT_IO_HPP_INCLUDED
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/cstdint.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <string>
#include <algorithm> // for copy
#include <cstring> // for memcpy

View File

@ -30,7 +30,12 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/cstdint.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/bandwidth_queue_entry.hpp"
#include <cstring>
#include <algorithm>