Now compiles on CodeWarrior 6 for MacOS Classic again.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 31 Jan 2003 04:07:48 +0000
changeset 538 8752e3c0dbf9
parent 537 938e33391878
child 539 755ec1051c60
Now compiles on CodeWarrior 6 for MacOS Classic again.
CWProjects.sit
archivers/zip.c
physfs.c
platform/macclassic.c
test/test_physfs.c
Binary file CWProjects.sit has changed
--- a/archivers/zip.c	Fri Jan 31 02:11:59 2003 +0000
+++ b/archivers/zip.c	Fri Jan 31 04:07:48 2003 +0000
@@ -54,7 +54,7 @@
     ZIP_RESOLVING,
     ZIP_RESOLVED,
     ZIP_BROKEN_FILE,
-    ZIP_BROKEN_SYMLINK,
+    ZIP_BROKEN_SYMLINK
 } ZipResolveType;
 
 
@@ -724,7 +724,7 @@
                 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 @@
 } /* 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;
--- a/physfs.c	Fri Jan 31 02:11:59 2003 +0000
+++ b/physfs.c	Fri Jan 31 04:07:48 2003 +0000
@@ -122,7 +122,7 @@
 
 /* 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 @@
 } /* __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))
 {
--- a/platform/macclassic.c	Fri Jan 31 02:11:59 2003 +0000
+++ b/platform/macclassic.c	Fri Jan 31 04:07:48 2003 +0000
@@ -10,6 +10,7 @@
 #  include <config.h>
 #endif
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <alloca.h>
@@ -83,7 +84,7 @@
         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 @@
         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 @@
         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 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 @@
     /* 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 @@
             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 @@
         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);
--- a/test/test_physfs.c	Fri Jan 31 02:11:59 2003 +0000
+++ b/test/test_physfs.c	Fri Jan 31 04:07:48 2003 +0000
@@ -297,7 +297,7 @@
         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 @@
             } /* 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 @@
             {
                 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());