summaryrefslogtreecommitdiffstats
path: root/src/physfs-1-cast-fixes.patch
blob: b469d6f0e164fd1e0e22a4c8a5330e178a177cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
This file is part of MXE. See LICENSE.md for licensing information.

This patch was adapted for PhysicsFS 2.0.3's file layout from
https://hg.icculus.org/icculus/physfs/rev/67031168b061.

# HG changeset patch
# User David Yip <dwyip@peach-bun.com>
# Date 1471367884 18000
#      Tue Aug 16 12:18:04 2016 -0500
# Branch stable-2.0
# Node ID 990fd55ba0c4979db59888283c7dde6c359927e2
# Parent  34ebe997c5c07f57aff8e56695cd89856800d11d
Replace unsigned long cast with cast to uintptr_t.

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.

diff -r 34ebe997c5c0 -r 990fd55ba0c4 archivers/lzma.c
--- a/archivers/lzma.c  Fri Jan 01 12:53:41 2016 -0500
+++ b/archivers/lzma.c  Tue Aug 16 12:18:04 2016 -0500
@@ -9,6 +9,7 @@
 
 #if (defined PHYSFS_SUPPORTS_7Z)
 
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
@@ -130,7 +131,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 *)((uintptr_t)object - offsetof(FileInputStream, inStream)); /* HACK! */
     size_t processedSizeLoc = __PHYSFS_platformRead(s->file, buffer, 1, size);
     if (processedSize != 0)
         *processedSize = processedSizeLoc;
@@ -145,7 +146,7 @@
  */
 SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
 {
-    FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); /* HACK! */
+    FileInputStream *s = (FileInputStream *)((uintptr_t)object - offsetof(FileInputStream, inStream)); /* HACK! */
     if (__PHYSFS_platformSeek(s->file, (PHYSFS_uint64) pos))
         return SZ_OK;
     return SZE_FAIL;