Made __PHYSFS_ui64FitsAddressSpace's behaviour match its name.
This commit is contained in:
parent
2beafa790d
commit
c92f3035f9
|
@ -2246,7 +2246,7 @@ const PHYSFS_Allocator *PHYSFS_getAllocator(void)
|
||||||
|
|
||||||
static void *mallocAllocatorMalloc(PHYSFS_uint64 s)
|
static void *mallocAllocatorMalloc(PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
BAIL_IF_MACRO(!__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef malloc
|
#undef malloc
|
||||||
return malloc((size_t) s);
|
return malloc((size_t) s);
|
||||||
} /* mallocAllocatorMalloc */
|
} /* mallocAllocatorMalloc */
|
||||||
|
@ -2254,7 +2254,7 @@ static void *mallocAllocatorMalloc(PHYSFS_uint64 s)
|
||||||
|
|
||||||
static void *mallocAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
static void *mallocAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
BAIL_IF_MACRO(!__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef realloc
|
#undef realloc
|
||||||
return realloc(ptr, (size_t) s);
|
return realloc(ptr, (size_t) s);
|
||||||
} /* mallocAllocatorRealloc */
|
} /* mallocAllocatorRealloc */
|
||||||
|
|
|
@ -1046,8 +1046,8 @@ void __PHYSFS_sort(void *entries, PHYSFS_uint32 max,
|
||||||
* size_t, suitable to pass to malloc. This is kinda messy, but effective.
|
* size_t, suitable to pass to malloc. This is kinda messy, but effective.
|
||||||
*/
|
*/
|
||||||
#define __PHYSFS_ui64FitsAddressSpace(s) ( \
|
#define __PHYSFS_ui64FitsAddressSpace(s) ( \
|
||||||
(sizeof (PHYSFS_uint64) > sizeof (size_t)) && \
|
(sizeof (PHYSFS_uint64) <= sizeof (size_t)) || \
|
||||||
((s) > (__PHYSFS_UI64(0xFFFFFFFFFFFFFFFF) >> (64-(sizeof(size_t)*8)))) \
|
((s) < (__PHYSFS_UI64(0xFFFFFFFFFFFFFFFF) >> (64-(sizeof(size_t)*8)))) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -324,14 +324,14 @@ static void macosxAllocatorDeinit(void)
|
||||||
|
|
||||||
static void *macosxAllocatorMalloc(PHYSFS_uint64 s)
|
static void *macosxAllocatorMalloc(PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
BAIL_IF_MACRO(!__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
||||||
return CFAllocatorAllocate(cfallocdef, (CFIndex) s, 0);
|
return CFAllocatorAllocate(cfallocdef, (CFIndex) s, 0);
|
||||||
} /* macosxAllocatorMalloc */
|
} /* macosxAllocatorMalloc */
|
||||||
|
|
||||||
|
|
||||||
static void *macosxAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
static void *macosxAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
BAIL_IF_MACRO(!__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL);
|
||||||
return CFAllocatorReallocate(cfallocdef, ptr, (CFIndex) s, 0);
|
return CFAllocatorReallocate(cfallocdef, ptr, (CFIndex) s, 0);
|
||||||
} /* macosxAllocatorRealloc */
|
} /* macosxAllocatorRealloc */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue