mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-14 03:09:08 +00:00
Fix Ryzom server compile under MinGW
This commit is contained in:
parent
689b563777
commit
252bc59e07
1 changed files with 11 additions and 11 deletions
|
@ -27,12 +27,12 @@
|
||||||
bool EnableStlAllocatorChecker= true;
|
bool EnableStlAllocatorChecker= true;
|
||||||
NLMISC_VARIABLE(bool,EnableStlAllocatorChecker,"Enable stl allocator tests");
|
NLMISC_VARIABLE(bool,EnableStlAllocatorChecker,"Enable stl allocator tests");
|
||||||
|
|
||||||
uint32 StlAllocatorMaxFree= 0;
|
uintptr_t StlAllocatorMaxFree= 0;
|
||||||
NLMISC_VARIABLE(uint32,StlAllocatorMaxFree,"When EnableStlAllocatorChecker is true, this value gives the largest number of free blocks encountered");
|
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
|
// => 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
|
// 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
|
// - 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;
|
if (IsCrashed) return;
|
||||||
|
|
||||||
// setup a pointer 'p' to the first block in the allocator's linked list of free blocks
|
// 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();
|
std::vector<uintptr_t>::allocator_type allocator= StaticIntVector.get_allocator();
|
||||||
uint32 *p;
|
uintptr_t *p;
|
||||||
p= allocator.allocate(1);
|
p= allocator.allocate(1);
|
||||||
allocator.deallocate(p,1);
|
allocator.deallocate(p,1);
|
||||||
|
|
||||||
// setup a counter to 3GBytes/ sizeof(uint32*) => equivalent to the total addressable memory space under linux
|
// setup a counter to 3GBytes/ sizeof(void*) (32bit) => equivalent to the total addressable memory space under linux
|
||||||
uint32 counter= MaxIterations;
|
uintptr_t counter= MaxIterations;
|
||||||
|
|
||||||
if (setjmp(Context) == 0)
|
if (setjmp(Context) == 0)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// step forwards allong the linked list
|
// 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 the counter hits zero then we can assume that we're in an infinite loop
|
||||||
if (--counter==0)
|
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 we hit a NULL end of list terminator then return happily
|
||||||
if (p==NULL)
|
if (p==NULL)
|
||||||
{
|
{
|
||||||
uint32 numIterations= MaxIterations- counter;
|
uintptr_t numIterations= MaxIterations- counter;
|
||||||
StlAllocatorMaxFree= std::max(numIterations,StlAllocatorMaxFree);
|
StlAllocatorMaxFree= std::max(numIterations,StlAllocatorMaxFree);
|
||||||
signal(SIGSEGV, NULL);
|
signal(SIGSEGV, NULL);
|
||||||
return;
|
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
|
// 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
|
// data thta they shouldn't and make our debugging task harder
|
||||||
// ... so just provoke an access violation
|
// ... so just provoke an access violation
|
||||||
*(uint32**)(0) = p;
|
*(uintptr_t**)(0) = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we just hit a crash case so setup flags / globals accordingly
|
// we just hit a crash case so setup flags / globals accordingly
|
||||||
|
|
Loading…
Reference in a new issue