Skip to content
Permalink
Browse files
Now compiles on CodeWarrior 6 for MacOS Classic again.
  • Loading branch information
icculus committed Jan 31, 2003
1 parent b35cef5 commit 3a479b6cd8000a8cb5acf4060ec41c8a41278899
Showing with 23 additions and 22 deletions.
  1. BIN CWProjects.sit
  2. +3 −3 archivers/zip.c
  3. +2 −2 physfs.c
  4. +12 −11 platform/macclassic.c
  5. +6 −6 test/test_physfs.c
BIN -139 Bytes (100%) CWProjects.sit
Binary file not shown.
@@ -54,7 +54,7 @@ typedef enum
ZIP_RESOLVING,
ZIP_RESOLVED,
ZIP_BROKEN_FILE,
ZIP_BROKEN_SYMLINK,
ZIP_BROKEN_SYMLINK
} ZipResolveType;


@@ -724,7 +724,7 @@ static int zip_resolve_symlink(void *in, ZIPinfo *info, ZIPentry *entry)
memset(&stream, '\0', sizeof (z_stream));
stream.next_in = compressed;
stream.avail_in = compsize;
stream.next_out = path;
stream.next_out = (unsigned char *) path;
stream.avail_out = size;
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 */


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;
struct tm unixtime;
@@ -122,7 +122,7 @@ static void *stateLock = NULL; /* protects other PhysFS static state. */

/* 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),
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 */


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),
void (*swapfn)(void *, PHYSFS_uint32, PHYSFS_uint32))
{
@@ -10,6 +10,7 @@
# include <config.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <alloca.h>
@@ -83,7 +84,7 @@ static const char *get_macos_error_string(OSErr err)
case fLckdErr: return(ERR_FILE_LOCKED);
case vLckdErr: return(ERR_VOL_LOCKED_SW);
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 rfNumErr: return(ERR_INVALID_REFNUM);
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 errFSNameTooLong: return(ERR_BAD_FILENAME);
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 fidExists: return(ERR_FILE_ID_EXISTS);
case afpAccessDenied: return(ERR_ACCESS_DENIED);
@@ -118,9 +119,9 @@ static const char *get_macos_error_string(OSErr err)
case errFSMissingName:
case errFSBadPosMode:
case errFSBadAllocFlags:
case errFSBadItemCount
case errFSBadSearchParams
case afpDenyConflict
case errFSBadItemCount:
case errFSBadSearchParams:
case afpDenyConflict:
return(ERR_PHYSFS_BAD_OS_CALL);

default: return(ERR_MACOS_GENERIC);
@@ -132,11 +133,11 @@ static const char *get_macos_error_string(OSErr err)

static OSErr oserr(OSErr retval)
{
char buf[128];
char buf[sizeof (ERR_MACOS_GENERIC) + 32];
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;
} /* if */

@@ -306,7 +307,7 @@ char *__PHYSFS_platformGetUserName(void)
/* use the System resource file. */
UseResFile(0);
/* apparently, -16096 specifies the username. */
strHandle = oserr(GetString(-16096));
strHandle = GetString(-16096);
UseResFile(origResourceFile);
BAIL_IF_MACRO(strHandle == NULL, NULL, NULL);

@@ -594,7 +595,7 @@ LinkedStringList *__PHYSFS_platformEnumerateFiles(const char *dirname,
continue;

/* 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 */

return(ret);
@@ -667,7 +668,7 @@ static SInt16 *macDoOpen(const char *fname, SInt8 perm, int createIfMissing)
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* 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)
{
free(retval);
@@ -297,7 +297,7 @@ static int cmd_setbuffer(char *args)
args[strlen(args) - 1] = '\0';
} /* if */

do_buffer_size = atoi(args);
do_buffer_size = (unsigned int) atoi(args);
if (do_buffer_size)
{
printf("Further tests will set a (%lu) size buffer.\n",
@@ -350,14 +350,14 @@ static int cmd_stressbuffer(char *args)
} /* if */

strcpy(buf, "abcdefghijklmnopqrstuvwxyz0123456789");
srand(time(NULL));
srand((unsigned int) time(NULL));

for (i = 0; i < 10; i++)
{
for (j = 0; j < 10000; j++)
{
int right = 1 + (int) (35.0 * rand() / (RAND_MAX + 1.0));
int left = 36 - right;
PHYSFS_uint32 right = 1 + (PHYSFS_uint32) (35.0 * rand() / (RAND_MAX + 1.0));
PHYSFS_uint32 left = 36 - right;
if (PHYSFS_write(f, buf, left, 1) != 1)
{
printf("PHYSFS_write() failed: %s.\n", PHYSFS_getLastError());
@@ -429,8 +429,8 @@ static int cmd_stressbuffer(char *args)
{
for (j = 0; j < 10000; j++)
{
int right = 1 + (int) (35.0 * rand() / (RAND_MAX + 1.0));
int left = 36 - right;
PHYSFS_uint32 right = 1 + (PHYSFS_uint32) (35.0 * rand() / (RAND_MAX + 1.0));
PHYSFS_uint32 left = 36 - right;
if (PHYSFS_read(f, buf2, left, 1) != 1)
{
printf("PHYSFS_read() failed: %s.\n", PHYSFS_getLastError());

0 comments on commit 3a479b6

Please sign in to comment.