Now compiles on CodeWarrior 6 for MacOS Classic again.
This commit is contained in:
parent
b35cef5ee2
commit
3a479b6cd8
BIN
CWProjects.sit
BIN
CWProjects.sit
Binary file not shown.
|
@ -54,7 +54,7 @@ typedef enum
|
||||||
ZIP_RESOLVING,
|
ZIP_RESOLVING,
|
||||||
ZIP_RESOLVED,
|
ZIP_RESOLVED,
|
||||||
ZIP_BROKEN_FILE,
|
ZIP_BROKEN_FILE,
|
||||||
ZIP_BROKEN_SYMLINK,
|
ZIP_BROKEN_SYMLINK
|
||||||
} ZipResolveType;
|
} ZipResolveType;
|
||||||
|
|
||||||
|
|
||||||
|
@ -724,7 +724,7 @@ static int zip_resolve_symlink(void *in, ZIPinfo *info, ZIPentry *entry)
|
||||||
memset(&stream, '\0', sizeof (z_stream));
|
memset(&stream, '\0', sizeof (z_stream));
|
||||||
stream.next_in = compressed;
|
stream.next_in = compressed;
|
||||||
stream.avail_in = compsize;
|
stream.avail_in = compsize;
|
||||||
stream.next_out = path;
|
stream.next_out = (unsigned char *) path;
|
||||||
stream.avail_out = size;
|
stream.avail_out = size;
|
||||||
if (zlib_err(inflateInit2(&stream, -MAX_WBITS)) == Z_OK)
|
if (zlib_err(inflateInit2(&stream, -MAX_WBITS)) == Z_OK)
|
||||||
{
|
{
|
||||||
|
@ -882,7 +882,7 @@ static int zip_has_symlink_attr(ZIPentry *entry, PHYSFS_uint32 extern_attr)
|
||||||
} /* zip_has_symlink_attr */
|
} /* zip_has_symlink_attr */
|
||||||
|
|
||||||
|
|
||||||
PHYSFS_sint64 zip_dos_time_to_physfs_time(PHYSFS_uint32 dostime)
|
static PHYSFS_sint64 zip_dos_time_to_physfs_time(PHYSFS_uint32 dostime)
|
||||||
{
|
{
|
||||||
PHYSFS_uint32 dosdate;
|
PHYSFS_uint32 dosdate;
|
||||||
struct tm unixtime;
|
struct tm unixtime;
|
||||||
|
|
4
physfs.c
4
physfs.c
|
@ -122,7 +122,7 @@ static void *stateLock = NULL; /* protects other PhysFS static state. */
|
||||||
|
|
||||||
/* functions ... */
|
/* functions ... */
|
||||||
|
|
||||||
void __PHYSFS_bubble_sort(void *a, PHYSFS_uint32 lo, PHYSFS_uint32 hi,
|
static void __PHYSFS_bubble_sort(void *a, PHYSFS_uint32 lo, PHYSFS_uint32 hi,
|
||||||
int (*cmpfn)(void *, PHYSFS_uint32, PHYSFS_uint32),
|
int (*cmpfn)(void *, PHYSFS_uint32, PHYSFS_uint32),
|
||||||
void (*swapfn)(void *, PHYSFS_uint32, PHYSFS_uint32))
|
void (*swapfn)(void *, PHYSFS_uint32, PHYSFS_uint32))
|
||||||
{
|
{
|
||||||
|
@ -144,7 +144,7 @@ void __PHYSFS_bubble_sort(void *a, PHYSFS_uint32 lo, PHYSFS_uint32 hi,
|
||||||
} /* __PHYSFS_bubble_sort */
|
} /* __PHYSFS_bubble_sort */
|
||||||
|
|
||||||
|
|
||||||
void __PHYSFS_quick_sort(void *a, PHYSFS_uint32 lo, PHYSFS_uint32 hi,
|
static void __PHYSFS_quick_sort(void *a, PHYSFS_uint32 lo, PHYSFS_uint32 hi,
|
||||||
int (*cmpfn)(void *, PHYSFS_uint32, PHYSFS_uint32),
|
int (*cmpfn)(void *, PHYSFS_uint32, PHYSFS_uint32),
|
||||||
void (*swapfn)(void *, PHYSFS_uint32, PHYSFS_uint32))
|
void (*swapfn)(void *, PHYSFS_uint32, PHYSFS_uint32))
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
@ -83,7 +84,7 @@ static const char *get_macos_error_string(OSErr err)
|
||||||
case fLckdErr: return(ERR_FILE_LOCKED);
|
case fLckdErr: return(ERR_FILE_LOCKED);
|
||||||
case vLckdErr: return(ERR_VOL_LOCKED_SW);
|
case vLckdErr: return(ERR_VOL_LOCKED_SW);
|
||||||
case fBsyErr: return(ERR_FILE_OR_DIR_BUSY);
|
case fBsyErr: return(ERR_FILE_OR_DIR_BUSY);
|
||||||
case dupFNErr: return(ERR_FILE_ALREADY_EXISTS);
|
case dupFNErr: return(ERR_FILE_EXISTS);
|
||||||
case opWrErr: return(ERR_FILE_ALREADY_OPEN_W);
|
case opWrErr: return(ERR_FILE_ALREADY_OPEN_W);
|
||||||
case rfNumErr: return(ERR_INVALID_REFNUM);
|
case rfNumErr: return(ERR_INVALID_REFNUM);
|
||||||
case gfpErr: return(ERR_GETTING_FILE_POS);
|
case gfpErr: return(ERR_GETTING_FILE_POS);
|
||||||
|
@ -104,7 +105,7 @@ static const char *get_macos_error_string(OSErr err)
|
||||||
case volGoneErr: return(ERR_SERVER_VOL_LOST);
|
case volGoneErr: return(ERR_SERVER_VOL_LOST);
|
||||||
case errFSNameTooLong: return(ERR_BAD_FILENAME);
|
case errFSNameTooLong: return(ERR_BAD_FILENAME);
|
||||||
case errFSNotAFolder: return(ERR_NOT_A_DIR);
|
case errFSNotAFolder: return(ERR_NOT_A_DIR);
|
||||||
case errFSNotAFile: return(ERR_NOT_A_FILE);
|
/*case errFSNotAFile: return(ERR_NOT_A_FILE);*/
|
||||||
case fidNotFound: return(ERR_FILE_ID_NOT_FOUND);
|
case fidNotFound: return(ERR_FILE_ID_NOT_FOUND);
|
||||||
case fidExists: return(ERR_FILE_ID_EXISTS);
|
case fidExists: return(ERR_FILE_ID_EXISTS);
|
||||||
case afpAccessDenied: return(ERR_ACCESS_DENIED);
|
case afpAccessDenied: return(ERR_ACCESS_DENIED);
|
||||||
|
@ -118,9 +119,9 @@ static const char *get_macos_error_string(OSErr err)
|
||||||
case errFSMissingName:
|
case errFSMissingName:
|
||||||
case errFSBadPosMode:
|
case errFSBadPosMode:
|
||||||
case errFSBadAllocFlags:
|
case errFSBadAllocFlags:
|
||||||
case errFSBadItemCount
|
case errFSBadItemCount:
|
||||||
case errFSBadSearchParams
|
case errFSBadSearchParams:
|
||||||
case afpDenyConflict
|
case afpDenyConflict:
|
||||||
return(ERR_PHYSFS_BAD_OS_CALL);
|
return(ERR_PHYSFS_BAD_OS_CALL);
|
||||||
|
|
||||||
default: return(ERR_MACOS_GENERIC);
|
default: return(ERR_MACOS_GENERIC);
|
||||||
|
@ -132,11 +133,11 @@ static const char *get_macos_error_string(OSErr err)
|
||||||
|
|
||||||
static OSErr oserr(OSErr retval)
|
static OSErr oserr(OSErr retval)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[sizeof (ERR_MACOS_GENERIC) + 32];
|
||||||
const char *errstr = get_macos_error_string(retval);
|
const char *errstr = get_macos_error_string(retval);
|
||||||
if (errstr == ERR_MACOS_GENERIC)
|
if (strcmp(errstr, ERR_MACOS_GENERIC) == 0)
|
||||||
{
|
{
|
||||||
snprintf(buf, ERR_MACOS_GENERIC, (int) retval);
|
snprintf(buf, sizeof (buf), ERR_MACOS_GENERIC, (int) retval);
|
||||||
errstr = buf;
|
errstr = buf;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
|
@ -306,7 +307,7 @@ char *__PHYSFS_platformGetUserName(void)
|
||||||
/* use the System resource file. */
|
/* use the System resource file. */
|
||||||
UseResFile(0);
|
UseResFile(0);
|
||||||
/* apparently, -16096 specifies the username. */
|
/* apparently, -16096 specifies the username. */
|
||||||
strHandle = oserr(GetString(-16096));
|
strHandle = GetString(-16096);
|
||||||
UseResFile(origResourceFile);
|
UseResFile(origResourceFile);
|
||||||
BAIL_IF_MACRO(strHandle == NULL, NULL, NULL);
|
BAIL_IF_MACRO(strHandle == NULL, NULL, NULL);
|
||||||
|
|
||||||
|
@ -594,7 +595,7 @@ LinkedStringList *__PHYSFS_platformEnumerateFiles(const char *dirname,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* still here? Add it to the list. */
|
/* still here? Add it to the list. */
|
||||||
ret = __PHYSFS_addToLinkedStringList(ret, &p, &str255[1], str255[0]);
|
ret = __PHYSFS_addToLinkedStringList(ret, &p, (const char *) &str255[1], str255[0]);
|
||||||
} /* for */
|
} /* for */
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
|
@ -667,7 +668,7 @@ static SInt16 *macDoOpen(const char *fname, SInt8 perm, int createIfMissing)
|
||||||
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
err = HOpenDF(spec.vRefNum, spec.parID, spec.name, perm, retval)
|
err = HOpenDF(spec.vRefNum, spec.parID, spec.name, perm, retval);
|
||||||
if (oserr(err) != noErr)
|
if (oserr(err) != noErr)
|
||||||
{
|
{
|
||||||
free(retval);
|
free(retval);
|
||||||
|
|
|
@ -297,7 +297,7 @@ static int cmd_setbuffer(char *args)
|
||||||
args[strlen(args) - 1] = '\0';
|
args[strlen(args) - 1] = '\0';
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
do_buffer_size = atoi(args);
|
do_buffer_size = (unsigned int) atoi(args);
|
||||||
if (do_buffer_size)
|
if (do_buffer_size)
|
||||||
{
|
{
|
||||||
printf("Further tests will set a (%lu) size buffer.\n",
|
printf("Further tests will set a (%lu) size buffer.\n",
|
||||||
|
@ -350,14 +350,14 @@ static int cmd_stressbuffer(char *args)
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
strcpy(buf, "abcdefghijklmnopqrstuvwxyz0123456789");
|
strcpy(buf, "abcdefghijklmnopqrstuvwxyz0123456789");
|
||||||
srand(time(NULL));
|
srand((unsigned int) time(NULL));
|
||||||
|
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < 10000; j++)
|
for (j = 0; j < 10000; j++)
|
||||||
{
|
{
|
||||||
int right = 1 + (int) (35.0 * rand() / (RAND_MAX + 1.0));
|
PHYSFS_uint32 right = 1 + (PHYSFS_uint32) (35.0 * rand() / (RAND_MAX + 1.0));
|
||||||
int left = 36 - right;
|
PHYSFS_uint32 left = 36 - right;
|
||||||
if (PHYSFS_write(f, buf, left, 1) != 1)
|
if (PHYSFS_write(f, buf, left, 1) != 1)
|
||||||
{
|
{
|
||||||
printf("PHYSFS_write() failed: %s.\n", PHYSFS_getLastError());
|
printf("PHYSFS_write() failed: %s.\n", PHYSFS_getLastError());
|
||||||
|
@ -429,8 +429,8 @@ static int cmd_stressbuffer(char *args)
|
||||||
{
|
{
|
||||||
for (j = 0; j < 10000; j++)
|
for (j = 0; j < 10000; j++)
|
||||||
{
|
{
|
||||||
int right = 1 + (int) (35.0 * rand() / (RAND_MAX + 1.0));
|
PHYSFS_uint32 right = 1 + (PHYSFS_uint32) (35.0 * rand() / (RAND_MAX + 1.0));
|
||||||
int left = 36 - right;
|
PHYSFS_uint32 left = 36 - right;
|
||||||
if (PHYSFS_read(f, buf2, left, 1) != 1)
|
if (PHYSFS_read(f, buf2, left, 1) != 1)
|
||||||
{
|
{
|
||||||
printf("PHYSFS_read() failed: %s.\n", PHYSFS_getLastError());
|
printf("PHYSFS_read() failed: %s.\n", PHYSFS_getLastError());
|
||||||
|
|
Loading…
Reference in New Issue