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 #define TORRENT_CHAINED_BUFFER_HPP_INCLUDED
#include <boost/function.hpp> #include <boost/function.hpp>
#if BOOST_VERSION < 103500
#include <asio/buffer.hpp>
#else
#include <boost/asio/buffer.hpp> #include <boost/asio/buffer.hpp>
#endif
#include <list> #include <list>
#include <cstring> #include <cstring>
namespace libtorrent namespace libtorrent
{ {
#if BOOST_VERSION >= 103500
namespace asio = boost::asio; namespace asio = boost::asio;
#endif
struct chained_buffer struct chained_buffer
{ {
chained_buffer(): m_bytes(0), m_capacity(0) {} chained_buffer(): m_bytes(0), m_capacity(0) {}

View File

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

View File

@ -38,9 +38,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/function.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/read.hpp>
#include <boost/asio/write.hpp> #include <boost/asio/write.hpp>
#endif
namespace libtorrent { namespace libtorrent {

View File

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

View File

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

View File

@ -21,7 +21,11 @@
# include <boost/type_traits/add_pointer.hpp> # include <boost/type_traits/add_pointer.hpp>
# include <boost/noncopyable.hpp> # include <boost/noncopyable.hpp>
#if BOOST_VERSION < 103500
#include <asio/io_service.hpp>
#else
#include <boost/asio/io_service.hpp> #include <boost/asio/io_service.hpp>
#endif
# define NETWORK_VARIANT_STREAM_LIMIT 5 # 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/host_name.hpp>
#include <boost/asio/ip/multicast.hpp> #include <boost/asio/ip/multicast.hpp>
#endif
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include "libtorrent/socket.hpp" #include "libtorrent/socket.hpp"

View File

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

View File

@ -40,8 +40,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/ref.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/host_name.hpp>
#include <boost/asio/ip/multicast.hpp> #include <boost/asio/ip/multicast.hpp>
#endif
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include <cstdlib> #include <cstdlib>
#include <boost/config.hpp> #include <boost/config.hpp>

View File

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

View File

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

View File

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

View File

@ -42,8 +42,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/ref.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/host_name.hpp>
#include <boost/asio/ip/multicast.hpp> #include <boost/asio/ip/multicast.hpp>
#endif
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include <cstdlib> #include <cstdlib>