Explorar o código

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).
Ryan C. Gordon %!s(int64=9) %!d(string=hai) anos
pai
achega
b66b2d4563
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/archiver_lzma.c

+ 2 - 2
src/archiver_lzma.c

@@ -124,7 +124,7 @@ SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
 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 SzFileReadImp(void *object, void *buffer, size_t size,
  */
 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;