Remove deprecated PHYSFS_getLastError() from all the extras (thanks, Rob!).
authorRyan C. Gordon <icculus@icculus.org>
Tue, 20 Feb 2018 10:26:33 -0500
changeset 1631 1aec60db9326
parent 1630 5123a32160af
child 1632 e9a16884a594
Remove deprecated PHYSFS_getLastError() from all the extras (thanks, Rob!).
extras/globbing.c
extras/ignorecase.c
extras/physfsrwops.c
extras/physfsunpack.c
extras/selfextract.c
--- a/extras/globbing.c	Sat Nov 11 08:53:23 2017 -0500
+++ b/extras/globbing.c	Tue Feb 20 10:26:33 2018 -0500
@@ -208,13 +208,13 @@
 
     if (!PHYSFS_init(argv[0]))
     {
-        fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         return 1;
     } /* if */
 
     if (!PHYSFS_addToSearchPath(".", 1))
     {
-        fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         PHYSFS_deinit();
         return 1;
     } /* if */
--- a/extras/ignorecase.c	Sat Nov 11 08:53:23 2017 -0500
+++ b/extras/ignorecase.c	Tue Feb 20 10:26:33 2018 -0500
@@ -101,34 +101,34 @@
 
     if (!PHYSFS_init(argv[0]))
     {
-        fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         return 1;
     } /* if */
 
     if (!PHYSFS_addToSearchPath(".", 1))
     {
-        fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         PHYSFS_deinit();
         return 1;
     } /* if */
 
     if (!PHYSFS_setWriteDir("."))
     {
-        fprintf(stderr, "PHYSFS_setWriteDir(): %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_setWriteDir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         PHYSFS_deinit();
         return 1;
     } /* if */
 
     if (!PHYSFS_mkdir("/a/b/c"))
     {
-        fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         PHYSFS_deinit();
         return 1;
     } /* if */
 
     if (!PHYSFS_mkdir("/a/b/C"))
     {
-        fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         PHYSFS_deinit();
         return 1;
     } /* if */
@@ -137,7 +137,7 @@
     PHYSFS_close(f);
     if (f == NULL)
     {
-        fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         PHYSFS_deinit();
         return 1;
     } /* if */
@@ -146,7 +146,7 @@
     PHYSFS_close(f);
     if (f == NULL)
     {
-        fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         PHYSFS_deinit();
         return 1;
     } /* if */
--- a/extras/physfsrwops.c	Sat Nov 11 08:53:23 2017 -0500
+++ b/extras/physfsrwops.c	Tue Feb 20 10:26:33 2018 -0500
@@ -70,7 +70,7 @@
         if (current == -1)
         {
             SDL_SetError("Can't find position in file: %s",
-                          PHYSFS_getLastError());
+                          PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
             return -1;
         } /* if */
 
@@ -91,7 +91,7 @@
         const PHYSFS_sint64 len = PHYSFS_fileLength(handle);
         if (len == -1)
         {
-            SDL_SetError("Can't find end of file: %s", PHYSFS_getLastError());
+            SDL_SetError("Can't find end of file: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
             return -1;
         } /* if */
 
@@ -112,7 +112,7 @@
     
     if (!PHYSFS_seek(handle, (PHYSFS_uint64) pos))
     {
-        SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+        SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         return -1;
     } /* if */
 
@@ -138,7 +138,7 @@
     {
         if (!PHYSFS_eof(handle)) /* not EOF? Must be an error. */
         {
-            SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+            SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
 
             #if TARGET_SDL2
             return 0;
@@ -167,7 +167,7 @@
     const PHYSFS_uint64 writelen = (PHYSFS_uint64) (num * size);
     const PHYSFS_sint64 rc = PHYSFS_writeBytes(handle, ptr, writelen);
     if (rc != ((PHYSFS_sint64) writelen))
-        SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+        SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
 
     #if TARGET_SDL2
     return (size_t) rc;
@@ -182,7 +182,7 @@
     PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
     if (!PHYSFS_close(handle))
     {
-        SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+        SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         return -1;
     } /* if */
 
@@ -196,7 +196,7 @@
     SDL_RWops *retval = NULL;
 
     if (handle == NULL)
-        SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+        SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
     else
     {
         retval = SDL_AllocRW();
--- a/extras/physfsunpack.c	Sat Nov 11 08:53:23 2017 -0500
+++ b/extras/physfsunpack.c	Tue Feb 20 10:26:33 2018 -0500
@@ -28,7 +28,7 @@
 static void fail(const char *what, const char *why)
 {
     if (why == NULL)
-        why = PHYSFS_getLastError();
+        why = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode());
     fprintf(stderr, "%s failed: %s\n", what, why);
     failure = 1;
 } /* fail */
@@ -150,21 +150,21 @@
 
     if (!PHYSFS_init(argv[0]))
     {
-        fprintf(stderr, "PHYSFS_init() failed: %s\n", PHYSFS_getLastError());
+        fprintf(stderr, "PHYSFS_init() failed: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         return 2;
     } /* if */
 
     if (!PHYSFS_setWriteDir(argv[2]))
     {
         fprintf(stderr, "PHYSFS_setWriteDir('%s') failed: %s\n",
-                argv[2], PHYSFS_getLastError());
+                argv[2], PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         return 3;
     } /* if */
 
     if (!PHYSFS_mount(argv[1], NULL, 1))
     {
         fprintf(stderr, "PHYSFS_mount('%s') failed: %s\n",
-                argv[1], PHYSFS_getLastError());
+                argv[1], PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         return 4;
     } /* if */
 
--- a/extras/selfextract.c	Sat Nov 11 08:53:23 2017 -0500
+++ b/extras/selfextract.c	Tue Feb 20 10:26:33 2018 -0500
@@ -40,14 +40,14 @@
 
     if (!PHYSFS_init(argv[0]))
     {
-        printf("PHYSFS_init() failed: %s\n", PHYSFS_getLastError());
+        printf("PHYSFS_init() failed: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         return 42;
     } /* if */
 
     rc = PHYSFS_addToSearchPath(argv[0], 0);
     if (!rc)
     {
-        printf("Couldn't find self-extract data: %s\n", PHYSFS_getLastError());
+        printf("Couldn't find self-extract data: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
         printf("This might mean you didn't append a zipfile to the binary.\n");
         return 42;
     } /* if */