mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-10 09:19:01 +00:00
Fix Ryzom server compile under MinGW
This commit is contained in:
parent
8967f57fdf
commit
a07d54e819
1 changed files with 11 additions and 11 deletions
|
@ -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<uint32>::allocator_type allocator= StaticIntVector.get_allocator();
|
||||
uint32 *p;
|
||||
std::vector<uintptr_t>::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
|
||||
|
|
Loading…
Reference in a new issue