Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
zconf.h
1/* zconf.h -- configuration of the zlib compression library
2 * Copyright (C) 1995-2002 Jean-loup Gailly.
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6/* @(#) $Id: zconf.h 6526 2026-10-19 23:45:18Z wini $ */
7
8#ifndef _ZCONF_H
9#define _ZCONF_H
10
11#ifndef USE_Z_NAMES
12# define deflateInit_ zba_deflateInit_
13# define deflate zba_deflate
14# define deflateEnd zba_deflateEnd
15# define inflateInit_ zba_inflateInit_
16# define inflate zba_inflate
17# define inflateEnd zba_inflateEnd
18# define deflateInit2_ zba_deflateInit2_
19# define deflateSetDictionary zba_deflateSetDictionary
20# define deflateCopy zba_deflateCopy
21# define deflateReset zba_deflateReset
22# define deflateParams zba_deflateParams
23# define inflateInit2_ zba_inflateInit2_
24# define inflateSetDictionary zba_inflateSetDictionary
25# define inflateSync zba_inflateSync
26# define inflateSyncPoint zba_inflateSyncPoint
27# define inflateReset zba_inflateReset
28# define compress zba_compress
29# define compress2 zba_compress2
30# define uncompress zba_uncompress
31# define adler32 zba_adler32
32# define get_crc_table zba_get_crc_table
33#endif
34
35#if 0
36# define Byte z_Byte
37# define uInt z_uInt
38# define uLong z_uLong
39# define Bytef z_Bytef
40# define charf z_charf
41# define intf z_intf
42# define uIntf z_uIntf
43# define uLongf z_uLongf
44# define voidpf z_voidpf
45# define voidp z_voidp
46#endif
47
48#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
49# define WIN32
50#endif
51#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
52# ifndef __32BIT__
53# define __32BIT__
54# endif
55#endif
56#if defined(__MSDOS__) && !defined(MSDOS)
57# define MSDOS
58#endif
59
60/*
61 * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
62 * than 64k bytes at a time (needed on systems with 16-bit int).
63 */
64#if defined(MSDOS) && !defined(__32BIT__)
65# define MAXSEG_64K
66#endif
67#ifdef MSDOS
68# define UNALIGNED_OK
69#endif
70
71#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
72# define STDC
73#endif
74#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
75# ifndef STDC
76# define STDC
77# endif
78#endif
79
80#ifndef STDC
81# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
82# define const
83# endif
84#endif
85
86/* Some Mac compilers merge all .h files incorrectly: */
87#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
88# define NO_DUMMY_DECL
89#endif
90
91/* Old Borland C incorrectly complains about missing returns: */
92#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
93# define NEED_DUMMY_RETURN
94#endif
95
96
97/* Maximum value for memLevel in deflateInit2 */
98#ifndef MAX_MEM_LEVEL
99# ifdef MAXSEG_64K
100# define MAX_MEM_LEVEL 8
101# else
102# define MAX_MEM_LEVEL 9
103# endif
104#endif
105
106/* BAS compressor memory setting. Embedded builds can select 5 to save
107 * 112 KiB per compressor without reducing the 32 KiB deflate window.
108 */
109#ifndef BA_DEFLATE_MEM_LEVEL
110# if MAX_MEM_LEVEL >= 8
111# define BA_DEFLATE_MEM_LEVEL 8
112# else
113# define BA_DEFLATE_MEM_LEVEL MAX_MEM_LEVEL
114# endif
115#endif
116#if BA_DEFLATE_MEM_LEVEL < 1 || BA_DEFLATE_MEM_LEVEL > MAX_MEM_LEVEL
117# error BA_DEFLATE_MEM_LEVEL must be between 1 and MAX_MEM_LEVEL
118#endif
119
120/* Maximum value for windowBits in deflateInit2 and inflateInit2.
121 * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
122 * created by gzip. (Files created by minigzip can still be extracted by
123 * gzip.)
124 */
125#ifndef MAX_WBITS
126# define MAX_WBITS 15 /* 32K LZ77 window */
127#endif
128
129/* The memory requirements for deflate are (in bytes):
130 (1 << (windowBits+2)) + (1 << (memLevel+9))
131 that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
132 plus a few kilobytes for small objects. For example, if you want to reduce
133 the default memory requirements from 256K to 128K, compile with
134 make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
135 Of course this will generally degrade compression (there's no free lunch).
136
137 The memory requirements for inflate are (in bytes) 1 << windowBits
138 that is, 32K for windowBits=15 (default value) plus a few kilobytes
139 for small objects.
140*/
141
142 /* Type declarations */
143
144#ifndef OF /* function prototypes */
145# ifdef STDC
146# define OF(args) args
147# else
148# define OF(args) ()
149# endif
150#endif
151
152/* The following definitions for FAR are needed only for MSDOS mixed
153 * model programming (small or medium model with some far allocations).
154 * This was tested only with MSC; for other MSDOS compilers you may have
155 * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
156 * just define FAR to be empty.
157 */
158#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
159 /* MSC small or medium model */
160# define SMALL_MEDIUM
161# ifdef _MSC_VER
162# define FAR _far
163# else
164# define FAR far
165# endif
166#endif
167#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
168# ifndef __32BIT__
169# define SMALL_MEDIUM
170# define FAR _far
171# endif
172#endif
173
174/* Compile with -DZLIB_DLL for Windows DLL support */
175#if defined(ZLIB_DLL)
176# if defined(_WINDOWS) || defined(WINDOWS)
177# ifdef FAR
178# undef FAR
179# endif
180# include <windows.h>
181# define ZEXPORT WINAPI
182# ifdef WIN32
183# define ZEXPORTVA WINAPIV
184# else
185# define ZEXPORTVA FAR _cdecl _export
186# endif
187# endif
188# if defined (__BORLANDC__)
189# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
190# include <windows.h>
191# define ZEXPORT __declspec(dllexport) WINAPI
192# define ZEXPORTRVA __declspec(dllexport) WINAPIV
193# else
194# if defined (_Windows) && defined (__DLL__)
195# define ZEXPORT _export
196# define ZEXPORTVA _export
197# endif
198# endif
199# endif
200#endif
201
202#if defined (__BEOS__)
203# if defined (ZLIB_DLL)
204# define ZEXTERN extern __declspec(dllexport)
205# else
206# define ZEXTERN extern __declspec(dllimport)
207# endif
208#endif
209
210#ifndef ZEXPORT
211# define ZEXPORT
212#endif
213#ifndef ZEXPORTVA
214# define ZEXPORTVA
215#endif
216#ifndef ZEXTERN
217# define ZEXTERN extern
218#endif
219
220#ifndef FAR
221# define FAR
222#endif
223
224typedef unsigned char Byte; /* 8 bits */
225typedef unsigned int uInt; /* 16 bits or more */
226typedef unsigned long uLong; /* 32 bits or more */
227
228#ifdef SMALL_MEDIUM
229 /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
230# define Bytef Byte FAR
231#else
232 typedef Byte FAR Bytef;
233#endif
234typedef char FAR charf;
235typedef int FAR intf;
236typedef uInt FAR uIntf;
237typedef uLong FAR uLongf;
238
239#ifdef STDC
240 typedef void FAR *voidpf;
241 typedef void *voidp;
242#else
243 typedef Byte FAR *voidpf;
244 typedef Byte *voidp;
245#endif
246
247#ifdef HAVE_UNISTD_H
248# include <sys/types.h> /* for off_t */
249# include <unistd.h> /* for SEEK_* and off_t */
250# define z_off_t off_t
251#endif
252#ifndef SEEK_SET
253# define SEEK_SET 0 /* Seek from beginning of file. */
254# define SEEK_CUR 1 /* Seek from current position. */
255# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
256#endif
257#ifndef z_off_t
258# define z_off_t long
259#endif
260
261/* MVS linker does not support external names larger than 8 bytes */
262#if defined(__MVS__)
263# pragma map(deflateInit_,"DEIN")
264# pragma map(deflateInit2_,"DEIN2")
265# pragma map(deflateEnd,"DEEND")
266# pragma map(inflateInit_,"ININ")
267# pragma map(inflateInit2_,"ININ2")
268# pragma map(inflateEnd,"INEND")
269# pragma map(inflateSync,"INSY")
270# pragma map(inflateSetDictionary,"INSEDI")
271# pragma map(inflate_blocks,"INBL")
272# pragma map(inflate_blocks_new,"INBLNE")
273# pragma map(inflate_blocks_free,"INBLFR")
274# pragma map(inflate_blocks_reset,"INBLRE")
275# pragma map(inflate_codes_free,"INCOFR")
276# pragma map(inflate_codes,"INCO")
277# pragma map(inflate_fast,"INFA")
278# pragma map(inflate_flush,"INFLU")
279# pragma map(inflate_mask,"INMA")
280# pragma map(inflate_set_dictionary,"INSEDI2")
281# pragma map(inflate_copyright,"INCOPY")
282# pragma map(inflate_trees_bits,"INTRBI")
283# pragma map(inflate_trees_dynamic,"INTRDY")
284# pragma map(inflate_trees_fixed,"INTRFI")
285# pragma map(inflate_trees_free,"INTRFR")
286#endif
287
288#endif /* _ZCONF_H */