diff options
author | Alexander Miller <alex.miller@gmx.de> | 2024-03-11 22:24:14 +0100 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2024-03-16 11:18:50 -0700 |
commit | f02ea29e5f5f1b14e71dfdf44bf39ee969ca9bde (patch) | |
tree | 99debedf9a82e19807b7aabff8b556d804752a2e | |
parent | 9f418e1028d98cd4782fd3a2b883eaaf1a09cae5 (diff) | |
download | zlib-f02ea29e5f5f1b14e71dfdf44bf39ee969ca9bde.tar.gz zlib-f02ea29e5f5f1b14e71dfdf44bf39ee969ca9bde.tar.bz2 zlib-f02ea29e5f5f1b14e71dfdf44bf39ee969ca9bde.zip |
Improve detection of UNIX-style systems in minizip.
Not all toolchains on UNIX-style operating systems predefine
"unix". For example, it's missing on NetBSD, OpenBSD/gcc, AIX,
HP-UX. There is no single macro defined everywhere, but checking
both "__unix__" and "__unix" should cover everything except macOS,
which is already checked for using "__APPLE__".
Note that case sensitivity should default to off on macOS and
cygwin, so the check there is different.
-rw-r--r-- | contrib/minizip/make_vms.com | 2 | ||||
-rw-r--r-- | contrib/minizip/miniunz.c | 8 | ||||
-rw-r--r-- | contrib/minizip/minizip.c | 4 | ||||
-rw-r--r-- | contrib/minizip/unzip.c | 2 |
4 files changed, 5 insertions, 11 deletions
diff --git a/contrib/minizip/make_vms.com b/contrib/minizip/make_vms.com index 9ac13a9..4a0a77e 100644 --- a/contrib/minizip/make_vms.com +++ b/contrib/minizip/make_vms.com | |||
@@ -2,7 +2,7 @@ $ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig | |||
2 | $ open/write zdef vmsdefs.h | 2 | $ open/write zdef vmsdefs.h |
3 | $ copy sys$input: zdef | 3 | $ copy sys$input: zdef |
4 | $ deck | 4 | $ deck |
5 | #define unix | 5 | #define __unix__ |
6 | #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from | 6 | #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from |
7 | #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator | 7 | #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator |
8 | #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord | 8 | #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord |
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c index d871b3f..8e19534 100644 --- a/contrib/minizip/miniunz.c +++ b/contrib/minizip/miniunz.c | |||
@@ -93,8 +93,7 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat | |||
93 | LocalFileTimeToFileTime(&ftLocal,&ftm); | 93 | LocalFileTimeToFileTime(&ftLocal,&ftm); |
94 | SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); | 94 | SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); |
95 | CloseHandle(hFile); | 95 | CloseHandle(hFile); |
96 | #else | 96 | #elif defined(__unix__) || defined(__unix) || defined(__APPLE__) |
97 | #if defined(unix) || defined(__APPLE__) | ||
98 | (void)dosdate; | 97 | (void)dosdate; |
99 | struct utimbuf ut; | 98 | struct utimbuf ut; |
100 | struct tm newdate; | 99 | struct tm newdate; |
@@ -116,7 +115,6 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat | |||
116 | (void)dosdate; | 115 | (void)dosdate; |
117 | (void)tmu_date; | 116 | (void)tmu_date; |
118 | #endif | 117 | #endif |
119 | #endif | ||
120 | } | 118 | } |
121 | 119 | ||
122 | 120 | ||
@@ -127,9 +125,7 @@ static int mymkdir(const char* dirname) { | |||
127 | int ret=0; | 125 | int ret=0; |
128 | #ifdef _WIN32 | 126 | #ifdef _WIN32 |
129 | ret = _mkdir(dirname); | 127 | ret = _mkdir(dirname); |
130 | #elif unix | 128 | #elif defined(__unix__) || defined(__unix) || defined(__APPLE__) |
131 | ret = mkdir (dirname,0775); | ||
132 | #elif __APPLE__ | ||
133 | ret = mkdir (dirname,0775); | 129 | ret = mkdir (dirname,0775); |
134 | #else | 130 | #else |
135 | (void)dirname; | 131 | (void)dirname; |
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c index 26ee8d0..4d93d22 100644 --- a/contrib/minizip/minizip.c +++ b/contrib/minizip/minizip.c | |||
@@ -91,8 +91,7 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { | |||
91 | } | 91 | } |
92 | return ret; | 92 | return ret; |
93 | } | 93 | } |
94 | #else | 94 | #elif defined(__unix__) || defined(__unix) || defined(__APPLE__) |
95 | #if defined(unix) || defined(__APPLE__) | ||
96 | /* f: name of file to get info on, tmzip: return value: access, | 95 | /* f: name of file to get info on, tmzip: return value: access, |
97 | modification and creation times, dt: dostime */ | 96 | modification and creation times, dt: dostime */ |
98 | static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { | 97 | static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { |
@@ -143,7 +142,6 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { | |||
143 | return 0; | 142 | return 0; |
144 | } | 143 | } |
145 | #endif | 144 | #endif |
146 | #endif | ||
147 | 145 | ||
148 | 146 | ||
149 | 147 | ||
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index b5783ca..feaec67 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c | |||
@@ -88,7 +88,7 @@ | |||
88 | 88 | ||
89 | 89 | ||
90 | #ifndef CASESENSITIVITYDEFAULT_NO | 90 | #ifndef CASESENSITIVITYDEFAULT_NO |
91 | # if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) | 91 | # if (!defined(__unix__) && !defined(__unix) || defined(__CYGWIN__)) && !defined(CASESENSITIVITYDEFAULT_YES) |
92 | # define CASESENSITIVITYDEFAULT_NO | 92 | # define CASESENSITIVITYDEFAULT_NO |
93 | # endif | 93 | # endif |
94 | #endif | 94 | #endif |