diff --git a/include/libtorrent/bencode.hpp b/include/libtorrent/bencode.hpp index 82541fed0..a5fa1e298 100755 --- a/include/libtorrent/bencode.hpp +++ b/include/libtorrent/bencode.hpp @@ -68,7 +68,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/entry.hpp" -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1300 namespace std { using ::isdigit; @@ -226,7 +226,7 @@ namespace libtorrent // ---------------------------------------------- // string default: - if (std::isdigit(*in)) + if (isdigit(*in)) { std::string len_s = read_until(in, end, ':'); assert(*in == ':'); diff --git a/include/libtorrent/policy.hpp b/include/libtorrent/policy.hpp index f27cc1679..d21f40d6c 100755 --- a/include/libtorrent/policy.hpp +++ b/include/libtorrent/policy.hpp @@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "libtorrent/peer.hpp" -#include "piece_picker.hpp" +#include "libtorrent/piece_picker.hpp" // TODO: should be able to close connections with too low bandwidth to save memory diff --git a/include/libtorrent/session.hpp b/include/libtorrent/session.hpp index 233684d76..236fe8185 100755 --- a/include/libtorrent/session.hpp +++ b/include/libtorrent/session.hpp @@ -162,7 +162,11 @@ namespace libtorrent { main_loop_thread(int listen_port, session_impl* s) : m_ses(s), m_listen_port(listen_port) {} - void operator()() { m_ses->run(m_listen_port); } + void operator()() + { + std::cout << "main thread started\n"; + m_ses->run(m_listen_port); + } session_impl* m_ses; int m_listen_port; }; diff --git a/include/libtorrent/torrent_info.hpp b/include/libtorrent/torrent_info.hpp index c2f3c70b2..01562a446 100755 --- a/include/libtorrent/torrent_info.hpp +++ b/include/libtorrent/torrent_info.hpp @@ -114,7 +114,10 @@ namespace libtorrent entry::integer_type piece_size(unsigned int index) const { if (index == num_pieces()-1) - return total_size() % m_piece_length; + { + entry::integer_type s = total_size() % m_piece_length; + return (s == 0)?m_piece_length:s; + } else return piece_length(); } diff --git a/src/storage.cpp b/src/storage.cpp index f2be9f0db..3857b7ea3 100755 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#include #include #include #include diff --git a/src/torrent.cpp b/src/torrent.cpp index b7346375e..abf295823 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -407,4 +407,5 @@ namespace libtorrent } } -} \ No newline at end of file +} +