From a09595c634c9809aaffce4c80afd1f5e7d66a9c0 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 24 Oct 2003 02:18:11 +0000 Subject: [PATCH] made some fixes mainly for the bsd-sockets. It still doesn't work on linux. --- include/libtorrent/bencode.hpp | 4 ++-- include/libtorrent/policy.hpp | 2 +- include/libtorrent/session.hpp | 6 +++++- include/libtorrent/torrent_info.hpp | 5 ++++- src/storage.cpp | 1 + src/torrent.cpp | 3 ++- 6 files changed, 15 insertions(+), 6 deletions(-) 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 +} +