From 252bc59e07d2e3b18b15b0f6b9bfc1a76024a45e Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 19 Jun 2014 20:43:03 +0200 Subject: [PATCH] Fix Ryzom server compile under MinGW --- .../server_share/stl_allocator_checker.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/code/ryzom/server/src/server_share/stl_allocator_checker.cpp b/code/ryzom/server/src/server_share/stl_allocator_checker.cpp index 893ff9cb3..daf9b79b6 100644 --- a/code/ryzom/server/src/server_share/stl_allocator_checker.cpp +++ b/code/ryzom/server/src/server_share/stl_allocator_checker.cpp @@ -27,12 +27,12 @@ bool EnableStlAllocatorChecker= true; NLMISC_VARIABLE(bool,EnableStlAllocatorChecker,"Enable stl allocator tests"); -uint32 StlAllocatorMaxFree= 0; -NLMISC_VARIABLE(uint32,StlAllocatorMaxFree,"When EnableStlAllocatorChecker is true, this value gives the largest number of free blocks encountered"); +uintptr_t StlAllocatorMaxFree= 0; +NLMISC_VARIABLE(uintptr_t,StlAllocatorMaxFree,"When EnableStlAllocatorChecker is true, this value gives the largest number of free blocks encountered"); -// setup a 'max iterations' value of 3GBytes/ sizeof(uint32*) +// setup a 'max iterations' value of 3GBytes/ sizeof(void*) (32bit) // => this is equivalent to the total addressable memory space under linux -static const uint32 MaxIterations= 768*1024*1024; +static const uintptr_t MaxIterations= 768*1024*1024; // the following static vector exists only for the use of the testStlMemoryAllocator() routine // - it is required to allow us to get hold of the stl small block memory allocator @@ -54,20 +54,20 @@ void testStlMemoryAllocator(const char* state) if (IsCrashed) return; // setup a pointer 'p' to the first block in the allocator's linked list of free blocks - std::vector::allocator_type allocator= StaticIntVector.get_allocator(); - uint32 *p; + std::vector::allocator_type allocator= StaticIntVector.get_allocator(); + uintptr_t *p; p= allocator.allocate(1); allocator.deallocate(p,1); - // setup a counter to 3GBytes/ sizeof(uint32*) => equivalent to the total addressable memory space under linux - uint32 counter= MaxIterations; + // setup a counter to 3GBytes/ sizeof(void*) (32bit) => equivalent to the total addressable memory space under linux + uintptr_t counter= MaxIterations; if (setjmp(Context) == 0) { do { // step forwards allong the linked list - p= (uint32*)*p; + p= (uintptr_t*)*p; // if the counter hits zero then we can assume that we're in an infinite loop if (--counter==0) @@ -78,7 +78,7 @@ void testStlMemoryAllocator(const char* state) // if we hit a NULL end of list terminator then return happily if (p==NULL) { - uint32 numIterations= MaxIterations- counter; + uintptr_t numIterations= MaxIterations- counter; StlAllocatorMaxFree= std::max(numIterations,StlAllocatorMaxFree); signal(SIGSEGV, NULL); return; @@ -88,7 +88,7 @@ void testStlMemoryAllocator(const char* state) // note that our memory allocators contain invalid data so any call to 'nlassert' etc may modify // data thta they shouldn't and make our debugging task harder // ... so just provoke an access violation - *(uint32**)(0) = p; + *(uintptr_t**)(0) = p; } // we just hit a crash case so setup flags / globals accordingly