summaryrefslogtreecommitdiff
path: root/Build/source/libs/zziplib/TLpatches/patch-03-w64-ptr
blob: 3ea18dd71e4d3e4b124d4a034fd8ac1051175dbd (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
diff -ur zziplib-0.13.66.orig/zzip/zip.c zziplib-0.13.66/zzip/zip.c
--- zziplib-0.13.66.orig/zzip/zip.c	Mon Apr 24 08:46:28 2017
+++ zziplib-0.13.66/zzip/zip.c	Wed May 24 21:14:48 2017
@@ -369,15 +369,19 @@
  * making pointer alignments to values that can be handled as structures
  * is tricky. We assume here that an align(4) is sufficient even for
  * 64 bit machines. Note that binary operations are not usually allowed
- * to pointer types but we do need only the lower bits in this implementation,
- * so we can just cast the value to a long value.
+ * to pointer types but we can cast the value to a suitably sized integer.
  */
 _zzip_inline static char *
 __zzip_aligned4(char *p)
 {
 #define aligned4   __zzip_aligned4
-    p += ((long) p) & 1;        /* warnings about truncation of a "pointer" */
-    p += ((long) p) & 2;        /* to a "long int" may be safely ignored :) */
+#ifdef _WIN64
+    p += ((__int64) p) & 1;
+    p += ((__int64) p) & 2;
+#else
+    p += ((long) p) & 1;
+    p += ((long) p) & 2;
+#endif
     return p;
 }