From 9bae670ac7ce6f974b2afa00ed23bdc907fbfb35 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 16 Aug 2008 21:11:27 +0000 Subject: [PATCH] fix build with boost-1.36 --- include/libtorrent/create_torrent.hpp | 12 ++++++++++++ include/libtorrent/disk_io_thread.hpp | 3 ++- include/libtorrent/error_code.hpp | 4 ++++ src/create_torrent.cpp | 12 ++++++++++++ src/file_storage.cpp | 4 ++++ src/storage.cpp | 4 ++++ src/torrent_info.cpp | 4 ++++ 7 files changed, 42 insertions(+), 1 deletion(-) diff --git a/include/libtorrent/create_torrent.hpp b/include/libtorrent/create_torrent.hpp index e631a145a..108de8fda 100644 --- a/include/libtorrent/create_torrent.hpp +++ b/include/libtorrent/create_torrent.hpp @@ -143,14 +143,22 @@ namespace libtorrent { using boost::filesystem::path; using boost::filesystem::directory_iterator; +#if BOOST_VERSION < 103600 std::string const& leaf = l.leaf(); +#else + std::string const& leaf = l.filename(); +#endif if (leaf == ".." || leaf == ".") return; if (!pred(l)) return; path f(p / l); if (is_directory(f)) { for (directory_iterator i(f), end; i != end; ++i) +#if BOOST_VERSION < 103600 add_files_impl(fs, p, l / i->leaf(), pred); +#else + add_files_impl(fs, p, l / i->filename(), pred); +#endif } else { @@ -162,7 +170,11 @@ namespace libtorrent template void add_files(file_storage& fs, boost::filesystem::path const& file, Pred p) { +#if BOOST_VERSION < 103600 detail::add_files_impl(fs, complete(file).branch_path(), file.leaf(), p); +#else + detail::add_files_impl(fs, complete(file).parent_path(), file.filename(), p); +#endif } inline void add_files(file_storage& fs, boost::filesystem::path const& file) diff --git a/include/libtorrent/disk_io_thread.hpp b/include/libtorrent/disk_io_thread.hpp index 922896741..23e8dd349 100644 --- a/include/libtorrent/disk_io_thread.hpp +++ b/include/libtorrent/disk_io_thread.hpp @@ -39,8 +39,9 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/storage.hpp" #include -#include #include +#include +#include #include #include #include diff --git a/include/libtorrent/error_code.hpp b/include/libtorrent/error_code.hpp index ffc7d662e..36c8da342 100644 --- a/include/libtorrent/error_code.hpp +++ b/include/libtorrent/error_code.hpp @@ -73,7 +73,11 @@ namespace libtorrent inline boost::system::error_category const& get_system_category() { return boost::system::get_system_category(); } inline boost::system::error_category const& get_posix_category() +#if BOOST_VERSION < 103600 { return boost::system::get_posix_category(); } +#else + { return boost::system::get_generic_category(); } +#endif #endif } diff --git a/src/create_torrent.cpp b/src/create_torrent.cpp index 98f590d20..67448bb7b 100644 --- a/src/create_torrent.cpp +++ b/src/create_torrent.cpp @@ -49,7 +49,11 @@ namespace libtorrent , m_private(false) { TORRENT_ASSERT(fs.num_files() > 0); +#if BOOST_VERSION < 103600 if (!m_multifile && m_files.at(0).path.has_branch_path()) m_multifile = true; +#else + if (!m_multifile && m_files.at(0).path.has_parent_path()) m_multifile = true; +#endif // make sure the size is an even power of 2 #ifndef NDEBUG @@ -75,7 +79,11 @@ namespace libtorrent , m_private(false) { TORRENT_ASSERT(fs.num_files() > 0); +#if BOOST_VERSION < 103600 if (!m_multifile && m_files.at(0).path.has_branch_path()) m_multifile = true; +#else + if (!m_multifile && m_files.at(0).path.has_parent_path()) m_multifile = true; +#endif const int target_size = 40 * 1024; int size = fs.total_size() / (target_size / 20); @@ -190,7 +198,11 @@ namespace libtorrent file_e["length"] = i->size; entry& path_e = file_e["path"]; +#if BOOST_VERSION < 103600 TORRENT_ASSERT(i->path.has_branch_path()); +#else + TORRENT_ASSERT(i->path.has_parent_path()); +#endif TORRENT_ASSERT(*i->path.begin() == m_files.name()); for (fs::path::iterator j = boost::next(i->path.begin()); diff --git a/src/file_storage.cpp b/src/file_storage.cpp index a0c4145f3..dd732bef1 100644 --- a/src/file_storage.cpp +++ b/src/file_storage.cpp @@ -131,7 +131,11 @@ namespace libtorrent void file_storage::add_file(fs::path const& file, size_type size) { TORRENT_ASSERT(size >= 0); +#if BOOST_VERSION < 103600 if (!file.has_branch_path()) +#else + if (!file.has_parent_path()) +#endif { // you have already added at least one file with a // path to the file (branch_path), which means that diff --git a/src/storage.cpp b/src/storage.cpp index dffea8267..ed6546e23 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -265,7 +265,11 @@ namespace libtorrent create_directory(new_path); for (basic_directory_iterator i(old_path), end; i != end; ++i) { +#if BOOST_VERSION < 103600 recursive_copy(i->path(), new_path / i->leaf(), ec); +#else + recursive_copy(i->path(), new_path / i->filename(), ec); +#endif if (ec) return; } } diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 0c3e0fe5d..6fb5fa992 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -385,7 +385,11 @@ namespace libtorrent { name = tmp.leaf(); } +#if BOOST_VERSION < 103600 else if (tmp.has_branch_path()) +#else + else if (tmp.has_parent_path()) +#endif { fs::path p; for (fs::path::iterator i = tmp.begin()