Ticket #2481: 0ad-check.patch
File 0ad-check.patch, 1.1 KB (added by , 10 years ago) |
---|
-
source/lib/allocators/tests/test_headerless.h
114 114 115 115 srand(1); 116 116 117 const size_t maxSize = (size_t)((rand() / (float)RAND_MAX) * poolSize); 118 const size_t size = std::max((size_t)HeaderlessAllocator::minAllocationSize, round_down(maxSize, HeaderlessAllocator::allocationAlignment)); 119 // (the size_t cast on minAllocationSize prevents max taking a reference to the non-defined variable) 117 120 for(int i = 0; i < 1000; i++) 118 121 { 119 122 // allocate 120 123 if(rand() >= RAND_MAX/2) 121 124 { 122 const size_t maxSize = (size_t)((rand() / (float)RAND_MAX) * poolSize);123 const size_t size = std::max((size_t)HeaderlessAllocator::minAllocationSize, round_down(maxSize, HeaderlessAllocator::allocationAlignment));124 // (the size_t cast on minAllocationSize prevents max taking a reference to the non-defined variable)125 125 void* p = a.Allocate(size); 126 126 if(!p) 127 127 continue;