Patches to get this building on Mac Classic again.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 29 Dec 2003 08:50:21 +0000
changeset 622 c8e67ca63ad6
parent 621 d2d994be1e61
child 623 cbbbcf8174cc
Patches to get this building on Mac Classic again.
archivers/hog.c
archivers/wad.c
platform/macclassic.c
--- a/archivers/hog.c	Mon Dec 29 08:49:58 2003 +0000
+++ b/archivers/hog.c	Mon Dec 29 08:50:21 2003 +0000
@@ -249,10 +249,10 @@
         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 @@
 
         (*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 @@
             return(0);
         }
 
-        // Skip over entry
+        /* Skip over entry */
         if (!__PHYSFS_platformSeek(fh, entry->startPos + entry->size))
         {
             __PHYSFS_platformClose(fh);
--- a/archivers/wad.c	Mon Dec 29 08:49:58 2003 +0000
+++ b/archivers/wad.c	Mon Dec 29 08:50:21 2003 +0000
@@ -309,7 +309,7 @@
     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. */
 
--- a/platform/macclassic.c	Mon Dec 29 08:49:58 2003 +0000
+++ b/platform/macclassic.c	Mon Dec 29 08:50:21 2003 +0000
@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <alloca.h>
 
 /*
@@ -345,16 +346,42 @@
 
 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)