From 24c8651f7f4738f18b70c80187b8c313d97d5647 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 29 Dec 2003 08:50:21 +0000 Subject: [PATCH] Patches to get this building on Mac Classic again. --- archivers/hog.c | 12 ++++++------ archivers/wad.c | 2 +- platform/macclassic.c | 39 +++++++++++++++++++++++++++++++++------ 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/archivers/hog.c b/archivers/hog.c index 5f8ca361..2f20b7ce 100644 --- a/archivers/hog.c +++ b/archivers/hog.c @@ -249,10 +249,10 @@ static int hog_open(const char *filename, int forWriting, goto openHog_failed; } /* if */ - while( 1 ) + while (1) { if (__PHYSFS_platformRead(*fh, buf, 13, 1) != 1) - break; //eof here is ok + break; /* eof here is ok */ if (__PHYSFS_platformRead(*fh, &size, 4, 1) != 1) goto openHog_failed; @@ -261,15 +261,15 @@ static int hog_open(const char *filename, int forWriting, (*count)++; - // Skip over entry + /* Skip over entry... */ pos = __PHYSFS_platformTell(*fh); if (pos == -1) goto openHog_failed; if (!__PHYSFS_platformSeek(*fh, pos + size)) goto openHog_failed; - } + } /* while */ - // Rewind to start of entries + /* Rewind to start of entries... */ if (!__PHYSFS_platformSeek(*fh, 3)) goto openHog_failed; @@ -353,7 +353,7 @@ static int hog_load_entries(const char *name, int forWriting, HOGinfo *info) return(0); } - // Skip over entry + /* Skip over entry */ if (!__PHYSFS_platformSeek(fh, entry->startPos + entry->size)) { __PHYSFS_platformClose(fh); diff --git a/archivers/wad.c b/archivers/wad.c index 6b5f470b..f89800a0 100644 --- a/archivers/wad.c +++ b/archivers/wad.c @@ -309,7 +309,7 @@ static int wad_load_entries(const char *name, int forWriting, WADinfo *info) PHYSFS_uint32 fileCount; PHYSFS_uint32 directoryOffset; WADentry *entry; - char lastDirectory[9],buffer[9]; + char lastDirectory[9]; lastDirectory[8] = 0; /* Make sure lastDirectory stays null-terminated. */ diff --git a/platform/macclassic.c b/platform/macclassic.c index 43554a39..c5ad92ce 100644 --- a/platform/macclassic.c +++ b/platform/macclassic.c @@ -13,6 +13,7 @@ #include #include #include +#include #include /* @@ -345,16 +346,42 @@ PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) int __PHYSFS_platformStricmp(const char *x, const char *y) { - extern int _stricmp(const char *, const char *); - return(_stricmp(x, y)); /* (*shrug*) */ + int ux, uy; + + do + { + ux = toupper((int) *x); + uy = toupper((int) *y); + if (ux != uy) + return((ux > uy) ? 1 : -1); + x++; + y++; + } while ((ux) && (uy)); + + return(0); } /* __PHYSFS_platformStricmp */ -int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 l) +int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len) { - extern int _strnicmp(const char *, const char *, int); - return(_strnicmp(x, y, (int) l)); /* (*shrug*) */ -} /* __PHYSFS_platformStricmp */ + int ux, uy; + + if (!len) + return(0); + + do + { + ux = toupper((int) *x); + uy = toupper((int) *y); + if (ux != uy) + return((ux > uy) ? 1 : -1); + x++; + y++; + len--; + } while ((ux) && (uy) && (len)); + + return(0); +} /* __PHYSFS_platformStrnicmp */ static OSErr fnameToFSSpecNoAlias(const char *fname, FSSpec *spec)