From 6d01cb475c16e43a3ef518762f8360bf8dda3fa8 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 6 Sep 2009 00:57:01 +0000 Subject: [PATCH] msvc build fixes --- src/disk_io_thread.cpp | 2 +- src/http_tracker_connection.cpp | 18 +++++++++++------- src/torrent.cpp | 9 +++++++-- src/torrent_info.cpp | 1 + src/udp_tracker_connection.cpp | 9 +++++---- test/test_storage.cpp | 2 +- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 3efb7959d..29522d1fe 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -1303,7 +1303,7 @@ namespace libtorrent , buffer_operation = 4 }; - static const uint8_t action_flags[] = + static const boost::uint8_t action_flags[] = { read_operation + buffer_operation // read , buffer_operation // write diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index 945654a13..9325e8f25 100644 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -64,7 +64,11 @@ using boost::bind; namespace libtorrent { - +#if TORRENT_USE_I2P + // defined in torrent_info.cpp + bool is_i2p_url(std::string const& url); +#endif + http_tracker_connection::http_tracker_connection( io_service& ios , connection_queue& cc @@ -110,8 +114,6 @@ namespace libtorrent } #if TORRENT_USE_I2P - // defined in torrent_info.cpp - bool is_i2p_url(std::string const& url); bool i2p = is_i2p_url(url); #else static const bool i2p = false; @@ -516,10 +518,12 @@ namespace libtorrent incomplete = int(incomplete_ent->integer()); std::list
ip_list; - std::transform(m_tracker_connection->endpoints().begin() - , m_tracker_connection->endpoints().end() - , std::back_inserter(ip_list) - , boost::bind(&tcp::endpoint::address, _1)); + std::list const& epts = m_tracker_connection->endpoints(); + for (std::list::const_iterator i = epts.begin() + , end(epts.end()); i != end; ++i) + { + ip_list.push_back(i->address()); + } cb->tracker_response(tracker_req(), m_tracker_ip, ip_list, peer_list , interval->integer(), complete, incomplete, external_ip); diff --git a/src/torrent.cpp b/src/torrent.cpp index 7e083e99f..3680dfa30 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -55,6 +55,7 @@ POSSIBILITY OF SUCH DAMAGE. #pragma warning(pop) #endif +#include "libtorrent/config.hpp" #include "libtorrent/torrent_handle.hpp" #include "libtorrent/session.hpp" #include "libtorrent/torrent_info.hpp" @@ -3875,12 +3876,16 @@ namespace libtorrent // this asserts that we don't have duplicates in the policy's peer list peer_iterator i_ = std::find_if(m_connections.begin(), m_connections.end() , bind(&peer_connection::remote, _1) == peerinfo->ip()); +#if TORRENT_USE_I2P TORRENT_ASSERT(i_ == m_connections.end() || dynamic_cast(*i_) == 0 -#if TORRENT_USE_I2P || peerinfo->is_i2p_addr -#endif ); +#else + TORRENT_ASSERT(i_ == m_connections.end() + || dynamic_cast(*i_) == 0 + ); +#endif #endif TORRENT_ASSERT(want_more_peers()); diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index ec25c94ad..e0dc3a858 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -55,6 +55,7 @@ POSSIBILITY OF SUCH DAMAGE. #pragma warning(pop) #endif +#include "libtorrent/config.hpp" #include "libtorrent/torrent_info.hpp" #include "libtorrent/bencode.hpp" #include "libtorrent/hasher.hpp" diff --git a/src/udp_tracker_connection.cpp b/src/udp_tracker_connection.cpp index 7a8a030a9..87fb16c5d 100644 --- a/src/udp_tracker_connection.cpp +++ b/src/udp_tracker_connection.cpp @@ -439,10 +439,11 @@ namespace libtorrent } std::list
ip_list; - std::transform(m_endpoints.begin() - , m_endpoints.end() - , std::back_inserter(ip_list) - , boost::bind(&udp::endpoint::address, _1)); + for (std::list::const_iterator i = m_endpoints.begin() + , end(m_endpoints.end()); i != end; ++i) + { + ip_list.push_back(i->address()); + } cb->tracker_response(tracker_req(), m_target.address(), ip_list , peer_list, interval, complete, incomplete, address()); diff --git a/test/test_storage.cpp b/test/test_storage.cpp index 56af1e444..76a299f03 100644 --- a/test/test_storage.cpp +++ b/test/test_storage.cpp @@ -251,7 +251,7 @@ void run_elevator_test() // test the elevator going up add_job_up(dio, 0, pm); - uint32_t p = 1234513; + boost::uint32_t p = 1234513; for (int i = 0; i < 100; ++i) { p *= 123;