diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 87ea0f7bf..f4b6f49b1 100755 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -35,6 +35,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#include "libtorrent/config.hpp" + #ifdef _MSC_VER #pragma warning(push, 1) #endif @@ -75,9 +77,9 @@ using boost::bind; bool sleep_and_input(char* c) { Sleep(500); - if (kbhit()) + if (_kbhit()) { - *c = getch(); + *c = _getch(); return true; } return false; diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index ff4d2980b..04d71885c 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -363,7 +363,7 @@ namespace libtorrent boost::posix_time::ptime m_last_tick; #ifndef TORRENT_DISABLE_DHT - boost::shared_ptr m_dht; + boost::intrusive_ptr m_dht; dht_settings m_dht_settings; #endif // the timer used to fire the second_tick diff --git a/include/libtorrent/random_sample.hpp b/include/libtorrent/random_sample.hpp index 741576fd9..8d85080df 100644 --- a/include/libtorrent/random_sample.hpp +++ b/include/libtorrent/random_sample.hpp @@ -36,6 +36,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#include "libtorrent/config.hpp" + namespace libtorrent { @@ -51,7 +53,7 @@ namespace libtorrent while (m < n) { - if ((rand() / (RAND_MAX + 1.f)) * (N - t) >= n - m) + if ((std::rand() / (RAND_MAX + 1.f)) * (N - t) >= n - m) { ++start; ++t; diff --git a/include/libtorrent/utf8.hpp b/include/libtorrent/utf8.hpp index 7a31af804..157a7fdba 100644 --- a/include/libtorrent/utf8.hpp +++ b/include/libtorrent/utf8.hpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace libtorrent { namespace detail { @@ -132,7 +133,7 @@ OutputIterator wchar_utf8(InputIterator first, InputIterator last, OutputIterato inline void utf8_wchar(const std::string &utf8, std::wstring &wide) { wide.clear(); - detail::utf8_wchar(utf8.begin(), utf8.end(), std::insert_iterator(wide, wide.end())); + detail::utf8_wchar(utf8.begin(), utf8.end(), std::back_inserter(wide)); } inline std::wstring utf8_wchar(const std::string &str) @@ -145,7 +146,7 @@ inline std::wstring utf8_wchar(const std::string &str) inline void wchar_utf8(const std::wstring &wide, std::string &utf8) { utf8.clear(); - detail::wchar_utf8(wide.begin(), wide.end(), std::insert_iterator(utf8, utf8.end())); + detail::wchar_utf8(wide.begin(), wide.end(), std::back_inserter(utf8)); } inline std::string wchar_utf8(const std::wstring &str) diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index 1618d3dc2..ebcda8313 100755 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -35,7 +35,9 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include +#include "libtorrent/config.hpp" #include "zlib.h" #ifdef _MSC_VER @@ -98,6 +100,8 @@ namespace return url.find(argument, i) != std::string::npos; } + + char to_lower(char c) { return std::tolower(c); } } namespace libtorrent @@ -186,7 +190,7 @@ namespace libtorrent } std::string name = line.substr(0, separator); - transform(name.begin(), name.end(), name.begin(), (int(*)(int))std::tolower); + std::transform(name.begin(), name.end(), name.begin(), &to_lower); std::string value = line.substr(separator + 2, std::string::npos); m_header.insert(std::make_pair(name, value)); diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 5d6a95510..07c9358e9 100755 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1510,18 +1510,18 @@ namespace libtorrent { namespace detail if (m_dht) { m_dht->stop(); - m_dht.reset(); + m_dht = 0; } - m_dht.reset(new dht::dht_tracker(m_io_service + m_dht = new dht::dht_tracker(m_io_service , m_dht_settings, m_listen_interface.address() - , startup_state)); + , startup_state); } void session_impl::stop_dht() { mutex_t::scoped_lock l(m_mutex); m_dht->stop(); - m_dht.reset(); + m_dht = 0; } void session_impl::set_dht_settings(dht_settings const& settings)