Patched to compile on MacOS Classic, with CodeWarrior 6.
This commit is contained in:
parent
9982d89b5b
commit
cccf065f68
|
@ -309,14 +309,14 @@ static LinkedStringList *GRP_enumerateFiles(DirHandle *h,
|
||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
l->str = (char *) malloc(strlen(buf) + 1);
|
l->str = (char *) malloc(strlen((const char *) buf) + 1);
|
||||||
if (l->str == NULL)
|
if (l->str == NULL)
|
||||||
{
|
{
|
||||||
free(l);
|
free(l);
|
||||||
break;
|
break;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
strcpy(l->str, buf);
|
strcpy(l->str, (const char *) buf);
|
||||||
|
|
||||||
if (retval == NULL)
|
if (retval == NULL)
|
||||||
retval = l;
|
retval = l;
|
||||||
|
@ -332,7 +332,7 @@ static LinkedStringList *GRP_enumerateFiles(DirHandle *h,
|
||||||
|
|
||||||
|
|
||||||
static PHYSFS_sint32 getFileEntry(DirHandle *h, const char *name,
|
static PHYSFS_sint32 getFileEntry(DirHandle *h, const char *name,
|
||||||
PHYSFS_sint32 *size)
|
PHYSFS_uint32 *size)
|
||||||
{
|
{
|
||||||
PHYSFS_uint8 buf[16];
|
PHYSFS_uint8 buf[16];
|
||||||
GRPinfo *g = (GRPinfo *) (h->opaque);
|
GRPinfo *g = (GRPinfo *) (h->opaque);
|
||||||
|
@ -364,7 +364,7 @@ static PHYSFS_sint32 getFileEntry(DirHandle *h, const char *name,
|
||||||
|
|
||||||
buf[12] = '\0'; /* FILENAME.EXT is all you get. */
|
buf[12] = '\0'; /* FILENAME.EXT is all you get. */
|
||||||
|
|
||||||
if (__PHYSFS_platformStricmp(buf, name) == 0)
|
if (__PHYSFS_platformStricmp((const char *) buf, name) == 0)
|
||||||
{
|
{
|
||||||
if (size != NULL)
|
if (size != NULL)
|
||||||
*size = l;
|
*size = l;
|
||||||
|
|
42
physfs.c
42
physfs.c
|
@ -32,7 +32,7 @@ typedef struct __PHYSFS_DIRINFO__
|
||||||
char *dirName;
|
char *dirName;
|
||||||
DirHandle *dirHandle;
|
DirHandle *dirHandle;
|
||||||
struct __PHYSFS_DIRINFO__ *next;
|
struct __PHYSFS_DIRINFO__ *next;
|
||||||
} DirInfo;
|
} PhysDirInfo;
|
||||||
|
|
||||||
typedef struct __PHYSFS_FILEHANDLELIST__
|
typedef struct __PHYSFS_FILEHANDLELIST__
|
||||||
{
|
{
|
||||||
|
@ -87,8 +87,8 @@ static const DirFunctions *dirFunctions[] =
|
||||||
/* General PhysicsFS state ... */
|
/* General PhysicsFS state ... */
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
static ErrMsg *errorMessages = NULL;
|
static ErrMsg *errorMessages = NULL;
|
||||||
static DirInfo *searchPath = NULL;
|
static PhysDirInfo *searchPath = NULL;
|
||||||
static DirInfo *writeDir = NULL;
|
static PhysDirInfo *writeDir = NULL;
|
||||||
static FileHandleList *openWriteList = NULL;
|
static FileHandleList *openWriteList = NULL;
|
||||||
static FileHandleList *openReadList = NULL;
|
static FileHandleList *openReadList = NULL;
|
||||||
static char *baseDir = NULL;
|
static char *baseDir = NULL;
|
||||||
|
@ -211,17 +211,17 @@ static DirHandle *openDirectory(const char *d, int forWriting)
|
||||||
} /* openDirectory */
|
} /* openDirectory */
|
||||||
|
|
||||||
|
|
||||||
static DirInfo *buildDirInfo(const char *newDir, int forWriting)
|
static PhysDirInfo *buildDirInfo(const char *newDir, int forWriting)
|
||||||
{
|
{
|
||||||
DirHandle *dirHandle = NULL;
|
DirHandle *dirHandle = NULL;
|
||||||
DirInfo *di = NULL;
|
PhysDirInfo *di = NULL;
|
||||||
|
|
||||||
BAIL_IF_MACRO(newDir == NULL, ERR_INVALID_ARGUMENT, 0);
|
BAIL_IF_MACRO(newDir == NULL, ERR_INVALID_ARGUMENT, 0);
|
||||||
|
|
||||||
dirHandle = openDirectory(newDir, forWriting);
|
dirHandle = openDirectory(newDir, forWriting);
|
||||||
BAIL_IF_MACRO(dirHandle == NULL, NULL, 0);
|
BAIL_IF_MACRO(dirHandle == NULL, NULL, 0);
|
||||||
|
|
||||||
di = (DirInfo *) malloc(sizeof (DirInfo));
|
di = (PhysDirInfo *) malloc(sizeof (PhysDirInfo));
|
||||||
if (di == NULL)
|
if (di == NULL)
|
||||||
{
|
{
|
||||||
dirHandle->funcs->dirClose(dirHandle);
|
dirHandle->funcs->dirClose(dirHandle);
|
||||||
|
@ -244,7 +244,7 @@ static DirInfo *buildDirInfo(const char *newDir, int forWriting)
|
||||||
|
|
||||||
|
|
||||||
/* MAKE SURE you've got the stateLock held before calling this! */
|
/* MAKE SURE you've got the stateLock held before calling this! */
|
||||||
static int freeDirInfo(DirInfo *di, FileHandleList *openList)
|
static int freeDirInfo(PhysDirInfo *di, FileHandleList *openList)
|
||||||
{
|
{
|
||||||
FileHandleList *i;
|
FileHandleList *i;
|
||||||
|
|
||||||
|
@ -460,8 +460,8 @@ static int closeFileHandleList(FileHandleList **list)
|
||||||
/* MAKE SURE you hold the stateLock before calling this! */
|
/* MAKE SURE you hold the stateLock before calling this! */
|
||||||
static void freeSearchPath(void)
|
static void freeSearchPath(void)
|
||||||
{
|
{
|
||||||
DirInfo *i;
|
PhysDirInfo *i;
|
||||||
DirInfo *next = NULL;
|
PhysDirInfo *next = NULL;
|
||||||
|
|
||||||
closeFileHandleList(&openReadList);
|
closeFileHandleList(&openReadList);
|
||||||
|
|
||||||
|
@ -591,9 +591,9 @@ int PHYSFS_setWriteDir(const char *newDir)
|
||||||
|
|
||||||
int PHYSFS_addToSearchPath(const char *newDir, int appendToPath)
|
int PHYSFS_addToSearchPath(const char *newDir, int appendToPath)
|
||||||
{
|
{
|
||||||
DirInfo *di;
|
PhysDirInfo *di;
|
||||||
DirInfo *prev = NULL;
|
PhysDirInfo *prev = NULL;
|
||||||
DirInfo *i;
|
PhysDirInfo *i;
|
||||||
|
|
||||||
__PHYSFS_platformGrabMutex(stateLock);
|
__PHYSFS_platformGrabMutex(stateLock);
|
||||||
|
|
||||||
|
@ -628,9 +628,9 @@ int PHYSFS_addToSearchPath(const char *newDir, int appendToPath)
|
||||||
|
|
||||||
int PHYSFS_removeFromSearchPath(const char *oldDir)
|
int PHYSFS_removeFromSearchPath(const char *oldDir)
|
||||||
{
|
{
|
||||||
DirInfo *i;
|
PhysDirInfo *i;
|
||||||
DirInfo *prev = NULL;
|
PhysDirInfo *prev = NULL;
|
||||||
DirInfo *next = NULL;
|
PhysDirInfo *next = NULL;
|
||||||
|
|
||||||
BAIL_IF_MACRO(oldDir == NULL, ERR_INVALID_ARGUMENT, 0);
|
BAIL_IF_MACRO(oldDir == NULL, ERR_INVALID_ARGUMENT, 0);
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ char **PHYSFS_getSearchPath(void)
|
||||||
{
|
{
|
||||||
int count = 1;
|
int count = 1;
|
||||||
int x;
|
int x;
|
||||||
DirInfo *i;
|
PhysDirInfo *i;
|
||||||
char **retval;
|
char **retval;
|
||||||
|
|
||||||
__PHYSFS_platformGrabMutex(stateLock);
|
__PHYSFS_platformGrabMutex(stateLock);
|
||||||
|
@ -983,7 +983,7 @@ int PHYSFS_delete(const char *fname)
|
||||||
|
|
||||||
const char *PHYSFS_getRealDir(const char *filename)
|
const char *PHYSFS_getRealDir(const char *filename)
|
||||||
{
|
{
|
||||||
DirInfo *i;
|
PhysDirInfo *i;
|
||||||
|
|
||||||
while (*filename == '/')
|
while (*filename == '/')
|
||||||
filename++;
|
filename++;
|
||||||
|
@ -1098,7 +1098,7 @@ static void interpolateStringLists(LinkedStringList **final,
|
||||||
|
|
||||||
char **PHYSFS_enumerateFiles(const char *path)
|
char **PHYSFS_enumerateFiles(const char *path)
|
||||||
{
|
{
|
||||||
DirInfo *i;
|
PhysDirInfo *i;
|
||||||
char **retval = NULL;
|
char **retval = NULL;
|
||||||
LinkedStringList *rc;
|
LinkedStringList *rc;
|
||||||
LinkedStringList *finalList = NULL;
|
LinkedStringList *finalList = NULL;
|
||||||
|
@ -1137,7 +1137,7 @@ int PHYSFS_exists(const char *fname)
|
||||||
|
|
||||||
int PHYSFS_isDirectory(const char *fname)
|
int PHYSFS_isDirectory(const char *fname)
|
||||||
{
|
{
|
||||||
DirInfo *i;
|
PhysDirInfo *i;
|
||||||
|
|
||||||
BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, 0);
|
BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, 0);
|
||||||
while (*fname == '/')
|
while (*fname == '/')
|
||||||
|
@ -1168,7 +1168,7 @@ int PHYSFS_isDirectory(const char *fname)
|
||||||
|
|
||||||
int PHYSFS_isSymbolicLink(const char *fname)
|
int PHYSFS_isSymbolicLink(const char *fname)
|
||||||
{
|
{
|
||||||
DirInfo *i;
|
PhysDirInfo *i;
|
||||||
|
|
||||||
if (!allowSymLinks)
|
if (!allowSymLinks)
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -1254,7 +1254,7 @@ PHYSFS_file *PHYSFS_openRead(const char *fname)
|
||||||
PHYSFS_file *retval;
|
PHYSFS_file *retval;
|
||||||
FileHandle *rc = NULL;
|
FileHandle *rc = NULL;
|
||||||
FileHandleList *list;
|
FileHandleList *list;
|
||||||
DirInfo *i;
|
PhysDirInfo *i;
|
||||||
|
|
||||||
BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, NULL);
|
BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, NULL);
|
||||||
while (*fname == '/')
|
while (*fname == '/')
|
||||||
|
|
|
@ -261,6 +261,7 @@ typedef struct __PHYSFS_DIRFUNCTIONS__
|
||||||
#define ERR_CANT_SET_WRITE_DIR "Can't set write directory"
|
#define ERR_CANT_SET_WRITE_DIR "Can't set write directory"
|
||||||
#define ERR_TOO_MANY_SYMLINKS "Too many symbolic links"
|
#define ERR_TOO_MANY_SYMLINKS "Too many symbolic links"
|
||||||
#define ERR_COMPRESSION "(De)compression error"
|
#define ERR_COMPRESSION "(De)compression error"
|
||||||
|
#define ERR_NOT_IMPLEMENTED "Not implemented"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call this to set the message returned by PHYSFS_getLastError().
|
* Call this to set the message returned by PHYSFS_getLastError().
|
||||||
|
|
Loading…
Reference in New Issue