Make libtorrent build with boost <1.35

This commit is contained in:
Andrew Resch 2008-05-20 06:03:46 +00:00
parent 5840a50d79
commit aed8f355b0
14 changed files with 100 additions and 22 deletions

View File

@ -34,14 +34,19 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_CHAINED_BUFFER_HPP_INCLUDED
#include <boost/function.hpp>
#if BOOST_VERSION < 103500
#include <asio/buffer.hpp>
#else
#include <boost/asio/buffer.hpp>
#endif
#include <list>
#include <cstring>
namespace libtorrent
{
#if BOOST_VERSION >= 103500
namespace asio = boost::asio;
#endif
struct chained_buffer
{
chained_buffer(): m_bytes(0), m_capacity(0) {}

View File

@ -36,7 +36,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include <libtorrent/kademlia/node_id.hpp>
#include "libtorrent/entry.hpp"
#if BOOST_VERSION < 103500
#include <asio/ip/udp.hpp>
#else
#include <boost/asio/ip/udp.hpp>
#endif
namespace libtorrent {
namespace dht {

View File

@ -38,9 +38,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/function.hpp>
#if BOOST_VERSION < 103500
#include <asio/read.hpp>
#include <asio/write.hpp>
#else
#include <boost/asio/read.hpp>
#include <boost/asio/write.hpp>
#endif
namespace libtorrent {

View File

@ -45,6 +45,16 @@ POSSIBILITY OF SUCH DAMAGE.
#define Protocol Protocol_
#endif
#if BOOST_VERSION < 103500
#include <asio/ip/tcp.hpp>
#include <asio/ip/udp.hpp>
#include <asio/io_service.hpp>
#include <asio/deadline_timer.hpp>
#include <asio/write.hpp>
#include <asio/read.hpp>
#include <asio/time_traits.hpp>
#include <asio/basic_deadline_timer.hpp>
#else
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ip/udp.hpp>
#include <boost/asio/io_service.hpp>
@ -53,7 +63,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/asio/read.hpp>
#include <boost/asio/time_traits.hpp>
#include <boost/asio/basic_deadline_timer.hpp>
#include <boost/system/error_code.hpp>
#endif
#ifdef __OBJC__
#undef Protocol
@ -69,22 +79,24 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent
{
/*
namespace asio = boost::asio;
#if BOOST_VERSION < 103500
using asio::ip::tcp;
using asio::ip::udp;
using asio::async_write;
using asio::async_read;
using boost::asio::ipv4::tcp;
using boost::asio::ipv4::address;
using boost::asio::stream_socket;
using boost::asio::datagram_socket;
using boost::asio::socket_acceptor;
using boost::asio::io_service;
using boost::asio::ipv4::host_resolver;
using boost::asio::async_write;
using boost::asio::ipv4::host;
using boost::asio::deadline_timer;
*/
// namespace asio = ::asio;
typedef asio::ip::tcp::socket stream_socket;
typedef asio::ip::address address;
typedef asio::ip::address_v4 address_v4;
typedef asio::ip::address_v6 address_v6;
typedef asio::ip::udp::socket datagram_socket;
typedef asio::ip::tcp::acceptor socket_acceptor;
typedef asio::io_service io_service;
typedef asio::error_code error_code;
namespace asio = ::asio;
typedef asio::basic_deadline_timer<libtorrent::ptime> deadline_timer;
#else
using boost::system::error_code;
using boost::asio::ip::tcp;
using boost::asio::ip::udp;
@ -100,8 +112,8 @@ namespace libtorrent
typedef boost::asio::io_service io_service;
namespace asio = boost::asio;
typedef boost::asio::basic_deadline_timer<libtorrent::ptime> deadline_timer;
#endif
inline std::ostream& print_address(std::ostream& os, address const& addr)
{

View File

@ -34,8 +34,11 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_SSL_STREAM_HPP_INCLUDED
#include "libtorrent/socket.hpp"
#if BOOST_VERSION < 103500
#include <asio/ssl.hpp>
#else
#include <boost/asio/ssl.hpp>
#endif
// openssl seems to believe it owns
// this name in every single scope
#undef set_key

View File

@ -86,7 +86,11 @@ namespace libtorrent
#else
#if BOOST_VERSION < 103500
#include <asio/time_traits.hpp>
#else
#include <boost/asio/time_traits.hpp>
#endif
#include <boost/cstdint.hpp>
#include "libtorrent/assert.hpp"
@ -152,7 +156,10 @@ namespace libtorrent
}
// asio time_traits
namespace boost { namespace asio
#if BOOST_VERSION < 103500
namespace boost {
#endif
namespace asio
{
template<>
struct time_traits<libtorrent::ptime>
@ -171,7 +178,10 @@ namespace boost { namespace asio
duration_type d)
{ return boost::posix_time::microseconds(libtorrent::total_microseconds(d)); }
};
} }
}
#if BOOST_VERSION < 103500
}
#endif
#if defined(__MACH__)

View File

@ -21,7 +21,11 @@
# include <boost/type_traits/add_pointer.hpp>
# include <boost/noncopyable.hpp>
#if BOOST_VERSION < 103500
#include <asio/io_service.hpp>
#else
#include <boost/asio/io_service.hpp>
#endif
# define NETWORK_VARIANT_STREAM_LIMIT 5

View File

@ -30,8 +30,14 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#include <asio/ip/multicast.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/ip/multicast.hpp>
#endif
#include <boost/bind.hpp>
#include "libtorrent/socket.hpp"

View File

@ -35,8 +35,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include "libtorrent/enum_net.hpp"
#include "libtorrent/broadcast_socket.hpp"
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#endif
#if defined TORRENT_BSD
#include <sys/ioctl.h>

View File

@ -40,8 +40,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#include <asio/ip/multicast.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/ip/multicast.hpp>
#endif
#include <boost/thread/mutex.hpp>
#include <cstdlib>
#include <boost/config.hpp>

View File

@ -47,7 +47,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/utility.hpp>
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#if BOOST_VERSION >= 103500
#include <boost/system/error_code.hpp>
#endif
#include <boost/version.hpp>
#ifdef _MSC_VER
@ -60,7 +63,9 @@ using boost::iostreams::mapped_file_params;
namespace libtorrent
{
namespace fs = boost::filesystem;
#if BOOST_VERSION >= 103500
using boost::system::error_code;
#endif
struct mapped_file_pool
{
@ -199,7 +204,11 @@ namespace libtorrent
size_type start = (offset / view_size) * view_size;
TORRENT_ASSERT(start + view_size >= offset + length);
#if BOOST_VERSION < 103500
fs::system_error_type ec;
#else
error_code ec;
#endif
fs::file_status st = fs::status(p, ec);
m_files.push_back(file_entry());

View File

@ -33,7 +33,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/pch.hpp"
#include <boost/bind.hpp>
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#endif
#include "libtorrent/natpmp.hpp"
#include "libtorrent/io.hpp"

View File

@ -4,7 +4,11 @@
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/array.hpp>
#if BOOST_VERSION < 103500
#include <asio/read.hpp>
#else
#include <boost/asio/read.hpp>
#endif
using namespace libtorrent;

View File

@ -42,8 +42,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#include <asio/ip/multicast.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/ip/multicast.hpp>
#endif
#include <boost/thread/mutex.hpp>
#include <cstdlib>