build fix

This commit is contained in:
Arvid Norberg 2015-04-27 00:56:58 +00:00
parent c6a4bd8dec
commit f97168241f
4 changed files with 12 additions and 8 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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 <boost/crc.hpp>
#ifdef _MSC_VER
#include <nmmintrin.h>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"

View File

@ -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