Patches to get this building on Mac Classic again.

This commit is contained in:
Ryan C. Gordon 2003-12-29 08:50:21 +00:00
parent 56606fa65c
commit 24c8651f7f
3 changed files with 40 additions and 13 deletions

View File

@ -249,10 +249,10 @@ static int hog_open(const char *filename, int forWriting,
goto openHog_failed; goto openHog_failed;
} /* if */ } /* if */
while( 1 ) while (1)
{ {
if (__PHYSFS_platformRead(*fh, buf, 13, 1) != 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) if (__PHYSFS_platformRead(*fh, &size, 4, 1) != 1)
goto openHog_failed; goto openHog_failed;
@ -261,15 +261,15 @@ static int hog_open(const char *filename, int forWriting,
(*count)++; (*count)++;
// Skip over entry /* Skip over entry... */
pos = __PHYSFS_platformTell(*fh); pos = __PHYSFS_platformTell(*fh);
if (pos == -1) if (pos == -1)
goto openHog_failed; goto openHog_failed;
if (!__PHYSFS_platformSeek(*fh, pos + size)) if (!__PHYSFS_platformSeek(*fh, pos + size))
goto openHog_failed; goto openHog_failed;
} } /* while */
// Rewind to start of entries /* Rewind to start of entries... */
if (!__PHYSFS_platformSeek(*fh, 3)) if (!__PHYSFS_platformSeek(*fh, 3))
goto openHog_failed; goto openHog_failed;
@ -353,7 +353,7 @@ static int hog_load_entries(const char *name, int forWriting, HOGinfo *info)
return(0); return(0);
} }
// Skip over entry /* Skip over entry */
if (!__PHYSFS_platformSeek(fh, entry->startPos + entry->size)) if (!__PHYSFS_platformSeek(fh, entry->startPos + entry->size))
{ {
__PHYSFS_platformClose(fh); __PHYSFS_platformClose(fh);

View File

@ -309,7 +309,7 @@ static int wad_load_entries(const char *name, int forWriting, WADinfo *info)
PHYSFS_uint32 fileCount; PHYSFS_uint32 fileCount;
PHYSFS_uint32 directoryOffset; PHYSFS_uint32 directoryOffset;
WADentry *entry; WADentry *entry;
char lastDirectory[9],buffer[9]; char lastDirectory[9];
lastDirectory[8] = 0; /* Make sure lastDirectory stays null-terminated. */ lastDirectory[8] = 0; /* Make sure lastDirectory stays null-terminated. */

View File

@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <alloca.h> #include <alloca.h>
/* /*
@ -345,16 +346,42 @@ PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
int __PHYSFS_platformStricmp(const char *x, const char *y) int __PHYSFS_platformStricmp(const char *x, const char *y)
{ {
extern int _stricmp(const char *, const char *); int ux, uy;
return(_stricmp(x, y)); /* (*shrug*) */
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 */ } /* __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); int ux, uy;
return(_strnicmp(x, y, (int) l)); /* (*shrug*) */
} /* __PHYSFS_platformStricmp */ 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) static OSErr fnameToFSSpecNoAlias(const char *fname, FSSpec *spec)