fix build with boost-1.36

This commit is contained in:
Arvid Norberg 2008-08-16 21:11:27 +00:00
parent a49906f0cc
commit 9bae670ac7
7 changed files with 42 additions and 1 deletions

View File

@ -143,14 +143,22 @@ namespace libtorrent
{ {
using boost::filesystem::path; using boost::filesystem::path;
using boost::filesystem::directory_iterator; using boost::filesystem::directory_iterator;
#if BOOST_VERSION < 103600
std::string const& leaf = l.leaf(); std::string const& leaf = l.leaf();
#else
std::string const& leaf = l.filename();
#endif
if (leaf == ".." || leaf == ".") return; if (leaf == ".." || leaf == ".") return;
if (!pred(l)) return; if (!pred(l)) return;
path f(p / l); path f(p / l);
if (is_directory(f)) if (is_directory(f))
{ {
for (directory_iterator i(f), end; i != end; ++i) for (directory_iterator i(f), end; i != end; ++i)
#if BOOST_VERSION < 103600
add_files_impl(fs, p, l / i->leaf(), pred); add_files_impl(fs, p, l / i->leaf(), pred);
#else
add_files_impl(fs, p, l / i->filename(), pred);
#endif
} }
else else
{ {
@ -162,7 +170,11 @@ namespace libtorrent
template <class Pred> template <class Pred>
void add_files(file_storage& fs, boost::filesystem::path const& file, Pred p) 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); 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) inline void add_files(file_storage& fs, boost::filesystem::path const& file)

View File

@ -39,8 +39,9 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/storage.hpp" #include "libtorrent/storage.hpp"
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <boost/function.hpp>
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/shared_array.hpp> #include <boost/shared_array.hpp>

View File

@ -73,7 +73,11 @@ namespace libtorrent
inline boost::system::error_category const& get_system_category() inline boost::system::error_category const& get_system_category()
{ return boost::system::get_system_category(); } { return boost::system::get_system_category(); }
inline boost::system::error_category const& get_posix_category() inline boost::system::error_category const& get_posix_category()
#if BOOST_VERSION < 103600
{ return boost::system::get_posix_category(); } { return boost::system::get_posix_category(); }
#else
{ return boost::system::get_generic_category(); }
#endif
#endif #endif
} }

View File

@ -49,7 +49,11 @@ namespace libtorrent
, m_private(false) , m_private(false)
{ {
TORRENT_ASSERT(fs.num_files() > 0); TORRENT_ASSERT(fs.num_files() > 0);
#if BOOST_VERSION < 103600
if (!m_multifile && m_files.at(0).path.has_branch_path()) m_multifile = true; 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 // make sure the size is an even power of 2
#ifndef NDEBUG #ifndef NDEBUG
@ -75,7 +79,11 @@ namespace libtorrent
, m_private(false) , m_private(false)
{ {
TORRENT_ASSERT(fs.num_files() > 0); TORRENT_ASSERT(fs.num_files() > 0);
#if BOOST_VERSION < 103600
if (!m_multifile && m_files.at(0).path.has_branch_path()) m_multifile = true; 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; const int target_size = 40 * 1024;
int size = fs.total_size() / (target_size / 20); int size = fs.total_size() / (target_size / 20);
@ -190,7 +198,11 @@ namespace libtorrent
file_e["length"] = i->size; file_e["length"] = i->size;
entry& path_e = file_e["path"]; entry& path_e = file_e["path"];
#if BOOST_VERSION < 103600
TORRENT_ASSERT(i->path.has_branch_path()); TORRENT_ASSERT(i->path.has_branch_path());
#else
TORRENT_ASSERT(i->path.has_parent_path());
#endif
TORRENT_ASSERT(*i->path.begin() == m_files.name()); TORRENT_ASSERT(*i->path.begin() == m_files.name());
for (fs::path::iterator j = boost::next(i->path.begin()); for (fs::path::iterator j = boost::next(i->path.begin());

View File

@ -131,7 +131,11 @@ namespace libtorrent
void file_storage::add_file(fs::path const& file, size_type size) void file_storage::add_file(fs::path const& file, size_type size)
{ {
TORRENT_ASSERT(size >= 0); TORRENT_ASSERT(size >= 0);
#if BOOST_VERSION < 103600
if (!file.has_branch_path()) if (!file.has_branch_path())
#else
if (!file.has_parent_path())
#endif
{ {
// you have already added at least one file with a // you have already added at least one file with a
// path to the file (branch_path), which means that // path to the file (branch_path), which means that

View File

@ -265,7 +265,11 @@ namespace libtorrent
create_directory(new_path); create_directory(new_path);
for (basic_directory_iterator<Path> i(old_path), end; i != end; ++i) for (basic_directory_iterator<Path> i(old_path), end; i != end; ++i)
{ {
#if BOOST_VERSION < 103600
recursive_copy(i->path(), new_path / i->leaf(), ec); recursive_copy(i->path(), new_path / i->leaf(), ec);
#else
recursive_copy(i->path(), new_path / i->filename(), ec);
#endif
if (ec) return; if (ec) return;
} }
} }

View File

@ -385,7 +385,11 @@ namespace libtorrent
{ {
name = tmp.leaf(); name = tmp.leaf();
} }
#if BOOST_VERSION < 103600
else if (tmp.has_branch_path()) else if (tmp.has_branch_path())
#else
else if (tmp.has_parent_path())
#endif
{ {
fs::path p; fs::path p;
for (fs::path::iterator i = tmp.begin() for (fs::path::iterator i = tmp.begin()