mirror of
https://abf.rosa.ru/djam/0ad.git
synced 2025-02-23 06:52:48 +00:00
22 lines
1.2 KiB
Diff
22 lines
1.2 KiB
Diff
![]() |
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
|
||
|
--- 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h.orig 2014-04-18 18:59:21.714584836 -0300
|
||
|
+++ 0ad-0.0.15-alpha/source/lib/allocators/tests/test_headerless.h 2014-04-18 19:00:01.101586345 -0300
|
||
|
@@ -114,14 +114,14 @@ public:
|
||
|
|
||
|
srand(1);
|
||
|
|
||
|
+ const size_t maxSize = (size_t)((rand() / (float)RAND_MAX) * poolSize);
|
||
|
+ const size_t size = std::max((size_t)HeaderlessAllocator::minAllocationSize, round_down(maxSize, HeaderlessAllocator::allocationAlignment));
|
||
|
+ // (the size_t cast on minAllocationSize prevents max taking a reference to the non-defined variable)
|
||
|
for(int i = 0; i < 1000; i++)
|
||
|
{
|
||
|
// allocate
|
||
|
if(rand() >= RAND_MAX/2)
|
||
|
{
|
||
|
- const size_t maxSize = (size_t)((rand() / (float)RAND_MAX) * poolSize);
|
||
|
- const size_t size = std::max((size_t)HeaderlessAllocator::minAllocationSize, round_down(maxSize, HeaderlessAllocator::allocationAlignment));
|
||
|
- // (the size_t cast on minAllocationSize prevents max taking a reference to the non-defined variable)
|
||
|
void* p = a.Allocate(size);
|
||
|
if(!p)
|
||
|
continue;
|