From 3afcff55dcd9dfe44980eebd097250fb2b78e0fe Mon Sep 17 00:00:00 2001 From: Hans Kristian Rosbach Date: Wed, 1 Feb 2017 12:33:12 +0100 Subject: [PATCH] Make a noble effort at setting OS_CODE correctly. Based on upstream commit ce12c5cd00628bf8f680c98123a369974d32df15 Original patch notes: This updates the OS_CODE determination at compile time to match as closely as possible the operating system mappings documented in the PKWare APPNOTE.TXT version 6.3.4, section 4.4.2.2. That byte in the gzip header is used by nobody for anything, as far as I can tell. However we might as well try to set it appropriately. --- zutil.h | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/zutil.h b/zutil.h index 0353210ed..21371bea8 100644 --- a/zutil.h +++ b/zutil.h @@ -65,12 +65,47 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* target dependencies */ -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b +#ifdef AMIGA +# define OS_CODE 1 +#endif + +#ifdef __370__ +# if __TARGET_LIB__ < 0x20000000 +# define OS_CODE 4 +# elif __TARGET_LIB__ < 0x40000000 +# define OS_CODE 11 +# else +# define OS_CODE 8 +# endif +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 5 +#endif + +#ifdef OS2 +# define OS_CODE 6 +# if defined(M_I86) && !defined(Z_SOLO) +# include # endif #endif +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 7 +#endif + +#ifdef __acorn +# define OS_CODE 13 +#endif + +#if defined(WIN32) && !defined(__CYGWIN__) +# define OS_CODE 10 +#endif + +#ifdef __APPLE__ +# define OS_CODE 19 +#endif + #if (defined(_MSC_VER) && (_MSC_VER > 600)) # define fdopen(fd, type) _fdopen(fd, type) #endif @@ -90,7 +125,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* common defaults */ #ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ +# define OS_CODE 3 /* assume Unix */ #endif #ifndef F_OPEN -- 2.47.3