Fix type conversion warnings in unit tests for memory allocators.
This commit is contained in:
@@ -49,13 +49,13 @@ main( int __unused argc,
|
|||||||
|
|
||||||
mem_HeapPrint( false);
|
mem_HeapPrint( false);
|
||||||
|
|
||||||
for ( int i = 0; i < test_iters; i++ )
|
for ( uint32_t i = 0; i < test_iters; i++ )
|
||||||
{
|
{
|
||||||
const int subiters = test_sub_iters;
|
const uint32_t subiters = test_sub_iters;
|
||||||
uint8_t * ptrs[subiters];
|
uint8_t * ptrs[subiters];
|
||||||
size_t sizes[subiters];
|
size_t sizes[subiters];
|
||||||
|
|
||||||
for ( int j = 0; j < subiters; j++ )
|
for ( uint32_t j = 0; j < subiters; j++ )
|
||||||
{
|
{
|
||||||
size_t size = (unsigned int) rand() % ( test_threshold_block_size );
|
size_t size = (unsigned int) rand() % ( test_threshold_block_size );
|
||||||
ptrs[j] = mem_HeapAllocBlock( size, ( rand() % 2 ) ? MEM_HEAP_ALLOC_SHORT_TERM : MEM_HEAP_ALLOC_SHORT_TERM);
|
ptrs[j] = mem_HeapAllocBlock( size, ( rand() % 2 ) ? MEM_HEAP_ALLOC_SHORT_TERM : MEM_HEAP_ALLOC_SHORT_TERM);
|
||||||
@@ -69,7 +69,7 @@ main( int __unused argc,
|
|||||||
|
|
||||||
// mem_HeapPrint( true);
|
// mem_HeapPrint( true);
|
||||||
|
|
||||||
for ( int j = 0; j < subiters; j++ )
|
for ( uint32_t j = 0; j < subiters; j++ )
|
||||||
{
|
{
|
||||||
if ( ptrs[j] != NULL )
|
if ( ptrs[j] != NULL )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,12 +46,12 @@ main( int __unused argc,
|
|||||||
printf("seed=%d\n", k);
|
printf("seed=%d\n", k);
|
||||||
srand((unsigned int) k);
|
srand((unsigned int) k);
|
||||||
|
|
||||||
for ( int i = 0; i < test_iters; i++ )
|
for ( uint32_t i = 0; i < test_iters; i++ )
|
||||||
{
|
{
|
||||||
mem_PoolState_t pool;
|
mem_PoolState_t pool;
|
||||||
uint8_t test_pool[test_pool_area_size] __attribute__((aligned(MEM_ALIGNMENT)));
|
uint8_t test_pool[test_pool_area_size] __attribute__((aligned(MEM_ALIGNMENT)));
|
||||||
|
|
||||||
const size_t chunkSize = MEM_ALIGNMENT * ( ( rand() % test_max_chunk_size_divided_by_alignment ) + 1 );
|
const size_t chunkSize = MEM_ALIGNMENT * ( ( (size_t) rand() % test_max_chunk_size_divided_by_alignment ) + 1 );
|
||||||
|
|
||||||
mem_PoolInit( &pool, chunkSize, test_pool, sizeof (test_pool));
|
mem_PoolInit( &pool, chunkSize, test_pool, sizeof (test_pool));
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ main( int __unused argc,
|
|||||||
__printf("seed=%u\n", seed);
|
__printf("seed=%u\n", seed);
|
||||||
srand(seed);
|
srand(seed);
|
||||||
|
|
||||||
for ( int i = 0; i < test_iters; i++ )
|
for ( uint32_t i = 0; i < test_iters; i++ )
|
||||||
{
|
{
|
||||||
const size_t subiters = ( (size_t) rand() % test_max_sub_iters ) + 1;
|
const size_t subiters = ( (size_t) rand() % test_max_sub_iters ) + 1;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ main( int __unused argc,
|
|||||||
for ( size_t j = 0; j < subiters; j++ )
|
for ( size_t j = 0; j < subiters; j++ )
|
||||||
{
|
{
|
||||||
mem_PoolChunkType_t type = (mem_PoolChunkType_t) (rand() % MEM_POOL_CHUNK_TYPE__COUNT);
|
mem_PoolChunkType_t type = (mem_PoolChunkType_t) (rand() % MEM_POOL_CHUNK_TYPE__COUNT);
|
||||||
const uint32_t chunkSize = mem_GetChunkSize( type);
|
const size_t chunkSize = mem_GetChunkSize( type);
|
||||||
|
|
||||||
types[j] = type;
|
types[j] = type;
|
||||||
ptrs[j] = mem_PoolsAlloc( type);
|
ptrs[j] = mem_PoolsAlloc( type);
|
||||||
@@ -81,7 +81,7 @@ main( int __unused argc,
|
|||||||
if ( ptrs[j] != NULL )
|
if ( ptrs[j] != NULL )
|
||||||
{
|
{
|
||||||
mem_PoolChunkType_t type = types[j];
|
mem_PoolChunkType_t type = types[j];
|
||||||
const uint32_t chunkSize = mem_GetChunkSize( type);
|
const size_t chunkSize = mem_GetChunkSize( type);
|
||||||
|
|
||||||
for ( size_t k = 0; k < chunkSize; k++ )
|
for ( size_t k = 0; k < chunkSize; k++ )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user