|
|
91ebe26 |
diff -up 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h.orig 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h
|
|
|
91ebe26 |
--- 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h.orig 2014-04-18 18:59:21.714584836 -0300
|
|
|
91ebe26 |
+++ 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h 2014-04-18 19:00:01.101586345 -0300
|
|
|
91ebe26 |
@@ -114,14 +114,14 @@ public:
|
|
|
91ebe26 |
|
|
|
91ebe26 |
srand(1);
|
|
|
91ebe26 |
|
|
|
91ebe26 |
+ const size_t maxSize = (size_t)((rand() / (float)RAND_MAX) * poolSize);
|
|
|
91ebe26 |
+ const size_t size = std::max((size_t)HeaderlessAllocator::minAllocationSize, round_down(maxSize, HeaderlessAllocator::allocationAlignment));
|
|
|
91ebe26 |
+ // (the size_t cast on minAllocationSize prevents max taking a reference to the non-defined variable)
|
|
|
91ebe26 |
for(int i = 0; i < 1000; i++)
|
|
|
91ebe26 |
{
|
|
|
91ebe26 |
// allocate
|
|
|
91ebe26 |
if(rand() >= RAND_MAX/2)
|
|
|
91ebe26 |
{
|
|
|
91ebe26 |
- const size_t maxSize = (size_t)((rand() / (float)RAND_MAX) * poolSize);
|
|
|
91ebe26 |
- const size_t size = std::max((size_t)HeaderlessAllocator::minAllocationSize, round_down(maxSize, HeaderlessAllocator::allocationAlignment));
|
|
|
91ebe26 |
- // (the size_t cast on minAllocationSize prevents max taking a reference to the non-defined variable)
|
|
|
91ebe26 |
void* p = a.Allocate(size);
|
|
|
91ebe26 |
if(!p)
|
|
|
91ebe26 |
continue;
|