Fixed some compiler warnings on Visual Studio.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 14 Aug 2017 21:15:58 -0400
changeset 1582 526d606206fa
parent 1581 ad04b99afb88
child 1583 66ed1e1d525b
Fixed some compiler warnings on Visual Studio.

(and maybe made a few new ones...)
src/physfs.c
src/physfs_archiver_zip.c
src/physfs_platform_windows.c
--- a/src/physfs.c	Mon Aug 14 19:58:56 2017 -0400
+++ b/src/physfs.c	Mon Aug 14 21:15:58 2017 -0400
@@ -3043,8 +3043,9 @@
 } /* PHYSFS_stat */
 
 
-int __PHYSFS_readAll(PHYSFS_Io *io, void *buf, const PHYSFS_uint64 len)
+int __PHYSFS_readAll(PHYSFS_Io *io, void *buf, const size_t _len)
 {
+    const PHYSFS_uint64 len = (PHYSFS_uint64) _len;
     return (io->read(io, buf, len) == len);
 } /* __PHYSFS_readAll */
 
--- a/src/physfs_archiver_zip.c	Mon Aug 14 19:58:56 2017 -0400
+++ b/src/physfs_archiver_zip.c	Mon Aug 14 21:15:58 2017 -0400
@@ -747,7 +747,7 @@
 
 static int zip_resolve_symlink(PHYSFS_Io *io, ZIPinfo *info, ZIPentry *entry)
 {
-    const PHYSFS_uint64 size = entry->uncompressed_size;
+    const size_t size = (size_t) entry->uncompressed_size;
     char *path = NULL;
     int rc = 0;
 
@@ -768,7 +768,7 @@
     else  /* symlink target path is compressed... */
     {
         z_stream stream;
-        const PHYSFS_uint64 complen = entry->compressed_size;
+        const size_t complen = (size_t) entry->compressed_size;
         PHYSFS_uint8 *compressed = (PHYSFS_uint8*) __PHYSFS_smallAlloc(complen);
         if (compressed != NULL)
         {
@@ -1223,8 +1223,8 @@
     /*  Just try moving back at most 256k. Oh well. */
     if ((offset < pos) && (pos > 4))
     {
-        const PHYSFS_uint64 maxbuflen = 256 * 1024;
-        PHYSFS_uint64 len = pos - offset;
+        const size_t maxbuflen = 256 * 1024;
+        size_t len = pos - offset;
         PHYSFS_uint8 *buf = NULL;
         PHYSFS_sint32 i;
 
@@ -1246,7 +1246,7 @@
                  (buf[i+2] == 0x06) && (buf[i+3] == 0x06) )
             {
                 __PHYSFS_smallFree(buf);
-                return pos - (len - i);
+                return pos - ((PHYSFS_sint64) (len - i));
             } /* if */
         } /* for */
 
@@ -1542,10 +1542,10 @@
         const char *ptr = strrchr(filename, '$');
         if (ptr != NULL)
         {
-            const PHYSFS_uint64 len = (PHYSFS_uint64) (ptr - filename);
+            const size_t len = (size_t) (ptr - filename);
             char *str = (char *) __PHYSFS_smallAlloc(len + 1);
             BAIL_IF(!str, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
-            memcpy(str, filename, (size_t) len);
+            memcpy(str, filename, len);
             str[len] = '\0';
             entry = zip_find_entry(info, str);
             __PHYSFS_smallFree(str);
--- a/src/physfs_platform_windows.c	Mon Aug 14 19:58:56 2017 -0400
+++ b/src/physfs_platform_windows.c	Mon Aug 14 21:15:58 2017 -0400
@@ -59,7 +59,7 @@
     if (str == NULL) \
         w_assignto = NULL; \
     else { \
-        const PHYSFS_uint64 len = (PHYSFS_uint64) ((strlen(str) + 1) * 2); \
+        const size_t len = (PHYSFS_uint64) ((strlen(str) + 1) * 2); \
         w_assignto = (WCHAR *) __PHYSFS_smallAlloc(len); \
         if (w_assignto != NULL) \
             PHYSFS_utf8ToUtf16(str, (PHYSFS_uint16 *) w_assignto, len); \