Replace unsigned long cast with cast to size_t (thanks, David!).
authorRyan C. Gordon <icculus@icculus.org>
Tue, 16 Aug 2016 14:46:53 -0400
changeset 1377 67031168b061
parent 1376 e1f788a76b86
child 1378 2e64448a6cea
Replace unsigned long cast with cast to size_t (thanks, David!).

When targeting MinGW-w64's x86_64 target, unsigned long is 4 bytes but void* is
8 bytes. This mismatch triggers the pointer-to-int-cast warning.

(This patch was originally David Yip's work, with uintptr_t instead of size_t).
src/archiver_lzma.c
--- a/src/archiver_lzma.c	Mon Aug 15 05:41:36 2016 -0500
+++ b/src/archiver_lzma.c	Tue Aug 16 14:46:53 2016 -0400
@@ -124,7 +124,7 @@
 SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
                         size_t *processedSize)
 {
-    FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); /* HACK! */
+    FileInputStream *s = (FileInputStream *)((size_t)object - offsetof(FileInputStream, inStream)); /* HACK! */
     const size_t processedSizeLoc = s->io->read(s->io, buffer, size);
     if (processedSize != NULL)
         *processedSize = processedSizeLoc;
@@ -139,7 +139,7 @@
  */
 SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
 {
-    FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); /* HACK! */
+    FileInputStream *s = (FileInputStream *)((size_t)object - offsetof(FileInputStream, inStream)); /* HACK! */
     if (s->io->seek(s->io, (PHYSFS_uint64) pos))
         return SZ_OK;
     return SZE_FAIL;