From f97168241fd6ff5e0db8d04fa126905e767185ef Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 27 Apr 2015 00:56:58 +0000 Subject: [PATCH] build fix --- include/libtorrent/allocator.hpp | 2 +- src/allocator.cpp | 12 ++++++------ src/crc32c.cpp | 4 ++++ src/kademlia/traversal_algorithm.cpp | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/libtorrent/allocator.hpp b/include/libtorrent/allocator.hpp index 28c13916e..a91c8b05c 100644 --- a/include/libtorrent/allocator.hpp +++ b/include/libtorrent/allocator.hpp @@ -46,7 +46,7 @@ namespace libtorrent typedef int size_type; typedef std::ptrdiff_t difference_type; - static char* malloc(const size_type bytes); + static char* malloc(size_type bytes); static void free(char* block); #ifdef TORRENT_DEBUG_BUFFERS static bool in_use(char const* block); diff --git a/src/allocator.cpp b/src/allocator.cpp index cbd20225f..8e8478386 100644 --- a/src/allocator.cpp +++ b/src/allocator.cpp @@ -104,9 +104,9 @@ namespace libtorrent TORRENT_ASSERT(int(bytes) >= page_size()); #ifdef TORRENT_DEBUG_BUFFERS - int page = page_size(); - int num_pages = (bytes + (page-1)) / page + 2; - int orig_bytes = bytes; + const int page = page_size(); + const int num_pages = (bytes + (page-1)) / page + 2; + const int orig_bytes = bytes; bytes = num_pages * page; #endif @@ -165,11 +165,11 @@ namespace libtorrent #define PROT_READ PAGE_READONLY #define PROT_WRITE PAGE_READWRITE #endif - int page = page_size(); + const int page = page_size(); // make the two surrounding pages non-readable and -writable mprotect(block - page, page, PROT_READ | PROT_WRITE); alloc_header* h = (alloc_header*)(block - page); - int num_pages = (h->size + (page-1)) / page + 2; + const int num_pages = (h->size + (page-1)) / page + 2; TORRENT_ASSERT(h->magic == 0x1337); mprotect(block + (num_pages-2) * page, page, PROT_READ | PROT_WRITE); // fprintf(stderr, "free: %p head: %p tail: %p size: %d\n", block, block - page, block + h->size, int(h->size)); @@ -200,7 +200,7 @@ namespace libtorrent #ifdef TORRENT_DEBUG_BUFFERS bool page_aligned_allocator::in_use(char const* block) { - int page = page_size(); + const int page = page_size(); alloc_header* h = (alloc_header*)(block - page); return h->magic == 0x1337; } diff --git a/src/crc32c.cpp b/src/crc32c.cpp index 17dab32cb..2cdc4292c 100644 --- a/src/crc32c.cpp +++ b/src/crc32c.cpp @@ -30,11 +30,15 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "libtorrent/config.hpp" #include "libtorrent/crc32c.hpp" #include "libtorrent/aux_/cpuid.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp" #include +#ifdef _MSC_VER +#include +#endif #include "libtorrent/aux_/disable_warnings_pop.hpp" diff --git a/src/kademlia/traversal_algorithm.cpp b/src/kademlia/traversal_algorithm.cpp index a405385ee..38ca97b2b 100644 --- a/src/kademlia/traversal_algorithm.cpp +++ b/src/kademlia/traversal_algorithm.cpp @@ -243,7 +243,7 @@ void traversal_algorithm::traverse(node_id const& id, udp::endpoint addr) #ifdef TORRENT_DHT_VERBOSE_LOGGING if (id.is_all_zeros()) { - TORRENT_LOG(traversal) << aux::time_now_string() << "[" << this << "] WARNING node returned a list which included a node with id 0"; + TORRENT_LOG(traversal) << " [" << this << "] WARNING node returned a list which included a node with id 0"; } #endif