platform/posix.c
changeset 747 3da194b12f43
parent 717 ae8bc9888553
child 754 e7cd7411eadf
equal deleted inserted replaced
746:88780f7156d3 747:3da194b12f43
   512 {
   512 {
   513     /* no-op */
   513     /* no-op */
   514 } /* __PHYSFS_platformAllocatorInit */
   514 } /* __PHYSFS_platformAllocatorInit */
   515 
   515 
   516 
   516 
   517 void *__PHYSFS_platformAllocatorMalloc(size_t s)
   517 void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
   518 {
   518 {
       
   519     /* make sure s isn't larger than the address space of the platform... */
       
   520     if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
       
   521         BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
   519     #undef malloc
   522     #undef malloc
   520     return(malloc(s));
   523     return(malloc((size_t) s));
   521 } /* __PHYSFS_platformMalloc */
   524 } /* __PHYSFS_platformMalloc */
   522 
   525 
   523 
   526 
   524 void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s)
   527 void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
   525 {
   528 {
       
   529     /* make sure s isn't larger than the address space of the platform... */
       
   530     if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
       
   531         BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
   526     #undef realloc
   532     #undef realloc
   527     return(realloc(ptr, s));
   533     return(realloc(ptr, (size_t) s));
   528 } /* __PHYSFS_platformRealloc */
   534 } /* __PHYSFS_platformRealloc */
   529 
   535 
   530 
   536 
   531 void __PHYSFS_platformAllocatorFree(void *ptr)
   537 void __PHYSFS_platformAllocatorFree(void *ptr)
   532 {
   538 {