Don't use size_t in physfs.h, since it relies on C runtime headers.
This commit is contained in:
parent
bbb0cab5ee
commit
64599213f1
|
@ -2,6 +2,9 @@
|
||||||
* CHANGELOG.
|
* CHANGELOG.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
09062005 - Happy September. Changed the allocation abstraction to use
|
||||||
|
PHYSFS_uint64 instead of size_t, so we don't have to include
|
||||||
|
system headers inside physfs.h.
|
||||||
08202005 - Fixed bug in verifyPath() that was breaking PHYSFS_setSaneConfig()
|
08202005 - Fixed bug in verifyPath() that was breaking PHYSFS_setSaneConfig()
|
||||||
and other corner cases.
|
and other corner cases.
|
||||||
07242005 - Patched to compile on BeOS.
|
07242005 - Patched to compile on BeOS.
|
||||||
|
|
11
physfs.h
11
physfs.h
|
@ -1857,14 +1857,21 @@ __EXPORT__ int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val);
|
||||||
* Allocators are assumed to be reentrant by the caller; please mutex
|
* Allocators are assumed to be reentrant by the caller; please mutex
|
||||||
* accordingly.
|
* accordingly.
|
||||||
*
|
*
|
||||||
|
* Allocations are always discussed in 64-bits, for future expansion...we're
|
||||||
|
* on the cusp of a 64-bit transition, and we'll probably be allocating 6
|
||||||
|
* gigabytes like it's nothing sooner or later, and I don't want to change
|
||||||
|
* this again at that point. If you're on a 32-bit platform and have to
|
||||||
|
* downcast, it's okay to return NULL if the allocation is greater than
|
||||||
|
* 4 gigabytes, since you'd have to do so anyhow.
|
||||||
|
*
|
||||||
* \sa PHYSFS_setAllocator
|
* \sa PHYSFS_setAllocator
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int (*Init)(void);
|
int (*Init)(void);
|
||||||
void (*Deinit)(void);
|
void (*Deinit)(void);
|
||||||
void *(*Malloc)(size_t);
|
void *(*Malloc)(PHYSFS_uint64);
|
||||||
void *(*Realloc)(void *, size_t);
|
void *(*Realloc)(void *, PHYSFS_uint64);
|
||||||
void (*Free)(void *);
|
void (*Free)(void *);
|
||||||
} PHYSFS_Allocator;
|
} PHYSFS_Allocator;
|
||||||
|
|
||||||
|
|
|
@ -1682,14 +1682,14 @@ void __PHYSFS_platformAllocatorDeinit(void);
|
||||||
* This is used for allocation if the user hasn't selected their own
|
* This is used for allocation if the user hasn't selected their own
|
||||||
* allocator via PHYSFS_setAllocator().
|
* allocator via PHYSFS_setAllocator().
|
||||||
*/
|
*/
|
||||||
void *__PHYSFS_platformAllocatorMalloc(size_t s);
|
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Implement realloc. It's safe to just pass through from the C runtime.
|
* Implement realloc. It's safe to just pass through from the C runtime.
|
||||||
* This is used for allocation if the user hasn't selected their own
|
* This is used for allocation if the user hasn't selected their own
|
||||||
* allocator via PHYSFS_setAllocator().
|
* allocator via PHYSFS_setAllocator().
|
||||||
*/
|
*/
|
||||||
void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s);
|
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Implement free. It's safe to just pass through from the C runtime.
|
* Implement free. It's safe to just pass through from the C runtime.
|
||||||
|
|
|
@ -939,17 +939,23 @@ void __PHYSFS_platformAllocatorDeinit(void)
|
||||||
} /* __PHYSFS_platformAllocatorInit */
|
} /* __PHYSFS_platformAllocatorInit */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorMalloc(size_t s)
|
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef malloc
|
#undef malloc
|
||||||
return(malloc(s));
|
return(malloc((size_t) s));
|
||||||
} /* __PHYSFS_platformMalloc */
|
} /* __PHYSFS_platformMalloc */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s)
|
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef realloc
|
#undef realloc
|
||||||
return(realloc(ptr, s));
|
return(realloc(ptr, (size_t) s));
|
||||||
} /* __PHYSFS_platformRealloc */
|
} /* __PHYSFS_platformRealloc */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -754,17 +754,23 @@ void __PHYSFS_platformAllocatorDeinit(void)
|
||||||
} /* __PHYSFS_platformAllocatorInit */
|
} /* __PHYSFS_platformAllocatorInit */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorMalloc(size_t s)
|
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef malloc
|
#undef malloc
|
||||||
return(malloc(s));
|
return(malloc((size_t) s));
|
||||||
} /* __PHYSFS_platformMalloc */
|
} /* __PHYSFS_platformMalloc */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s)
|
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef realloc
|
#undef realloc
|
||||||
return(realloc(ptr, s));
|
return(realloc(ptr, (size_t) s));
|
||||||
} /* __PHYSFS_platformRealloc */
|
} /* __PHYSFS_platformRealloc */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -672,17 +672,23 @@ void __PHYSFS_platformAllocatorDeinit(void)
|
||||||
} /* __PHYSFS_platformAllocatorInit */
|
} /* __PHYSFS_platformAllocatorInit */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorMalloc(size_t s)
|
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef malloc
|
#undef malloc
|
||||||
return(malloc(s));
|
return(malloc((size_t) s));
|
||||||
} /* __PHYSFS_platformMalloc */
|
} /* __PHYSFS_platformMalloc */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s)
|
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef realloc
|
#undef realloc
|
||||||
return(realloc(ptr, s));
|
return(realloc(ptr, (size_t) s));
|
||||||
} /* __PHYSFS_platformRealloc */
|
} /* __PHYSFS_platformRealloc */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -514,17 +514,23 @@ void __PHYSFS_platformAllocatorDeinit(void)
|
||||||
} /* __PHYSFS_platformAllocatorInit */
|
} /* __PHYSFS_platformAllocatorInit */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorMalloc(size_t s)
|
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef malloc
|
#undef malloc
|
||||||
return(malloc(s));
|
return(malloc((size_t) s));
|
||||||
} /* __PHYSFS_platformMalloc */
|
} /* __PHYSFS_platformMalloc */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s)
|
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef realloc
|
#undef realloc
|
||||||
return(realloc(ptr, s));
|
return(realloc(ptr, (size_t) s));
|
||||||
} /* __PHYSFS_platformRealloc */
|
} /* __PHYSFS_platformRealloc */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -246,17 +246,23 @@ void __PHYSFS_platformAllocatorDeinit(void)
|
||||||
} /* __PHYSFS_platformAllocatorInit */
|
} /* __PHYSFS_platformAllocatorInit */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorMalloc(size_t s)
|
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef malloc
|
#undef malloc
|
||||||
return(malloc(s));
|
return(malloc((size_t) s));
|
||||||
} /* __PHYSFS_platformMalloc */
|
} /* __PHYSFS_platformMalloc */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s)
|
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef realloc
|
#undef realloc
|
||||||
return(realloc(ptr, s));
|
return(realloc(ptr, (size_t) s));
|
||||||
} /* __PHYSFS_platformRealloc */
|
} /* __PHYSFS_platformRealloc */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1122,17 +1122,23 @@ void __PHYSFS_platformAllocatorDeinit(void)
|
||||||
} /* __PHYSFS_platformAllocatorInit */
|
} /* __PHYSFS_platformAllocatorInit */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorMalloc(size_t s)
|
void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef malloc
|
#undef malloc
|
||||||
return(malloc(s));
|
return(malloc((size_t) s));
|
||||||
} /* __PHYSFS_platformMalloc */
|
} /* __PHYSFS_platformMalloc */
|
||||||
|
|
||||||
|
|
||||||
void *__PHYSFS_platformAllocatorRealloc(void *ptr, size_t s)
|
void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
|
||||||
{
|
{
|
||||||
|
/* make sure s isn't larger than the address space of the platform... */
|
||||||
|
if ( s > (0xFFFFFFFFFFFFFFFF >> (64-(sizeof (size_t) * 8))) )
|
||||||
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
#undef realloc
|
#undef realloc
|
||||||
return(realloc(ptr, s));
|
return(realloc(ptr, (size_t) s));
|
||||||
} /* __PHYSFS_platformRealloc */
|
} /* __PHYSFS_platformRealloc */
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue