aboutsummaryrefslogtreecommitdiff
path: root/zutil.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2016-10-25 20:45:41 -0700
committerMark Adler <madler@alumni.caltech.edu>2016-10-25 20:45:41 -0700
commitce12c5cd00628bf8f680c98123a369974d32df15 (patch)
tree6aaf3750f4bc70ddd721926766b87fff0840d5b1 /zutil.h
parentb516b4bdd7c0c9f0858adfebf732089014f7b282 (diff)
downloadzlib-ce12c5cd00628bf8f680c98123a369974d32df15.tar.gz
zlib-ce12c5cd00628bf8f680c98123a369974d32df15.tar.bz2
zlib-ce12c5cd00628bf8f680c98123a369974d32df15.zip
Make a noble effort at setting OS_CODE correctly.
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.
Diffstat (limited to 'zutil.h')
-rw-r--r--zutil.h44
1 files changed, 30 insertions, 14 deletions
diff --git a/zutil.h b/zutil.h
index 3b761d3..9441a1e 100644
--- a/zutil.h
+++ b/zutil.h
@@ -98,28 +98,38 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
98#endif 98#endif
99 99
100#ifdef AMIGA 100#ifdef AMIGA
101# define OS_CODE 0x01 101# define OS_CODE 1
102#endif 102#endif
103 103
104#if defined(VAXC) || defined(VMS) 104#if defined(VAXC) || defined(VMS)
105# define OS_CODE 0x02 105# define OS_CODE 2
106# define F_OPEN(name, mode) \ 106# define F_OPEN(name, mode) \
107 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") 107 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
108#endif 108#endif
109 109
110#ifdef __370__
111# if __TARGET_LIB__ < 0x20000000
112# define OS_CODE 4
113# elif __TARGET_LIB__ < 0x40000000
114# define OS_CODE 11
115# else
116# define OS_CODE 8
117# endif
118#endif
119
110#if defined(ATARI) || defined(atarist) 120#if defined(ATARI) || defined(atarist)
111# define OS_CODE 0x05 121# define OS_CODE 5
112#endif 122#endif
113 123
114#ifdef OS2 124#ifdef OS2
115# define OS_CODE 0x06 125# define OS_CODE 6
116# if defined(M_I86) && !defined(Z_SOLO) 126# if defined(M_I86) && !defined(Z_SOLO)
117# include <malloc.h> 127# include <malloc.h>
118# endif 128# endif
119#endif 129#endif
120 130
121#if defined(MACOS) || defined(TARGET_OS_MAC) 131#if defined(MACOS) || defined(TARGET_OS_MAC)
122# define OS_CODE 0x07 132# define OS_CODE 7
123# ifndef Z_SOLO 133# ifndef Z_SOLO
124# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os 134# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
125# include <unix.h> /* for fdopen */ 135# include <unix.h> /* for fdopen */
@@ -131,18 +141,24 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
131# endif 141# endif
132#endif 142#endif
133 143
134#ifdef TOPS20 144#ifdef __acorn
135# define OS_CODE 0x0a 145# define OS_CODE 13
136#endif 146#endif
137 147
138#ifdef WIN32 148#if defined(WIN32) && !defined(__CYGWIN__)
139# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ 149# define OS_CODE 10
140# define OS_CODE 0x0b 150#endif
141# endif 151
152#ifdef _BEOS_
153# define OS_CODE 16
154#endif
155
156#ifdef __TOS_OS400__
157# define OS_CODE 18
142#endif 158#endif
143 159
144#ifdef __50SERIES /* Prime/PRIMOS */ 160#ifdef __APPLE__
145# define OS_CODE 0x0f 161# define OS_CODE 19
146#endif 162#endif
147 163
148#if defined(_BEOS_) || defined(RISCOS) 164#if defined(_BEOS_) || defined(RISCOS)
@@ -177,7 +193,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
177 /* common defaults */ 193 /* common defaults */
178 194
179#ifndef OS_CODE 195#ifndef OS_CODE
180# define OS_CODE 0x03 /* assume Unix */ 196# define OS_CODE 3 /* assume Unix */
181#endif 197#endif
182 198
183#ifndef F_OPEN 199#ifndef F_OPEN