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.
This commit is contained in:
Alexander Miller 2024-03-11 22:24:14 +01:00 committed by Mark Adler
parent 9f418e1028
commit f02ea29e5f
4 changed files with 5 additions and 11 deletions

View File

@ -2,7 +2,7 @@ $ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig
$ open/write zdef vmsdefs.h $ open/write zdef vmsdefs.h
$ copy sys$input: zdef $ copy sys$input: zdef
$ deck $ deck
#define unix #define __unix__
#define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from
#define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator
#define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord

View File

@ -93,8 +93,7 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
LocalFileTimeToFileTime(&ftLocal,&ftm); LocalFileTimeToFileTime(&ftLocal,&ftm);
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
CloseHandle(hFile); CloseHandle(hFile);
#else #elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
#if defined(unix) || defined(__APPLE__)
(void)dosdate; (void)dosdate;
struct utimbuf ut; struct utimbuf ut;
struct tm newdate; struct tm newdate;
@ -116,7 +115,6 @@ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_dat
(void)dosdate; (void)dosdate;
(void)tmu_date; (void)tmu_date;
#endif #endif
#endif
} }
@ -127,9 +125,7 @@ static int mymkdir(const char* dirname) {
int ret=0; int ret=0;
#ifdef _WIN32 #ifdef _WIN32
ret = _mkdir(dirname); ret = _mkdir(dirname);
#elif unix #elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
ret = mkdir (dirname,0775);
#elif __APPLE__
ret = mkdir (dirname,0775); ret = mkdir (dirname,0775);
#else #else
(void)dirname; (void)dirname;

View File

@ -91,8 +91,7 @@ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
} }
return ret; return ret;
} }
#else #elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
#if defined(unix) || defined(__APPLE__)
/* f: name of file to get info on, tmzip: return value: access, /* f: name of file to get info on, tmzip: return value: access,
modification and creation times, dt: dostime */ modification and creation times, dt: dostime */
static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { 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) {
return 0; return 0;
} }
#endif #endif
#endif

View File

@ -88,7 +88,7 @@
#ifndef CASESENSITIVITYDEFAULT_NO #ifndef CASESENSITIVITYDEFAULT_NO
# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) # if (!defined(__unix__) && !defined(__unix) || defined(__CYGWIN__)) && !defined(CASESENSITIVITYDEFAULT_YES)
# define CASESENSITIVITYDEFAULT_NO # define CASESENSITIVITYDEFAULT_NO
# endif # endif
#endif #endif