Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Patches to get this building on Mac Classic again.
  • Loading branch information
icculus committed Dec 29, 2003
1 parent 56606fa commit 24c8651
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
12 changes: 6 additions & 6 deletions archivers/hog.c
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion archivers/wad.c
Expand Up @@ -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. */

Expand Down
39 changes: 33 additions & 6 deletions platform/macclassic.c
Expand Up @@ -13,6 +13,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <alloca.h>

/*
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 24c8651

Please sign in to comment.