updates.
[website.git] / docs / toolkit / manual / zlib.html
1
2 <html>
3 <head>
4  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-a" />
5  <meta http-equiv="Content-Language" content="en" />
6  <meta name="description" content="SILC Secure Internet Live Conferencing" />
7  <meta name="keywords" content="SILC, secure, chat, protocol, cipher, encrypt, SKE" />
8  <meta content="INDEX, FOLLOW" name="ROBOTS" />
9  <style type="text/css">
10   <!--
11   body { color: #000000; background: #f0f0f0; font-family: Helvetica, Arial, Sans-serif; }
12   a:link { text-decoration: none; color: #2f488f; }
13   a:visited { text-decoration: none;color: #2f488f; }
14   a:active { text-decoration: none; color: #2f488f; }
15   -->
16  </style>
17 </head>
18
19 <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
20
21 <table border="0" cellspacing="0" cellpadding="6" width="100%">
22  <tr valign="top" bgcolor="#dddddd">
23   <td><small>Copyright &copy; 2001 - 2007 SILC Project<br />
24     <a href="http://silcnet.org">SILC Project Website</a></small></td>
25   <td align="right"><small>
26    <a href="index.html">SILC Toolkit Reference Manual</a><br />
27    <a href="toolkit_index.html">Index</a></small></td>
28    </small></td>
29  </tr>
30 </table>
31 <table border="0" cellspacing="0" cellpadding="0" width="100%">
32 <tr bgcolor="#444444"><td><img src="space.gif" width="1" height="1"border="0" alt="" ></td></tr>
33 </table>
34
35 <table cellpadding="0" cellspacing="0" border="0">
36  <tr valign="top">
37
38   <td width="200" bgcolor="#f0f0f0">
39    <img src="space.gif" width="1" height="1" border="0" alt="">
40    <table width="100%" cellpadding="2" cellspacing="2" border="0">
41     <tr valign="top"><td>
42 <br />
43 <small>
44 <!-- Template file for the big index that appears in the Toolkit reference
45 manual on the left side.  With this file it is possible to add other than
46 automatically generated links to that list. -->
47
48 <a href="index.html"><img src="box.gif" border="0" alt="">SILC Toolkit Reference Manual</a><br />
49
50
51 <a href=silccryptlib.html><img src=box.gif border=0 alt=>SILC Crypto Library</a><br />
52 &nbsp;&nbsp;&nbsp; <a href=silcrng_intro.html><img src=box2.gif border=0 alt=>Introduction to SILC RNG</a><br />
53 &nbsp;&nbsp;&nbsp; <a href=silcrng.html><img src=box2.gif border=0 alt=>SILC RNG Interface</a><br />
54 &nbsp;&nbsp;&nbsp; <a href=silccipher.html><img src=box2.gif border=0 alt=>SILC Cipher API</a><br />
55 &nbsp;&nbsp;&nbsp; <a href=silcpkcs.html><img src=box2.gif border=0 alt=>SILC PKCS API</a><br />
56 &nbsp;&nbsp;&nbsp; <a href=silcpk.html><img src=box2.gif border=0 alt=>SILC Public Key API</a><br />
57 &nbsp;&nbsp;&nbsp; <a href=silcpkcs1.html><img src=box2.gif border=0 alt=>SILC PKCS #1 API</a><br />
58 &nbsp;&nbsp;&nbsp; <a href=silchash.html><img src=box2.gif border=0 alt=>SILC Hash Interface</a><br />
59 &nbsp;&nbsp;&nbsp; <a href=silchmac.html><img src=box2.gif border=0 alt=>SILC HMAC Interface</a><br />
60 <a href=silccorelib.html><img src=box.gif border=0 alt=>SILC Core Library</a><br />
61 &nbsp;&nbsp;&nbsp; <a href=silcauth.html><img src=box2.gif border=0 alt=>SILC Authentication Interface</a><br />
62 &nbsp;&nbsp;&nbsp; <a href=silcmessage.html><img src=box2.gif border=0 alt=>SILC Message Interface</a><br />
63 &nbsp;&nbsp;&nbsp; <a href=silcchannel.html><img src=box2.gif border=0 alt=>SILC Channel Interface</a><br />
64 &nbsp;&nbsp;&nbsp; <a href=silccommand.html><img src=box2.gif border=0 alt=>SILC Command Interface</a><br />
65 &nbsp;&nbsp;&nbsp; <a href=silcnotify.html><img src=box2.gif border=0 alt=>SILC Notify Interface</a><br />
66 &nbsp;&nbsp;&nbsp; <a href=silcstatus.html><img src=box2.gif border=0 alt=>SILC Status Types</a><br />
67 &nbsp;&nbsp;&nbsp; <a href=silcmode.html><img src=box2.gif border=0 alt=>SILC Modes</a><br />
68 &nbsp;&nbsp;&nbsp; <a href=silcid.html><img src=box2.gif border=0 alt=>SILC ID Interface</a><br />
69 &nbsp;&nbsp;&nbsp; <a href=silcargument.html><img src=box2.gif border=0 alt=>SILC Argument Interface</a><br />
70 &nbsp;&nbsp;&nbsp; <a href=silcattrs.html><img src=box2.gif border=0 alt=>SILC Attributes Interface</a><br />
71 &nbsp;&nbsp;&nbsp; <a href=silcpacket.html><img src=box2.gif border=0 alt=>Packet Engine Interface</a><br />
72 &nbsp;&nbsp;&nbsp; <a href=silcpubkey.html><img src=box2.gif border=0 alt=>SILC Public Key Payload Interface</a><br />
73 <a href=silcskelib.html><img src=box.gif border=0 alt=>SILC Key Exchange Library</a><br />
74 &nbsp;&nbsp;&nbsp; <a href=silcske.html><img src=box2.gif border=0 alt=>SILC SKE Interface</a><br />
75 &nbsp;&nbsp;&nbsp; <a href=silcconnauth.html><img src=box2.gif border=0 alt=>SILC Connection Authentication Interface</a><br />
76 <a href=silcvcardlib.html><img src=box.gif border=0 alt=>SILC VCard Library</a><br />
77 &nbsp;&nbsp;&nbsp; <a href=silcvcard.html><img src=box2.gif border=0 alt=>SILC VCard Interface</a><br />
78 <a href=silcmathlib.html><img src=box.gif border=0 alt=>SILC Math Library</a><br />
79 &nbsp;&nbsp;&nbsp; <a href=silcmp.html><img src=box2.gif border=0 alt=>SILC MP Interface</a><br />
80 &nbsp;&nbsp;&nbsp; <a href=silcmath.html><img src=box2.gif border=0 alt=>SILC Math Interface</a><br />
81 <a href=silcclientlib.html><img src=box.gif border=0 alt=>SILC Client Library</a><br />
82 &nbsp;&nbsp;&nbsp; <a href=silcclient_using.html><img src=box2.gif border=0 alt=>Using SILC Client Library Tutorial</a><br />
83 &nbsp;&nbsp;&nbsp; <a href=command_reply_args.html><img src=box2.gif border=0 alt=>Arguments for <b>command_reply</b> Client Operation</a><br />
84 &nbsp;&nbsp;&nbsp; <a href=silcstatus_args.html><img src=box2.gif border=0 alt=>SilcStatus Error Arguments in <b>command_reply</b> Client Operation</a><br />
85 &nbsp;&nbsp;&nbsp; <a href=notifyargs.html><img src=box2.gif border=0 alt=>Arguments for <b>notify</b> Client Operation</a><br />
86 &nbsp;&nbsp;&nbsp; <a href=silcclient_unicode.html><img src=box2.gif border=0 alt=>Unicode and UTF-8 Strings in Client Library</a><br />
87 &nbsp;&nbsp;&nbsp; <a href=silcclient.html><img src=box2.gif border=0 alt=>Client Library Interface Reference</a><br />
88 &nbsp;&nbsp;&nbsp; <a href=silcclient_entry.html><img src=box2.gif border=0 alt=>Client Entry Interface Reference</a><br />
89 <a href=silcasn1lib.html><img src=box.gif border=0 alt=>SILC ASN.1 Library</a><br />
90 &nbsp;&nbsp;&nbsp; <a href=silcasn1.html><img src=box2.gif border=0 alt=>SILC ASN.1 Interface</a><br />
91 &nbsp;&nbsp;&nbsp; <a href=silcber.html><img src=box2.gif border=0 alt=>SILC BER interface</a><br />
92 <a href=silchttplib.html><img src=box.gif border=0 alt=>SILC HTTP Library</a><br />
93 &nbsp;&nbsp;&nbsp; <a href=silchttpserver.html><img src=box2.gif border=0 alt=>SILC HTTP Server Interface</a><br />
94 &nbsp;&nbsp;&nbsp; <a href=silchttpphp.html><img src=box2.gif border=0 alt=>SILC HTTP PHP Translator</a><br />
95 <a href=silcutillib.html><img src=box.gif border=0 alt=>SILC Utility Library</a><br />
96 &nbsp;&nbsp;&nbsp; <a href=silctypes.html><img src=box2.gif border=0 alt=>Basic Types and Definitions</a><br />
97 &nbsp;&nbsp;&nbsp; <a href=silcbuffer.html><img src=box2.gif border=0 alt=>Data Buffer Interface</a><br />
98 &nbsp;&nbsp;&nbsp; <a href=silcbuffmt.html><img src=box2.gif border=0 alt=>Data Buffer Format Interface</a><br />
99 &nbsp;&nbsp;&nbsp; <a href=silchashtable.html><img src=box2.gif border=0 alt=>Hash Table Interface</a><br />
100 &nbsp;&nbsp;&nbsp; <a href=silcmemory.html><img src=box2.gif border=0 alt=>Memory Allocation Interface</a><br />
101 &nbsp;&nbsp;&nbsp; <a href=silcstack.html><img src=box2.gif border=0 alt=>Data Stack (memory pool) Interface</a><br />
102 &nbsp;&nbsp;&nbsp; <a href=silcfsm.html><img src=box2.gif border=0 alt=>Finite State Machine Interface</a><br />
103 &nbsp;&nbsp;&nbsp; <a href=silcthread.html><img src=box2.gif border=0 alt=>Thread Interface</a><br />
104 &nbsp;&nbsp;&nbsp; <a href=silcmutex.html><img src=box2.gif border=0 alt=>Mutual Exclusion Lock Interface</a><br />
105 &nbsp;&nbsp;&nbsp; <a href=silccond.html><img src=box2.gif border=0 alt=>Condition Variable Interface</a><br />
106 &nbsp;&nbsp;&nbsp; <a href=silcatomic.html><img src=box2.gif border=0 alt=>Atomic Operations Interface</a><br />
107 &nbsp;&nbsp;&nbsp; <a href=silcnet.html><img src=box2.gif border=0 alt=>Network (TCP and UDP) Interface</a><br />
108 &nbsp;&nbsp;&nbsp; <a href=silcschedule.html><img src=box2.gif border=0 alt=>Scheduler Interface</a><br />
109 &nbsp;&nbsp;&nbsp; <a href=silcasync.html><img src=box2.gif border=0 alt=>Asynchronous Operation Interface</a><br />
110 &nbsp;&nbsp;&nbsp; <a href=silcstream.html><img src=box2.gif border=0 alt=>Abstract Stream Interface</a><br />
111 &nbsp;&nbsp;&nbsp; <a href=silcsocketstream.html><img src=box2.gif border=0 alt=>Socket Stream Interface</a><br />
112 &nbsp;&nbsp;&nbsp; <a href=silcfdstream.html><img src=box2.gif border=0 alt=>File Descriptor Stream Interface</a><br />
113 &nbsp;&nbsp;&nbsp; <a href=silcfileutil.html><img src=box2.gif border=0 alt=>File Utility Functions</a><br />
114 &nbsp;&nbsp;&nbsp; <a href=silcstrutil.html><img src=box2.gif border=0 alt=>String Utility Interface</a><br />
115 &nbsp;&nbsp;&nbsp; <a href=silcsnprintf.html><img src=box2.gif border=0 alt=>Snprintf Interface</a><br />
116 &nbsp;&nbsp;&nbsp; <a href=silcutf8.html><img src=box2.gif border=0 alt=>UTF-8 String Interface</a><br />
117 &nbsp;&nbsp;&nbsp; <a href=silcstringprep.html><img src=box2.gif border=0 alt=>Stringprep Interface</a><br />
118 &nbsp;&nbsp;&nbsp; <a href=silcutil.html><img src=box2.gif border=0 alt=>Utility Functions</a><br />
119 &nbsp;&nbsp;&nbsp; <a href=silclist.html><img src=box2.gif border=0 alt=>List Interface</a><br />
120 &nbsp;&nbsp;&nbsp; <a href=silcdlist.html><img src=box2.gif border=0 alt=>Dynamic List Interface</a><br />
121 &nbsp;&nbsp;&nbsp; <a href=silcmime.html><img src=box2.gif border=0 alt=>MIME Interface</a><br />
122 &nbsp;&nbsp;&nbsp; <a href=silctime.html><img src=box2.gif border=0 alt=>Time Utility Functions</a><br />
123 &nbsp;&nbsp;&nbsp; <a href=silclog.html><img src=box2.gif border=0 alt=>Logging Interface</a><br />
124 &nbsp;&nbsp;&nbsp; <a href=silcconfig.html><img src=box2.gif border=0 alt=>Config File Interface</a><br />
125 <a href=silcskrlib.html><img src=box.gif border=0 alt=>SILC Key Repository Library</a><br />
126 &nbsp;&nbsp;&nbsp; <a href=silcskr.html><img src=box2.gif border=0 alt=>SILC SKR Interface</a><br />
127 <a href=silcaputillib.html><img src=box.gif border=0 alt=>SILC Application Utility Library</a><br />
128 &nbsp;&nbsp;&nbsp; <a href=silcapputil.html><img src=box2.gif border=0 alt=>SILC Application Utilities</a><br />
129 &nbsp;&nbsp;&nbsp; <a href=silcidcache.html><img src=box2.gif border=0 alt=>SILC ID Cache Interface</a><br />
130 <a href=silcsftplib.html><img src=box.gif border=0 alt=>SILC SFTP Library</a><br />
131 &nbsp;&nbsp;&nbsp; <a href=silcsftp.html><img src=box2.gif border=0 alt=>SILC SFTP Interface</a><br />
132 &nbsp;&nbsp;&nbsp; <a href=silcsftp_fs.html><img src=box2.gif border=0 alt=>SFTP Filesystems Interface</a><br />
133
134 <br />
135 <b>Resource Links</b>
136 <br />
137 <a href="http://silcnet.org"><img src="box.gif" border="0" alt="">SILC Project Website</a><br />
138 <a href="http://silcnet.org/support/documentation/"><img src="box.gif" border="0" alt="">SILC Protocol Documentation</a><br />
139 <a href="http://silcnet.org/support/documentation/wp/"><img src="box.gif" border="0" alt="">SILC White Paper</a><br />
140 <a href="http://silcnet.org/support/faq/"><img src="box.gif" border="0" alt="">SILC FAQs</a><br />
141
142 </small>
143 <br /><br /><br /><br />
144     </td></tr>
145    </table>
146   </td>
147
148   <td bgcolor="#cccccc" background="dot.gif">
149    <img src="space.gif" width="1" height="1" border="0" alt=""></td>
150
151   <td width="720" bgcolor="#ffffff">
152    <img src="space.gif" width="1" height="1" border="0" alt="">
153    <table cellpadding="2" cellspacing="6" width="100%">
154     <tr><td valign="top">
155 <br />
156 <html>
157 <head>
158  <title>
159  zlib general purpose compression library version 1.1.4
160  </title>
161 </head>
162 <body bgcolor="White" text="Black" vlink="Red" alink="Navy" link="Red">
163 <!-- background="zlibbg.gif" -->
164
165 <h1> zlib 1.1.4 Manual </h1>
166 <hr>
167 <a name="Contents"><h2>Contents</h2>
168 <ol type="I">
169 <li> <a href="#Prologue">Prologue</a>
170 <li> <a href="#Introduction">Introduction</a>
171 <li> <a href="#Utility functions">Utility functions</a>
172 <li> <a href="#Basic functions">Basic functions</a>
173 <li> <a href="#Advanced functions">Advanced functions</a>
174 <li> <a href="#Constants">Constants</a>
175 <li> <a href="#struct z_stream_s">struct z_stream_s</a>
176 <li> <a href="#Checksum functions">Checksum functions</a>
177 <li> <a href="#Misc">Misc</a>
178 </ol>
179 <hr>
180 <a name="Prologue"><h2> Prologue </h2>
181   'zlib' general purpose compression library version 1.1.4, March 11th, 2002
182   <p>
183   Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
184   <p>
185   This software is provided 'as-is', without any express or implied
186   warranty.  In no event will the authors be held liable for any damages
187   arising from the use of this software.
188   <p>
189   Permission is granted to anyone to use this software for any purpose,
190   including commercial applications, and to alter it and redistribute it
191   freely, subject to the following restrictions:
192   <ol>
193    <li> The origin of this software must not be misrepresented ; you must not
194      claim that you wrote the original software. If you use this software
195      in a product, an acknowledgment in the product documentation would be
196      appreciated but is not required.
197    <li> Altered source versions must be plainly marked as such, and must not be
198      misrepresented as being the original software.
199    <li> This notice may not be removed or altered from any source distribution.
200   </ol>
201
202   <dl>
203   <dt>Jean-loup Gailly        
204   <dd><a href="mailto:jloup@gzip.org">jloup@gzip.org</a>
205   <dt>Mark Adler
206   <dd><a href="mailto:madler@alumni.caltech.edu">madler@alumni.caltech.edu</a>
207   </dl>
208
209   The data format used by the zlib library is described by RFCs (Request for
210   Comments) 1950 to 1952 in the files
211   <a href="ftp://ds.internic.net/rfc/rfc1950.txt">
212   ftp://ds.internic.net/rfc/rfc1950.txt </a>
213   (zlib format), 
214   <a href="ftp://ds.internic.net/rfc/rfc1951.txt">
215   rfc1951.txt </a>
216   (<a href="#deflate">deflate</a> format) and 
217   <a href="ftp://ds.internic.net/rfc/rfc1952.txt">
218   rfc1952.txt </a>
219   (gzip format).
220   <p>
221   This manual is converted from zlib.h by 
222   <a href="mailto:piaip@csie.ntu.edu.tw"> piaip </a>
223   <p>
224   Visit <a href="http://ftp.cdrom.com/pub/infozip/zlib/">
225   http://ftp.cdrom.com/pub/infozip/zlib/</a> 
226   for the official zlib web page.
227   <p>
228
229 <hr>
230 <a name="Introduction"><h2> Introduction </h2>
231      The 'zlib' compression library provides in-memory compression and
232   decompression functions, including integrity checks of the uncompressed
233   data.  This version of the library supports only one compression method
234   (deflation) but other algorithms will be added later and will have the same
235   stream interface.
236   <p>
237
238      Compression can be done in a single step if the buffers are large
239   enough (for example if an input file is mmap'ed), or can be done by
240   repeated calls of the compression function.  In the latter case, the
241   application must provide more input and/or consume the output
242   (providing more output space) before each call.
243   <p>
244
245      The library also supports reading and writing files in gzip (.gz) format
246   with an interface similar to that of stdio.
247   <p>
248
249      The library does not install any signal handler. The decoder checks
250   the consistency of the compressed data, so the library should never
251   crash even in case of corrupted input.
252   <p>
253
254 <hr>
255 <a name="Utility functions"><h2> Utility functions </h2>
256      The following utility functions are implemented on top of the
257    <a href="#Basic functions">basic stream-oriented functions</a>. 
258    To simplify the interface, some
259    default options are assumed (compression level and memory usage,
260    standard memory allocation functions). The source code of these
261    utility functions can easily be modified if you need special options.
262 <h3> Function list </h3>
263 <ul>
264 <li> int  <a href="#compress">compress</a> (Bytef *dest,   uLongf *destLen, const Bytef *source, uLong sourceLen);
265 <li> int  <a href="#compress2">compress2</a> (Bytef *dest,   uLongf *destLen, const Bytef *source, uLong sourceLen, int level);
266 <li> int  <a href="#uncompress">uncompress</a> (Bytef *dest,   uLongf *destLen, const Bytef *source, uLong sourceLen);
267 <li> typedef voidp gzFile;
268 <li>  gzFile  <a href="#gzopen">gzopen</a>  (const char *path, const char *mode);
269 <li> gzFile  <a href="#gzdopen">gzdopen</a>  (int fd, const char *mode);
270 <li> int  <a href="#gzsetparams">gzsetparams</a> (gzFile file, int level, int strategy);
271 <li> int     <a href="#gzread">gzread</a>  (gzFile file, voidp buf, unsigned len);
272 <li> int     <a href="#gzwrite">gzwrite</a> (gzFile file, const voidp buf, unsigned len);
273 <li> int VA   <a href="#gzprintf">gzprintf</a> (gzFile file, const char *format, ...);
274 <li> int  <a href="#gzputs">gzputs</a> (gzFile file, const char *s);
275 <li> char *  <a href="#gzgets">gzgets</a> (gzFile file, char *buf, int len);
276 <li> int     <a href="#gzputc">gzputc</a> (gzFile file, int c);
277 <li> int     <a href="#gzgetc">gzgetc</a> (gzFile file);
278 <li> int     <a href="#gzflush">gzflush</a> (gzFile file, int flush);
279 <li> z_off_t     <a href="#gzseek">gzseek</a> (gzFile file, z_off_t offset, int whence);
280 <li> z_off_t     <a href="#gztell">gztell</a> (gzFile file);
281 <li> int     <a href="#gzrewind">gzrewind</a> (gzFile file);
282 <li> int  <a href="#gzeof">gzeof</a> (gzFile file);
283 <li> int     <a href="#gzclose">gzclose</a> (gzFile file);
284 <li> const char *  <a href="#gzerror">gzerror</a> (gzFile file, int *errnum);
285 </ul>
286 <h3> Function description </h3>
287 <dl>
288 <font color="Blue"><dt> int  <a name="compress">compress</a> (Bytef *dest,   uLongf *destLen, const Bytef *source, uLong sourceLen);</font>
289 <dd>
290      Compresses the source buffer into the destination buffer.  sourceLen is
291    the byte length of the source buffer. Upon entry, destLen is the total
292    size of the destination buffer, which must be at least 0.1% larger than
293    sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
294    compressed buffer.<p>
295      This function can be used to <a href="#compress">compress</a> a whole file at once if the
296    input file is mmap'ed.<p>
297      <a href="#compress">compress</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
298    enough memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if there was not enough room in the output
299    buffer.<p>
300
301 <font color="Blue"><dt> int  <a name="compress2">compress2</a> (Bytef *dest,   uLongf *destLen, const Bytef *source, uLong sourceLen, int level);</font>
302 <dd>
303      Compresses the source buffer into the destination buffer. The level
304    parameter has the same meaning as in <a href="#deflateInit">deflateInit</a>.  sourceLen is the byte
305    length of the source buffer. Upon entry, destLen is the total size of the
306    destination buffer, which must be at least 0.1% larger than sourceLen plus
307    12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
308    <p>
309
310      <a href="#compress2">compress2</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
311    memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if there was not enough room in the output buffer,
312    <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the level parameter is invalid.
313    <p>
314
315 <font color="Blue"><dt> int  <a name="uncompress">uncompress</a> (Bytef *dest,   uLongf *destLen, const Bytef *source, uLong sourceLen);</font>
316 <dd>
317      Decompresses the source buffer into the destination buffer.  sourceLen is
318    the byte length of the source buffer. Upon entry, destLen is the total
319    size of the destination buffer, which must be large enough to hold the
320    entire uncompressed data. (The size of the uncompressed data must have
321    been saved previously by the compressor and transmitted to the decompressor
322    by some mechanism outside the scope of this compression library.)
323    Upon exit, destLen is the actual size of the compressed buffer. <p>
324      This function can be used to decompress a whole file at once if the
325    input file is mmap'ed.
326    <p>
327
328      <a href="#uncompress">uncompress</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
329    enough memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if there was not enough room in the output
330    buffer, or <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the input data was corrupted.
331    <p>
332
333 <dt> typedef voidp gzFile;
334 <dd> <p>
335
336 <font color="Blue"><dt>  gzFile  <a name="gzopen">gzopen</a>  (const char *path, const char *mode);</font>
337 <dd>
338      Opens a gzip (.gz) file for reading or writing. The mode parameter
339    is as in fopen ("rb" or "wb") but can also include a compression level
340    ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
341    Huffman only compression as in "wb1h". (See the description
342    of <a href="#deflateInit2">deflateInit2</a> for more information about the strategy parameter.)
343    <p>
344
345      <a href="#gzopen">gzopen</a> can be used to read a file which is not in gzip format ; in this
346    case <a href="#gzread">gzread</a> will directly read from the file without decompression.
347    <p>
348
349      <a href="#gzopen">gzopen</a> returns NULL if the file could not be opened or if there was
350    insufficient memory to allocate the (de)compression <a href="#state">state</a> ; errno
351    can be checked to distinguish the two cases (if errno is zero, the
352    zlib error is <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a>).
353    <p>
354
355 <font color="Blue"><dt> gzFile  <a name="gzdopen">gzdopen</a>  (int fd, const char *mode);</font>
356 <dd>
357      <a href="#gzdopen">gzdopen</a>() associates a gzFile with the file descriptor fd.  File
358    descriptors are obtained from calls like open, dup, creat, pipe or
359    fileno (in the file has been previously opened with fopen).
360    The mode parameter is as in <a href="#gzopen">gzopen</a>.
361    <p>
362      The next call of <a href="#gzclose">gzclose</a> on the returned gzFile will also close the
363    file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
364    descriptor fd. If you want to keep fd open, use <a href="#gzdopen">gzdopen</a>(dup(fd), mode).
365    <p>
366      <a href="#gzdopen">gzdopen</a> returns NULL if there was insufficient memory to allocate
367    the (de)compression <a href="#state">state</a>.
368    <p>
369
370 <font color="Blue"><dt> int  <a name="gzsetparams">gzsetparams</a> (gzFile file, int level, int strategy);</font>
371 <dd>
372      Dynamically update the compression level or strategy. See the description
373    of <a href="#deflateInit2">deflateInit2</a> for the meaning of these parameters.
374    <p>
375      <a href="#gzsetparams">gzsetparams</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the file was not
376    opened for writing.
377    <p>
378
379 <font color="Blue"><dt> int     <a name="gzread">gzread</a>  (gzFile file, voidp buf, unsigned len);</font>
380 <dd>
381      Reads the given number of uncompressed bytes from the compressed file.
382    If the input file was not in gzip format, <a href="#gzread">gzread</a> copies the given number
383    of bytes into the buffer.
384    <p>
385      <a href="#gzread">gzread</a> returns the number of uncompressed bytes actually read (0 for
386    end of file, -1 for error).
387    <p>
388
389 <font color="Blue"><dt> int     <a name="gzwrite">gzwrite</a> (gzFile file, const voidp buf, unsigned len);</font>
390 <dd>
391      Writes the given number of uncompressed bytes into the compressed file.
392    <a href="#gzwrite">gzwrite</a> returns the number of uncompressed bytes actually written
393    (0 in case of error).
394    <p>
395
396 <font color="Blue"><dt> int VA   <a name="gzprintf">gzprintf</a> (gzFile file, const char *format, ...);</font>
397 <dd>
398      Converts, formats, and writes the args to the compressed file under
399    control of the format string, as in fprintf. <a href="#gzprintf">gzprintf</a> returns the number of
400    uncompressed bytes actually written (0 in case of error).
401    <p>
402
403 <font color="Blue"><dt> int  <a name="gzputs">gzputs</a> (gzFile file, const char *s);</font>
404 <dd>
405       Writes the given null-terminated string to the compressed file, excluding
406    the terminating null character.
407    <p>
408       <a href="#gzputs">gzputs</a> returns the number of characters written, or -1 in case of error.
409       <p>
410
411 <font color="Blue"><dt> char *  <a name="gzgets">gzgets</a> (gzFile file, char *buf, int len);</font>
412 <dd>
413       Reads bytes from the compressed file until len-1 characters are read, or
414    a newline character is read and transferred to buf, or an end-of-file
415    condition is encountered.  The string is then terminated with a null
416    character.
417    <p>
418       <a href="#gzgets">gzgets</a> returns buf, or <a href="#Z_NULL">Z_NULL</a> in case of error.
419       <p>
420
421 <font color="Blue"><dt> int     <a name="gzputc">gzputc</a> (gzFile file, int c);</font>
422 <dd>
423       Writes c, converted to an unsigned char, into the compressed file.
424    <a href="#gzputc">gzputc</a> returns the value that was written, or -1 in case of error.
425    <p>
426
427 <font color="Blue"><dt> int     <a name="gzgetc">gzgetc</a> (gzFile file);</font>
428 <dd>
429       Reads one byte from the compressed file. <a href="#gzgetc">gzgetc</a> returns this byte
430    or -1 in case of end of file or error.
431    <p>
432
433 <font color="Blue"><dt> int     <a name="gzflush">gzflush</a> (gzFile file, int flush);</font>
434 <dd>
435      Flushes all pending output into the compressed file. The parameter
436    flush is as in the <a href="#deflate">deflate</a>() function. The return value is the zlib
437    error number (see function <a href="#gzerror">gzerror</a> below). <a href="#gzflush">gzflush</a> returns <a href="#Z_OK">Z_OK</a> if
438    the flush parameter is <a href="#Z_FINISH">Z_FINISH</a> and all output could be flushed.
439    <p>
440      <a href="#gzflush">gzflush</a> should be called only when strictly necessary because it can
441    degrade compression.
442    <p>
443
444 <font color="Blue"><dt> z_off_t     <a name="gzseek">gzseek</a> (gzFile file, z_off_t offset, int whence);</font>
445 <dd>
446       Sets the starting position for the next <a href="#gzread">gzread</a> or <a href="#gzwrite">gzwrite</a> on the
447    given compressed file. The offset represents a number of bytes in the
448    uncompressed data stream. The whence parameter is defined as in lseek(2);
449    the value SEEK_END is not supported.
450    <p>
451      If the file is opened for reading, this function is emulated but can be
452    extremely slow. If the file is opened for writing, only forward seeks are
453    supported ; <a href="#gzseek">gzseek</a> then compresses a sequence of zeroes up to the new
454    starting position.
455    <p>
456       <a href="#gzseek">gzseek</a> returns the resulting offset location as measured in bytes from
457    the beginning of the uncompressed stream, or -1 in case of error, in
458    particular if the file is opened for writing and the new starting position
459    would be before the current position.
460    <p>
461
462 <font color="Blue"><dt> int     <a name="gzrewind">gzrewind</a> (gzFile file);</font>
463 <dd>
464      Rewinds the given file. This function is supported only for reading.
465      <p>
466    <a href="#gzrewind">gzrewind</a>(file) is equivalent to (int)<a href="#gzseek">gzseek</a>(file, 0L, SEEK_SET)
467    <p>
468
469 <font color="Blue"><dt> z_off_t     <a name="gztell">gztell</a> (gzFile file);</font>
470 <dd>
471      Returns the starting position for the next <a href="#gzread">gzread</a> or <a href="#gzwrite">gzwrite</a> on the
472    given compressed file. This position represents a number of bytes in the
473    uncompressed data stream.
474    <p>
475
476    <a href="#gztell">gztell</a>(file) is equivalent to <a href="#gzseek">gzseek</a>(file, 0L, SEEK_CUR)
477    <p>
478
479 <font color="Blue"><dt> int  <a name="gzeof">gzeof</a> (gzFile file);</font>
480 <dd>
481      Returns 1 when EOF has previously been detected reading the given
482    input stream, otherwise zero.
483    <p>
484
485 <font color="Blue"><dt> int     <a name="gzclose">gzclose</a> (gzFile file);</font>
486 <dd>
487      Flushes all pending output if necessary, closes the compressed file
488    and deallocates all the (de)compression <a href="#state">state</a>. The return value is the zlib
489    error number (see function <a href="#gzerror">gzerror</a> below).
490    <p>
491
492 <font color="Blue"><dt> const char *  <a name="gzerror">gzerror</a> (gzFile file, int *errnum);</font>
493 <dd>
494      Returns the error message for the last error which occurred on the
495    given compressed file. errnum is set to zlib error number. If an
496    error occurred in the file system and not in the compression library,
497    errnum is set to <a href="#Z_ERRNO">Z_ERRNO</a> and the application may consult errno
498    to get the exact error code.
499    <p>
500 </dl>
501 <hr>
502 <a name="Basic functions"><h2> Basic functions </h2>
503 <h3> Function list </h3>
504 <ul>
505 <li>  const char *  <a href="#zlibVersion">zlibVersion</a> (void);
506 <li>  int  <a href="#deflateInit">deflateInit</a> (<a href="#z_streamp">z_streamp</a> strm, int level);
507 <li>  int  <a href="#deflate">deflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);
508 <li>  int  <a href="#deflateEnd">deflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);
509 <li>  int  <a href="#inflateInit">inflateInit</a> (<a href="#z_streamp">z_streamp</a> strm);
510 <li>  int  <a href="#inflate">inflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);
511 <li>  int  <a href="#inflateEnd">inflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);
512 </ul>
513
514 <h3> Function description </h3>
515 <dl>
516 <font color="Blue"><dt>  const char *  <a name="zlibVersion">zlibVersion</a> (void);</font>
517 <dd> The application can compare <a href="#zlibVersion">zlibVersion</a> and ZLIB_VERSION for consistency.
518    If the first character differs, the library code actually used is
519    not compatible with the zlib.h header file used by the application.
520    This check is automatically made by <a href="#deflateInit">deflateInit</a> and <a href="#inflateInit">inflateInit</a>.
521    <p>
522
523 <font color="Blue"><dt> int  <a name="deflateInit">deflateInit</a> (<a href="#z_streamp">z_streamp</a> strm, int level);</font>
524 <dd>
525      Initializes the internal stream <a href="#state">state</a> for compression. The fields
526    <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by the caller.
527    If <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> are set to <a href="#Z_NULL">Z_NULL</a>, <a href="#deflateInit">deflateInit</a> updates them to
528    use default allocation functions.
529    <p>
530
531      The compression level must be <a href="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a>, or between 0 and 9:
532    1 gives best speed, 9 gives best compression, 0 gives no compression at
533    all (the input data is simply copied a block at a time).
534    <p>
535
536    <a href="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a> requests a default compromise between speed and
537    compression (currently equivalent to level 6).
538    <p>
539
540      <a href="#deflateInit">deflateInit</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
541    enough memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if level is not a valid compression level,
542    <a href="#Z_VERSION_ERROR">Z_VERSION_ERROR</a> if the zlib library version (<a href="#zlib_version">zlib_version</a>) is incompatible
543    with the version assumed by the caller (ZLIB_VERSION).
544    <a href="#msg">msg</a> is set to null if there is no error message.  <a href="#deflateInit">deflateInit</a> does not
545    perform any compression: this will be done by <a href="#deflate">deflate</a>().
546    <p>
547
548 <font color="Blue"><dt>  int  <a name="deflate">deflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);</font>
549 <dd>
550     <a href="#deflate">deflate</a> compresses as much data as possible, and stops when the input
551   buffer becomes empty or the output buffer becomes full. It may introduce some
552   output latency (reading input without producing any output) except when
553   forced to flush.<p>
554
555     The detailed semantics are as follows. <a href="#deflate">deflate</a> performs one or both of the
556   following actions:
557
558   <ul>
559   <li> Compress more input starting at <a href="#next_in">next_in</a> and update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a>
560     accordingly. If not all input can be processed (because there is not
561     enough room in the output buffer), <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> are updated and
562     processing will resume at this point for the next call of <a href="#deflate">deflate</a>().
563
564   <li> 
565     Provide more output starting at <a href="#next_out">next_out</a> and update <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a>
566     accordingly. This action is forced if the parameter flush is non zero.
567     Forcing flush frequently degrades the compression ratio, so this parameter
568     should be set only when necessary (in interactive applications).
569     Some output may be provided even if flush is not set.
570   </ul> <p>
571
572   Before the call of <a href="#deflate">deflate</a>(), the application should ensure that at least
573   one of the actions is possible, by providing more input and/or consuming
574   more output, and updating <a href="#avail_in">avail_in</a> or <a href="#avail_out">avail_out</a> accordingly ; <a href="#avail_out">avail_out</a>
575   should never be zero before the call. The application can consume the
576   compressed output when it wants, for example when the output buffer is full
577   (<a href="#avail_out">avail_out</a> == 0), or after each call of <a href="#deflate">deflate</a>(). If <a href="#deflate">deflate</a> returns <a href="#Z_OK">Z_OK</a>
578   and with zero <a href="#avail_out">avail_out</a>, it must be called again after making room in the
579   output buffer because there might be more output pending.
580   <p>
581
582     If the parameter flush is set to <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, all pending output is
583   flushed to the output buffer and the output is aligned on a byte boundary, so
584   that the decompressor can get all input data available so far. (In particular
585   <a href="#avail_in">avail_in</a> is zero after the call if enough output space has been provided
586   before the call.)  Flushing may degrade compression for some compression
587   algorithms and so it should be used only when necessary.
588   <p>
589
590     If flush is set to <a href="#Z_FULL_FLUSH">Z_FULL_FLUSH</a>, all output is flushed as with
591   <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, and the compression <a href="#state">state</a> is reset so that decompression can
592   restart from this point if previous compressed data has been damaged or if
593   random access is desired. Using <a href="#Z_FULL_FLUSH">Z_FULL_FLUSH</a> too often can seriously degrade
594   the compression.
595   <p>
596
597     If <a href="#deflate">deflate</a> returns with <a href="#avail_out">avail_out</a> == 0, this function must be called again
598   with the same value of the flush parameter and more output space (updated
599   <a href="#avail_out">avail_out</a>), until the flush is complete (<a href="#deflate">deflate</a> returns with non-zero
600   <a href="#avail_out">avail_out</a>).
601   <p>
602
603     If the parameter flush is set to <a href="#Z_FINISH">Z_FINISH</a>, pending input is processed,
604   pending output is flushed and <a href="#deflate">deflate</a> returns with <a href="#Z_STREAM_END">Z_STREAM_END</a> if there
605   was enough output space ; if <a href="#deflate">deflate</a> returns with <a href="#Z_OK">Z_OK</a>, this function must be
606   called again with <a href="#Z_FINISH">Z_FINISH</a> and more output space (updated <a href="#avail_out">avail_out</a>) but no
607   more input data, until it returns with <a href="#Z_STREAM_END">Z_STREAM_END</a> or an error. After
608   <a href="#deflate">deflate</a> has returned <a href="#Z_STREAM_END">Z_STREAM_END</a>, the only possible operations on the
609   stream are <a href="#deflateReset">deflateReset</a> or <a href="#deflateEnd">deflateEnd</a>.
610   <p>
611   
612     <a href="#Z_FINISH">Z_FINISH</a> can be used immediately after <a href="#deflateInit">deflateInit</a> if all the compression
613   is to be done in a single step. In this case, <a href="#avail_out">avail_out</a> must be at least
614   0.1% larger than <a href="#avail_in">avail_in</a> plus 12 bytes.  If <a href="#deflate">deflate</a> does not return
615   <a href="#Z_STREAM_END">Z_STREAM_END</a>, then it must be called again as described above.
616   <p>
617
618     <a href="#deflate">deflate</a>() sets strm-&gt <a href="#adler">adler</a> to the <a href="#adler32">adler32</a> checksum of all input read
619   so far (that is, <a href="#total_in">total_in</a> bytes).
620   <p>
621
622     <a href="#deflate">deflate</a>() may update <a href="#data_type">data_type</a> if it can make a good guess about
623   the input data type (<a href="#Z_ASCII">Z_ASCII</a> or <a href="#Z_BINARY">Z_BINARY</a>). In doubt, the data is considered
624   binary. This field is only for information purposes and does not affect
625   the compression algorithm in any manner.
626   <p>
627
628     <a href="#deflate">deflate</a>() returns <a href="#Z_OK">Z_OK</a> if some progress has been made (more input
629   processed or more output produced), <a href="#Z_STREAM_END">Z_STREAM_END</a> if all input has been
630   consumed and all output has been produced (only when flush is set to
631   <a href="#Z_FINISH">Z_FINISH</a>), <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream <a href="#state">state</a> was inconsistent (for example
632   if <a href="#next_in">next_in</a> or <a href="#next_out">next_out</a> was NULL), <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if no progress is possible
633   (for example <a href="#avail_in">avail_in</a> or <a href="#avail_out">avail_out</a> was zero).
634   <p>
635
636 <font color="Blue"><dt>  int  <a name="deflateEnd">deflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
637 <dd>
638      All dynamically allocated data structures for this stream are freed.
639    This function discards any unprocessed input and does not flush any
640    pending output.
641    <p>
642
643      <a href="#deflateEnd">deflateEnd</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the
644    stream <a href="#state">state</a> was inconsistent, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the stream was freed
645    prematurely (some input or output was discarded). In the error case,
646    <a href="#msg">msg</a> may be set but then points to a static string (which must not be
647    deallocated).
648    <p>
649
650 <font color="Blue"><dt>  int  <a name="inflateInit">inflateInit</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
651 <dd>     
652         Initializes the internal stream <a href="#state">state</a> for decompression. The fields
653    <a href="#next_in">next_in</a>, <a href="#avail_in">avail_in</a>, <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by
654    the caller. If <a href="#next_in">next_in</a> is not <a href="#Z_NULL">Z_NULL</a> and <a href="#avail_in">avail_in</a> is large enough (the exact
655    value depends on the compression method), <a href="#inflateInit">inflateInit</a> determines the
656    compression method from the zlib header and allocates all data structures
657    accordingly ; otherwise the allocation will be deferred to the first call of
658    <a href="#inflate">inflate</a>.  If <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> are set to <a href="#Z_NULL">Z_NULL</a>, <a href="#inflateInit">inflateInit</a> updates them to
659    use default allocation functions.
660    <p>
661
662      <a href="#inflateInit">inflateInit</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
663    memory, <a href="#Z_VERSION_ERROR">Z_VERSION_ERROR</a> if the zlib library version is incompatible with the
664    version assumed by the caller.  <a href="#msg">msg</a> is set to null if there is no error
665    message. <a href="#inflateInit">inflateInit</a> does not perform any decompression apart from reading
666    the zlib header if present: this will be done by <a href="#inflate">inflate</a>().  (So <a href="#next_in">next_in</a> and
667    <a href="#avail_in">avail_in</a> may be modified, but <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a> are unchanged.)
668    <p>
669
670 <font color="Blue"><dt>  int  <a name="inflate">inflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);</font>
671 <dd>
672     <a href="#inflate">inflate</a> decompresses as much data as possible, and stops when the input
673   buffer becomes empty or the output buffer becomes full. It may some
674   introduce some output latency (reading input without producing any output)
675   except when forced to flush.
676   <p>
677
678   The detailed semantics are as follows. <a href="#inflate">inflate</a> performs one or both of the
679   following actions:
680
681   <ul>
682   <li> Decompress more input starting at <a href="#next_in">next_in</a> and update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a>
683     accordingly. If not all input can be processed (because there is not
684     enough room in the output buffer), <a href="#next_in">next_in</a> is updated and processing
685     will resume at this point for the next call of <a href="#inflate">inflate</a>().
686
687   <li> Provide more output starting at <a href="#next_out">next_out</a> and update <a href="#next_out">next_out</a> and 
688     <a href="#avail_out">avail_out</a> accordingly.  <a href="#inflate">inflate</a>() provides as much output as possible, 
689     until there is no more input data or no more space in the output buffer 
690     (see below about the flush parameter).
691   </ul> <p>
692
693   Before the call of <a href="#inflate">inflate</a>(), the application should ensure that at least
694   one of the actions is possible, by providing more input and/or consuming
695   more output, and updating the next_* and avail_* values accordingly.
696   The application can consume the uncompressed output when it wants, for
697   example when the output buffer is full (<a href="#avail_out">avail_out</a> == 0), or after each
698   call of <a href="#inflate">inflate</a>(). If <a href="#inflate">inflate</a> returns <a href="#Z_OK">Z_OK</a> and with zero <a href="#avail_out">avail_out</a>, it
699   must be called again after making room in the output buffer because there
700   might be more output pending.
701   <p>
702
703     If the parameter flush is set to <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, <a href="#inflate">inflate</a> flushes as much
704   output as possible to the output buffer. The flushing behavior of <a href="#inflate">inflate</a> is
705   not specified for values of the flush parameter other than <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>
706   and <a href="#Z_FINISH">Z_FINISH</a>, but the current implementation actually flushes as much output
707   as possible anyway.
708   <p>
709
710     <a href="#inflate">inflate</a>() should normally be called until it returns <a href="#Z_STREAM_END">Z_STREAM_END</a> or an
711   error. However if all decompression is to be performed in a single step
712   (a single call of <a href="#inflate">inflate</a>), the parameter flush should be set to
713   <a href="#Z_FINISH">Z_FINISH</a>. In this case all pending input is processed and all pending
714   output is flushed ; <a href="#avail_out">avail_out</a> must be large enough to hold all the
715   uncompressed data. (The size of the uncompressed data may have been saved
716   by the compressor for this purpose.) The next operation on this stream must
717   be <a href="#inflateEnd">inflateEnd</a> to deallocate the decompression <a href="#state">state</a>. The use of <a href="#Z_FINISH">Z_FINISH</a>
718   is never required, but can be used to inform <a href="#inflate">inflate</a> that a faster routine
719   may be used for the single <a href="#inflate">inflate</a>() call.
720   <p>
721
722      If a preset dictionary is needed at this point (see <a href="#inflateSetDictionary">inflateSetDictionary</a>
723   below), <a href="#inflate">inflate</a> sets strm-<a href="#adler">adler</a> to the <a href="#adler32">adler32</a> checksum of the
724   dictionary chosen by the compressor and returns <a href="#Z_NEED_DICT">Z_NEED_DICT</a> ; otherwise 
725   it sets strm-&gt <a href="#adler">adler</a> to the <a href="#adler32">adler32</a> checksum of all output produced
726   so far (that is, <a href="#total_out">total_out</a> bytes) and returns <a href="#Z_OK">Z_OK</a>, <a href="#Z_STREAM_END">Z_STREAM_END</a> or
727   an error code as described below. At the end of the stream, <a href="#inflate">inflate</a>()
728   checks that its computed <a href="#adler32">adler32</a> checksum is equal to that saved by the
729   compressor and returns <a href="#Z_STREAM_END">Z_STREAM_END</a> only if the checksum is correct.
730   <p>
731
732     <a href="#inflate">inflate</a>() returns <a href="#Z_OK">Z_OK</a> if some progress has been made (more input processed
733   or more output produced), <a href="#Z_STREAM_END">Z_STREAM_END</a> if the end of the compressed data has
734   been reached and all uncompressed output has been produced, <a href="#Z_NEED_DICT">Z_NEED_DICT</a> if a
735   preset dictionary is needed at this point, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the input data was
736   corrupted (input stream not conforming to the zlib format or incorrect
737   <a href="#adler32">adler32</a> checksum), <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream structure was inconsistent
738   (for example if <a href="#next_in">next_in</a> or <a href="#next_out">next_out</a> was NULL), <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
739   enough memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if no progress is possible or if there was not
740   enough room in the output buffer when <a href="#Z_FINISH">Z_FINISH</a> is used. In the <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a>
741   case, the application may then call <a href="#inflateSync">inflateSync</a> to look for a good
742   compression block.
743   <p>
744
745 <font color="Blue"><dt>  int  <a name="inflateEnd">inflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
746 <dd>
747      All dynamically allocated data structures for this stream are freed.
748    This function discards any unprocessed input and does not flush any
749    pending output.
750    <p>
751
752      <a href="#inflateEnd">inflateEnd</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream <a href="#state">state</a>
753    was inconsistent. In the error case, <a href="#msg">msg</a> may be set but then points to a
754    static string (which must not be deallocated).
755 </dl>
756 <hr>
757 <a name="Advanced functions"><h2> Advanced functions </h2>
758     The following functions are needed only in some special applications.
759 <h3> Function list </h3>
760 <ul>
761 <li>  int  <a href="#deflateInit2">deflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm,
762 <li> int  <a href="#deflateSetDictionary">deflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt  dictLength);
763 <li> int  <a href="#deflateCopy">deflateCopy</a> (<a href="#z_streamp">z_streamp</a> dest, <a href="#z_streamp">z_streamp</a> source);
764 <li> int  <a href="#deflateReset">deflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);
765 <li> int  <a href="#deflateParams">deflateParams</a> (<a href="#z_streamp">z_streamp</a> strm, int level, int strategy);
766 <li> int  <a href="#inflateInit2">inflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm, int  windowBits);
767 <li>  int  <a href="#inflateSetDictionary">inflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt  dictLength);
768 <li> int  <a href="#inflateSync">inflateSync</a> (<a href="#z_streamp">z_streamp</a> strm);
769 <li> int  <a href="#inflateReset">inflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);
770
771 </ul>
772 <h3> Function description </h3>
773 <dl>
774 <font color="Blue"><dt>  int  <a name="deflateInit2">deflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm, int  level, int  method, int  windowBits, int  memLevel, int  strategy);</font>
775
776 <dd> This is another version of <a href="#deflateInit">deflateInit</a> with more compression options. The
777    fields <a href="#next_in">next_in</a>, <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by
778    the caller.<p>
779
780      The method parameter is the compression method. It must be <a href="#Z_DEFLATED">Z_DEFLATED</a> in
781    this version of the library.<p>
782
783      The windowBits parameter is the base two logarithm of the window size
784    (the size of the history buffer).  It should be in the range 8..15 for this
785    version of the library. Larger values of this parameter result in better
786    compression at the expense of memory usage. The default value is 15 if
787    <a href="#deflateInit">deflateInit</a> is used instead.<p>
788
789      The memLevel parameter specifies how much memory should be allocated
790    for the internal compression <a href="#state">state</a>. memLevel=1 uses minimum memory but
791    is slow and reduces compression ratio ; memLevel=9 uses maximum memory
792    for optimal speed. The default value is 8. See zconf.h for total memory
793    usage as a function of windowBits and memLevel.<p>
794
795      The strategy parameter is used to tune the compression algorithm. Use the
796    value <a href="#Z_DEFAULT_STRATEGY">Z_DEFAULT_STRATEGY</a> for normal data, <a href="#Z_FILTERED">Z_FILTERED</a> for data produced by a
797    filter (or predictor), or <a href="#Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a> to force Huffman encoding only (no
798    string match).  Filtered data consists mostly of small values with a
799    somewhat random distribution. In this case, the compression algorithm is
800    tuned to <a href="#compress">compress</a> them better. The effect of <a href="#Z_FILTERED">Z_FILTERED</a> is to force more
801    Huffman coding and less string matching ; it is somewhat intermediate
802    between Z_DEFAULT and <a href="#Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a>. The strategy parameter only affects
803    the compression ratio but not the correctness of the compressed output even
804    if it is not set appropriately.<p>
805
806       <a href="#deflateInit2">deflateInit2</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
807    memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a parameter is invalid (such as an invalid
808    method). <a href="#msg">msg</a> is set to null if there is no error message.  <a href="#deflateInit2">deflateInit2</a> does
809    not perform any compression: this will be done by <a href="#deflate">deflate</a>().<p>
810                             
811 <font color="Blue"><dt> int  <a name="deflateSetDictionary">deflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt  dictLength);</font>
812 <dd>
813      Initializes the compression dictionary from the given byte sequence
814    without producing any compressed output. This function must be called
815    immediately after <a href="#deflateInit">deflateInit</a>, <a href="#deflateInit2">deflateInit2</a> or <a href="#deflateReset">deflateReset</a>, before any
816    call of <a href="#deflate">deflate</a>. The compressor and decompressor must use exactly the same
817    dictionary (see <a href="#inflateSetDictionary">inflateSetDictionary</a>).<p>
818
819      The dictionary should consist of strings (byte sequences) that are likely
820    to be encountered later in the data to be compressed, with the most commonly
821    used strings preferably put towards the end of the dictionary. Using a
822    dictionary is most useful when the data to be compressed is short and can be
823    predicted with good accuracy ; the data can then be compressed better than
824    with the default empty dictionary.<p>
825
826      Depending on the size of the compression data structures selected by
827    <a href="#deflateInit">deflateInit</a> or <a href="#deflateInit2">deflateInit2</a>, a part of the dictionary may in effect be
828    discarded, for example if the dictionary is larger than the window size in
829    <a href="#deflate">deflate</a> or deflate2. Thus the strings most likely to be useful should be
830    put at the end of the dictionary, not at the front.<p>
831
832      Upon return of this function, strm-&gt <a href="#adler">adler</a> is set to the Adler32 value
833    of the dictionary ; the decompressor may later use this value to determine
834    which dictionary has been used by the compressor. (The Adler32 value
835    applies to the whole dictionary even if only a subset of the dictionary is
836    actually used by the compressor.)<p>
837
838      <a href="#deflateSetDictionary">deflateSetDictionary</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a
839    parameter is invalid (such as NULL dictionary) or the stream <a href="#state">state</a> is
840    inconsistent (for example if <a href="#deflate">deflate</a> has already been called for this stream
841    or if the compression method is bsort). <a href="#deflateSetDictionary">deflateSetDictionary</a> does not
842    perform any compression: this will be done by <a href="#deflate">deflate</a>().<p>
843
844 <font color="Blue"><dt> int  <a name="deflateCopy">deflateCopy</a> (<a href="#z_streamp">z_streamp</a> dest, <a href="#z_streamp">z_streamp</a> source);</font>
845 <dd>
846      Sets the destination stream as a complete copy of the source stream.<p>
847
848      This function can be useful when several compression strategies will be
849    tried, for example when there are several ways of pre-processing the input
850    data with a filter. The streams that will be discarded should then be freed
851    by calling <a href="#deflateEnd">deflateEnd</a>.  Note that <a href="#deflateCopy">deflateCopy</a> duplicates the internal
852    compression <a href="#state">state</a> which can be quite large, so this strategy is slow and
853    can consume lots of memory.<p>
854
855      <a href="#deflateCopy">deflateCopy</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
856    enough memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source stream <a href="#state">state</a> was inconsistent
857    (such as <a href="#zalloc">zalloc</a> being NULL). <a href="#msg">msg</a> is left unchanged in both source and
858    destination.<p>
859
860 <font color="Blue"><dt> int  <a name="deflateReset">deflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
861 <dd>     This function is equivalent to <a href="#deflateEnd">deflateEnd</a> followed by <a href="#deflateInit">deflateInit</a>,
862    but does not free and reallocate all the internal compression <a href="#state">state</a>.
863    The stream will keep the same compression level and any other attributes
864    that may have been set by <a href="#deflateInit2">deflateInit2</a>.<p>
865
866       <a href="#deflateReset">deflateReset</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
867    stream <a href="#state">state</a> was inconsistent (such as <a href="#zalloc">zalloc</a> or <a href="#state">state</a> being NULL).<p>
868
869 <font color="Blue"><dt> int  <a name="deflateParams">deflateParams</a> (<a href="#z_streamp">z_streamp</a> strm, int level, int strategy);</font>
870 <dd>
871      Dynamically update the compression level and compression strategy.  The
872    interpretation of level and strategy is as in <a href="#deflateInit2">deflateInit2</a>.  This can be
873    used to switch between compression and straight copy of the input data, or
874    to switch to a different kind of input data requiring a different
875    strategy. If the compression level is changed, the input available so far
876    is compressed with the old level (and may be flushed); the new level will
877    take effect only at the next call of <a href="#deflate">deflate</a>().<p>
878
879      Before the call of <a href="#deflateParams">deflateParams</a>, the stream <a href="#state">state</a> must be set as for
880    a call of <a href="#deflate">deflate</a>(), since the currently available input may have to
881    be compressed and flushed. In particular, strm-&gt <a href="#avail_out">avail_out</a> must be 
882    non-zero.<p>
883
884      <a href="#deflateParams">deflateParams</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
885    stream <a href="#state">state</a> was inconsistent or if a parameter was invalid, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a>
886    if strm-&gtavail_out was zero.<p>
887
888 <font color="Blue"><dt> int  <a name="inflateInit2">inflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm, int  windowBits);</font>
889
890 <dd>     This is another version of <a href="#inflateInit">inflateInit</a> with an extra parameter. The
891    fields <a href="#next_in">next_in</a>, <a href="#avail_in">avail_in</a>, <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized
892    before by the caller.<p>
893
894      The windowBits parameter is the base two logarithm of the maximum window
895    size (the size of the history buffer).  It should be in the range 8..15 for
896    this version of the library. The default value is 15 if <a href="#inflateInit">inflateInit</a> is used
897    instead. If a compressed stream with a larger window size is given as
898    input, <a href="#inflate">inflate</a>() will return with the error code <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> instead of
899    trying to allocate a larger window.<p>
900
901       <a href="#inflateInit2">inflateInit2</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
902    memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a parameter is invalid (such as a negative
903    memLevel). <a href="#msg">msg</a> is set to null if there is no error message.  <a href="#inflateInit2">inflateInit2</a>
904    does not perform any decompression apart from reading the zlib header if
905    present: this will be done by <a href="#inflate">inflate</a>(). (So <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> may be
906    modified, but <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a> are unchanged.)<p>
907
908 <font color="Blue"><dt>  int  <a name="inflateSetDictionary">inflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt  dictLength);</font>
909 <dd>
910      Initializes the decompression dictionary from the given uncompressed byte
911    sequence. This function must be called immediately after a call of <a href="#inflate">inflate</a>
912    if this call returned <a href="#Z_NEED_DICT">Z_NEED_DICT</a>. The dictionary chosen by the compressor
913    can be determined from the Adler32 value returned by this call of
914    <a href="#inflate">inflate</a>. The compressor and decompressor must use exactly the same
915    dictionary (see <a href="#deflateSetDictionary">deflateSetDictionary</a>).<p>
916
917      <a href="#inflateSetDictionary">inflateSetDictionary</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a
918    parameter is invalid (such as NULL dictionary) or the stream <a href="#state">state</a> is
919    inconsistent, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the given dictionary doesn't match the
920    expected one (incorrect Adler32 value). <a href="#inflateSetDictionary">inflateSetDictionary</a> does not
921    perform any decompression: this will be done by subsequent calls of
922    <a href="#inflate">inflate</a>().<p>
923
924 <font color="Blue"><dt> int  <a name="inflateSync">inflateSync</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
925
926 <dd>    Skips invalid compressed data until a full flush point (see above the
927   description of <a href="#deflate">deflate</a> with <a href="#Z_FULL_FLUSH">Z_FULL_FLUSH</a>) can be found, or until all
928   available input is skipped. No output is provided.<p>
929
930     <a href="#inflateSync">inflateSync</a> returns <a href="#Z_OK">Z_OK</a> if a full flush point has been found, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a>
931   if no more input was provided, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if no flush point has been found,
932   or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream structure was inconsistent. In the success
933   case, the application may save the current current value of <a href="#total_in">total_in</a> which
934   indicates where valid compressed data was found. In the error case, the
935   application may repeatedly call <a href="#inflateSync">inflateSync</a>, providing more input each time,
936   until success or end of the input data.<p>
937
938 <font color="Blue"><dt> int  <a name="inflateReset">inflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
939 <dd>
940      This function is equivalent to <a href="#inflateEnd">inflateEnd</a> followed by <a href="#inflateInit">inflateInit</a>,
941    but does not free and reallocate all the internal decompression <a href="#state">state</a>.
942    The stream will keep attributes that may have been set by <a href="#inflateInit2">inflateInit2</a>.
943    <p>
944
945       <a href="#inflateReset">inflateReset</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
946    stream <a href="#state">state</a> was inconsistent (such as <a href="#zalloc">zalloc</a> or <a href="#state">state</a> being NULL).
947    <p>
948 </dl>
949
950 <hr>
951 <a name="Checksum functions"><h2> Checksum functions </h2>
952      These functions are not related to compression but are exported
953    anyway because they might be useful in applications using the
954    compression library.
955 <h3> Function list </h3>
956 <ul>
957 <li> uLong  <a href="#adler32">adler32</a> (uLong <a href="#adler">adler</a>, const Bytef *buf, uInt len);
958 <li> uLong  <a href="#crc32">crc32</a>   (uLong crc, const Bytef *buf, uInt len);
959 </ul>
960 <h3> Function description </h3>
961 <dl>
962 <font color="Blue"><dt> uLong  <a name="adler32">adler32</a> (uLong <a href="#adler">adler</a>, const Bytef *buf, uInt len);</font>
963 <dd>
964      Update a running Adler-32 checksum with the bytes buf[0..len-1] and
965    return the updated checksum. If buf is NULL, this function returns
966    the required initial value for the checksum.
967    <p>
968    An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
969    much faster. Usage example:
970    <pre>
971
972      uLong <a href="#adler">adler</a> = <a href="#adler32">adler32</a>(0L, <a href="#Z_NULL">Z_NULL</a>, 0);
973
974      while (read_buffer(buffer, length) != EOF) {
975        <a href="#adler">adler</a> = <a href="#adler32">adler32</a>(<a href="#adler">adler</a>, buffer, length);
976      }
977      if (<a href="#adler">adler</a> != original_adler) error();
978    </pre>
979
980 <font color="Blue"><dt> uLong  <a name="crc32">crc32</a>   (uLong crc, const Bytef *buf, uInt len);</font>
981 <dd>
982      Update a running crc with the bytes buf[0..len-1] and return the updated
983    crc. If buf is NULL, this function returns the required initial value
984    for the crc. Pre- and post-conditioning (one's complement) is performed
985    within this function so it shouldn't be done by the application.
986    Usage example:
987    <pre>
988
989      uLong crc = <a href="#crc32">crc32</a>(0L, <a href="#Z_NULL">Z_NULL</a>, 0);
990
991      while (read_buffer(buffer, length) != EOF) {
992        crc = <a href="#crc32">crc32</a>(crc, buffer, length);
993      }
994      if (crc != original_crc) error();
995    </pre>
996 </dl>
997 <hr>
998 <a name="struct z_stream_s"><h2> struct z_stream_s </h2>
999 <font color="Blue">
1000 <a name="z_stream_s">
1001 <pre>
1002 typedef struct z_stream_s {
1003     Bytef    *<a name="next_in">next_in</a>;  /* next input byte */
1004     uInt     <a name="avail_in">avail_in</a>;  /* number of bytes available at <a href="#next_in">next_in</a> */
1005     uLong    <a name="total_in">total_in</a>;  /* total nb of input bytes read so far */
1006
1007     Bytef    *<a name="next_out">next_out</a>; /* next output byte should be put there */
1008     uInt     <a name="avail_out">avail_out</a>; /* remaining free space at <a href="#next_out">next_out</a> */
1009     uLong    <a name="total_out">total_out</a>; /* total nb of bytes output so far */
1010
1011     char     *<a name="msg">msg</a>;      /* last error message, NULL if no error */
1012     struct internal_state FAR *<a name="state">state</a>; /* not visible by applications */
1013
1014     alloc_func <a name="zalloc">zalloc</a>;  /* used to allocate the internal <a href="#state">state</a> */
1015     free_func  <a name="zfree">zfree</a>;   /* used to free the internal <a href="#state">state</a> */
1016     voidpf     <a name="opaque">opaque</a>;  /* private data object passed to <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> */
1017
1018     int     <a name="data_type">data_type</a>;  /* best guess about the data type: ascii or binary */
1019     uLong   <a name="adler">adler</a>;      /* <a href="#adler32">adler32</a> value of the uncompressed data */
1020     uLong   <a name="reserved">reserved</a>;   /* <a href="#reserved">reserved</a> for future use */
1021 } <a href="#z_stream_s">z_stream</a> ;
1022
1023 typedef <a href="#z_stream_s">z_stream</a> FAR * <a name="z_streamp">z_streamp</a>;  ΓΏ 
1024 </pre>
1025 </font>
1026    The application must update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> when <a href="#avail_in">avail_in</a> has
1027    dropped to zero. It must update <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a> when <a href="#avail_out">avail_out</a>
1028    has dropped to zero. The application must initialize <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and
1029    <a href="#opaque">opaque</a> before calling the init function. All other fields are set by the
1030    compression library and must not be updated by the application. <p>
1031
1032    The <a href="#opaque">opaque</a> value provided by the application will be passed as the first
1033    parameter for calls of <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a>. This can be useful for custom
1034    memory management. The compression library attaches no meaning to the
1035    <a href="#opaque">opaque</a> value. <p>
1036
1037    <a href="#zalloc">zalloc</a> must return <a href="#Z_NULL">Z_NULL</a> if there is not enough memory for the object.
1038    If zlib is used in a multi-threaded application, <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> must be
1039    thread safe. <p>
1040
1041    On 16-bit systems, the functions <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> must be able to allocate
1042    exactly 65536 bytes, but will not be required to allocate more than this
1043    if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
1044    pointers returned by <a href="#zalloc">zalloc</a> for objects of exactly 65536 bytes *must*
1045    have their offset normalized to zero. The default allocation function
1046    provided by this library ensures this (see zutil.c). To reduce memory
1047    requirements and avoid any allocation of 64K objects, at the expense of
1048    compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
1049    <p>
1050
1051    The fields <a href="#total_in">total_in</a> and <a href="#total_out">total_out</a> can be used for statistics or
1052    progress reports. After compression, <a href="#total_in">total_in</a> holds the total size of
1053    the uncompressed data and may be saved for use in the decompressor
1054    (particularly if the decompressor wants to decompress everything in
1055    a single step). <p>
1056
1057 <hr>
1058 <a name="Constants"><h2> Constants </h2>
1059 <font color="Blue">
1060 <pre>
1061 #define <a name="Z_NO_FLUSH">Z_NO_FLUSH</a>      0
1062 #define <a name="Z_PARTIAL_FLUSH">Z_PARTIAL_FLUSH</a> 1 
1063         /* will be removed, use <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a> instead */
1064 #define <a name="Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>    2
1065 #define <a name="Z_FULL_FLUSH">Z_FULL_FLUSH</a>    3
1066 #define <a name="Z_FINISH">Z_FINISH</a>        4
1067 /* Allowed flush values ; see <a href="#deflate">deflate</a>() below for details */
1068
1069 #define <a name="Z_OK">Z_OK</a>            0
1070 #define <a name="Z_STREAM_END">Z_STREAM_END</a>    1
1071 #define <a name="Z_NEED_DICT">Z_NEED_DICT</a>     2
1072 #define <a name="Z_ERRNO">Z_ERRNO</a>        (-1)
1073 #define <a name="Z_STREAM_ERROR">Z_STREAM_ERROR</a> (-2)
1074 #define <a name="Z_DATA_ERROR">Z_DATA_ERROR</a>   (-3)
1075 #define <a name="Z_MEM_ERROR">Z_MEM_ERROR</a>    (-4)
1076 #define <a name="Z_BUF_ERROR">Z_BUF_ERROR</a>    (-5)
1077 #define <a name="Z_VERSION_ERROR">Z_VERSION_ERROR</a> (-6)
1078 /* Return codes for the compression/decompression functions. Negative
1079  * values are errors, positive values are used for special but normal events.
1080  */
1081
1082 #define <a name="Z_NO_COMPRESSION">Z_NO_COMPRESSION</a>         0
1083 #define <a name="Z_BEST_SPEED">Z_BEST_SPEED</a>             1
1084 #define <a name="Z_BEST_COMPRESSION">Z_BEST_COMPRESSION</a>       9
1085 #define <a name="Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a>  (-1)
1086 /* compression levels */
1087
1088 #define <a name="Z_FILTERED">Z_FILTERED</a>            1
1089 #define <a name="Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a>        2
1090 #define <a name="Z_DEFAULT_STRATEGY">Z_DEFAULT_STRATEGY</a>    0
1091 /* compression strategy ; see <a href="#deflateInit2">deflateInit2</a>() below for details */
1092
1093 #define <a name="Z_BINARY">Z_BINARY</a>   0
1094 #define <a name="Z_ASCII">Z_ASCII</a>    1
1095 #define <a name="Z_UNKNOWN">Z_UNKNOWN</a>  2
1096 /* Possible values of the <a href="#data_type">data_type</a> field */
1097
1098 #define <a name="Z_DEFLATED">Z_DEFLATED</a>   8
1099 /* The <a href="#deflate">deflate</a> compression method (the only one supported in this version) */
1100
1101 #define <a name="Z_NULL">Z_NULL</a>  0  /* for initializing <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a>, <a href="#opaque">opaque</a> */
1102
1103 #define <a name="zlib_version">zlib_version</a> <a href="#zlibVersion">zlibVersion</a>()
1104 /* for compatibility with versions less than 1.0.2 */
1105 </pre>
1106 </font>
1107
1108 <hr>
1109 <a name="Misc"><h2> Misc </h2>
1110  <a href="#deflateInit">deflateInit</a> and <a href="#inflateInit">inflateInit</a> are macros to allow checking the zlib version
1111  and the compiler's view of <a href="#z_stream_s">z_stream</a>.
1112  <p>
1113  Other functions:
1114  <dl>
1115  <font color="Blue"><dt> const char   *  <a name="zError">zError</a>           (int err);</font>
1116  <font color="Blue"><dt> int             <a name="inflateSyncPoint">inflateSyncPoint</a> (<a href="#z_streamp">z_streamp</a> z);</font>
1117  <font color="Blue"><dt> const uLongf *  <a name="get_crc_table">get_crc_table</a>    (void);</font>
1118  </dl>
1119  <hr>
1120  <font size="-1">
1121  Last update: Wed Oct 13 20:42:34 1999<br>
1122  piapi@csie.ntu.edu.tw
1123  </font>
1124
1125 </body>
1126 </html>
1127 <br /><br /><br /><br />
1128     </td></tr>
1129    </table>
1130   </td>
1131
1132   <td bgcolor="#cccccc" background="dot.gif">
1133    <img src="space.gif" width="1" height="1" border="0" alt=""></td>
1134
1135   <td width="180" bgcolor="#f0f0f0">
1136     <img src="space.gif" width="1" height="1" border="0" alt="">
1137     <table width="100%" cellpadding="4" cellspacing="0">
1138     <tr valign="top"><td>
1139 <br />
1140 <font face="Helvetica,Arial,Sans-serif" size="1">
1141 </font>
1142
1143 <br /><br /><br /><br />
1144     </td></tr>
1145     </table>
1146   </td>
1147 </tr>
1148 </table>
1149
1150 <table border="0" cellspacing="0" cellpadding="0" width="100%">
1151 <tr bgcolor="#444444"><td><img src="space.gif" width="1" height="1"border="0" alt="" ></td></tr>
1152 </table>
1153 <table border="0" cellspacing="0" cellpadding="6" width="100%">
1154  <tr valign="top" bgcolor="#dddddd">
1155   <td><small>Copyright &copy; 2001 - 2007 SILC Project<br />
1156     <a href="http://silcnet.org">SILC Project Website</a></small></td>
1157   <td align="right"><small>
1158    <a href="index.html">SILC Toolkit Reference Manual</a><br />
1159    <a href="toolkit_index.html">Index</a></small></td>
1160    </small></td>
1161  </tr>
1162 </table>
1163
1164 </body>
1165 </html>