xref: /aosp_15_r20/external/zlib/patches/0008-minizip-zip-unzip-tools.patch (revision 86ee64e75fa5f8bce2c8c356138035642429cd05)
1From 0c7de17000659f4f79de878296892c46be0aff77 Mon Sep 17 00:00:00 2001
2From: Noel Gordon <[email protected]>
3Date: Wed, 26 May 2021 21:57:43 +1000
4Subject: [PATCH] Build minizip zip and unzip tools
5
6---
7 third_party/zlib/contrib/minizip/miniunz.c | 13 ++++++-------
8 third_party/zlib/contrib/minizip/minizip.c |  7 +++----
9 2 files changed, 9 insertions(+), 11 deletions(-)
10
11diff --git a/third_party/zlib/contrib/minizip/miniunz.c b/third_party/zlib/contrib/minizip/miniunz.c
12index 8ada038dbd4e7..5b4312e5647cd 100644
13--- a/third_party/zlib/contrib/minizip/miniunz.c
14+++ b/third_party/zlib/contrib/minizip/miniunz.c
15@@ -12,7 +12,7 @@
16          Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
17 */
18
19-#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
20+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!defined(__ANDROID_API__))
21         #ifndef __USE_FILE_OFFSET64
22                 #define __USE_FILE_OFFSET64
23         #endif
24@@ -27,7 +27,7 @@
25         #endif
26 #endif
27
28-#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
29+#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) || defined(__Fuchsia__) || defined(__ANDROID_API__)
30 // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
31 #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
32 #define FTELLO_FUNC(stream) ftello(stream)
33@@ -94,7 +94,7 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
34   SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
35   CloseHandle(hFile);
36 #else
37-#if defined(unix) || defined(__APPLE__)
38+#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
39   (void)dosdate;
40   struct utimbuf ut;
41   struct tm newdate;
42@@ -125,11 +125,9 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
43
44 static int mymkdir(const char* dirname) {
45     int ret=0;
46-#ifdef _WIN32
47+#if defined(_WIN32)
48     ret = _mkdir(dirname);
49-#elif unix
50-    ret = mkdir (dirname,0775);
51-#elif __APPLE__
52+#elif defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
53     ret = mkdir (dirname,0775);
54 #else
55     (void)dirname;
56diff --git a/third_party/zlib/contrib/minizip/minizip.c b/third_party/zlib/contrib/minizip/minizip.c
57index 26ee8d029efe6..9eb3956a55e00 100644
58--- a/third_party/zlib/contrib/minizip/minizip.c
59+++ b/third_party/zlib/contrib/minizip/minizip.c
60@@ -12,8 +12,7 @@
61          Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
62 */
63
64-
65-#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
66+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!defined(__ANDROID_API__))
67         #ifndef __USE_FILE_OFFSET64
68                 #define __USE_FILE_OFFSET64
69         #endif
70@@ -28,7 +27,7 @@
71         #endif
72 #endif
73
74-#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
75+#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) || defined(__Fuchsia__) || defined(__ANDROID_API__)
76 // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
77 #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
78 #define FTELLO_FUNC(stream) ftello(stream)
79@@ -92,7 +91,7 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
80   return ret;
81 }
82 #else
83-#if defined(unix) || defined(__APPLE__)
84+#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
85 /* f: name of file to get info on, tmzip: return value: access,
86    modification and creation times, dt: dostime */
87 static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
88--
892.31.1.818.g46aad6cb9e-goog
90