| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| <title>activemq-cpp-3.3.0: src/main/decaf/internal/util/zip/zlib.h Source File</title> |
| <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript" src="jquery.js"></script> |
| <script type="text/javascript" src="navtree.js"></script> |
| <script type="text/javascript" src="resize.js"></script> |
| <script type="text/javascript"> |
| $(document).ready(initResizable); |
| </script> |
| <link href="doxygen.css" rel="stylesheet" type="text/css"/> |
| </head> |
| <body> |
| <!-- Generated by Doxygen 1.7.3 --> |
| <div id="top"> |
| <div id="titlearea"> |
| <table cellspacing="0" cellpadding="0"> |
| <tbody> |
| <tr style="height: 56px;"> |
| <td style="padding-left: 0.5em;"> |
| <div id="projectname">activemq-cpp-3.3.0</div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div id="navrow1" class="tabs"> |
| <ul class="tablist"> |
| <li><a href="index.html"><span>Main Page</span></a></li> |
| <li><a href="namespaces.html"><span>Namespaces</span></a></li> |
| <li><a href="annotated.html"><span>Data Structures</span></a></li> |
| <li class="current"><a href="files.html"><span>Files</span></a></li> |
| </ul> |
| </div> |
| <div id="navrow2" class="tabs2"> |
| <ul class="tablist"> |
| <li><a href="files.html"><span>File List</span></a></li> |
| <li><a href="globals.html"><span>Globals</span></a></li> |
| </ul> |
| </div> |
| </div> |
| <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| <div id="nav-tree"> |
| <div id="nav-tree-contents"> |
| </div> |
| </div> |
| <div id="splitbar" style="-moz-user-select:none;" |
| class="ui-resizable-handle"> |
| </div> |
| </div> |
| <script type="text/javascript"> |
| initNavTree('zlib_8h.html',''); |
| </script> |
| <div id="doc-content"> |
| <div class="header"> |
| <div class="headertitle"> |
| <h1>src/main/decaf/internal/util/zip/zlib.h</h1> </div> |
| </div> |
| <div class="contents"> |
| <a href="zlib_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* zlib.h -- interface of the 'zlib' general purpose compression library</span> |
| <a name="l00002"></a>00002 <span class="comment"> version 1.2.5, April 19th, 2010</span> |
| <a name="l00003"></a>00003 <span class="comment"></span> |
| <a name="l00004"></a>00004 <span class="comment"> Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler</span> |
| <a name="l00005"></a>00005 <span class="comment"></span> |
| <a name="l00006"></a>00006 <span class="comment"> This software is provided 'as-is', without any express or implied</span> |
| <a name="l00007"></a>00007 <span class="comment"> warranty. In no event will the authors be held liable for any damages</span> |
| <a name="l00008"></a>00008 <span class="comment"> arising from the use of this software.</span> |
| <a name="l00009"></a>00009 <span class="comment"></span> |
| <a name="l00010"></a>00010 <span class="comment"> Permission is granted to anyone to use this software for any purpose,</span> |
| <a name="l00011"></a>00011 <span class="comment"> including commercial applications, and to alter it and redistribute it</span> |
| <a name="l00012"></a>00012 <span class="comment"> freely, subject to the following restrictions:</span> |
| <a name="l00013"></a>00013 <span class="comment"></span> |
| <a name="l00014"></a>00014 <span class="comment"> 1. The origin of this software must not be misrepresented; you must not</span> |
| <a name="l00015"></a>00015 <span class="comment"> claim that you wrote the original software. If you use this software</span> |
| <a name="l00016"></a>00016 <span class="comment"> in a product, an acknowledgment in the product documentation would be</span> |
| <a name="l00017"></a>00017 <span class="comment"> appreciated but is not required.</span> |
| <a name="l00018"></a>00018 <span class="comment"> 2. Altered source versions must be plainly marked as such, and must not be</span> |
| <a name="l00019"></a>00019 <span class="comment"> misrepresented as being the original software.</span> |
| <a name="l00020"></a>00020 <span class="comment"> 3. This notice may not be removed or altered from any source distribution.</span> |
| <a name="l00021"></a>00021 <span class="comment"></span> |
| <a name="l00022"></a>00022 <span class="comment"> Jean-loup Gailly Mark Adler</span> |
| <a name="l00023"></a>00023 <span class="comment"> jloup@gzip.org madler@alumni.caltech.edu</span> |
| <a name="l00024"></a>00024 <span class="comment"></span> |
| <a name="l00025"></a>00025 <span class="comment"></span> |
| <a name="l00026"></a>00026 <span class="comment"> The data format used by the zlib library is described by RFCs (Request for</span> |
| <a name="l00027"></a>00027 <span class="comment"> Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt</span> |
| <a name="l00028"></a>00028 <span class="comment"> (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).</span> |
| <a name="l00029"></a>00029 <span class="comment">*/</span> |
| <a name="l00030"></a>00030 |
| <a name="l00031"></a>00031 <span class="preprocessor">#ifndef ZLIB_H</span> |
| <a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define ZLIB_H</span> |
| <a name="l00033"></a>00033 <span class="preprocessor"></span> |
| <a name="l00034"></a>00034 <span class="preprocessor">#include "<a class="code" href="zconf_8h.html">zconf.h</a>"</span> |
| <a name="l00035"></a>00035 |
| <a name="l00036"></a>00036 <span class="preprocessor">#ifdef __cplusplus</span> |
| <a name="l00037"></a>00037 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> { |
| <a name="l00038"></a>00038 <span class="preprocessor">#endif</span> |
| <a name="l00039"></a>00039 <span class="preprocessor"></span> |
| <a name="l00040"></a><a class="code" href="zlib_8h.html#a51dc9dc65e483b3222c1f0f6a87eb76e">00040</a> <span class="preprocessor">#define ZLIB_VERSION "1.2.5"</span> |
| <a name="l00041"></a><a class="code" href="zlib_8h.html#a6413cdfb4cdc0b5a09cf9b5f3f8f48ef">00041</a> <span class="preprocessor"></span><span class="preprocessor">#define ZLIB_VERNUM 0x1250</span> |
| <a name="l00042"></a><a class="code" href="zlib_8h.html#a52eec052f38e306d472e75bfafda9608">00042</a> <span class="preprocessor"></span><span class="preprocessor">#define ZLIB_VER_MAJOR 1</span> |
| <a name="l00043"></a><a class="code" href="zlib_8h.html#a82109105b5511ffa8f8373b6a917e1e4">00043</a> <span class="preprocessor"></span><span class="preprocessor">#define ZLIB_VER_MINOR 2</span> |
| <a name="l00044"></a><a class="code" href="zlib_8h.html#ad3662b8749a50045ec1c120354fb7e9d">00044</a> <span class="preprocessor"></span><span class="preprocessor">#define ZLIB_VER_REVISION 5</span> |
| <a name="l00045"></a><a class="code" href="zlib_8h.html#a788ea49a5b65e12b11d7f274542d5af5">00045</a> <span class="preprocessor"></span><span class="preprocessor">#define ZLIB_VER_SUBREVISION 0</span> |
| <a name="l00046"></a>00046 <span class="preprocessor"></span> |
| <a name="l00047"></a>00047 <span class="comment">/*</span> |
| <a name="l00048"></a>00048 <span class="comment"> The 'zlib' compression library provides in-memory compression and</span> |
| <a name="l00049"></a>00049 <span class="comment"> decompression functions, including integrity checks of the uncompressed data.</span> |
| <a name="l00050"></a>00050 <span class="comment"> This version of the library supports only one compression method (deflation)</span> |
| <a name="l00051"></a>00051 <span class="comment"> but other algorithms will be added later and will have the same stream</span> |
| <a name="l00052"></a>00052 <span class="comment"> interface.</span> |
| <a name="l00053"></a>00053 <span class="comment"></span> |
| <a name="l00054"></a>00054 <span class="comment"> Compression can be done in a single step if the buffers are large enough,</span> |
| <a name="l00055"></a>00055 <span class="comment"> or can be done by repeated calls of the compression function. In the latter</span> |
| <a name="l00056"></a>00056 <span class="comment"> case, the application must provide more input and/or consume the output</span> |
| <a name="l00057"></a>00057 <span class="comment"> (providing more output space) before each call.</span> |
| <a name="l00058"></a>00058 <span class="comment"></span> |
| <a name="l00059"></a>00059 <span class="comment"> The compressed data format used by default by the in-memory functions is</span> |
| <a name="l00060"></a>00060 <span class="comment"> the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped</span> |
| <a name="l00061"></a>00061 <span class="comment"> around a deflate stream, which is itself documented in RFC 1951.</span> |
| <a name="l00062"></a>00062 <span class="comment"></span> |
| <a name="l00063"></a>00063 <span class="comment"> The library also supports reading and writing files in gzip (.gz) format</span> |
| <a name="l00064"></a>00064 <span class="comment"> with an interface similar to that of stdio using the functions that start</span> |
| <a name="l00065"></a>00065 <span class="comment"> with "gz". The gzip format is different from the zlib format. gzip is a</span> |
| <a name="l00066"></a>00066 <span class="comment"> gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.</span> |
| <a name="l00067"></a>00067 <span class="comment"></span> |
| <a name="l00068"></a>00068 <span class="comment"> This library can optionally read and write gzip streams in memory as well.</span> |
| <a name="l00069"></a>00069 <span class="comment"></span> |
| <a name="l00070"></a>00070 <span class="comment"> The zlib format was designed to be compact and fast for use in memory</span> |
| <a name="l00071"></a>00071 <span class="comment"> and on communications channels. The gzip format was designed for single-</span> |
| <a name="l00072"></a>00072 <span class="comment"> file compression on file systems, has a larger header than zlib to maintain</span> |
| <a name="l00073"></a>00073 <span class="comment"> directory information, and uses a different, slower check method than zlib.</span> |
| <a name="l00074"></a>00074 <span class="comment"></span> |
| <a name="l00075"></a>00075 <span class="comment"> The library does not install any signal handler. The decoder checks</span> |
| <a name="l00076"></a>00076 <span class="comment"> the consistency of the compressed data, so the library should never crash</span> |
| <a name="l00077"></a>00077 <span class="comment"> even in case of corrupted input.</span> |
| <a name="l00078"></a>00078 <span class="comment">*/</span> |
| <a name="l00079"></a>00079 |
| <a name="l00080"></a><a class="code" href="zlib_8h.html#a67a40268fa6e70f6368c37c03eacf78d">00080</a> <span class="keyword">typedef</span> <a class="code" href="zconf_8h.html#a04c731495379021454c8e61439dc88ec">voidpf</a> (*alloc_func) <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#a04c731495379021454c8e61439dc88ec">voidpf</a> opaque, <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> items, <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> size)); |
| <a name="l00081"></a>00081 typedef <span class="keywordtype">void</span> (*free_func) <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#a04c731495379021454c8e61439dc88ec">voidpf</a> opaque, <a class="code" href="zconf_8h.html#a04c731495379021454c8e61439dc88ec">voidpf</a> address)); |
| <a name="l00082"></a>00082 |
| <a name="l00083"></a>00083 struct <a class="code" href="structinternal__state.html">internal_state</a>; |
| <a name="l00084"></a>00084 |
| <a name="l00085"></a><a class="code" href="structz__stream__s.html">00085</a> typedef struct <a class="code" href="structz__stream__s.html">z_stream_s</a> { |
| <a name="l00086"></a><a class="code" href="structz__stream__s.html#a21d2c026f0f2fcd67f33011231f8ed00">00086</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *<a class="code" href="structz__stream__s.html#a21d2c026f0f2fcd67f33011231f8ed00">next_in</a>; <span class="comment">/* next input byte */</span> |
| <a name="l00087"></a><a class="code" href="structz__stream__s.html#a0cf177f50dbb49692f27480cbcfde794">00087</a> <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> <a class="code" href="structz__stream__s.html#a0cf177f50dbb49692f27480cbcfde794">avail_in</a>; <span class="comment">/* number of bytes available at next_in */</span> |
| <a name="l00088"></a><a class="code" href="structz__stream__s.html#aa8f408b9632737dc21519fa1ed34b08d">00088</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="structz__stream__s.html#aa8f408b9632737dc21519fa1ed34b08d">total_in</a>; <span class="comment">/* total nb of input bytes read so far */</span> |
| <a name="l00089"></a>00089 |
| <a name="l00090"></a><a class="code" href="structz__stream__s.html#aed4a02cfe93e975314fed50b04427bf3">00090</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *<a class="code" href="structz__stream__s.html#aed4a02cfe93e975314fed50b04427bf3">next_out</a>; <span class="comment">/* next output byte should be put there */</span> |
| <a name="l00091"></a><a class="code" href="structz__stream__s.html#a45ad2364307af9d944fd39d4eca3ca3c">00091</a> <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> <a class="code" href="structz__stream__s.html#a45ad2364307af9d944fd39d4eca3ca3c">avail_out</a>; <span class="comment">/* remaining free space at next_out */</span> |
| <a name="l00092"></a><a class="code" href="structz__stream__s.html#abae26f1f236cf920250b9d37fdf009c1">00092</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="structz__stream__s.html#abae26f1f236cf920250b9d37fdf009c1">total_out</a>; <span class="comment">/* total nb of bytes output so far */</span> |
| <a name="l00093"></a>00093 |
| <a name="l00094"></a><a class="code" href="structz__stream__s.html#a9b2f745fc780e3b33e2935f8c650a326">00094</a> <span class="keywordtype">char</span> *<a class="code" href="structz__stream__s.html#a9b2f745fc780e3b33e2935f8c650a326">msg</a>; <span class="comment">/* last error message, NULL if no error */</span> |
| <a name="l00095"></a><a class="code" href="structz__stream__s.html#ac4a114217a1868dc6fbe7d1f5bda126b">00095</a> <span class="keyword">struct </span>internal_state <a class="code" href="zconf_8h.html#aef060b3456fdcc093a7210a762d5f2ed">FAR</a> *<a class="code" href="structz__stream__s.html#ac4a114217a1868dc6fbe7d1f5bda126b">state</a>; <span class="comment">/* not visible by applications */</span> |
| <a name="l00096"></a>00096 |
| <a name="l00097"></a><a class="code" href="structz__stream__s.html#a23a2299c384f808e76e9908f21216b0f">00097</a> alloc_func <a class="code" href="structz__stream__s.html#a23a2299c384f808e76e9908f21216b0f">zalloc</a>; <span class="comment">/* used to allocate the internal state */</span> |
| <a name="l00098"></a><a class="code" href="structz__stream__s.html#a89eb750ade7f4f0b56bfdadf13344982">00098</a> free_func <a class="code" href="structz__stream__s.html#a89eb750ade7f4f0b56bfdadf13344982">zfree</a>; <span class="comment">/* used to free the internal state */</span> |
| <a name="l00099"></a><a class="code" href="structz__stream__s.html#ab72467f908d2ce65d5b42ee6556ef8bb">00099</a> <a class="code" href="zconf_8h.html#a04c731495379021454c8e61439dc88ec">voidpf</a> <a class="code" href="structz__stream__s.html#ab72467f908d2ce65d5b42ee6556ef8bb">opaque</a>; <span class="comment">/* private data object passed to zalloc and zfree */</span> |
| <a name="l00100"></a>00100 |
| <a name="l00101"></a><a class="code" href="structz__stream__s.html#a9d8f63877d7639a8bca60f9fc3704fc4">00101</a> <span class="keywordtype">int</span> <a class="code" href="structz__stream__s.html#a9d8f63877d7639a8bca60f9fc3704fc4">data_type</a>; <span class="comment">/* best guess about the data type: binary or text */</span> |
| <a name="l00102"></a><a class="code" href="structz__stream__s.html#ade2217fe31e671be1257731883201223">00102</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="structz__stream__s.html#ade2217fe31e671be1257731883201223">adler</a>; <span class="comment">/* adler32 value of the uncompressed data */</span> |
| <a name="l00103"></a><a class="code" href="structz__stream__s.html#add73791dd19b49c9c68f3f3d328c37db">00103</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="structz__stream__s.html#add73791dd19b49c9c68f3f3d328c37db">reserved</a>; <span class="comment">/* reserved for future use */</span> |
| <a name="l00104"></a>00104 } <a class="code" href="zlib_8h.html#afa60092f4e0b9bc4f23b41c6930463f0">z_stream</a>; |
| <a name="l00105"></a>00105 |
| <a name="l00106"></a><a class="code" href="zlib_8h.html#a6ede25c84d3c9f8632305866acffb1d6">00106</a> <span class="keyword">typedef</span> <a class="code" href="structz__stream__s.html">z_stream</a> <a class="code" href="zconf_8h.html#aef060b3456fdcc093a7210a762d5f2ed">FAR</a> *<a class="code" href="zlib_8h.html#a6ede25c84d3c9f8632305866acffb1d6">z_streamp</a>; |
| <a name="l00107"></a>00107 |
| <a name="l00108"></a>00108 <span class="comment">/*</span> |
| <a name="l00109"></a>00109 <span class="comment"> gzip header information passed to and from zlib routines. See RFC 1952</span> |
| <a name="l00110"></a>00110 <span class="comment"> for more details on the meanings of these fields.</span> |
| <a name="l00111"></a>00111 <span class="comment">*/</span> |
| <a name="l00112"></a><a class="code" href="structgz__header__s.html">00112</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structgz__header__s.html">gz_header_s</a> { |
| <a name="l00113"></a><a class="code" href="structgz__header__s.html#af94c3fadfed835a501bc1babc4b894f9">00113</a> <span class="keywordtype">int</span> <a class="code" href="structgz__header__s.html#af94c3fadfed835a501bc1babc4b894f9">text</a>; <span class="comment">/* true if compressed data believed to be text */</span> |
| <a name="l00114"></a><a class="code" href="structgz__header__s.html#a5f00bb6f9689c1abf7a54dad449ce9d3">00114</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="structgz__header__s.html#a5f00bb6f9689c1abf7a54dad449ce9d3">time</a>; <span class="comment">/* modification time */</span> |
| <a name="l00115"></a><a class="code" href="structgz__header__s.html#a40e35dc1a967c6537c6012cf5416210a">00115</a> <span class="keywordtype">int</span> <a class="code" href="structgz__header__s.html#a40e35dc1a967c6537c6012cf5416210a">xflags</a>; <span class="comment">/* extra flags (not used when writing a gzip file) */</span> |
| <a name="l00116"></a><a class="code" href="structgz__header__s.html#a2708d3180d30b0563e3c2c965865cd4f">00116</a> <span class="keywordtype">int</span> <a class="code" href="structgz__header__s.html#a2708d3180d30b0563e3c2c965865cd4f">os</a>; <span class="comment">/* operating system */</span> |
| <a name="l00117"></a><a class="code" href="structgz__header__s.html#a397959afc459da7e296c676a3d4c1915">00117</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *<a class="code" href="structgz__header__s.html#a397959afc459da7e296c676a3d4c1915">extra</a>; <span class="comment">/* pointer to extra field or Z_NULL if none */</span> |
| <a name="l00118"></a><a class="code" href="structgz__header__s.html#a271798915d64ae1f0d25a3a814ca0aa3">00118</a> <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> <a class="code" href="structgz__header__s.html#a271798915d64ae1f0d25a3a814ca0aa3">extra_len</a>; <span class="comment">/* extra field length (valid if extra != Z_NULL) */</span> |
| <a name="l00119"></a><a class="code" href="structgz__header__s.html#ada4b174bf7ec0442b1091011c7342ca1">00119</a> <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> <a class="code" href="structgz__header__s.html#ada4b174bf7ec0442b1091011c7342ca1">extra_max</a>; <span class="comment">/* space at extra (only when reading header) */</span> |
| <a name="l00120"></a><a class="code" href="structgz__header__s.html#a60ae5eee2882d1c25b3bb328972f0149">00120</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *<a class="code" href="structgz__header__s.html#a60ae5eee2882d1c25b3bb328972f0149">name</a>; <span class="comment">/* pointer to zero-terminated file name or Z_NULL */</span> |
| <a name="l00121"></a><a class="code" href="structgz__header__s.html#af503d267de15a461b81dcbbfb0d628e5">00121</a> <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> <a class="code" href="structgz__header__s.html#af503d267de15a461b81dcbbfb0d628e5">name_max</a>; <span class="comment">/* space at name (only when reading header) */</span> |
| <a name="l00122"></a><a class="code" href="structgz__header__s.html#a1d4fd0807e838ce4bfde54aa021e18e9">00122</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *<a class="code" href="structgz__header__s.html#a1d4fd0807e838ce4bfde54aa021e18e9">comment</a>; <span class="comment">/* pointer to zero-terminated comment or Z_NULL */</span> |
| <a name="l00123"></a><a class="code" href="structgz__header__s.html#aa0529f45e5c08b3009cfc2a61a86aea0">00123</a> <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> <a class="code" href="structgz__header__s.html#aa0529f45e5c08b3009cfc2a61a86aea0">comm_max</a>; <span class="comment">/* space at comment (only when reading header) */</span> |
| <a name="l00124"></a><a class="code" href="structgz__header__s.html#a29fa8de3acff8d8c7bad61dc924d8564">00124</a> <span class="keywordtype">int</span> <a class="code" href="structgz__header__s.html#a29fa8de3acff8d8c7bad61dc924d8564">hcrc</a>; <span class="comment">/* true if there was or will be a header crc */</span> |
| <a name="l00125"></a><a class="code" href="structgz__header__s.html#ab8fd11f59b76a7d031e24bede8679d9d">00125</a> <span class="keywordtype">int</span> <a class="code" href="structgz__header__s.html#ab8fd11f59b76a7d031e24bede8679d9d">done</a>; <span class="comment">/* true when done reading gzip header (not used</span> |
| <a name="l00126"></a>00126 <span class="comment"> when writing a gzip file) */</span> |
| <a name="l00127"></a>00127 } <a class="code" href="zlib_8h.html#a2c394ffb61e707fba3c6b1a36704b305">gz_header</a>; |
| <a name="l00128"></a>00128 |
| <a name="l00129"></a><a class="code" href="zlib_8h.html#a40e9dcc294796d99b25e98fb06477fc8">00129</a> <span class="keyword">typedef</span> <a class="code" href="structgz__header__s.html">gz_header</a> <a class="code" href="zconf_8h.html#aef060b3456fdcc093a7210a762d5f2ed">FAR</a> *<a class="code" href="zlib_8h.html#a40e9dcc294796d99b25e98fb06477fc8">gz_headerp</a>; |
| <a name="l00130"></a>00130 |
| <a name="l00131"></a>00131 <span class="comment">/*</span> |
| <a name="l00132"></a>00132 <span class="comment"> The application must update next_in and avail_in when avail_in has dropped</span> |
| <a name="l00133"></a>00133 <span class="comment"> to zero. It must update next_out and avail_out when avail_out has dropped</span> |
| <a name="l00134"></a>00134 <span class="comment"> to zero. The application must initialize zalloc, zfree and opaque before</span> |
| <a name="l00135"></a>00135 <span class="comment"> calling the init function. All other fields are set by the compression</span> |
| <a name="l00136"></a>00136 <span class="comment"> library and must not be updated by the application.</span> |
| <a name="l00137"></a>00137 <span class="comment"></span> |
| <a name="l00138"></a>00138 <span class="comment"> The opaque value provided by the application will be passed as the first</span> |
| <a name="l00139"></a>00139 <span class="comment"> parameter for calls of zalloc and zfree. This can be useful for custom</span> |
| <a name="l00140"></a>00140 <span class="comment"> memory management. The compression library attaches no meaning to the</span> |
| <a name="l00141"></a>00141 <span class="comment"> opaque value.</span> |
| <a name="l00142"></a>00142 <span class="comment"></span> |
| <a name="l00143"></a>00143 <span class="comment"> zalloc must return Z_NULL if there is not enough memory for the object.</span> |
| <a name="l00144"></a>00144 <span class="comment"> If zlib is used in a multi-threaded application, zalloc and zfree must be</span> |
| <a name="l00145"></a>00145 <span class="comment"> thread safe.</span> |
| <a name="l00146"></a>00146 <span class="comment"></span> |
| <a name="l00147"></a>00147 <span class="comment"> On 16-bit systems, the functions zalloc and zfree must be able to allocate</span> |
| <a name="l00148"></a>00148 <span class="comment"> exactly 65536 bytes, but will not be required to allocate more than this if</span> |
| <a name="l00149"></a>00149 <span class="comment"> the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers</span> |
| <a name="l00150"></a>00150 <span class="comment"> returned by zalloc for objects of exactly 65536 bytes *must* have their</span> |
| <a name="l00151"></a>00151 <span class="comment"> offset normalized to zero. The default allocation function provided by this</span> |
| <a name="l00152"></a>00152 <span class="comment"> library ensures this (see zutil.c). To reduce memory requirements and avoid</span> |
| <a name="l00153"></a>00153 <span class="comment"> any allocation of 64K objects, at the expense of compression ratio, compile</span> |
| <a name="l00154"></a>00154 <span class="comment"> the library with -DMAX_WBITS=14 (see zconf.h).</span> |
| <a name="l00155"></a>00155 <span class="comment"></span> |
| <a name="l00156"></a>00156 <span class="comment"> The fields total_in and total_out can be used for statistics or progress</span> |
| <a name="l00157"></a>00157 <span class="comment"> reports. After compression, total_in holds the total size of the</span> |
| <a name="l00158"></a>00158 <span class="comment"> uncompressed data and may be saved for use in the decompressor (particularly</span> |
| <a name="l00159"></a>00159 <span class="comment"> if the decompressor wants to decompress everything in a single step).</span> |
| <a name="l00160"></a>00160 <span class="comment">*/</span> |
| <a name="l00161"></a>00161 |
| <a name="l00162"></a>00162 <span class="comment">/* constants */</span> |
| <a name="l00163"></a>00163 |
| <a name="l00164"></a><a class="code" href="zlib_8h.html#ac3b62e37b9922d9496014515acd6083a">00164</a> <span class="preprocessor">#define Z_NO_FLUSH 0</span> |
| <a name="l00165"></a><a class="code" href="zlib_8h.html#adbd49089a5611593f05ac80c9e12cc7f">00165</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_PARTIAL_FLUSH 1</span> |
| <a name="l00166"></a><a class="code" href="zlib_8h.html#aa32ca175522e0ef314f4dc0b0196bada">00166</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_SYNC_FLUSH 2</span> |
| <a name="l00167"></a><a class="code" href="zlib_8h.html#aed4fbb038c3973aacf52fccffbc44b53">00167</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_FULL_FLUSH 3</span> |
| <a name="l00168"></a><a class="code" href="zlib_8h.html#a876a626ba14eb12eea4bbf6823b6ca50">00168</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_FINISH 4</span> |
| <a name="l00169"></a><a class="code" href="zlib_8h.html#a73e5f4c24156c63ba863014396685062">00169</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_BLOCK 5</span> |
| <a name="l00170"></a><a class="code" href="zlib_8h.html#a0c44b4d8d05cacb1227b535cd8ed538f">00170</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_TREES 6</span> |
| <a name="l00171"></a>00171 <span class="preprocessor"></span><span class="comment">/* Allowed flush values; see deflate() and inflate() below for details */</span> |
| <a name="l00172"></a>00172 |
| <a name="l00173"></a><a class="code" href="zlib_8h.html#a8cb802b6a11e926478dc6547c514c65c">00173</a> <span class="preprocessor">#define Z_OK 0</span> |
| <a name="l00174"></a><a class="code" href="zlib_8h.html#a7d94a4a852228a899864a0053162e7a8">00174</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_STREAM_END 1</span> |
| <a name="l00175"></a><a class="code" href="zlib_8h.html#a32916ba675b2d06463da2576b6a49d64">00175</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_NEED_DICT 2</span> |
| <a name="l00176"></a><a class="code" href="zlib_8h.html#a3c66d64c427c0337c64e578537478737">00176</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_ERRNO (-1)</span> |
| <a name="l00177"></a><a class="code" href="zlib_8h.html#aad97cde83a9a4bb77f5c3b03bb68e483">00177</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_STREAM_ERROR (-2)</span> |
| <a name="l00178"></a><a class="code" href="zlib_8h.html#a9eda83d428a71752d148f38b5dbe04f2">00178</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_DATA_ERROR (-3)</span> |
| <a name="l00179"></a><a class="code" href="zlib_8h.html#ae2be6be871e377c6e2c25a7296ce320c">00179</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_MEM_ERROR (-4)</span> |
| <a name="l00180"></a><a class="code" href="zlib_8h.html#a425e2f0664e1b1f75bf2bffab88d353d">00180</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_BUF_ERROR (-5)</span> |
| <a name="l00181"></a><a class="code" href="zlib_8h.html#a7634cdd55f955ee1be99c065c6977371">00181</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_VERSION_ERROR (-6)</span> |
| <a name="l00182"></a>00182 <span class="preprocessor"></span><span class="comment">/* Return codes for the compression/decompression functions. Negative values</span> |
| <a name="l00183"></a>00183 <span class="comment"> * are errors, positive values are used for special but normal events.</span> |
| <a name="l00184"></a>00184 <span class="comment"> */</span> |
| <a name="l00185"></a>00185 |
| <a name="l00186"></a><a class="code" href="zlib_8h.html#a496a4523776bcfa14568cd083b59f24c">00186</a> <span class="preprocessor">#define Z_NO_COMPRESSION 0</span> |
| <a name="l00187"></a><a class="code" href="zlib_8h.html#ad5222ae19b77c6e83815d07ca5d03fd8">00187</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_BEST_SPEED 1</span> |
| <a name="l00188"></a><a class="code" href="zlib_8h.html#a8db83edd9dea51f8cf0afd1727838b95">00188</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_BEST_COMPRESSION 9</span> |
| <a name="l00189"></a><a class="code" href="zlib_8h.html#af5387baee05124298e431ebe6fe96b17">00189</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_DEFAULT_COMPRESSION (-1)</span> |
| <a name="l00190"></a>00190 <span class="preprocessor"></span><span class="comment">/* compression levels */</span> |
| <a name="l00191"></a>00191 |
| <a name="l00192"></a><a class="code" href="zlib_8h.html#af01ccb5a9db8d415cde987d9553ad200">00192</a> <span class="preprocessor">#define Z_FILTERED 1</span> |
| <a name="l00193"></a><a class="code" href="zlib_8h.html#a1eec3d3720ba91fd54fa08d2757c1785">00193</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_HUFFMAN_ONLY 2</span> |
| <a name="l00194"></a><a class="code" href="zlib_8h.html#af52c1220e7193d2da78332d75f9251ea">00194</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_RLE 3</span> |
| <a name="l00195"></a><a class="code" href="zlib_8h.html#aaa5c996fbc985d5ec43f99112c0ac4a6">00195</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_FIXED 4</span> |
| <a name="l00196"></a><a class="code" href="zlib_8h.html#a580d7c2527e653ddd783109271750849">00196</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_DEFAULT_STRATEGY 0</span> |
| <a name="l00197"></a>00197 <span class="preprocessor"></span><span class="comment">/* compression strategy; see deflateInit2() below for details */</span> |
| <a name="l00198"></a>00198 |
| <a name="l00199"></a><a class="code" href="zlib_8h.html#a2bfe22ed89d3553335d18a4c3cab67af">00199</a> <span class="preprocessor">#define Z_BINARY 0</span> |
| <a name="l00200"></a><a class="code" href="zlib_8h.html#ac5c9021ac9271248094c6b93c61e1f02">00200</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_TEXT 1</span> |
| <a name="l00201"></a><a class="code" href="zlib_8h.html#a9a852d9163cdb10687403d4e79dda06e">00201</a> <span class="preprocessor"></span><span class="preprocessor">#define Z_ASCII Z_TEXT </span><span class="comment">/* for compatibility with 1.2.2 and earlier */</span> |
| <a name="l00202"></a><a class="code" href="zlib_8h.html#a4be54d9d68d40adb73f87492284cc290">00202</a> <span class="preprocessor">#define Z_UNKNOWN 2</span> |
| <a name="l00203"></a>00203 <span class="preprocessor"></span><span class="comment">/* Possible values of the data_type field (though see inflate()) */</span> |
| <a name="l00204"></a>00204 |
| <a name="l00205"></a><a class="code" href="zlib_8h.html#a27a96226f3dc88e4743131c632adf32f">00205</a> <span class="preprocessor">#define Z_DEFLATED 8</span> |
| <a name="l00206"></a>00206 <span class="preprocessor"></span><span class="comment">/* The deflate compression method (the only one supported in this version) */</span> |
| <a name="l00207"></a>00207 |
| <a name="l00208"></a><a class="code" href="zlib_8h.html#ad15afa2776b41b2f4d8582dd152bd736">00208</a> <span class="preprocessor">#define Z_NULL 0 </span><span class="comment">/* for initializing zalloc, zfree, opaque */</span> |
| <a name="l00209"></a>00209 |
| <a name="l00210"></a><a class="code" href="zlib_8h.html#a1f228220c3e6935eb171761c61487059">00210</a> <span class="preprocessor">#define zlib_version zlibVersion()</span> |
| <a name="l00211"></a>00211 <span class="preprocessor"></span><span class="comment">/* for compatibility with versions < 1.0.2 */</span> |
| <a name="l00212"></a>00212 |
| <a name="l00213"></a>00213 |
| <a name="l00214"></a>00214 <span class="comment">/* basic functions */</span> |
| <a name="l00215"></a>00215 |
| <a name="l00216"></a>00216 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> zlibVersion <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keywordtype">void</span>)); |
| <a name="l00217"></a>00217 <span class="comment">/* The application can compare zlibVersion and ZLIB_VERSION for consistency.</span> |
| <a name="l00218"></a>00218 <span class="comment"> If the first character differs, the library code actually used is not</span> |
| <a name="l00219"></a>00219 <span class="comment"> compatible with the zlib.h header file used by the application. This check</span> |
| <a name="l00220"></a>00220 <span class="comment"> is automatically made by deflateInit and inflateInit.</span> |
| <a name="l00221"></a>00221 <span class="comment"> */</span> |
| <a name="l00222"></a>00222 |
| <a name="l00223"></a>00223 <span class="comment">/*</span> |
| <a name="l00224"></a>00224 <span class="comment">ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));</span> |
| <a name="l00225"></a>00225 <span class="comment"></span> |
| <a name="l00226"></a>00226 <span class="comment"> Initializes the internal stream state for compression. The fields</span> |
| <a name="l00227"></a>00227 <span class="comment"> zalloc, zfree and opaque must be initialized before by the caller. If</span> |
| <a name="l00228"></a>00228 <span class="comment"> zalloc and zfree are set to Z_NULL, deflateInit updates them to use default</span> |
| <a name="l00229"></a>00229 <span class="comment"> allocation functions.</span> |
| <a name="l00230"></a>00230 <span class="comment"></span> |
| <a name="l00231"></a>00231 <span class="comment"> The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:</span> |
| <a name="l00232"></a>00232 <span class="comment"> 1 gives best speed, 9 gives best compression, 0 gives no compression at all</span> |
| <a name="l00233"></a>00233 <span class="comment"> (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION</span> |
| <a name="l00234"></a>00234 <span class="comment"> requests a default compromise between speed and compression (currently</span> |
| <a name="l00235"></a>00235 <span class="comment"> equivalent to level 6).</span> |
| <a name="l00236"></a>00236 <span class="comment"></span> |
| <a name="l00237"></a>00237 <span class="comment"> deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough</span> |
| <a name="l00238"></a>00238 <span class="comment"> memory, Z_STREAM_ERROR if level is not a valid compression level, or</span> |
| <a name="l00239"></a>00239 <span class="comment"> Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible</span> |
| <a name="l00240"></a>00240 <span class="comment"> with the version assumed by the caller (ZLIB_VERSION). msg is set to null</span> |
| <a name="l00241"></a>00241 <span class="comment"> if there is no error message. deflateInit does not perform any compression:</span> |
| <a name="l00242"></a>00242 <span class="comment"> this will be done by deflate().</span> |
| <a name="l00243"></a>00243 <span class="comment">*/</span> |
| <a name="l00244"></a>00244 |
| <a name="l00245"></a>00245 |
| <a name="l00246"></a>00246 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflate <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, <span class="keywordtype">int</span> flush)); |
| <a name="l00247"></a>00247 <span class="comment">/*</span> |
| <a name="l00248"></a>00248 <span class="comment"> deflate compresses as much data as possible, and stops when the input</span> |
| <a name="l00249"></a>00249 <span class="comment"> buffer becomes empty or the output buffer becomes full. It may introduce</span> |
| <a name="l00250"></a>00250 <span class="comment"> some output latency (reading input without producing any output) except when</span> |
| <a name="l00251"></a>00251 <span class="comment"> forced to flush.</span> |
| <a name="l00252"></a>00252 <span class="comment"></span> |
| <a name="l00253"></a>00253 <span class="comment"> The detailed semantics are as follows. deflate performs one or both of the</span> |
| <a name="l00254"></a>00254 <span class="comment"> following actions:</span> |
| <a name="l00255"></a>00255 <span class="comment"></span> |
| <a name="l00256"></a>00256 <span class="comment"> - Compress more input starting at next_in and update next_in and avail_in</span> |
| <a name="l00257"></a>00257 <span class="comment"> accordingly. If not all input can be processed (because there is not</span> |
| <a name="l00258"></a>00258 <span class="comment"> enough room in the output buffer), next_in and avail_in are updated and</span> |
| <a name="l00259"></a>00259 <span class="comment"> processing will resume at this point for the next call of deflate().</span> |
| <a name="l00260"></a>00260 <span class="comment"></span> |
| <a name="l00261"></a>00261 <span class="comment"> - Provide more output starting at next_out and update next_out and avail_out</span> |
| <a name="l00262"></a>00262 <span class="comment"> accordingly. This action is forced if the parameter flush is non zero.</span> |
| <a name="l00263"></a>00263 <span class="comment"> Forcing flush frequently degrades the compression ratio, so this parameter</span> |
| <a name="l00264"></a>00264 <span class="comment"> should be set only when necessary (in interactive applications). Some</span> |
| <a name="l00265"></a>00265 <span class="comment"> output may be provided even if flush is not set.</span> |
| <a name="l00266"></a>00266 <span class="comment"></span> |
| <a name="l00267"></a>00267 <span class="comment"> Before the call of deflate(), the application should ensure that at least</span> |
| <a name="l00268"></a>00268 <span class="comment"> one of the actions is possible, by providing more input and/or consuming more</span> |
| <a name="l00269"></a>00269 <span class="comment"> output, and updating avail_in or avail_out accordingly; avail_out should</span> |
| <a name="l00270"></a>00270 <span class="comment"> never be zero before the call. The application can consume the compressed</span> |
| <a name="l00271"></a>00271 <span class="comment"> output when it wants, for example when the output buffer is full (avail_out</span> |
| <a name="l00272"></a>00272 <span class="comment"> == 0), or after each call of deflate(). If deflate returns Z_OK and with</span> |
| <a name="l00273"></a>00273 <span class="comment"> zero avail_out, it must be called again after making room in the output</span> |
| <a name="l00274"></a>00274 <span class="comment"> buffer because there might be more output pending.</span> |
| <a name="l00275"></a>00275 <span class="comment"></span> |
| <a name="l00276"></a>00276 <span class="comment"> Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to</span> |
| <a name="l00277"></a>00277 <span class="comment"> decide how much data to accumulate before producing output, in order to</span> |
| <a name="l00278"></a>00278 <span class="comment"> maximize compression.</span> |
| <a name="l00279"></a>00279 <span class="comment"></span> |
| <a name="l00280"></a>00280 <span class="comment"> If the parameter flush is set to Z_SYNC_FLUSH, all pending output is</span> |
| <a name="l00281"></a>00281 <span class="comment"> flushed to the output buffer and the output is aligned on a byte boundary, so</span> |
| <a name="l00282"></a>00282 <span class="comment"> that the decompressor can get all input data available so far. (In</span> |
| <a name="l00283"></a>00283 <span class="comment"> particular avail_in is zero after the call if enough output space has been</span> |
| <a name="l00284"></a>00284 <span class="comment"> provided before the call.) Flushing may degrade compression for some</span> |
| <a name="l00285"></a>00285 <span class="comment"> compression algorithms and so it should be used only when necessary. This</span> |
| <a name="l00286"></a>00286 <span class="comment"> completes the current deflate block and follows it with an empty stored block</span> |
| <a name="l00287"></a>00287 <span class="comment"> that is three bits plus filler bits to the next byte, followed by four bytes</span> |
| <a name="l00288"></a>00288 <span class="comment"> (00 00 ff ff).</span> |
| <a name="l00289"></a>00289 <span class="comment"></span> |
| <a name="l00290"></a>00290 <span class="comment"> If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the</span> |
| <a name="l00291"></a>00291 <span class="comment"> output buffer, but the output is not aligned to a byte boundary. All of the</span> |
| <a name="l00292"></a>00292 <span class="comment"> input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.</span> |
| <a name="l00293"></a>00293 <span class="comment"> This completes the current deflate block and follows it with an empty fixed</span> |
| <a name="l00294"></a>00294 <span class="comment"> codes block that is 10 bits long. This assures that enough bytes are output</span> |
| <a name="l00295"></a>00295 <span class="comment"> in order for the decompressor to finish the block before the empty fixed code</span> |
| <a name="l00296"></a>00296 <span class="comment"> block.</span> |
| <a name="l00297"></a>00297 <span class="comment"></span> |
| <a name="l00298"></a>00298 <span class="comment"> If flush is set to Z_BLOCK, a deflate block is completed and emitted, as</span> |
| <a name="l00299"></a>00299 <span class="comment"> for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to</span> |
| <a name="l00300"></a>00300 <span class="comment"> seven bits of the current block are held to be written as the next byte after</span> |
| <a name="l00301"></a>00301 <span class="comment"> the next deflate block is completed. In this case, the decompressor may not</span> |
| <a name="l00302"></a>00302 <span class="comment"> be provided enough bits at this point in order to complete decompression of</span> |
| <a name="l00303"></a>00303 <span class="comment"> the data provided so far to the compressor. It may need to wait for the next</span> |
| <a name="l00304"></a>00304 <span class="comment"> block to be emitted. This is for advanced applications that need to control</span> |
| <a name="l00305"></a>00305 <span class="comment"> the emission of deflate blocks.</span> |
| <a name="l00306"></a>00306 <span class="comment"></span> |
| <a name="l00307"></a>00307 <span class="comment"> If flush is set to Z_FULL_FLUSH, all output is flushed as with</span> |
| <a name="l00308"></a>00308 <span class="comment"> Z_SYNC_FLUSH, and the compression state is reset so that decompression can</span> |
| <a name="l00309"></a>00309 <span class="comment"> restart from this point if previous compressed data has been damaged or if</span> |
| <a name="l00310"></a>00310 <span class="comment"> random access is desired. Using Z_FULL_FLUSH too often can seriously degrade</span> |
| <a name="l00311"></a>00311 <span class="comment"> compression.</span> |
| <a name="l00312"></a>00312 <span class="comment"></span> |
| <a name="l00313"></a>00313 <span class="comment"> If deflate returns with avail_out == 0, this function must be called again</span> |
| <a name="l00314"></a>00314 <span class="comment"> with the same value of the flush parameter and more output space (updated</span> |
| <a name="l00315"></a>00315 <span class="comment"> avail_out), until the flush is complete (deflate returns with non-zero</span> |
| <a name="l00316"></a>00316 <span class="comment"> avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that</span> |
| <a name="l00317"></a>00317 <span class="comment"> avail_out is greater than six to avoid repeated flush markers due to</span> |
| <a name="l00318"></a>00318 <span class="comment"> avail_out == 0 on return.</span> |
| <a name="l00319"></a>00319 <span class="comment"></span> |
| <a name="l00320"></a>00320 <span class="comment"> If the parameter flush is set to Z_FINISH, pending input is processed,</span> |
| <a name="l00321"></a>00321 <span class="comment"> pending output is flushed and deflate returns with Z_STREAM_END if there was</span> |
| <a name="l00322"></a>00322 <span class="comment"> enough output space; if deflate returns with Z_OK, this function must be</span> |
| <a name="l00323"></a>00323 <span class="comment"> called again with Z_FINISH and more output space (updated avail_out) but no</span> |
| <a name="l00324"></a>00324 <span class="comment"> more input data, until it returns with Z_STREAM_END or an error. After</span> |
| <a name="l00325"></a>00325 <span class="comment"> deflate has returned Z_STREAM_END, the only possible operations on the stream</span> |
| <a name="l00326"></a>00326 <span class="comment"> are deflateReset or deflateEnd.</span> |
| <a name="l00327"></a>00327 <span class="comment"></span> |
| <a name="l00328"></a>00328 <span class="comment"> Z_FINISH can be used immediately after deflateInit if all the compression</span> |
| <a name="l00329"></a>00329 <span class="comment"> is to be done in a single step. In this case, avail_out must be at least the</span> |
| <a name="l00330"></a>00330 <span class="comment"> value returned by deflateBound (see below). If deflate does not return</span> |
| <a name="l00331"></a>00331 <span class="comment"> Z_STREAM_END, then it must be called again as described above.</span> |
| <a name="l00332"></a>00332 <span class="comment"></span> |
| <a name="l00333"></a>00333 <span class="comment"> deflate() sets strm->adler to the adler32 checksum of all input read</span> |
| <a name="l00334"></a>00334 <span class="comment"> so far (that is, total_in bytes).</span> |
| <a name="l00335"></a>00335 <span class="comment"></span> |
| <a name="l00336"></a>00336 <span class="comment"> deflate() may update strm->data_type if it can make a good guess about</span> |
| <a name="l00337"></a>00337 <span class="comment"> the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered</span> |
| <a name="l00338"></a>00338 <span class="comment"> binary. This field is only for information purposes and does not affect the</span> |
| <a name="l00339"></a>00339 <span class="comment"> compression algorithm in any manner.</span> |
| <a name="l00340"></a>00340 <span class="comment"></span> |
| <a name="l00341"></a>00341 <span class="comment"> deflate() returns Z_OK if some progress has been made (more input</span> |
| <a name="l00342"></a>00342 <span class="comment"> processed or more output produced), Z_STREAM_END if all input has been</span> |
| <a name="l00343"></a>00343 <span class="comment"> consumed and all output has been produced (only when flush is set to</span> |
| <a name="l00344"></a>00344 <span class="comment"> Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example</span> |
| <a name="l00345"></a>00345 <span class="comment"> if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible</span> |
| <a name="l00346"></a>00346 <span class="comment"> (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not</span> |
| <a name="l00347"></a>00347 <span class="comment"> fatal, and deflate() can be called again with more input and more output</span> |
| <a name="l00348"></a>00348 <span class="comment"> space to continue compressing.</span> |
| <a name="l00349"></a>00349 <span class="comment">*/</span> |
| <a name="l00350"></a>00350 |
| <a name="l00351"></a>00351 |
| <a name="l00352"></a>00352 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateEnd <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm)); |
| <a name="l00353"></a>00353 <span class="comment">/*</span> |
| <a name="l00354"></a>00354 <span class="comment"> All dynamically allocated data structures for this stream are freed.</span> |
| <a name="l00355"></a>00355 <span class="comment"> This function discards any unprocessed input and does not flush any pending</span> |
| <a name="l00356"></a>00356 <span class="comment"> output.</span> |
| <a name="l00357"></a>00357 <span class="comment"></span> |
| <a name="l00358"></a>00358 <span class="comment"> deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the</span> |
| <a name="l00359"></a>00359 <span class="comment"> stream state was inconsistent, Z_DATA_ERROR if the stream was freed</span> |
| <a name="l00360"></a>00360 <span class="comment"> prematurely (some input or output was discarded). In the error case, msg</span> |
| <a name="l00361"></a>00361 <span class="comment"> may be set but then points to a static string (which must not be</span> |
| <a name="l00362"></a>00362 <span class="comment"> deallocated).</span> |
| <a name="l00363"></a>00363 <span class="comment">*/</span> |
| <a name="l00364"></a>00364 |
| <a name="l00365"></a>00365 |
| <a name="l00366"></a>00366 <span class="comment">/*</span> |
| <a name="l00367"></a>00367 <span class="comment">ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));</span> |
| <a name="l00368"></a>00368 <span class="comment"></span> |
| <a name="l00369"></a>00369 <span class="comment"> Initializes the internal stream state for decompression. The fields</span> |
| <a name="l00370"></a>00370 <span class="comment"> next_in, avail_in, zalloc, zfree and opaque must be initialized before by</span> |
| <a name="l00371"></a>00371 <span class="comment"> the caller. If next_in is not Z_NULL and avail_in is large enough (the</span> |
| <a name="l00372"></a>00372 <span class="comment"> exact value depends on the compression method), inflateInit determines the</span> |
| <a name="l00373"></a>00373 <span class="comment"> compression method from the zlib header and allocates all data structures</span> |
| <a name="l00374"></a>00374 <span class="comment"> accordingly; otherwise the allocation will be deferred to the first call of</span> |
| <a name="l00375"></a>00375 <span class="comment"> inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to</span> |
| <a name="l00376"></a>00376 <span class="comment"> use default allocation functions.</span> |
| <a name="l00377"></a>00377 <span class="comment"></span> |
| <a name="l00378"></a>00378 <span class="comment"> inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough</span> |
| <a name="l00379"></a>00379 <span class="comment"> memory, Z_VERSION_ERROR if the zlib library version is incompatible with the</span> |
| <a name="l00380"></a>00380 <span class="comment"> version assumed by the caller, or Z_STREAM_ERROR if the parameters are</span> |
| <a name="l00381"></a>00381 <span class="comment"> invalid, such as a null pointer to the structure. msg is set to null if</span> |
| <a name="l00382"></a>00382 <span class="comment"> there is no error message. inflateInit does not perform any decompression</span> |
| <a name="l00383"></a>00383 <span class="comment"> apart from possibly reading the zlib header if present: actual decompression</span> |
| <a name="l00384"></a>00384 <span class="comment"> will be done by inflate(). (So next_in and avail_in may be modified, but</span> |
| <a name="l00385"></a>00385 <span class="comment"> next_out and avail_out are unused and unchanged.) The current implementation</span> |
| <a name="l00386"></a>00386 <span class="comment"> of inflateInit() does not process any header information -- that is deferred</span> |
| <a name="l00387"></a>00387 <span class="comment"> until inflate() is called.</span> |
| <a name="l00388"></a>00388 <span class="comment">*/</span> |
| <a name="l00389"></a>00389 |
| <a name="l00390"></a>00390 |
| <a name="l00391"></a>00391 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflate <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, <span class="keywordtype">int</span> flush)); |
| <a name="l00392"></a>00392 <span class="comment">/*</span> |
| <a name="l00393"></a>00393 <span class="comment"> inflate decompresses as much data as possible, and stops when the input</span> |
| <a name="l00394"></a>00394 <span class="comment"> buffer becomes empty or the output buffer becomes full. It may introduce</span> |
| <a name="l00395"></a>00395 <span class="comment"> some output latency (reading input without producing any output) except when</span> |
| <a name="l00396"></a>00396 <span class="comment"> forced to flush.</span> |
| <a name="l00397"></a>00397 <span class="comment"></span> |
| <a name="l00398"></a>00398 <span class="comment"> The detailed semantics are as follows. inflate performs one or both of the</span> |
| <a name="l00399"></a>00399 <span class="comment"> following actions:</span> |
| <a name="l00400"></a>00400 <span class="comment"></span> |
| <a name="l00401"></a>00401 <span class="comment"> - Decompress more input starting at next_in and update next_in and avail_in</span> |
| <a name="l00402"></a>00402 <span class="comment"> accordingly. If not all input can be processed (because there is not</span> |
| <a name="l00403"></a>00403 <span class="comment"> enough room in the output buffer), next_in is updated and processing will</span> |
| <a name="l00404"></a>00404 <span class="comment"> resume at this point for the next call of inflate().</span> |
| <a name="l00405"></a>00405 <span class="comment"></span> |
| <a name="l00406"></a>00406 <span class="comment"> - Provide more output starting at next_out and update next_out and avail_out</span> |
| <a name="l00407"></a>00407 <span class="comment"> accordingly. inflate() provides as much output as possible, until there is</span> |
| <a name="l00408"></a>00408 <span class="comment"> no more input data or no more space in the output buffer (see below about</span> |
| <a name="l00409"></a>00409 <span class="comment"> the flush parameter).</span> |
| <a name="l00410"></a>00410 <span class="comment"></span> |
| <a name="l00411"></a>00411 <span class="comment"> Before the call of inflate(), the application should ensure that at least</span> |
| <a name="l00412"></a>00412 <span class="comment"> one of the actions is possible, by providing more input and/or consuming more</span> |
| <a name="l00413"></a>00413 <span class="comment"> output, and updating the next_* and avail_* values accordingly. The</span> |
| <a name="l00414"></a>00414 <span class="comment"> application can consume the uncompressed output when it wants, for example</span> |
| <a name="l00415"></a>00415 <span class="comment"> when the output buffer is full (avail_out == 0), or after each call of</span> |
| <a name="l00416"></a>00416 <span class="comment"> inflate(). If inflate returns Z_OK and with zero avail_out, it must be</span> |
| <a name="l00417"></a>00417 <span class="comment"> called again after making room in the output buffer because there might be</span> |
| <a name="l00418"></a>00418 <span class="comment"> more output pending.</span> |
| <a name="l00419"></a>00419 <span class="comment"></span> |
| <a name="l00420"></a>00420 <span class="comment"> The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,</span> |
| <a name="l00421"></a>00421 <span class="comment"> Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much</span> |
| <a name="l00422"></a>00422 <span class="comment"> output as possible to the output buffer. Z_BLOCK requests that inflate()</span> |
| <a name="l00423"></a>00423 <span class="comment"> stop if and when it gets to the next deflate block boundary. When decoding</span> |
| <a name="l00424"></a>00424 <span class="comment"> the zlib or gzip format, this will cause inflate() to return immediately</span> |
| <a name="l00425"></a>00425 <span class="comment"> after the header and before the first block. When doing a raw inflate,</span> |
| <a name="l00426"></a>00426 <span class="comment"> inflate() will go ahead and process the first block, and will return when it</span> |
| <a name="l00427"></a>00427 <span class="comment"> gets to the end of that block, or when it runs out of data.</span> |
| <a name="l00428"></a>00428 <span class="comment"></span> |
| <a name="l00429"></a>00429 <span class="comment"> The Z_BLOCK option assists in appending to or combining deflate streams.</span> |
| <a name="l00430"></a>00430 <span class="comment"> Also to assist in this, on return inflate() will set strm->data_type to the</span> |
| <a name="l00431"></a>00431 <span class="comment"> number of unused bits in the last byte taken from strm->next_in, plus 64 if</span> |
| <a name="l00432"></a>00432 <span class="comment"> inflate() is currently decoding the last block in the deflate stream, plus</span> |
| <a name="l00433"></a>00433 <span class="comment"> 128 if inflate() returned immediately after decoding an end-of-block code or</span> |
| <a name="l00434"></a>00434 <span class="comment"> decoding the complete header up to just before the first byte of the deflate</span> |
| <a name="l00435"></a>00435 <span class="comment"> stream. The end-of-block will not be indicated until all of the uncompressed</span> |
| <a name="l00436"></a>00436 <span class="comment"> data from that block has been written to strm->next_out. The number of</span> |
| <a name="l00437"></a>00437 <span class="comment"> unused bits may in general be greater than seven, except when bit 7 of</span> |
| <a name="l00438"></a>00438 <span class="comment"> data_type is set, in which case the number of unused bits will be less than</span> |
| <a name="l00439"></a>00439 <span class="comment"> eight. data_type is set as noted here every time inflate() returns for all</span> |
| <a name="l00440"></a>00440 <span class="comment"> flush options, and so can be used to determine the amount of currently</span> |
| <a name="l00441"></a>00441 <span class="comment"> consumed input in bits.</span> |
| <a name="l00442"></a>00442 <span class="comment"></span> |
| <a name="l00443"></a>00443 <span class="comment"> The Z_TREES option behaves as Z_BLOCK does, but it also returns when the</span> |
| <a name="l00444"></a>00444 <span class="comment"> end of each deflate block header is reached, before any actual data in that</span> |
| <a name="l00445"></a>00445 <span class="comment"> block is decoded. This allows the caller to determine the length of the</span> |
| <a name="l00446"></a>00446 <span class="comment"> deflate block header for later use in random access within a deflate block.</span> |
| <a name="l00447"></a>00447 <span class="comment"> 256 is added to the value of strm->data_type when inflate() returns</span> |
| <a name="l00448"></a>00448 <span class="comment"> immediately after reaching the end of the deflate block header.</span> |
| <a name="l00449"></a>00449 <span class="comment"></span> |
| <a name="l00450"></a>00450 <span class="comment"> inflate() should normally be called until it returns Z_STREAM_END or an</span> |
| <a name="l00451"></a>00451 <span class="comment"> error. However if all decompression is to be performed in a single step (a</span> |
| <a name="l00452"></a>00452 <span class="comment"> single call of inflate), the parameter flush should be set to Z_FINISH. In</span> |
| <a name="l00453"></a>00453 <span class="comment"> this case all pending input is processed and all pending output is flushed;</span> |
| <a name="l00454"></a>00454 <span class="comment"> avail_out must be large enough to hold all the uncompressed data. (The size</span> |
| <a name="l00455"></a>00455 <span class="comment"> of the uncompressed data may have been saved by the compressor for this</span> |
| <a name="l00456"></a>00456 <span class="comment"> purpose.) The next operation on this stream must be inflateEnd to deallocate</span> |
| <a name="l00457"></a>00457 <span class="comment"> the decompression state. The use of Z_FINISH is never required, but can be</span> |
| <a name="l00458"></a>00458 <span class="comment"> used to inform inflate that a faster approach may be used for the single</span> |
| <a name="l00459"></a>00459 <span class="comment"> inflate() call.</span> |
| <a name="l00460"></a>00460 <span class="comment"></span> |
| <a name="l00461"></a>00461 <span class="comment"> In this implementation, inflate() always flushes as much output as</span> |
| <a name="l00462"></a>00462 <span class="comment"> possible to the output buffer, and always uses the faster approach on the</span> |
| <a name="l00463"></a>00463 <span class="comment"> first call. So the only effect of the flush parameter in this implementation</span> |
| <a name="l00464"></a>00464 <span class="comment"> is on the return value of inflate(), as noted below, or when it returns early</span> |
| <a name="l00465"></a>00465 <span class="comment"> because Z_BLOCK or Z_TREES is used.</span> |
| <a name="l00466"></a>00466 <span class="comment"></span> |
| <a name="l00467"></a>00467 <span class="comment"> If a preset dictionary is needed after this call (see inflateSetDictionary</span> |
| <a name="l00468"></a>00468 <span class="comment"> below), inflate sets strm->adler to the adler32 checksum of the dictionary</span> |
| <a name="l00469"></a>00469 <span class="comment"> chosen by the compressor and returns Z_NEED_DICT; otherwise it sets</span> |
| <a name="l00470"></a>00470 <span class="comment"> strm->adler to the adler32 checksum of all output produced so far (that is,</span> |
| <a name="l00471"></a>00471 <span class="comment"> total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described</span> |
| <a name="l00472"></a>00472 <span class="comment"> below. At the end of the stream, inflate() checks that its computed adler32</span> |
| <a name="l00473"></a>00473 <span class="comment"> checksum is equal to that saved by the compressor and returns Z_STREAM_END</span> |
| <a name="l00474"></a>00474 <span class="comment"> only if the checksum is correct.</span> |
| <a name="l00475"></a>00475 <span class="comment"></span> |
| <a name="l00476"></a>00476 <span class="comment"> inflate() can decompress and check either zlib-wrapped or gzip-wrapped</span> |
| <a name="l00477"></a>00477 <span class="comment"> deflate data. The header type is detected automatically, if requested when</span> |
| <a name="l00478"></a>00478 <span class="comment"> initializing with inflateInit2(). Any information contained in the gzip</span> |
| <a name="l00479"></a>00479 <span class="comment"> header is not retained, so applications that need that information should</span> |
| <a name="l00480"></a>00480 <span class="comment"> instead use raw inflate, see inflateInit2() below, or inflateBack() and</span> |
| <a name="l00481"></a>00481 <span class="comment"> perform their own processing of the gzip header and trailer.</span> |
| <a name="l00482"></a>00482 <span class="comment"></span> |
| <a name="l00483"></a>00483 <span class="comment"> inflate() returns Z_OK if some progress has been made (more input processed</span> |
| <a name="l00484"></a>00484 <span class="comment"> or more output produced), Z_STREAM_END if the end of the compressed data has</span> |
| <a name="l00485"></a>00485 <span class="comment"> been reached and all uncompressed output has been produced, Z_NEED_DICT if a</span> |
| <a name="l00486"></a>00486 <span class="comment"> preset dictionary is needed at this point, Z_DATA_ERROR if the input data was</span> |
| <a name="l00487"></a>00487 <span class="comment"> corrupted (input stream not conforming to the zlib format or incorrect check</span> |
| <a name="l00488"></a>00488 <span class="comment"> value), Z_STREAM_ERROR if the stream structure was inconsistent (for example</span> |
| <a name="l00489"></a>00489 <span class="comment"> next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,</span> |
| <a name="l00490"></a>00490 <span class="comment"> Z_BUF_ERROR if no progress is possible or if there was not enough room in the</span> |
| <a name="l00491"></a>00491 <span class="comment"> output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and</span> |
| <a name="l00492"></a>00492 <span class="comment"> inflate() can be called again with more input and more output space to</span> |
| <a name="l00493"></a>00493 <span class="comment"> continue decompressing. If Z_DATA_ERROR is returned, the application may</span> |
| <a name="l00494"></a>00494 <span class="comment"> then call inflateSync() to look for a good compression block if a partial</span> |
| <a name="l00495"></a>00495 <span class="comment"> recovery of the data is desired.</span> |
| <a name="l00496"></a>00496 <span class="comment">*/</span> |
| <a name="l00497"></a>00497 |
| <a name="l00498"></a>00498 |
| <a name="l00499"></a>00499 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateEnd <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm)); |
| <a name="l00500"></a>00500 <span class="comment">/*</span> |
| <a name="l00501"></a>00501 <span class="comment"> All dynamically allocated data structures for this stream are freed.</span> |
| <a name="l00502"></a>00502 <span class="comment"> This function discards any unprocessed input and does not flush any pending</span> |
| <a name="l00503"></a>00503 <span class="comment"> output.</span> |
| <a name="l00504"></a>00504 <span class="comment"></span> |
| <a name="l00505"></a>00505 <span class="comment"> inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state</span> |
| <a name="l00506"></a>00506 <span class="comment"> was inconsistent. In the error case, msg may be set but then points to a</span> |
| <a name="l00507"></a>00507 <span class="comment"> static string (which must not be deallocated).</span> |
| <a name="l00508"></a>00508 <span class="comment">*/</span> |
| <a name="l00509"></a>00509 |
| <a name="l00510"></a>00510 |
| <a name="l00511"></a>00511 <span class="comment">/* Advanced functions */</span> |
| <a name="l00512"></a>00512 |
| <a name="l00513"></a>00513 <span class="comment">/*</span> |
| <a name="l00514"></a>00514 <span class="comment"> The following functions are needed only in some special applications.</span> |
| <a name="l00515"></a>00515 <span class="comment">*/</span> |
| <a name="l00516"></a>00516 |
| <a name="l00517"></a>00517 <span class="comment">/*</span> |
| <a name="l00518"></a>00518 <span class="comment">ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,</span> |
| <a name="l00519"></a>00519 <span class="comment"> int level,</span> |
| <a name="l00520"></a>00520 <span class="comment"> int method,</span> |
| <a name="l00521"></a>00521 <span class="comment"> int windowBits,</span> |
| <a name="l00522"></a>00522 <span class="comment"> int memLevel,</span> |
| <a name="l00523"></a>00523 <span class="comment"> int strategy));</span> |
| <a name="l00524"></a>00524 <span class="comment"></span> |
| <a name="l00525"></a>00525 <span class="comment"> This is another version of deflateInit with more compression options. The</span> |
| <a name="l00526"></a>00526 <span class="comment"> fields next_in, zalloc, zfree and opaque must be initialized before by the</span> |
| <a name="l00527"></a>00527 <span class="comment"> caller.</span> |
| <a name="l00528"></a>00528 <span class="comment"></span> |
| <a name="l00529"></a>00529 <span class="comment"> The method parameter is the compression method. It must be Z_DEFLATED in</span> |
| <a name="l00530"></a>00530 <span class="comment"> this version of the library.</span> |
| <a name="l00531"></a>00531 <span class="comment"></span> |
| <a name="l00532"></a>00532 <span class="comment"> The windowBits parameter is the base two logarithm of the window size</span> |
| <a name="l00533"></a>00533 <span class="comment"> (the size of the history buffer). It should be in the range 8..15 for this</span> |
| <a name="l00534"></a>00534 <span class="comment"> version of the library. Larger values of this parameter result in better</span> |
| <a name="l00535"></a>00535 <span class="comment"> compression at the expense of memory usage. The default value is 15 if</span> |
| <a name="l00536"></a>00536 <span class="comment"> deflateInit is used instead.</span> |
| <a name="l00537"></a>00537 <span class="comment"></span> |
| <a name="l00538"></a>00538 <span class="comment"> windowBits can also be -8..-15 for raw deflate. In this case, -windowBits</span> |
| <a name="l00539"></a>00539 <span class="comment"> determines the window size. deflate() will then generate raw deflate data</span> |
| <a name="l00540"></a>00540 <span class="comment"> with no zlib header or trailer, and will not compute an adler32 check value.</span> |
| <a name="l00541"></a>00541 <span class="comment"></span> |
| <a name="l00542"></a>00542 <span class="comment"> windowBits can also be greater than 15 for optional gzip encoding. Add</span> |
| <a name="l00543"></a>00543 <span class="comment"> 16 to windowBits to write a simple gzip header and trailer around the</span> |
| <a name="l00544"></a>00544 <span class="comment"> compressed data instead of a zlib wrapper. The gzip header will have no</span> |
| <a name="l00545"></a>00545 <span class="comment"> file name, no extra data, no comment, no modification time (set to zero), no</span> |
| <a name="l00546"></a>00546 <span class="comment"> header crc, and the operating system will be set to 255 (unknown). If a</span> |
| <a name="l00547"></a>00547 <span class="comment"> gzip stream is being written, strm->adler is a crc32 instead of an adler32.</span> |
| <a name="l00548"></a>00548 <span class="comment"></span> |
| <a name="l00549"></a>00549 <span class="comment"> The memLevel parameter specifies how much memory should be allocated</span> |
| <a name="l00550"></a>00550 <span class="comment"> for the internal compression state. memLevel=1 uses minimum memory but is</span> |
| <a name="l00551"></a>00551 <span class="comment"> slow and reduces compression ratio; memLevel=9 uses maximum memory for</span> |
| <a name="l00552"></a>00552 <span class="comment"> optimal speed. The default value is 8. See zconf.h for total memory usage</span> |
| <a name="l00553"></a>00553 <span class="comment"> as a function of windowBits and memLevel.</span> |
| <a name="l00554"></a>00554 <span class="comment"></span> |
| <a name="l00555"></a>00555 <span class="comment"> The strategy parameter is used to tune the compression algorithm. Use the</span> |
| <a name="l00556"></a>00556 <span class="comment"> value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a</span> |
| <a name="l00557"></a>00557 <span class="comment"> filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no</span> |
| <a name="l00558"></a>00558 <span class="comment"> string match), or Z_RLE to limit match distances to one (run-length</span> |
| <a name="l00559"></a>00559 <span class="comment"> encoding). Filtered data consists mostly of small values with a somewhat</span> |
| <a name="l00560"></a>00560 <span class="comment"> random distribution. In this case, the compression algorithm is tuned to</span> |
| <a name="l00561"></a>00561 <span class="comment"> compress them better. The effect of Z_FILTERED is to force more Huffman</span> |
| <a name="l00562"></a>00562 <span class="comment"> coding and less string matching; it is somewhat intermediate between</span> |
| <a name="l00563"></a>00563 <span class="comment"> Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as</span> |
| <a name="l00564"></a>00564 <span class="comment"> fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The</span> |
| <a name="l00565"></a>00565 <span class="comment"> strategy parameter only affects the compression ratio but not the</span> |
| <a name="l00566"></a>00566 <span class="comment"> correctness of the compressed output even if it is not set appropriately.</span> |
| <a name="l00567"></a>00567 <span class="comment"> Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler</span> |
| <a name="l00568"></a>00568 <span class="comment"> decoder for special applications.</span> |
| <a name="l00569"></a>00569 <span class="comment"></span> |
| <a name="l00570"></a>00570 <span class="comment"> deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough</span> |
| <a name="l00571"></a>00571 <span class="comment"> memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid</span> |
| <a name="l00572"></a>00572 <span class="comment"> method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is</span> |
| <a name="l00573"></a>00573 <span class="comment"> incompatible with the version assumed by the caller (ZLIB_VERSION). msg is</span> |
| <a name="l00574"></a>00574 <span class="comment"> set to null if there is no error message. deflateInit2 does not perform any</span> |
| <a name="l00575"></a>00575 <span class="comment"> compression: this will be done by deflate().</span> |
| <a name="l00576"></a>00576 <span class="comment">*/</span> |
| <a name="l00577"></a>00577 |
| <a name="l00578"></a>00578 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateSetDictionary <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00579"></a>00579 <span class="keyword">const</span> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *dictionary, |
| <a name="l00580"></a>00580 <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> dictLength)); |
| <a name="l00581"></a>00581 <span class="comment">/*</span> |
| <a name="l00582"></a>00582 <span class="comment"> Initializes the compression dictionary from the given byte sequence</span> |
| <a name="l00583"></a>00583 <span class="comment"> without producing any compressed output. This function must be called</span> |
| <a name="l00584"></a>00584 <span class="comment"> immediately after deflateInit, deflateInit2 or deflateReset, before any call</span> |
| <a name="l00585"></a>00585 <span class="comment"> of deflate. The compressor and decompressor must use exactly the same</span> |
| <a name="l00586"></a>00586 <span class="comment"> dictionary (see inflateSetDictionary).</span> |
| <a name="l00587"></a>00587 <span class="comment"></span> |
| <a name="l00588"></a>00588 <span class="comment"> The dictionary should consist of strings (byte sequences) that are likely</span> |
| <a name="l00589"></a>00589 <span class="comment"> to be encountered later in the data to be compressed, with the most commonly</span> |
| <a name="l00590"></a>00590 <span class="comment"> used strings preferably put towards the end of the dictionary. Using a</span> |
| <a name="l00591"></a>00591 <span class="comment"> dictionary is most useful when the data to be compressed is short and can be</span> |
| <a name="l00592"></a>00592 <span class="comment"> predicted with good accuracy; the data can then be compressed better than</span> |
| <a name="l00593"></a>00593 <span class="comment"> with the default empty dictionary.</span> |
| <a name="l00594"></a>00594 <span class="comment"></span> |
| <a name="l00595"></a>00595 <span class="comment"> Depending on the size of the compression data structures selected by</span> |
| <a name="l00596"></a>00596 <span class="comment"> deflateInit or deflateInit2, a part of the dictionary may in effect be</span> |
| <a name="l00597"></a>00597 <span class="comment"> discarded, for example if the dictionary is larger than the window size</span> |
| <a name="l00598"></a>00598 <span class="comment"> provided in deflateInit or deflateInit2. Thus the strings most likely to be</span> |
| <a name="l00599"></a>00599 <span class="comment"> useful should be put at the end of the dictionary, not at the front. In</span> |
| <a name="l00600"></a>00600 <span class="comment"> addition, the current implementation of deflate will use at most the window</span> |
| <a name="l00601"></a>00601 <span class="comment"> size minus 262 bytes of the provided dictionary.</span> |
| <a name="l00602"></a>00602 <span class="comment"></span> |
| <a name="l00603"></a>00603 <span class="comment"> Upon return of this function, strm->adler is set to the adler32 value</span> |
| <a name="l00604"></a>00604 <span class="comment"> of the dictionary; the decompressor may later use this value to determine</span> |
| <a name="l00605"></a>00605 <span class="comment"> which dictionary has been used by the compressor. (The adler32 value</span> |
| <a name="l00606"></a>00606 <span class="comment"> applies to the whole dictionary even if only a subset of the dictionary is</span> |
| <a name="l00607"></a>00607 <span class="comment"> actually used by the compressor.) If a raw deflate was requested, then the</span> |
| <a name="l00608"></a>00608 <span class="comment"> adler32 value is not computed and strm->adler is not set.</span> |
| <a name="l00609"></a>00609 <span class="comment"></span> |
| <a name="l00610"></a>00610 <span class="comment"> deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a</span> |
| <a name="l00611"></a>00611 <span class="comment"> parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is</span> |
| <a name="l00612"></a>00612 <span class="comment"> inconsistent (for example if deflate has already been called for this stream</span> |
| <a name="l00613"></a>00613 <span class="comment"> or if the compression method is bsort). deflateSetDictionary does not</span> |
| <a name="l00614"></a>00614 <span class="comment"> perform any compression: this will be done by deflate().</span> |
| <a name="l00615"></a>00615 <span class="comment">*/</span> |
| <a name="l00616"></a>00616 |
| <a name="l00617"></a>00617 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateCopy <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp dest, |
| <a name="l00618"></a>00618 z_streamp source)); |
| <a name="l00619"></a>00619 <span class="comment">/*</span> |
| <a name="l00620"></a>00620 <span class="comment"> Sets the destination stream as a complete copy of the source stream.</span> |
| <a name="l00621"></a>00621 <span class="comment"></span> |
| <a name="l00622"></a>00622 <span class="comment"> This function can be useful when several compression strategies will be</span> |
| <a name="l00623"></a>00623 <span class="comment"> tried, for example when there are several ways of pre-processing the input</span> |
| <a name="l00624"></a>00624 <span class="comment"> data with a filter. The streams that will be discarded should then be freed</span> |
| <a name="l00625"></a>00625 <span class="comment"> by calling deflateEnd. Note that deflateCopy duplicates the internal</span> |
| <a name="l00626"></a>00626 <span class="comment"> compression state which can be quite large, so this strategy is slow and can</span> |
| <a name="l00627"></a>00627 <span class="comment"> consume lots of memory.</span> |
| <a name="l00628"></a>00628 <span class="comment"></span> |
| <a name="l00629"></a>00629 <span class="comment"> deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not</span> |
| <a name="l00630"></a>00630 <span class="comment"> enough memory, Z_STREAM_ERROR if the source stream state was inconsistent</span> |
| <a name="l00631"></a>00631 <span class="comment"> (such as zalloc being Z_NULL). msg is left unchanged in both source and</span> |
| <a name="l00632"></a>00632 <span class="comment"> destination.</span> |
| <a name="l00633"></a>00633 <span class="comment">*/</span> |
| <a name="l00634"></a>00634 |
| <a name="l00635"></a>00635 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateReset <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm)); |
| <a name="l00636"></a>00636 <span class="comment">/*</span> |
| <a name="l00637"></a>00637 <span class="comment"> This function is equivalent to deflateEnd followed by deflateInit,</span> |
| <a name="l00638"></a>00638 <span class="comment"> but does not free and reallocate all the internal compression state. The</span> |
| <a name="l00639"></a>00639 <span class="comment"> stream will keep the same compression level and any other attributes that</span> |
| <a name="l00640"></a>00640 <span class="comment"> may have been set by deflateInit2.</span> |
| <a name="l00641"></a>00641 <span class="comment"></span> |
| <a name="l00642"></a>00642 <span class="comment"> deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source</span> |
| <a name="l00643"></a>00643 <span class="comment"> stream state was inconsistent (such as zalloc or state being Z_NULL).</span> |
| <a name="l00644"></a>00644 <span class="comment">*/</span> |
| <a name="l00645"></a>00645 |
| <a name="l00646"></a>00646 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateParams <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00647"></a>00647 <span class="keywordtype">int</span> level, |
| <a name="l00648"></a>00648 <span class="keywordtype">int</span> strategy)); |
| <a name="l00649"></a>00649 <span class="comment">/*</span> |
| <a name="l00650"></a>00650 <span class="comment"> Dynamically update the compression level and compression strategy. The</span> |
| <a name="l00651"></a>00651 <span class="comment"> interpretation of level and strategy is as in deflateInit2. This can be</span> |
| <a name="l00652"></a>00652 <span class="comment"> used to switch between compression and straight copy of the input data, or</span> |
| <a name="l00653"></a>00653 <span class="comment"> to switch to a different kind of input data requiring a different strategy.</span> |
| <a name="l00654"></a>00654 <span class="comment"> If the compression level is changed, the input available so far is</span> |
| <a name="l00655"></a>00655 <span class="comment"> compressed with the old level (and may be flushed); the new level will take</span> |
| <a name="l00656"></a>00656 <span class="comment"> effect only at the next call of deflate().</span> |
| <a name="l00657"></a>00657 <span class="comment"></span> |
| <a name="l00658"></a>00658 <span class="comment"> Before the call of deflateParams, the stream state must be set as for</span> |
| <a name="l00659"></a>00659 <span class="comment"> a call of deflate(), since the currently available input may have to be</span> |
| <a name="l00660"></a>00660 <span class="comment"> compressed and flushed. In particular, strm->avail_out must be non-zero.</span> |
| <a name="l00661"></a>00661 <span class="comment"></span> |
| <a name="l00662"></a>00662 <span class="comment"> deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source</span> |
| <a name="l00663"></a>00663 <span class="comment"> stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if</span> |
| <a name="l00664"></a>00664 <span class="comment"> strm->avail_out was zero.</span> |
| <a name="l00665"></a>00665 <span class="comment">*/</span> |
| <a name="l00666"></a>00666 |
| <a name="l00667"></a>00667 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateTune <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00668"></a>00668 <span class="keywordtype">int</span> good_length, |
| <a name="l00669"></a>00669 <span class="keywordtype">int</span> max_lazy, |
| <a name="l00670"></a>00670 <span class="keywordtype">int</span> nice_length, |
| <a name="l00671"></a>00671 <span class="keywordtype">int</span> max_chain)); |
| <a name="l00672"></a>00672 <span class="comment">/*</span> |
| <a name="l00673"></a>00673 <span class="comment"> Fine tune deflate's internal compression parameters. This should only be</span> |
| <a name="l00674"></a>00674 <span class="comment"> used by someone who understands the algorithm used by zlib's deflate for</span> |
| <a name="l00675"></a>00675 <span class="comment"> searching for the best matching string, and even then only by the most</span> |
| <a name="l00676"></a>00676 <span class="comment"> fanatic optimizer trying to squeeze out the last compressed bit for their</span> |
| <a name="l00677"></a>00677 <span class="comment"> specific input data. Read the deflate.c source code for the meaning of the</span> |
| <a name="l00678"></a>00678 <span class="comment"> max_lazy, good_length, nice_length, and max_chain parameters.</span> |
| <a name="l00679"></a>00679 <span class="comment"></span> |
| <a name="l00680"></a>00680 <span class="comment"> deflateTune() can be called after deflateInit() or deflateInit2(), and</span> |
| <a name="l00681"></a>00681 <span class="comment"> returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.</span> |
| <a name="l00682"></a>00682 <span class="comment"> */</span> |
| <a name="l00683"></a>00683 |
| <a name="l00684"></a>00684 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateBound <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00685"></a>00685 <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> sourceLen)); |
| <a name="l00686"></a>00686 <span class="comment">/*</span> |
| <a name="l00687"></a>00687 <span class="comment"> deflateBound() returns an upper bound on the compressed size after</span> |
| <a name="l00688"></a>00688 <span class="comment"> deflation of sourceLen bytes. It must be called after deflateInit() or</span> |
| <a name="l00689"></a>00689 <span class="comment"> deflateInit2(), and after deflateSetHeader(), if used. This would be used</span> |
| <a name="l00690"></a>00690 <span class="comment"> to allocate an output buffer for deflation in a single pass, and so would be</span> |
| <a name="l00691"></a>00691 <span class="comment"> called before deflate().</span> |
| <a name="l00692"></a>00692 <span class="comment">*/</span> |
| <a name="l00693"></a>00693 |
| <a name="l00694"></a>00694 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflatePrime <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00695"></a>00695 <span class="keywordtype">int</span> bits, |
| <a name="l00696"></a>00696 <span class="keywordtype">int</span> value)); |
| <a name="l00697"></a>00697 <span class="comment">/*</span> |
| <a name="l00698"></a>00698 <span class="comment"> deflatePrime() inserts bits in the deflate output stream. The intent</span> |
| <a name="l00699"></a>00699 <span class="comment"> is that this function is used to start off the deflate output with the bits</span> |
| <a name="l00700"></a>00700 <span class="comment"> leftover from a previous deflate stream when appending to it. As such, this</span> |
| <a name="l00701"></a>00701 <span class="comment"> function can only be used for raw deflate, and must be used before the first</span> |
| <a name="l00702"></a>00702 <span class="comment"> deflate() call after a deflateInit2() or deflateReset(). bits must be less</span> |
| <a name="l00703"></a>00703 <span class="comment"> than or equal to 16, and that many of the least significant bits of value</span> |
| <a name="l00704"></a>00704 <span class="comment"> will be inserted in the output.</span> |
| <a name="l00705"></a>00705 <span class="comment"></span> |
| <a name="l00706"></a>00706 <span class="comment"> deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source</span> |
| <a name="l00707"></a>00707 <span class="comment"> stream state was inconsistent.</span> |
| <a name="l00708"></a>00708 <span class="comment">*/</span> |
| <a name="l00709"></a>00709 |
| <a name="l00710"></a>00710 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateSetHeader <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00711"></a>00711 gz_headerp head)); |
| <a name="l00712"></a>00712 <span class="comment">/*</span> |
| <a name="l00713"></a>00713 <span class="comment"> deflateSetHeader() provides gzip header information for when a gzip</span> |
| <a name="l00714"></a>00714 <span class="comment"> stream is requested by deflateInit2(). deflateSetHeader() may be called</span> |
| <a name="l00715"></a>00715 <span class="comment"> after deflateInit2() or deflateReset() and before the first call of</span> |
| <a name="l00716"></a>00716 <span class="comment"> deflate(). The text, time, os, extra field, name, and comment information</span> |
| <a name="l00717"></a>00717 <span class="comment"> in the provided gz_header structure are written to the gzip header (xflag is</span> |
| <a name="l00718"></a>00718 <span class="comment"> ignored -- the extra flags are set according to the compression level). The</span> |
| <a name="l00719"></a>00719 <span class="comment"> caller must assure that, if not Z_NULL, name and comment are terminated with</span> |
| <a name="l00720"></a>00720 <span class="comment"> a zero byte, and that if extra is not Z_NULL, that extra_len bytes are</span> |
| <a name="l00721"></a>00721 <span class="comment"> available there. If hcrc is true, a gzip header crc is included. Note that</span> |
| <a name="l00722"></a>00722 <span class="comment"> the current versions of the command-line version of gzip (up through version</span> |
| <a name="l00723"></a>00723 <span class="comment"> 1.3.x) do not support header crc's, and will report that it is a "multi-part</span> |
| <a name="l00724"></a>00724 <span class="comment"> gzip file" and give up.</span> |
| <a name="l00725"></a>00725 <span class="comment"></span> |
| <a name="l00726"></a>00726 <span class="comment"> If deflateSetHeader is not used, the default gzip header has text false,</span> |
| <a name="l00727"></a>00727 <span class="comment"> the time set to zero, and os set to 255, with no extra, name, or comment</span> |
| <a name="l00728"></a>00728 <span class="comment"> fields. The gzip header is returned to the default state by deflateReset().</span> |
| <a name="l00729"></a>00729 <span class="comment"></span> |
| <a name="l00730"></a>00730 <span class="comment"> deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source</span> |
| <a name="l00731"></a>00731 <span class="comment"> stream state was inconsistent.</span> |
| <a name="l00732"></a>00732 <span class="comment">*/</span> |
| <a name="l00733"></a>00733 |
| <a name="l00734"></a>00734 <span class="comment">/*</span> |
| <a name="l00735"></a>00735 <span class="comment">ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,</span> |
| <a name="l00736"></a>00736 <span class="comment"> int windowBits));</span> |
| <a name="l00737"></a>00737 <span class="comment"></span> |
| <a name="l00738"></a>00738 <span class="comment"> This is another version of inflateInit with an extra parameter. The</span> |
| <a name="l00739"></a>00739 <span class="comment"> fields next_in, avail_in, zalloc, zfree and opaque must be initialized</span> |
| <a name="l00740"></a>00740 <span class="comment"> before by the caller.</span> |
| <a name="l00741"></a>00741 <span class="comment"></span> |
| <a name="l00742"></a>00742 <span class="comment"> The windowBits parameter is the base two logarithm of the maximum window</span> |
| <a name="l00743"></a>00743 <span class="comment"> size (the size of the history buffer). It should be in the range 8..15 for</span> |
| <a name="l00744"></a>00744 <span class="comment"> this version of the library. The default value is 15 if inflateInit is used</span> |
| <a name="l00745"></a>00745 <span class="comment"> instead. windowBits must be greater than or equal to the windowBits value</span> |
| <a name="l00746"></a>00746 <span class="comment"> provided to deflateInit2() while compressing, or it must be equal to 15 if</span> |
| <a name="l00747"></a>00747 <span class="comment"> deflateInit2() was not used. If a compressed stream with a larger window</span> |
| <a name="l00748"></a>00748 <span class="comment"> size is given as input, inflate() will return with the error code</span> |
| <a name="l00749"></a>00749 <span class="comment"> Z_DATA_ERROR instead of trying to allocate a larger window.</span> |
| <a name="l00750"></a>00750 <span class="comment"></span> |
| <a name="l00751"></a>00751 <span class="comment"> windowBits can also be zero to request that inflate use the window size in</span> |
| <a name="l00752"></a>00752 <span class="comment"> the zlib header of the compressed stream.</span> |
| <a name="l00753"></a>00753 <span class="comment"></span> |
| <a name="l00754"></a>00754 <span class="comment"> windowBits can also be -8..-15 for raw inflate. In this case, -windowBits</span> |
| <a name="l00755"></a>00755 <span class="comment"> determines the window size. inflate() will then process raw deflate data,</span> |
| <a name="l00756"></a>00756 <span class="comment"> not looking for a zlib or gzip header, not generating a check value, and not</span> |
| <a name="l00757"></a>00757 <span class="comment"> looking for any check values for comparison at the end of the stream. This</span> |
| <a name="l00758"></a>00758 <span class="comment"> is for use with other formats that use the deflate compressed data format</span> |
| <a name="l00759"></a>00759 <span class="comment"> such as zip. Those formats provide their own check values. If a custom</span> |
| <a name="l00760"></a>00760 <span class="comment"> format is developed using the raw deflate format for compressed data, it is</span> |
| <a name="l00761"></a>00761 <span class="comment"> recommended that a check value such as an adler32 or a crc32 be applied to</span> |
| <a name="l00762"></a>00762 <span class="comment"> the uncompressed data as is done in the zlib, gzip, and zip formats. For</span> |
| <a name="l00763"></a>00763 <span class="comment"> most applications, the zlib format should be used as is. Note that comments</span> |
| <a name="l00764"></a>00764 <span class="comment"> above on the use in deflateInit2() applies to the magnitude of windowBits.</span> |
| <a name="l00765"></a>00765 <span class="comment"></span> |
| <a name="l00766"></a>00766 <span class="comment"> windowBits can also be greater than 15 for optional gzip decoding. Add</span> |
| <a name="l00767"></a>00767 <span class="comment"> 32 to windowBits to enable zlib and gzip decoding with automatic header</span> |
| <a name="l00768"></a>00768 <span class="comment"> detection, or add 16 to decode only the gzip format (the zlib format will</span> |
| <a name="l00769"></a>00769 <span class="comment"> return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a</span> |
| <a name="l00770"></a>00770 <span class="comment"> crc32 instead of an adler32.</span> |
| <a name="l00771"></a>00771 <span class="comment"></span> |
| <a name="l00772"></a>00772 <span class="comment"> inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough</span> |
| <a name="l00773"></a>00773 <span class="comment"> memory, Z_VERSION_ERROR if the zlib library version is incompatible with the</span> |
| <a name="l00774"></a>00774 <span class="comment"> version assumed by the caller, or Z_STREAM_ERROR if the parameters are</span> |
| <a name="l00775"></a>00775 <span class="comment"> invalid, such as a null pointer to the structure. msg is set to null if</span> |
| <a name="l00776"></a>00776 <span class="comment"> there is no error message. inflateInit2 does not perform any decompression</span> |
| <a name="l00777"></a>00777 <span class="comment"> apart from possibly reading the zlib header if present: actual decompression</span> |
| <a name="l00778"></a>00778 <span class="comment"> will be done by inflate(). (So next_in and avail_in may be modified, but</span> |
| <a name="l00779"></a>00779 <span class="comment"> next_out and avail_out are unused and unchanged.) The current implementation</span> |
| <a name="l00780"></a>00780 <span class="comment"> of inflateInit2() does not process any header information -- that is</span> |
| <a name="l00781"></a>00781 <span class="comment"> deferred until inflate() is called.</span> |
| <a name="l00782"></a>00782 <span class="comment">*/</span> |
| <a name="l00783"></a>00783 |
| <a name="l00784"></a>00784 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateSetDictionary <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00785"></a>00785 <span class="keyword">const</span> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *dictionary, |
| <a name="l00786"></a>00786 <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> dictLength)); |
| <a name="l00787"></a>00787 <span class="comment">/*</span> |
| <a name="l00788"></a>00788 <span class="comment"> Initializes the decompression dictionary from the given uncompressed byte</span> |
| <a name="l00789"></a>00789 <span class="comment"> sequence. This function must be called immediately after a call of inflate,</span> |
| <a name="l00790"></a>00790 <span class="comment"> if that call returned Z_NEED_DICT. The dictionary chosen by the compressor</span> |
| <a name="l00791"></a>00791 <span class="comment"> can be determined from the adler32 value returned by that call of inflate.</span> |
| <a name="l00792"></a>00792 <span class="comment"> The compressor and decompressor must use exactly the same dictionary (see</span> |
| <a name="l00793"></a>00793 <span class="comment"> deflateSetDictionary). For raw inflate, this function can be called</span> |
| <a name="l00794"></a>00794 <span class="comment"> immediately after inflateInit2() or inflateReset() and before any call of</span> |
| <a name="l00795"></a>00795 <span class="comment"> inflate() to set the dictionary. The application must insure that the</span> |
| <a name="l00796"></a>00796 <span class="comment"> dictionary that was used for compression is provided.</span> |
| <a name="l00797"></a>00797 <span class="comment"></span> |
| <a name="l00798"></a>00798 <span class="comment"> inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a</span> |
| <a name="l00799"></a>00799 <span class="comment"> parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is</span> |
| <a name="l00800"></a>00800 <span class="comment"> inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the</span> |
| <a name="l00801"></a>00801 <span class="comment"> expected one (incorrect adler32 value). inflateSetDictionary does not</span> |
| <a name="l00802"></a>00802 <span class="comment"> perform any decompression: this will be done by subsequent calls of</span> |
| <a name="l00803"></a>00803 <span class="comment"> inflate().</span> |
| <a name="l00804"></a>00804 <span class="comment">*/</span> |
| <a name="l00805"></a>00805 |
| <a name="l00806"></a>00806 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateSync <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm)); |
| <a name="l00807"></a>00807 <span class="comment">/*</span> |
| <a name="l00808"></a>00808 <span class="comment"> Skips invalid compressed data until a full flush point (see above the</span> |
| <a name="l00809"></a>00809 <span class="comment"> description of deflate with Z_FULL_FLUSH) can be found, or until all</span> |
| <a name="l00810"></a>00810 <span class="comment"> available input is skipped. No output is provided.</span> |
| <a name="l00811"></a>00811 <span class="comment"></span> |
| <a name="l00812"></a>00812 <span class="comment"> inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR</span> |
| <a name="l00813"></a>00813 <span class="comment"> if no more input was provided, Z_DATA_ERROR if no flush point has been</span> |
| <a name="l00814"></a>00814 <span class="comment"> found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the</span> |
| <a name="l00815"></a>00815 <span class="comment"> success case, the application may save the current current value of total_in</span> |
| <a name="l00816"></a>00816 <span class="comment"> which indicates where valid compressed data was found. In the error case,</span> |
| <a name="l00817"></a>00817 <span class="comment"> the application may repeatedly call inflateSync, providing more input each</span> |
| <a name="l00818"></a>00818 <span class="comment"> time, until success or end of the input data.</span> |
| <a name="l00819"></a>00819 <span class="comment">*/</span> |
| <a name="l00820"></a>00820 |
| <a name="l00821"></a>00821 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateCopy <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp dest, |
| <a name="l00822"></a>00822 z_streamp source)); |
| <a name="l00823"></a>00823 <span class="comment">/*</span> |
| <a name="l00824"></a>00824 <span class="comment"> Sets the destination stream as a complete copy of the source stream.</span> |
| <a name="l00825"></a>00825 <span class="comment"></span> |
| <a name="l00826"></a>00826 <span class="comment"> This function can be useful when randomly accessing a large stream. The</span> |
| <a name="l00827"></a>00827 <span class="comment"> first pass through the stream can periodically record the inflate state,</span> |
| <a name="l00828"></a>00828 <span class="comment"> allowing restarting inflate at those points when randomly accessing the</span> |
| <a name="l00829"></a>00829 <span class="comment"> stream.</span> |
| <a name="l00830"></a>00830 <span class="comment"></span> |
| <a name="l00831"></a>00831 <span class="comment"> inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not</span> |
| <a name="l00832"></a>00832 <span class="comment"> enough memory, Z_STREAM_ERROR if the source stream state was inconsistent</span> |
| <a name="l00833"></a>00833 <span class="comment"> (such as zalloc being Z_NULL). msg is left unchanged in both source and</span> |
| <a name="l00834"></a>00834 <span class="comment"> destination.</span> |
| <a name="l00835"></a>00835 <span class="comment">*/</span> |
| <a name="l00836"></a>00836 |
| <a name="l00837"></a>00837 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateReset <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm)); |
| <a name="l00838"></a>00838 <span class="comment">/*</span> |
| <a name="l00839"></a>00839 <span class="comment"> This function is equivalent to inflateEnd followed by inflateInit,</span> |
| <a name="l00840"></a>00840 <span class="comment"> but does not free and reallocate all the internal decompression state. The</span> |
| <a name="l00841"></a>00841 <span class="comment"> stream will keep attributes that may have been set by inflateInit2.</span> |
| <a name="l00842"></a>00842 <span class="comment"></span> |
| <a name="l00843"></a>00843 <span class="comment"> inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source</span> |
| <a name="l00844"></a>00844 <span class="comment"> stream state was inconsistent (such as zalloc or state being Z_NULL).</span> |
| <a name="l00845"></a>00845 <span class="comment">*/</span> |
| <a name="l00846"></a>00846 |
| <a name="l00847"></a>00847 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateReset2 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00848"></a>00848 <span class="keywordtype">int</span> windowBits)); |
| <a name="l00849"></a>00849 <span class="comment">/*</span> |
| <a name="l00850"></a>00850 <span class="comment"> This function is the same as inflateReset, but it also permits changing</span> |
| <a name="l00851"></a>00851 <span class="comment"> the wrap and window size requests. The windowBits parameter is interpreted</span> |
| <a name="l00852"></a>00852 <span class="comment"> the same as it is for inflateInit2.</span> |
| <a name="l00853"></a>00853 <span class="comment"></span> |
| <a name="l00854"></a>00854 <span class="comment"> inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source</span> |
| <a name="l00855"></a>00855 <span class="comment"> stream state was inconsistent (such as zalloc or state being Z_NULL), or if</span> |
| <a name="l00856"></a>00856 <span class="comment"> the windowBits parameter is invalid.</span> |
| <a name="l00857"></a>00857 <span class="comment">*/</span> |
| <a name="l00858"></a>00858 |
| <a name="l00859"></a>00859 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflatePrime <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00860"></a>00860 <span class="keywordtype">int</span> bits, |
| <a name="l00861"></a>00861 <span class="keywordtype">int</span> value)); |
| <a name="l00862"></a>00862 <span class="comment">/*</span> |
| <a name="l00863"></a>00863 <span class="comment"> This function inserts bits in the inflate input stream. The intent is</span> |
| <a name="l00864"></a>00864 <span class="comment"> that this function is used to start inflating at a bit position in the</span> |
| <a name="l00865"></a>00865 <span class="comment"> middle of a byte. The provided bits will be used before any bytes are used</span> |
| <a name="l00866"></a>00866 <span class="comment"> from next_in. This function should only be used with raw inflate, and</span> |
| <a name="l00867"></a>00867 <span class="comment"> should be used before the first inflate() call after inflateInit2() or</span> |
| <a name="l00868"></a>00868 <span class="comment"> inflateReset(). bits must be less than or equal to 16, and that many of the</span> |
| <a name="l00869"></a>00869 <span class="comment"> least significant bits of value will be inserted in the input.</span> |
| <a name="l00870"></a>00870 <span class="comment"></span> |
| <a name="l00871"></a>00871 <span class="comment"> If bits is negative, then the input stream bit buffer is emptied. Then</span> |
| <a name="l00872"></a>00872 <span class="comment"> inflatePrime() can be called again to put bits in the buffer. This is used</span> |
| <a name="l00873"></a>00873 <span class="comment"> to clear out bits leftover after feeding inflate a block description prior</span> |
| <a name="l00874"></a>00874 <span class="comment"> to feeding inflate codes.</span> |
| <a name="l00875"></a>00875 <span class="comment"></span> |
| <a name="l00876"></a>00876 <span class="comment"> inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source</span> |
| <a name="l00877"></a>00877 <span class="comment"> stream state was inconsistent.</span> |
| <a name="l00878"></a>00878 <span class="comment">*/</span> |
| <a name="l00879"></a>00879 |
| <a name="l00880"></a>00880 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">long</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateMark <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm)); |
| <a name="l00881"></a>00881 <span class="comment">/*</span> |
| <a name="l00882"></a>00882 <span class="comment"> This function returns two values, one in the lower 16 bits of the return</span> |
| <a name="l00883"></a>00883 <span class="comment"> value, and the other in the remaining upper bits, obtained by shifting the</span> |
| <a name="l00884"></a>00884 <span class="comment"> return value down 16 bits. If the upper value is -1 and the lower value is</span> |
| <a name="l00885"></a>00885 <span class="comment"> zero, then inflate() is currently decoding information outside of a block.</span> |
| <a name="l00886"></a>00886 <span class="comment"> If the upper value is -1 and the lower value is non-zero, then inflate is in</span> |
| <a name="l00887"></a>00887 <span class="comment"> the middle of a stored block, with the lower value equaling the number of</span> |
| <a name="l00888"></a>00888 <span class="comment"> bytes from the input remaining to copy. If the upper value is not -1, then</span> |
| <a name="l00889"></a>00889 <span class="comment"> it is the number of bits back from the current bit position in the input of</span> |
| <a name="l00890"></a>00890 <span class="comment"> the code (literal or length/distance pair) currently being processed. In</span> |
| <a name="l00891"></a>00891 <span class="comment"> that case the lower value is the number of bytes already emitted for that</span> |
| <a name="l00892"></a>00892 <span class="comment"> code.</span> |
| <a name="l00893"></a>00893 <span class="comment"></span> |
| <a name="l00894"></a>00894 <span class="comment"> A code is being processed if inflate is waiting for more input to complete</span> |
| <a name="l00895"></a>00895 <span class="comment"> decoding of the code, or if it has completed decoding but is waiting for</span> |
| <a name="l00896"></a>00896 <span class="comment"> more output space to write the literal or match data.</span> |
| <a name="l00897"></a>00897 <span class="comment"></span> |
| <a name="l00898"></a>00898 <span class="comment"> inflateMark() is used to mark locations in the input data for random</span> |
| <a name="l00899"></a>00899 <span class="comment"> access, which may be at bit positions, and to note those cases where the</span> |
| <a name="l00900"></a>00900 <span class="comment"> output of a code may span boundaries of random access blocks. The current</span> |
| <a name="l00901"></a>00901 <span class="comment"> location in the input stream can be determined from avail_in and data_type</span> |
| <a name="l00902"></a>00902 <span class="comment"> as noted in the description for the Z_BLOCK flush parameter for inflate.</span> |
| <a name="l00903"></a>00903 <span class="comment"></span> |
| <a name="l00904"></a>00904 <span class="comment"> inflateMark returns the value noted above or -1 << 16 if the provided</span> |
| <a name="l00905"></a>00905 <span class="comment"> source stream state was inconsistent.</span> |
| <a name="l00906"></a>00906 <span class="comment">*/</span> |
| <a name="l00907"></a>00907 |
| <a name="l00908"></a>00908 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateGetHeader <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00909"></a>00909 gz_headerp head)); |
| <a name="l00910"></a>00910 <span class="comment">/*</span> |
| <a name="l00911"></a>00911 <span class="comment"> inflateGetHeader() requests that gzip header information be stored in the</span> |
| <a name="l00912"></a>00912 <span class="comment"> provided gz_header structure. inflateGetHeader() may be called after</span> |
| <a name="l00913"></a>00913 <span class="comment"> inflateInit2() or inflateReset(), and before the first call of inflate().</span> |
| <a name="l00914"></a>00914 <span class="comment"> As inflate() processes the gzip stream, head->done is zero until the header</span> |
| <a name="l00915"></a>00915 <span class="comment"> is completed, at which time head->done is set to one. If a zlib stream is</span> |
| <a name="l00916"></a>00916 <span class="comment"> being decoded, then head->done is set to -1 to indicate that there will be</span> |
| <a name="l00917"></a>00917 <span class="comment"> no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be</span> |
| <a name="l00918"></a>00918 <span class="comment"> used to force inflate() to return immediately after header processing is</span> |
| <a name="l00919"></a>00919 <span class="comment"> complete and before any actual data is decompressed.</span> |
| <a name="l00920"></a>00920 <span class="comment"></span> |
| <a name="l00921"></a>00921 <span class="comment"> The text, time, xflags, and os fields are filled in with the gzip header</span> |
| <a name="l00922"></a>00922 <span class="comment"> contents. hcrc is set to true if there is a header CRC. (The header CRC</span> |
| <a name="l00923"></a>00923 <span class="comment"> was valid if done is set to one.) If extra is not Z_NULL, then extra_max</span> |
| <a name="l00924"></a>00924 <span class="comment"> contains the maximum number of bytes to write to extra. Once done is true,</span> |
| <a name="l00925"></a>00925 <span class="comment"> extra_len contains the actual extra field length, and extra contains the</span> |
| <a name="l00926"></a>00926 <span class="comment"> extra field, or that field truncated if extra_max is less than extra_len.</span> |
| <a name="l00927"></a>00927 <span class="comment"> If name is not Z_NULL, then up to name_max characters are written there,</span> |
| <a name="l00928"></a>00928 <span class="comment"> terminated with a zero unless the length is greater than name_max. If</span> |
| <a name="l00929"></a>00929 <span class="comment"> comment is not Z_NULL, then up to comm_max characters are written there,</span> |
| <a name="l00930"></a>00930 <span class="comment"> terminated with a zero unless the length is greater than comm_max. When any</span> |
| <a name="l00931"></a>00931 <span class="comment"> of extra, name, or comment are not Z_NULL and the respective field is not</span> |
| <a name="l00932"></a>00932 <span class="comment"> present in the header, then that field is set to Z_NULL to signal its</span> |
| <a name="l00933"></a>00933 <span class="comment"> absence. This allows the use of deflateSetHeader() with the returned</span> |
| <a name="l00934"></a>00934 <span class="comment"> structure to duplicate the header. However if those fields are set to</span> |
| <a name="l00935"></a>00935 <span class="comment"> allocated memory, then the application will need to save those pointers</span> |
| <a name="l00936"></a>00936 <span class="comment"> elsewhere so that they can be eventually freed.</span> |
| <a name="l00937"></a>00937 <span class="comment"></span> |
| <a name="l00938"></a>00938 <span class="comment"> If inflateGetHeader is not used, then the header information is simply</span> |
| <a name="l00939"></a>00939 <span class="comment"> discarded. The header is always checked for validity, including the header</span> |
| <a name="l00940"></a>00940 <span class="comment"> CRC if present. inflateReset() will reset the process to discard the header</span> |
| <a name="l00941"></a>00941 <span class="comment"> information. The application would need to call inflateGetHeader() again to</span> |
| <a name="l00942"></a>00942 <span class="comment"> retrieve the header from the next gzip stream.</span> |
| <a name="l00943"></a>00943 <span class="comment"></span> |
| <a name="l00944"></a>00944 <span class="comment"> inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source</span> |
| <a name="l00945"></a>00945 <span class="comment"> stream state was inconsistent.</span> |
| <a name="l00946"></a>00946 <span class="comment">*/</span> |
| <a name="l00947"></a>00947 |
| <a name="l00948"></a>00948 <span class="comment">/*</span> |
| <a name="l00949"></a>00949 <span class="comment">ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,</span> |
| <a name="l00950"></a>00950 <span class="comment"> unsigned char FAR *window));</span> |
| <a name="l00951"></a>00951 <span class="comment"></span> |
| <a name="l00952"></a>00952 <span class="comment"> Initialize the internal stream state for decompression using inflateBack()</span> |
| <a name="l00953"></a>00953 <span class="comment"> calls. The fields zalloc, zfree and opaque in strm must be initialized</span> |
| <a name="l00954"></a>00954 <span class="comment"> before the call. If zalloc and zfree are Z_NULL, then the default library-</span> |
| <a name="l00955"></a>00955 <span class="comment"> derived memory allocation routines are used. windowBits is the base two</span> |
| <a name="l00956"></a>00956 <span class="comment"> logarithm of the window size, in the range 8..15. window is a caller</span> |
| <a name="l00957"></a>00957 <span class="comment"> supplied buffer of that size. Except for special applications where it is</span> |
| <a name="l00958"></a>00958 <span class="comment"> assured that deflate was used with small window sizes, windowBits must be 15</span> |
| <a name="l00959"></a>00959 <span class="comment"> and a 32K byte window must be supplied to be able to decompress general</span> |
| <a name="l00960"></a>00960 <span class="comment"> deflate streams.</span> |
| <a name="l00961"></a>00961 <span class="comment"></span> |
| <a name="l00962"></a>00962 <span class="comment"> See inflateBack() for the usage of these routines.</span> |
| <a name="l00963"></a>00963 <span class="comment"></span> |
| <a name="l00964"></a>00964 <span class="comment"> inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of</span> |
| <a name="l00965"></a>00965 <span class="comment"> the paramaters are invalid, Z_MEM_ERROR if the internal state could not be</span> |
| <a name="l00966"></a>00966 <span class="comment"> allocated, or Z_VERSION_ERROR if the version of the library does not match</span> |
| <a name="l00967"></a>00967 <span class="comment"> the version of the header file.</span> |
| <a name="l00968"></a>00968 <span class="comment">*/</span> |
| <a name="l00969"></a>00969 |
| <a name="l00970"></a>00970 <span class="keyword">typedef</span> unsigned (*in_func) <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keywordtype">void</span> <a class="code" href="zconf_8h.html#aef060b3456fdcc093a7210a762d5f2ed">FAR</a> *, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> FAR * FAR *)); |
| <a name="l00971"></a>00971 typedef <span class="keywordtype">int</span> (*out_func) <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keywordtype">void</span> FAR *, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> FAR *, <span class="keywordtype">unsigned</span>)); |
| <a name="l00972"></a>00972 |
| <a name="l00973"></a>00973 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateBack <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l00974"></a>00974 in_func in, <span class="keywordtype">void</span> FAR *in_desc, |
| <a name="l00975"></a>00975 out_func out, <span class="keywordtype">void</span> FAR *out_desc)); |
| <a name="l00976"></a>00976 <span class="comment">/*</span> |
| <a name="l00977"></a>00977 <span class="comment"> inflateBack() does a raw inflate with a single call using a call-back</span> |
| <a name="l00978"></a>00978 <span class="comment"> interface for input and output. This is more efficient than inflate() for</span> |
| <a name="l00979"></a>00979 <span class="comment"> file i/o applications in that it avoids copying between the output and the</span> |
| <a name="l00980"></a>00980 <span class="comment"> sliding window by simply making the window itself the output buffer. This</span> |
| <a name="l00981"></a>00981 <span class="comment"> function trusts the application to not change the output buffer passed by</span> |
| <a name="l00982"></a>00982 <span class="comment"> the output function, at least until inflateBack() returns.</span> |
| <a name="l00983"></a>00983 <span class="comment"></span> |
| <a name="l00984"></a>00984 <span class="comment"> inflateBackInit() must be called first to allocate the internal state</span> |
| <a name="l00985"></a>00985 <span class="comment"> and to initialize the state with the user-provided window buffer.</span> |
| <a name="l00986"></a>00986 <span class="comment"> inflateBack() may then be used multiple times to inflate a complete, raw</span> |
| <a name="l00987"></a>00987 <span class="comment"> deflate stream with each call. inflateBackEnd() is then called to free the</span> |
| <a name="l00988"></a>00988 <span class="comment"> allocated state.</span> |
| <a name="l00989"></a>00989 <span class="comment"></span> |
| <a name="l00990"></a>00990 <span class="comment"> A raw deflate stream is one with no zlib or gzip header or trailer.</span> |
| <a name="l00991"></a>00991 <span class="comment"> This routine would normally be used in a utility that reads zip or gzip</span> |
| <a name="l00992"></a>00992 <span class="comment"> files and writes out uncompressed files. The utility would decode the</span> |
| <a name="l00993"></a>00993 <span class="comment"> header and process the trailer on its own, hence this routine expects only</span> |
| <a name="l00994"></a>00994 <span class="comment"> the raw deflate stream to decompress. This is different from the normal</span> |
| <a name="l00995"></a>00995 <span class="comment"> behavior of inflate(), which expects either a zlib or gzip header and</span> |
| <a name="l00996"></a>00996 <span class="comment"> trailer around the deflate stream.</span> |
| <a name="l00997"></a>00997 <span class="comment"></span> |
| <a name="l00998"></a>00998 <span class="comment"> inflateBack() uses two subroutines supplied by the caller that are then</span> |
| <a name="l00999"></a>00999 <span class="comment"> called by inflateBack() for input and output. inflateBack() calls those</span> |
| <a name="l01000"></a>01000 <span class="comment"> routines until it reads a complete deflate stream and writes out all of the</span> |
| <a name="l01001"></a>01001 <span class="comment"> uncompressed data, or until it encounters an error. The function's</span> |
| <a name="l01002"></a>01002 <span class="comment"> parameters and return types are defined above in the in_func and out_func</span> |
| <a name="l01003"></a>01003 <span class="comment"> typedefs. inflateBack() will call in(in_desc, &buf) which should return the</span> |
| <a name="l01004"></a>01004 <span class="comment"> number of bytes of provided input, and a pointer to that input in buf. If</span> |
| <a name="l01005"></a>01005 <span class="comment"> there is no input available, in() must return zero--buf is ignored in that</span> |
| <a name="l01006"></a>01006 <span class="comment"> case--and inflateBack() will return a buffer error. inflateBack() will call</span> |
| <a name="l01007"></a>01007 <span class="comment"> out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()</span> |
| <a name="l01008"></a>01008 <span class="comment"> should return zero on success, or non-zero on failure. If out() returns</span> |
| <a name="l01009"></a>01009 <span class="comment"> non-zero, inflateBack() will return with an error. Neither in() nor out()</span> |
| <a name="l01010"></a>01010 <span class="comment"> are permitted to change the contents of the window provided to</span> |
| <a name="l01011"></a>01011 <span class="comment"> inflateBackInit(), which is also the buffer that out() uses to write from.</span> |
| <a name="l01012"></a>01012 <span class="comment"> The length written by out() will be at most the window size. Any non-zero</span> |
| <a name="l01013"></a>01013 <span class="comment"> amount of input may be provided by in().</span> |
| <a name="l01014"></a>01014 <span class="comment"></span> |
| <a name="l01015"></a>01015 <span class="comment"> For convenience, inflateBack() can be provided input on the first call by</span> |
| <a name="l01016"></a>01016 <span class="comment"> setting strm->next_in and strm->avail_in. If that input is exhausted, then</span> |
| <a name="l01017"></a>01017 <span class="comment"> in() will be called. Therefore strm->next_in must be initialized before</span> |
| <a name="l01018"></a>01018 <span class="comment"> calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called</span> |
| <a name="l01019"></a>01019 <span class="comment"> immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in</span> |
| <a name="l01020"></a>01020 <span class="comment"> must also be initialized, and then if strm->avail_in is not zero, input will</span> |
| <a name="l01021"></a>01021 <span class="comment"> initially be taken from strm->next_in[0 .. strm->avail_in - 1].</span> |
| <a name="l01022"></a>01022 <span class="comment"></span> |
| <a name="l01023"></a>01023 <span class="comment"> The in_desc and out_desc parameters of inflateBack() is passed as the</span> |
| <a name="l01024"></a>01024 <span class="comment"> first parameter of in() and out() respectively when they are called. These</span> |
| <a name="l01025"></a>01025 <span class="comment"> descriptors can be optionally used to pass any information that the caller-</span> |
| <a name="l01026"></a>01026 <span class="comment"> supplied in() and out() functions need to do their job.</span> |
| <a name="l01027"></a>01027 <span class="comment"></span> |
| <a name="l01028"></a>01028 <span class="comment"> On return, inflateBack() will set strm->next_in and strm->avail_in to</span> |
| <a name="l01029"></a>01029 <span class="comment"> pass back any unused input that was provided by the last in() call. The</span> |
| <a name="l01030"></a>01030 <span class="comment"> return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR</span> |
| <a name="l01031"></a>01031 <span class="comment"> if in() or out() returned an error, Z_DATA_ERROR if there was a format error</span> |
| <a name="l01032"></a>01032 <span class="comment"> in the deflate stream (in which case strm->msg is set to indicate the nature</span> |
| <a name="l01033"></a>01033 <span class="comment"> of the error), or Z_STREAM_ERROR if the stream was not properly initialized.</span> |
| <a name="l01034"></a>01034 <span class="comment"> In the case of Z_BUF_ERROR, an input or output error can be distinguished</span> |
| <a name="l01035"></a>01035 <span class="comment"> using strm->next_in which will be Z_NULL only if in() returned an error. If</span> |
| <a name="l01036"></a>01036 <span class="comment"> strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning</span> |
| <a name="l01037"></a>01037 <span class="comment"> non-zero. (in() will always be called before out(), so strm->next_in is</span> |
| <a name="l01038"></a>01038 <span class="comment"> assured to be defined if out() returns non-zero.) Note that inflateBack()</span> |
| <a name="l01039"></a>01039 <span class="comment"> cannot return Z_OK.</span> |
| <a name="l01040"></a>01040 <span class="comment">*/</span> |
| <a name="l01041"></a>01041 |
| <a name="l01042"></a>01042 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateBackEnd <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm)); |
| <a name="l01043"></a>01043 <span class="comment">/*</span> |
| <a name="l01044"></a>01044 <span class="comment"> All memory allocated by inflateBackInit() is freed.</span> |
| <a name="l01045"></a>01045 <span class="comment"></span> |
| <a name="l01046"></a>01046 <span class="comment"> inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream</span> |
| <a name="l01047"></a>01047 <span class="comment"> state was inconsistent.</span> |
| <a name="l01048"></a>01048 <span class="comment">*/</span> |
| <a name="l01049"></a>01049 |
| <a name="l01050"></a>01050 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> zlibCompileFlags <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keywordtype">void</span>)); |
| <a name="l01051"></a>01051 <span class="comment">/* Return flags indicating compile-time options.</span> |
| <a name="l01052"></a>01052 <span class="comment"></span> |
| <a name="l01053"></a>01053 <span class="comment"> Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:</span> |
| <a name="l01054"></a>01054 <span class="comment"> 1.0: size of uInt</span> |
| <a name="l01055"></a>01055 <span class="comment"> 3.2: size of uLong</span> |
| <a name="l01056"></a>01056 <span class="comment"> 5.4: size of voidpf (pointer)</span> |
| <a name="l01057"></a>01057 <span class="comment"> 7.6: size of z_off_t</span> |
| <a name="l01058"></a>01058 <span class="comment"></span> |
| <a name="l01059"></a>01059 <span class="comment"> Compiler, assembler, and debug options:</span> |
| <a name="l01060"></a>01060 <span class="comment"> 8: DEBUG</span> |
| <a name="l01061"></a>01061 <span class="comment"> 9: ASMV or ASMINF -- use ASM code</span> |
| <a name="l01062"></a>01062 <span class="comment"> 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention</span> |
| <a name="l01063"></a>01063 <span class="comment"> 11: 0 (reserved)</span> |
| <a name="l01064"></a>01064 <span class="comment"></span> |
| <a name="l01065"></a>01065 <span class="comment"> One-time table building (smaller code, but not thread-safe if true):</span> |
| <a name="l01066"></a>01066 <span class="comment"> 12: BUILDFIXED -- build static block decoding tables when needed</span> |
| <a name="l01067"></a>01067 <span class="comment"> 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed</span> |
| <a name="l01068"></a>01068 <span class="comment"> 14,15: 0 (reserved)</span> |
| <a name="l01069"></a>01069 <span class="comment"></span> |
| <a name="l01070"></a>01070 <span class="comment"> Library content (indicates missing functionality):</span> |
| <a name="l01071"></a>01071 <span class="comment"> 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking</span> |
| <a name="l01072"></a>01072 <span class="comment"> deflate code when not needed)</span> |
| <a name="l01073"></a>01073 <span class="comment"> 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect</span> |
| <a name="l01074"></a>01074 <span class="comment"> and decode gzip streams (to avoid linking crc code)</span> |
| <a name="l01075"></a>01075 <span class="comment"> 18-19: 0 (reserved)</span> |
| <a name="l01076"></a>01076 <span class="comment"></span> |
| <a name="l01077"></a>01077 <span class="comment"> Operation variations (changes in library functionality):</span> |
| <a name="l01078"></a>01078 <span class="comment"> 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate</span> |
| <a name="l01079"></a>01079 <span class="comment"> 21: FASTEST -- deflate algorithm with only one, lowest compression level</span> |
| <a name="l01080"></a>01080 <span class="comment"> 22,23: 0 (reserved)</span> |
| <a name="l01081"></a>01081 <span class="comment"></span> |
| <a name="l01082"></a>01082 <span class="comment"> The sprintf variant used by gzprintf (zero is best):</span> |
| <a name="l01083"></a>01083 <span class="comment"> 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format</span> |
| <a name="l01084"></a>01084 <span class="comment"> 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!</span> |
| <a name="l01085"></a>01085 <span class="comment"> 26: 0 = returns value, 1 = void -- 1 means inferred string length returned</span> |
| <a name="l01086"></a>01086 <span class="comment"></span> |
| <a name="l01087"></a>01087 <span class="comment"> Remainder:</span> |
| <a name="l01088"></a>01088 <span class="comment"> 27-31: 0 (reserved)</span> |
| <a name="l01089"></a>01089 <span class="comment"> */</span> |
| <a name="l01090"></a>01090 |
| <a name="l01091"></a>01091 |
| <a name="l01092"></a>01092 <span class="comment">/* utility functions */</span> |
| <a name="l01093"></a>01093 |
| <a name="l01094"></a>01094 <span class="comment">/*</span> |
| <a name="l01095"></a>01095 <span class="comment"> The following utility functions are implemented on top of the basic</span> |
| <a name="l01096"></a>01096 <span class="comment"> stream-oriented functions. To simplify the interface, some default options</span> |
| <a name="l01097"></a>01097 <span class="comment"> are assumed (compression level and memory usage, standard memory allocation</span> |
| <a name="l01098"></a>01098 <span class="comment"> functions). The source code of these utility functions can be modified if</span> |
| <a name="l01099"></a>01099 <span class="comment"> you need special options.</span> |
| <a name="l01100"></a>01100 <span class="comment">*/</span> |
| <a name="l01101"></a>01101 |
| <a name="l01102"></a>01102 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> compress <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *dest, <a class="code" href="zconf_8h.html#a0426a5a0ed418ec4ae15af8281c64254">uLongf</a> *destLen, |
| <a name="l01103"></a>01103 <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *source, <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> sourceLen)); |
| <a name="l01104"></a>01104 <span class="comment">/*</span> |
| <a name="l01105"></a>01105 <span class="comment"> Compresses the source buffer into the destination buffer. sourceLen is</span> |
| <a name="l01106"></a>01106 <span class="comment"> the byte length of the source buffer. Upon entry, destLen is the total size</span> |
| <a name="l01107"></a>01107 <span class="comment"> of the destination buffer, which must be at least the value returned by</span> |
| <a name="l01108"></a>01108 <span class="comment"> compressBound(sourceLen). Upon exit, destLen is the actual size of the</span> |
| <a name="l01109"></a>01109 <span class="comment"> compressed buffer.</span> |
| <a name="l01110"></a>01110 <span class="comment"></span> |
| <a name="l01111"></a>01111 <span class="comment"> compress returns Z_OK if success, Z_MEM_ERROR if there was not</span> |
| <a name="l01112"></a>01112 <span class="comment"> enough memory, Z_BUF_ERROR if there was not enough room in the output</span> |
| <a name="l01113"></a>01113 <span class="comment"> buffer.</span> |
| <a name="l01114"></a>01114 <span class="comment">*/</span> |
| <a name="l01115"></a>01115 |
| <a name="l01116"></a>01116 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> compress2 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *dest, <a class="code" href="zconf_8h.html#a0426a5a0ed418ec4ae15af8281c64254">uLongf</a> *destLen, |
| <a name="l01117"></a>01117 <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *source, <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> sourceLen, |
| <a name="l01118"></a>01118 <span class="keywordtype">int</span> level)); |
| <a name="l01119"></a>01119 <span class="comment">/*</span> |
| <a name="l01120"></a>01120 <span class="comment"> Compresses the source buffer into the destination buffer. The level</span> |
| <a name="l01121"></a>01121 <span class="comment"> parameter has the same meaning as in deflateInit. sourceLen is the byte</span> |
| <a name="l01122"></a>01122 <span class="comment"> length of the source buffer. Upon entry, destLen is the total size of the</span> |
| <a name="l01123"></a>01123 <span class="comment"> destination buffer, which must be at least the value returned by</span> |
| <a name="l01124"></a>01124 <span class="comment"> compressBound(sourceLen). Upon exit, destLen is the actual size of the</span> |
| <a name="l01125"></a>01125 <span class="comment"> compressed buffer.</span> |
| <a name="l01126"></a>01126 <span class="comment"></span> |
| <a name="l01127"></a>01127 <span class="comment"> compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough</span> |
| <a name="l01128"></a>01128 <span class="comment"> memory, Z_BUF_ERROR if there was not enough room in the output buffer,</span> |
| <a name="l01129"></a>01129 <span class="comment"> Z_STREAM_ERROR if the level parameter is invalid.</span> |
| <a name="l01130"></a>01130 <span class="comment">*/</span> |
| <a name="l01131"></a>01131 |
| <a name="l01132"></a>01132 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> compressBound <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> sourceLen)); |
| <a name="l01133"></a>01133 <span class="comment">/*</span> |
| <a name="l01134"></a>01134 <span class="comment"> compressBound() returns an upper bound on the compressed size after</span> |
| <a name="l01135"></a>01135 <span class="comment"> compress() or compress2() on sourceLen bytes. It would be used before a</span> |
| <a name="l01136"></a>01136 <span class="comment"> compress() or compress2() call to allocate the destination buffer.</span> |
| <a name="l01137"></a>01137 <span class="comment">*/</span> |
| <a name="l01138"></a>01138 |
| <a name="l01139"></a>01139 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> uncompress <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *dest, <a class="code" href="zconf_8h.html#a0426a5a0ed418ec4ae15af8281c64254">uLongf</a> *destLen, |
| <a name="l01140"></a>01140 <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *source, <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> sourceLen)); |
| <a name="l01141"></a>01141 <span class="comment">/*</span> |
| <a name="l01142"></a>01142 <span class="comment"> Decompresses the source buffer into the destination buffer. sourceLen is</span> |
| <a name="l01143"></a>01143 <span class="comment"> the byte length of the source buffer. Upon entry, destLen is the total size</span> |
| <a name="l01144"></a>01144 <span class="comment"> of the destination buffer, which must be large enough to hold the entire</span> |
| <a name="l01145"></a>01145 <span class="comment"> uncompressed data. (The size of the uncompressed data must have been saved</span> |
| <a name="l01146"></a>01146 <span class="comment"> previously by the compressor and transmitted to the decompressor by some</span> |
| <a name="l01147"></a>01147 <span class="comment"> mechanism outside the scope of this compression library.) Upon exit, destLen</span> |
| <a name="l01148"></a>01148 <span class="comment"> is the actual size of the uncompressed buffer.</span> |
| <a name="l01149"></a>01149 <span class="comment"></span> |
| <a name="l01150"></a>01150 <span class="comment"> uncompress returns Z_OK if success, Z_MEM_ERROR if there was not</span> |
| <a name="l01151"></a>01151 <span class="comment"> enough memory, Z_BUF_ERROR if there was not enough room in the output</span> |
| <a name="l01152"></a>01152 <span class="comment"> buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.</span> |
| <a name="l01153"></a>01153 <span class="comment">*/</span> |
| <a name="l01154"></a>01154 |
| <a name="l01155"></a>01155 |
| <a name="l01156"></a>01156 <span class="comment">/* gzip file access functions */</span> |
| <a name="l01157"></a>01157 |
| <a name="l01158"></a>01158 <span class="comment">/*</span> |
| <a name="l01159"></a>01159 <span class="comment"> This library supports reading and writing files in gzip (.gz) format with</span> |
| <a name="l01160"></a>01160 <span class="comment"> an interface similar to that of stdio, using the functions that start with</span> |
| <a name="l01161"></a>01161 <span class="comment"> "gz". The gzip format is different from the zlib format. gzip is a gzip</span> |
| <a name="l01162"></a>01162 <span class="comment"> wrapper, documented in RFC 1952, wrapped around a deflate stream.</span> |
| <a name="l01163"></a>01163 <span class="comment">*/</span> |
| <a name="l01164"></a>01164 |
| <a name="l01165"></a><a class="code" href="zlib_8h.html#acd0143ddd532551631ecc7093fd7adfc">01165</a> typedef <a class="code" href="zconf_8h.html#aa3397ff439b5e076528b04bc9b8b086a">voidp</a> <a class="code" href="zlib_8h.html#acd0143ddd532551631ecc7093fd7adfc">gzFile</a>; <span class="comment">/* opaque gzip file descriptor */</span> |
| <a name="l01166"></a>01166 |
| <a name="l01167"></a>01167 <span class="comment">/*</span> |
| <a name="l01168"></a>01168 <span class="comment">ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));</span> |
| <a name="l01169"></a>01169 <span class="comment"></span> |
| <a name="l01170"></a>01170 <span class="comment"> Opens a gzip (.gz) file for reading or writing. The mode parameter is as</span> |
| <a name="l01171"></a>01171 <span class="comment"> in fopen ("rb" or "wb") but can also include a compression level ("wb9") or</span> |
| <a name="l01172"></a>01172 <span class="comment"> a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only</span> |
| <a name="l01173"></a>01173 <span class="comment"> compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'</span> |
| <a name="l01174"></a>01174 <span class="comment"> for fixed code compression as in "wb9F". (See the description of</span> |
| <a name="l01175"></a>01175 <span class="comment"> deflateInit2 for more information about the strategy parameter.) Also "a"</span> |
| <a name="l01176"></a>01176 <span class="comment"> can be used instead of "w" to request that the gzip stream that will be</span> |
| <a name="l01177"></a>01177 <span class="comment"> written be appended to the file. "+" will result in an error, since reading</span> |
| <a name="l01178"></a>01178 <span class="comment"> and writing to the same gzip file is not supported.</span> |
| <a name="l01179"></a>01179 <span class="comment"></span> |
| <a name="l01180"></a>01180 <span class="comment"> gzopen can be used to read a file which is not in gzip format; in this</span> |
| <a name="l01181"></a>01181 <span class="comment"> case gzread will directly read from the file without decompression.</span> |
| <a name="l01182"></a>01182 <span class="comment"></span> |
| <a name="l01183"></a>01183 <span class="comment"> gzopen returns NULL if the file could not be opened, if there was</span> |
| <a name="l01184"></a>01184 <span class="comment"> insufficient memory to allocate the gzFile state, or if an invalid mode was</span> |
| <a name="l01185"></a>01185 <span class="comment"> specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).</span> |
| <a name="l01186"></a>01186 <span class="comment"> errno can be checked to determine if the reason gzopen failed was that the</span> |
| <a name="l01187"></a>01187 <span class="comment"> file could not be opened.</span> |
| <a name="l01188"></a>01188 <span class="comment">*/</span> |
| <a name="l01189"></a>01189 |
| <a name="l01190"></a>01190 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> gzFile <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzdopen <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keywordtype">int</span> fd, <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <span class="keywordtype">char</span> *mode)); |
| <a name="l01191"></a>01191 <span class="comment">/*</span> |
| <a name="l01192"></a>01192 <span class="comment"> gzdopen associates a gzFile with the file descriptor fd. File descriptors</span> |
| <a name="l01193"></a>01193 <span class="comment"> are obtained from calls like open, dup, creat, pipe or fileno (if the file</span> |
| <a name="l01194"></a>01194 <span class="comment"> has been previously opened with fopen). The mode parameter is as in gzopen.</span> |
| <a name="l01195"></a>01195 <span class="comment"></span> |
| <a name="l01196"></a>01196 <span class="comment"> The next call of gzclose on the returned gzFile will also close the file</span> |
| <a name="l01197"></a>01197 <span class="comment"> descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor</span> |
| <a name="l01198"></a>01198 <span class="comment"> fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,</span> |
| <a name="l01199"></a>01199 <span class="comment"> mode);. The duplicated descriptor should be saved to avoid a leak, since</span> |
| <a name="l01200"></a>01200 <span class="comment"> gzdopen does not close fd if it fails.</span> |
| <a name="l01201"></a>01201 <span class="comment"></span> |
| <a name="l01202"></a>01202 <span class="comment"> gzdopen returns NULL if there was insufficient memory to allocate the</span> |
| <a name="l01203"></a>01203 <span class="comment"> gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not</span> |
| <a name="l01204"></a>01204 <span class="comment"> provided, or '+' was provided), or if fd is -1. The file descriptor is not</span> |
| <a name="l01205"></a>01205 <span class="comment"> used until the next gz* read, write, seek, or close operation, so gzdopen</span> |
| <a name="l01206"></a>01206 <span class="comment"> will not detect if fd is invalid (unless fd is -1).</span> |
| <a name="l01207"></a>01207 <span class="comment">*/</span> |
| <a name="l01208"></a>01208 |
| <a name="l01209"></a>01209 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzbuffer <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, <span class="keywordtype">unsigned</span> size)); |
| <a name="l01210"></a>01210 <span class="comment">/*</span> |
| <a name="l01211"></a>01211 <span class="comment"> Set the internal buffer size used by this library's functions. The</span> |
| <a name="l01212"></a>01212 <span class="comment"> default buffer size is 8192 bytes. This function must be called after</span> |
| <a name="l01213"></a>01213 <span class="comment"> gzopen() or gzdopen(), and before any other calls that read or write the</span> |
| <a name="l01214"></a>01214 <span class="comment"> file. The buffer memory allocation is always deferred to the first read or</span> |
| <a name="l01215"></a>01215 <span class="comment"> write. Two buffers are allocated, either both of the specified size when</span> |
| <a name="l01216"></a>01216 <span class="comment"> writing, or one of the specified size and the other twice that size when</span> |
| <a name="l01217"></a>01217 <span class="comment"> reading. A larger buffer size of, for example, 64K or 128K bytes will</span> |
| <a name="l01218"></a>01218 <span class="comment"> noticeably increase the speed of decompression (reading).</span> |
| <a name="l01219"></a>01219 <span class="comment"></span> |
| <a name="l01220"></a>01220 <span class="comment"> The new buffer size also affects the maximum length for gzprintf().</span> |
| <a name="l01221"></a>01221 <span class="comment"></span> |
| <a name="l01222"></a>01222 <span class="comment"> gzbuffer() returns 0 on success, or -1 on failure, such as being called</span> |
| <a name="l01223"></a>01223 <span class="comment"> too late.</span> |
| <a name="l01224"></a>01224 <span class="comment">*/</span> |
| <a name="l01225"></a>01225 |
| <a name="l01226"></a>01226 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzsetparams <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, <span class="keywordtype">int</span> level, <span class="keywordtype">int</span> strategy)); |
| <a name="l01227"></a>01227 <span class="comment">/*</span> |
| <a name="l01228"></a>01228 <span class="comment"> Dynamically update the compression level or strategy. See the description</span> |
| <a name="l01229"></a>01229 <span class="comment"> of deflateInit2 for the meaning of these parameters.</span> |
| <a name="l01230"></a>01230 <span class="comment"></span> |
| <a name="l01231"></a>01231 <span class="comment"> gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not</span> |
| <a name="l01232"></a>01232 <span class="comment"> opened for writing.</span> |
| <a name="l01233"></a>01233 <span class="comment">*/</span> |
| <a name="l01234"></a>01234 |
| <a name="l01235"></a>01235 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzread <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, <a class="code" href="zconf_8h.html#aa3397ff439b5e076528b04bc9b8b086a">voidp</a> buf, <span class="keywordtype">unsigned</span> len)); |
| <a name="l01236"></a>01236 <span class="comment">/*</span> |
| <a name="l01237"></a>01237 <span class="comment"> Reads the given number of uncompressed bytes from the compressed file. If</span> |
| <a name="l01238"></a>01238 <span class="comment"> the input file was not in gzip format, gzread copies the given number of</span> |
| <a name="l01239"></a>01239 <span class="comment"> bytes into the buffer.</span> |
| <a name="l01240"></a>01240 <span class="comment"></span> |
| <a name="l01241"></a>01241 <span class="comment"> After reaching the end of a gzip stream in the input, gzread will continue</span> |
| <a name="l01242"></a>01242 <span class="comment"> to read, looking for another gzip stream, or failing that, reading the rest</span> |
| <a name="l01243"></a>01243 <span class="comment"> of the input file directly without decompression. The entire input file</span> |
| <a name="l01244"></a>01244 <span class="comment"> will be read if gzread is called until it returns less than the requested</span> |
| <a name="l01245"></a>01245 <span class="comment"> len.</span> |
| <a name="l01246"></a>01246 <span class="comment"></span> |
| <a name="l01247"></a>01247 <span class="comment"> gzread returns the number of uncompressed bytes actually read, less than</span> |
| <a name="l01248"></a>01248 <span class="comment"> len for end of file, or -1 for error.</span> |
| <a name="l01249"></a>01249 <span class="comment">*/</span> |
| <a name="l01250"></a>01250 |
| <a name="l01251"></a>01251 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzwrite <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, |
| <a name="l01252"></a>01252 <a class="code" href="zconf_8h.html#a7db54413d7060e4b57868c2b23c0ec1c">voidpc</a> buf, <span class="keywordtype">unsigned</span> len)); |
| <a name="l01253"></a>01253 <span class="comment">/*</span> |
| <a name="l01254"></a>01254 <span class="comment"> Writes the given number of uncompressed bytes into the compressed file.</span> |
| <a name="l01255"></a>01255 <span class="comment"> gzwrite returns the number of uncompressed bytes written or 0 in case of</span> |
| <a name="l01256"></a>01256 <span class="comment"> error.</span> |
| <a name="l01257"></a>01257 <span class="comment">*/</span> |
| <a name="l01258"></a>01258 |
| <a name="l01259"></a>01259 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#af38d1853df635eee27f1a02f96457b22">ZEXPORTVA</a> gzprintf <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <span class="keywordtype">char</span> *format, ...)); |
| <a name="l01260"></a>01260 <span class="comment">/*</span> |
| <a name="l01261"></a>01261 <span class="comment"> Converts, formats, and writes the arguments to the compressed file under</span> |
| <a name="l01262"></a>01262 <span class="comment"> control of the format string, as in fprintf. gzprintf returns the number of</span> |
| <a name="l01263"></a>01263 <span class="comment"> uncompressed bytes actually written, or 0 in case of error. The number of</span> |
| <a name="l01264"></a>01264 <span class="comment"> uncompressed bytes written is limited to 8191, or one less than the buffer</span> |
| <a name="l01265"></a>01265 <span class="comment"> size given to gzbuffer(). The caller should assure that this limit is not</span> |
| <a name="l01266"></a>01266 <span class="comment"> exceeded. If it is exceeded, then gzprintf() will return an error (0) with</span> |
| <a name="l01267"></a>01267 <span class="comment"> nothing written. In this case, there may also be a buffer overflow with</span> |
| <a name="l01268"></a>01268 <span class="comment"> unpredictable consequences, which is possible only if zlib was compiled with</span> |
| <a name="l01269"></a>01269 <span class="comment"> the insecure functions sprintf() or vsprintf() because the secure snprintf()</span> |
| <a name="l01270"></a>01270 <span class="comment"> or vsnprintf() functions were not available. This can be determined using</span> |
| <a name="l01271"></a>01271 <span class="comment"> zlibCompileFlags().</span> |
| <a name="l01272"></a>01272 <span class="comment">*/</span> |
| <a name="l01273"></a>01273 |
| <a name="l01274"></a>01274 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzputs <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <span class="keywordtype">char</span> *s)); |
| <a name="l01275"></a>01275 <span class="comment">/*</span> |
| <a name="l01276"></a>01276 <span class="comment"> Writes the given null-terminated string to the compressed file, excluding</span> |
| <a name="l01277"></a>01277 <span class="comment"> the terminating null character.</span> |
| <a name="l01278"></a>01278 <span class="comment"></span> |
| <a name="l01279"></a>01279 <span class="comment"> gzputs returns the number of characters written, or -1 in case of error.</span> |
| <a name="l01280"></a>01280 <span class="comment">*/</span> |
| <a name="l01281"></a>01281 |
| <a name="l01282"></a>01282 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">char</span> * <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzgets <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, <span class="keywordtype">char</span> *buf, <span class="keywordtype">int</span> len)); |
| <a name="l01283"></a>01283 <span class="comment">/*</span> |
| <a name="l01284"></a>01284 <span class="comment"> Reads bytes from the compressed file until len-1 characters are read, or a</span> |
| <a name="l01285"></a>01285 <span class="comment"> newline character is read and transferred to buf, or an end-of-file</span> |
| <a name="l01286"></a>01286 <span class="comment"> condition is encountered. If any characters are read or if len == 1, the</span> |
| <a name="l01287"></a>01287 <span class="comment"> string is terminated with a null character. If no characters are read due</span> |
| <a name="l01288"></a>01288 <span class="comment"> to an end-of-file or len < 1, then the buffer is left untouched.</span> |
| <a name="l01289"></a>01289 <span class="comment"></span> |
| <a name="l01290"></a>01290 <span class="comment"> gzgets returns buf which is a null-terminated string, or it returns NULL</span> |
| <a name="l01291"></a>01291 <span class="comment"> for end-of-file or in case of error. If there was an error, the contents at</span> |
| <a name="l01292"></a>01292 <span class="comment"> buf are indeterminate.</span> |
| <a name="l01293"></a>01293 <span class="comment">*/</span> |
| <a name="l01294"></a>01294 |
| <a name="l01295"></a>01295 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzputc <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, <span class="keywordtype">int</span> c)); |
| <a name="l01296"></a>01296 <span class="comment">/*</span> |
| <a name="l01297"></a>01297 <span class="comment"> Writes c, converted to an unsigned char, into the compressed file. gzputc</span> |
| <a name="l01298"></a>01298 <span class="comment"> returns the value that was written, or -1 in case of error.</span> |
| <a name="l01299"></a>01299 <span class="comment">*/</span> |
| <a name="l01300"></a>01300 |
| <a name="l01301"></a>01301 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzgetc <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file)); |
| <a name="l01302"></a>01302 <span class="comment">/*</span> |
| <a name="l01303"></a>01303 <span class="comment"> Reads one byte from the compressed file. gzgetc returns this byte or -1</span> |
| <a name="l01304"></a>01304 <span class="comment"> in case of end of file or error.</span> |
| <a name="l01305"></a>01305 <span class="comment">*/</span> |
| <a name="l01306"></a>01306 |
| <a name="l01307"></a>01307 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzungetc <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keywordtype">int</span> c, gzFile file)); |
| <a name="l01308"></a>01308 <span class="comment">/*</span> |
| <a name="l01309"></a>01309 <span class="comment"> Push one character back onto the stream to be read as the first character</span> |
| <a name="l01310"></a>01310 <span class="comment"> on the next read. At least one character of push-back is allowed.</span> |
| <a name="l01311"></a>01311 <span class="comment"> gzungetc() returns the character pushed, or -1 on failure. gzungetc() will</span> |
| <a name="l01312"></a>01312 <span class="comment"> fail if c is -1, and may fail if a character has been pushed but not read</span> |
| <a name="l01313"></a>01313 <span class="comment"> yet. If gzungetc is used immediately after gzopen or gzdopen, at least the</span> |
| <a name="l01314"></a>01314 <span class="comment"> output buffer size of pushed characters is allowed. (See gzbuffer above.)</span> |
| <a name="l01315"></a>01315 <span class="comment"> The pushed character will be discarded if the stream is repositioned with</span> |
| <a name="l01316"></a>01316 <span class="comment"> gzseek() or gzrewind().</span> |
| <a name="l01317"></a>01317 <span class="comment">*/</span> |
| <a name="l01318"></a>01318 |
| <a name="l01319"></a>01319 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzflush <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, <span class="keywordtype">int</span> flush)); |
| <a name="l01320"></a>01320 <span class="comment">/*</span> |
| <a name="l01321"></a>01321 <span class="comment"> Flushes all pending output into the compressed file. The parameter flush</span> |
| <a name="l01322"></a>01322 <span class="comment"> is as in the deflate() function. The return value is the zlib error number</span> |
| <a name="l01323"></a>01323 <span class="comment"> (see function gzerror below). gzflush is only permitted when writing.</span> |
| <a name="l01324"></a>01324 <span class="comment"></span> |
| <a name="l01325"></a>01325 <span class="comment"> If the flush parameter is Z_FINISH, the remaining data is written and the</span> |
| <a name="l01326"></a>01326 <span class="comment"> gzip stream is completed in the output. If gzwrite() is called again, a new</span> |
| <a name="l01327"></a>01327 <span class="comment"> gzip stream will be started in the output. gzread() is able to read such</span> |
| <a name="l01328"></a>01328 <span class="comment"> concatented gzip streams.</span> |
| <a name="l01329"></a>01329 <span class="comment"></span> |
| <a name="l01330"></a>01330 <span class="comment"> gzflush should be called only when strictly necessary because it will</span> |
| <a name="l01331"></a>01331 <span class="comment"> degrade compression if called too often.</span> |
| <a name="l01332"></a>01332 <span class="comment">*/</span> |
| <a name="l01333"></a>01333 |
| <a name="l01334"></a>01334 <span class="comment">/*</span> |
| <a name="l01335"></a>01335 <span class="comment">ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,</span> |
| <a name="l01336"></a>01336 <span class="comment"> z_off_t offset, int whence));</span> |
| <a name="l01337"></a>01337 <span class="comment"></span> |
| <a name="l01338"></a>01338 <span class="comment"> Sets the starting position for the next gzread or gzwrite on the given</span> |
| <a name="l01339"></a>01339 <span class="comment"> compressed file. The offset represents a number of bytes in the</span> |
| <a name="l01340"></a>01340 <span class="comment"> uncompressed data stream. The whence parameter is defined as in lseek(2);</span> |
| <a name="l01341"></a>01341 <span class="comment"> the value SEEK_END is not supported.</span> |
| <a name="l01342"></a>01342 <span class="comment"></span> |
| <a name="l01343"></a>01343 <span class="comment"> If the file is opened for reading, this function is emulated but can be</span> |
| <a name="l01344"></a>01344 <span class="comment"> extremely slow. If the file is opened for writing, only forward seeks are</span> |
| <a name="l01345"></a>01345 <span class="comment"> supported; gzseek then compresses a sequence of zeroes up to the new</span> |
| <a name="l01346"></a>01346 <span class="comment"> starting position.</span> |
| <a name="l01347"></a>01347 <span class="comment"></span> |
| <a name="l01348"></a>01348 <span class="comment"> gzseek returns the resulting offset location as measured in bytes from</span> |
| <a name="l01349"></a>01349 <span class="comment"> the beginning of the uncompressed stream, or -1 in case of error, in</span> |
| <a name="l01350"></a>01350 <span class="comment"> particular if the file is opened for writing and the new starting position</span> |
| <a name="l01351"></a>01351 <span class="comment"> would be before the current position.</span> |
| <a name="l01352"></a>01352 <span class="comment">*/</span> |
| <a name="l01353"></a>01353 |
| <a name="l01354"></a>01354 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzrewind <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file)); |
| <a name="l01355"></a>01355 <span class="comment">/*</span> |
| <a name="l01356"></a>01356 <span class="comment"> Rewinds the given file. This function is supported only for reading.</span> |
| <a name="l01357"></a>01357 <span class="comment"></span> |
| <a name="l01358"></a>01358 <span class="comment"> gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)</span> |
| <a name="l01359"></a>01359 <span class="comment">*/</span> |
| <a name="l01360"></a>01360 |
| <a name="l01361"></a>01361 <span class="comment">/*</span> |
| <a name="l01362"></a>01362 <span class="comment">ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));</span> |
| <a name="l01363"></a>01363 <span class="comment"></span> |
| <a name="l01364"></a>01364 <span class="comment"> Returns the starting position for the next gzread or gzwrite on the given</span> |
| <a name="l01365"></a>01365 <span class="comment"> compressed file. This position represents a number of bytes in the</span> |
| <a name="l01366"></a>01366 <span class="comment"> uncompressed data stream, and is zero when starting, even if appending or</span> |
| <a name="l01367"></a>01367 <span class="comment"> reading a gzip stream from the middle of a file using gzdopen().</span> |
| <a name="l01368"></a>01368 <span class="comment"></span> |
| <a name="l01369"></a>01369 <span class="comment"> gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)</span> |
| <a name="l01370"></a>01370 <span class="comment">*/</span> |
| <a name="l01371"></a>01371 |
| <a name="l01372"></a>01372 <span class="comment">/*</span> |
| <a name="l01373"></a>01373 <span class="comment">ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));</span> |
| <a name="l01374"></a>01374 <span class="comment"></span> |
| <a name="l01375"></a>01375 <span class="comment"> Returns the current offset in the file being read or written. This offset</span> |
| <a name="l01376"></a>01376 <span class="comment"> includes the count of bytes that precede the gzip stream, for example when</span> |
| <a name="l01377"></a>01377 <span class="comment"> appending or when using gzdopen() for reading. When reading, the offset</span> |
| <a name="l01378"></a>01378 <span class="comment"> does not include as yet unused buffered input. This information can be used</span> |
| <a name="l01379"></a>01379 <span class="comment"> for a progress indicator. On error, gzoffset() returns -1.</span> |
| <a name="l01380"></a>01380 <span class="comment">*/</span> |
| <a name="l01381"></a>01381 |
| <a name="l01382"></a>01382 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzeof <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file)); |
| <a name="l01383"></a>01383 <span class="comment">/*</span> |
| <a name="l01384"></a>01384 <span class="comment"> Returns true (1) if the end-of-file indicator has been set while reading,</span> |
| <a name="l01385"></a>01385 <span class="comment"> false (0) otherwise. Note that the end-of-file indicator is set only if the</span> |
| <a name="l01386"></a>01386 <span class="comment"> read tried to go past the end of the input, but came up short. Therefore,</span> |
| <a name="l01387"></a>01387 <span class="comment"> just like feof(), gzeof() may return false even if there is no more data to</span> |
| <a name="l01388"></a>01388 <span class="comment"> read, in the event that the last read request was for the exact number of</span> |
| <a name="l01389"></a>01389 <span class="comment"> bytes remaining in the input file. This will happen if the input file size</span> |
| <a name="l01390"></a>01390 <span class="comment"> is an exact multiple of the buffer size.</span> |
| <a name="l01391"></a>01391 <span class="comment"></span> |
| <a name="l01392"></a>01392 <span class="comment"> If gzeof() returns true, then the read functions will return no more data,</span> |
| <a name="l01393"></a>01393 <span class="comment"> unless the end-of-file indicator is reset by gzclearerr() and the input file</span> |
| <a name="l01394"></a>01394 <span class="comment"> has grown since the previous end of file was detected.</span> |
| <a name="l01395"></a>01395 <span class="comment">*/</span> |
| <a name="l01396"></a>01396 |
| <a name="l01397"></a>01397 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzdirect <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file)); |
| <a name="l01398"></a>01398 <span class="comment">/*</span> |
| <a name="l01399"></a>01399 <span class="comment"> Returns true (1) if file is being copied directly while reading, or false</span> |
| <a name="l01400"></a>01400 <span class="comment"> (0) if file is a gzip stream being decompressed. This state can change from</span> |
| <a name="l01401"></a>01401 <span class="comment"> false to true while reading the input file if the end of a gzip stream is</span> |
| <a name="l01402"></a>01402 <span class="comment"> reached, but is followed by data that is not another gzip stream.</span> |
| <a name="l01403"></a>01403 <span class="comment"></span> |
| <a name="l01404"></a>01404 <span class="comment"> If the input file is empty, gzdirect() will return true, since the input</span> |
| <a name="l01405"></a>01405 <span class="comment"> does not contain a gzip stream.</span> |
| <a name="l01406"></a>01406 <span class="comment"></span> |
| <a name="l01407"></a>01407 <span class="comment"> If gzdirect() is used immediately after gzopen() or gzdopen() it will</span> |
| <a name="l01408"></a>01408 <span class="comment"> cause buffers to be allocated to allow reading the file to determine if it</span> |
| <a name="l01409"></a>01409 <span class="comment"> is a gzip file. Therefore if gzbuffer() is used, it should be called before</span> |
| <a name="l01410"></a>01410 <span class="comment"> gzdirect().</span> |
| <a name="l01411"></a>01411 <span class="comment">*/</span> |
| <a name="l01412"></a>01412 |
| <a name="l01413"></a>01413 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzclose <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file)); |
| <a name="l01414"></a>01414 <span class="comment">/*</span> |
| <a name="l01415"></a>01415 <span class="comment"> Flushes all pending output if necessary, closes the compressed file and</span> |
| <a name="l01416"></a>01416 <span class="comment"> deallocates the (de)compression state. Note that once file is closed, you</span> |
| <a name="l01417"></a>01417 <span class="comment"> cannot call gzerror with file, since its structures have been deallocated.</span> |
| <a name="l01418"></a>01418 <span class="comment"> gzclose must not be called more than once on the same file, just as free</span> |
| <a name="l01419"></a>01419 <span class="comment"> must not be called more than once on the same allocation.</span> |
| <a name="l01420"></a>01420 <span class="comment"></span> |
| <a name="l01421"></a>01421 <span class="comment"> gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a</span> |
| <a name="l01422"></a>01422 <span class="comment"> file operation error, or Z_OK on success.</span> |
| <a name="l01423"></a>01423 <span class="comment">*/</span> |
| <a name="l01424"></a>01424 |
| <a name="l01425"></a>01425 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzclose_r <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file)); |
| <a name="l01426"></a>01426 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzclose_w <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file)); |
| <a name="l01427"></a>01427 <span class="comment">/*</span> |
| <a name="l01428"></a>01428 <span class="comment"> Same as gzclose(), but gzclose_r() is only for use when reading, and</span> |
| <a name="l01429"></a>01429 <span class="comment"> gzclose_w() is only for use when writing or appending. The advantage to</span> |
| <a name="l01430"></a>01430 <span class="comment"> using these instead of gzclose() is that they avoid linking in zlib</span> |
| <a name="l01431"></a>01431 <span class="comment"> compression or decompression code that is not used when only reading or only</span> |
| <a name="l01432"></a>01432 <span class="comment"> writing respectively. If gzclose() is used, then both compression and</span> |
| <a name="l01433"></a>01433 <span class="comment"> decompression code will be included the application when linking to a static</span> |
| <a name="l01434"></a>01434 <span class="comment"> zlib library.</span> |
| <a name="l01435"></a>01435 <span class="comment">*/</span> |
| <a name="l01436"></a>01436 |
| <a name="l01437"></a>01437 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <span class="keywordtype">char</span> * <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzerror <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file, <span class="keywordtype">int</span> *errnum)); |
| <a name="l01438"></a>01438 <span class="comment">/*</span> |
| <a name="l01439"></a>01439 <span class="comment"> Returns the error message for the last error which occurred on the given</span> |
| <a name="l01440"></a>01440 <span class="comment"> compressed file. errnum is set to zlib error number. If an error occurred</span> |
| <a name="l01441"></a>01441 <span class="comment"> in the file system and not in the compression library, errnum is set to</span> |
| <a name="l01442"></a>01442 <span class="comment"> Z_ERRNO and the application may consult errno to get the exact error code.</span> |
| <a name="l01443"></a>01443 <span class="comment"></span> |
| <a name="l01444"></a>01444 <span class="comment"> The application must not modify the returned string. Future calls to</span> |
| <a name="l01445"></a>01445 <span class="comment"> this function may invalidate the previously returned string. If file is</span> |
| <a name="l01446"></a>01446 <span class="comment"> closed, then the string previously returned by gzerror will no longer be</span> |
| <a name="l01447"></a>01447 <span class="comment"> available.</span> |
| <a name="l01448"></a>01448 <span class="comment"></span> |
| <a name="l01449"></a>01449 <span class="comment"> gzerror() should be used to distinguish errors from end-of-file for those</span> |
| <a name="l01450"></a>01450 <span class="comment"> functions above that do not distinguish those cases in their return values.</span> |
| <a name="l01451"></a>01451 <span class="comment">*/</span> |
| <a name="l01452"></a>01452 |
| <a name="l01453"></a>01453 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">void</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzclearerr <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile file)); |
| <a name="l01454"></a>01454 <span class="comment">/*</span> |
| <a name="l01455"></a>01455 <span class="comment"> Clears the error and end-of-file flags for file. This is analogous to the</span> |
| <a name="l01456"></a>01456 <span class="comment"> clearerr() function in stdio. This is useful for continuing to read a gzip</span> |
| <a name="l01457"></a>01457 <span class="comment"> file that is being written concurrently.</span> |
| <a name="l01458"></a>01458 <span class="comment">*/</span> |
| <a name="l01459"></a>01459 |
| <a name="l01460"></a>01460 |
| <a name="l01461"></a>01461 <span class="comment">/* checksum functions */</span> |
| <a name="l01462"></a>01462 |
| <a name="l01463"></a>01463 <span class="comment">/*</span> |
| <a name="l01464"></a>01464 <span class="comment"> These functions are not related to compression but are exported</span> |
| <a name="l01465"></a>01465 <span class="comment"> anyway because they might be useful in applications using the compression</span> |
| <a name="l01466"></a>01466 <span class="comment"> library.</span> |
| <a name="l01467"></a>01467 <span class="comment">*/</span> |
| <a name="l01468"></a>01468 |
| <a name="l01469"></a>01469 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> adler32 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> adler, <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *buf, <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> len)); |
| <a name="l01470"></a>01470 <span class="comment">/*</span> |
| <a name="l01471"></a>01471 <span class="comment"> Update a running Adler-32 checksum with the bytes buf[0..len-1] and</span> |
| <a name="l01472"></a>01472 <span class="comment"> return the updated checksum. If buf is Z_NULL, this function returns the</span> |
| <a name="l01473"></a>01473 <span class="comment"> required initial value for the checksum.</span> |
| <a name="l01474"></a>01474 <span class="comment"></span> |
| <a name="l01475"></a>01475 <span class="comment"> An Adler-32 checksum is almost as reliable as a CRC32 but can be computed</span> |
| <a name="l01476"></a>01476 <span class="comment"> much faster.</span> |
| <a name="l01477"></a>01477 <span class="comment"></span> |
| <a name="l01478"></a>01478 <span class="comment"> Usage example:</span> |
| <a name="l01479"></a>01479 <span class="comment"></span> |
| <a name="l01480"></a>01480 <span class="comment"> uLong adler = adler32(0L, Z_NULL, 0);</span> |
| <a name="l01481"></a>01481 <span class="comment"></span> |
| <a name="l01482"></a>01482 <span class="comment"> while (read_buffer(buffer, length) != EOF) {</span> |
| <a name="l01483"></a>01483 <span class="comment"> adler = adler32(adler, buffer, length);</span> |
| <a name="l01484"></a>01484 <span class="comment"> }</span> |
| <a name="l01485"></a>01485 <span class="comment"> if (adler != original_adler) error();</span> |
| <a name="l01486"></a>01486 <span class="comment">*/</span> |
| <a name="l01487"></a>01487 |
| <a name="l01488"></a>01488 <span class="comment">/*</span> |
| <a name="l01489"></a>01489 <span class="comment">ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,</span> |
| <a name="l01490"></a>01490 <span class="comment"> z_off_t len2));</span> |
| <a name="l01491"></a>01491 <span class="comment"></span> |
| <a name="l01492"></a>01492 <span class="comment"> Combine two Adler-32 checksums into one. For two sequences of bytes, seq1</span> |
| <a name="l01493"></a>01493 <span class="comment"> and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for</span> |
| <a name="l01494"></a>01494 <span class="comment"> each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of</span> |
| <a name="l01495"></a>01495 <span class="comment"> seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.</span> |
| <a name="l01496"></a>01496 <span class="comment">*/</span> |
| <a name="l01497"></a>01497 |
| <a name="l01498"></a>01498 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> crc32 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> crc, <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <a class="code" href="zconf_8h.html#aeb722a888064be47e12d05f692e0f407">Bytef</a> *buf, <a class="code" href="zconf_8h.html#a87d141052bcd5ec8a80812a565c70369">uInt</a> len)); |
| <a name="l01499"></a>01499 <span class="comment">/*</span> |
| <a name="l01500"></a>01500 <span class="comment"> Update a running CRC-32 with the bytes buf[0..len-1] and return the</span> |
| <a name="l01501"></a>01501 <span class="comment"> updated CRC-32. If buf is Z_NULL, this function returns the required</span> |
| <a name="l01502"></a>01502 <span class="comment"> initial value for the for the crc. Pre- and post-conditioning (one's</span> |
| <a name="l01503"></a>01503 <span class="comment"> complement) is performed within this function so it shouldn't be done by the</span> |
| <a name="l01504"></a>01504 <span class="comment"> application.</span> |
| <a name="l01505"></a>01505 <span class="comment"></span> |
| <a name="l01506"></a>01506 <span class="comment"> Usage example:</span> |
| <a name="l01507"></a>01507 <span class="comment"></span> |
| <a name="l01508"></a>01508 <span class="comment"> uLong crc = crc32(0L, Z_NULL, 0);</span> |
| <a name="l01509"></a>01509 <span class="comment"></span> |
| <a name="l01510"></a>01510 <span class="comment"> while (read_buffer(buffer, length) != EOF) {</span> |
| <a name="l01511"></a>01511 <span class="comment"> crc = crc32(crc, buffer, length);</span> |
| <a name="l01512"></a>01512 <span class="comment"> }</span> |
| <a name="l01513"></a>01513 <span class="comment"> if (crc != original_crc) error();</span> |
| <a name="l01514"></a>01514 <span class="comment">*/</span> |
| <a name="l01515"></a>01515 |
| <a name="l01516"></a>01516 <span class="comment">/*</span> |
| <a name="l01517"></a>01517 <span class="comment">ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));</span> |
| <a name="l01518"></a>01518 <span class="comment"></span> |
| <a name="l01519"></a>01519 <span class="comment"> Combine two CRC-32 check values into one. For two sequences of bytes,</span> |
| <a name="l01520"></a>01520 <span class="comment"> seq1 and seq2 with lengths len1 and len2, CRC-32 check values were</span> |
| <a name="l01521"></a>01521 <span class="comment"> calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32</span> |
| <a name="l01522"></a>01522 <span class="comment"> check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and</span> |
| <a name="l01523"></a>01523 <span class="comment"> len2.</span> |
| <a name="l01524"></a>01524 <span class="comment">*/</span> |
| <a name="l01525"></a>01525 |
| <a name="l01526"></a>01526 |
| <a name="l01527"></a>01527 <span class="comment">/* various hacks, don't look :) */</span> |
| <a name="l01528"></a>01528 |
| <a name="l01529"></a>01529 <span class="comment">/* deflateInit and inflateInit are macros to allow checking the zlib version</span> |
| <a name="l01530"></a>01530 <span class="comment"> * and the compiler's view of z_stream:</span> |
| <a name="l01531"></a>01531 <span class="comment"> */</span> |
| <a name="l01532"></a>01532 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateInit_ <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, <span class="keywordtype">int</span> level, |
| <a name="l01533"></a>01533 <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <span class="keywordtype">char</span> *version, <span class="keywordtype">int</span> stream_size)); |
| <a name="l01534"></a>01534 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateInit_ <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, |
| <a name="l01535"></a>01535 <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <span class="keywordtype">char</span> *version, <span class="keywordtype">int</span> stream_size)); |
| <a name="l01536"></a>01536 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> deflateInit2_ <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, <span class="keywordtype">int</span> level, <span class="keywordtype">int</span> method, |
| <a name="l01537"></a>01537 <span class="keywordtype">int</span> windowBits, <span class="keywordtype">int</span> memLevel, |
| <a name="l01538"></a>01538 <span class="keywordtype">int</span> strategy, <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <span class="keywordtype">char</span> *version, |
| <a name="l01539"></a>01539 <span class="keywordtype">int</span> stream_size)); |
| <a name="l01540"></a>01540 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateInit2_ <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, <span class="keywordtype">int</span> windowBits, |
| <a name="l01541"></a>01541 <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <span class="keywordtype">char</span> *version, <span class="keywordtype">int</span> stream_size)); |
| <a name="l01542"></a>01542 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateBackInit_ <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp strm, <span class="keywordtype">int</span> windowBits, |
| <a name="l01543"></a>01543 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> FAR *window, |
| <a name="l01544"></a>01544 <a class="code" href="zconf_8h.html#a2c212835823e3c54a8ab6d95c652660e">const</a> <span class="keywordtype">char</span> *version, |
| <a name="l01545"></a>01545 <span class="keywordtype">int</span> stream_size)); |
| <a name="l01546"></a><a class="code" href="zlib_8h.html#ae7440c1c5a8becba6dbf410275dc0a5c">01546</a> <span class="preprocessor">#define deflateInit(strm, level) \</span> |
| <a name="l01547"></a>01547 <span class="preprocessor"> deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))</span> |
| <a name="l01548"></a><a class="code" href="zlib_8h.html#ad7c6797b618699f70f61323c5184f26e">01548</a> <span class="preprocessor"></span><span class="preprocessor">#define inflateInit(strm) \</span> |
| <a name="l01549"></a>01549 <span class="preprocessor"> inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))</span> |
| <a name="l01550"></a><a class="code" href="zlib_8h.html#a59b575a521efe7ea0d3b9dd3c8d315c1">01550</a> <span class="preprocessor"></span><span class="preprocessor">#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \</span> |
| <a name="l01551"></a>01551 <span class="preprocessor"> deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\</span> |
| <a name="l01552"></a>01552 <span class="preprocessor"> (strategy), ZLIB_VERSION, sizeof(z_stream))</span> |
| <a name="l01553"></a><a class="code" href="zlib_8h.html#a611fc206e69f34e812ca8b590982fdd5">01553</a> <span class="preprocessor"></span><span class="preprocessor">#define inflateInit2(strm, windowBits) \</span> |
| <a name="l01554"></a>01554 <span class="preprocessor"> inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))</span> |
| <a name="l01555"></a><a class="code" href="zlib_8h.html#a9253571ea0fc77cc53c330c0411b8c19">01555</a> <span class="preprocessor"></span><span class="preprocessor">#define inflateBackInit(strm, windowBits, window) \</span> |
| <a name="l01556"></a>01556 <span class="preprocessor"> inflateBackInit_((strm), (windowBits), (window), \</span> |
| <a name="l01557"></a>01557 <span class="preprocessor"> ZLIB_VERSION, sizeof(z_stream))</span> |
| <a name="l01558"></a>01558 <span class="preprocessor"></span> |
| <a name="l01559"></a>01559 <span class="comment">/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or</span> |
| <a name="l01560"></a>01560 <span class="comment"> * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if</span> |
| <a name="l01561"></a>01561 <span class="comment"> * both are true, the application gets the *64 functions, and the regular</span> |
| <a name="l01562"></a>01562 <span class="comment"> * functions are changed to 64 bits) -- in case these are set on systems</span> |
| <a name="l01563"></a>01563 <span class="comment"> * without large file support, _LFS64_LARGEFILE must also be true</span> |
| <a name="l01564"></a>01564 <span class="comment"> */</span> |
| <a name="l01565"></a>01565 <span class="preprocessor">#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0</span> |
| <a name="l01566"></a>01566 <span class="preprocessor"></span> <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> gzFile <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzopen64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *)); |
| <a name="l01567"></a>01567 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#ab9923767082c7a76924b31493e60d42c">z_off64_t</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzseek64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile, <a class="code" href="zconf_8h.html#ab9923767082c7a76924b31493e60d42c">z_off64_t</a>, <span class="keywordtype">int</span>)); |
| <a name="l01568"></a>01568 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#ab9923767082c7a76924b31493e60d42c">z_off64_t</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gztell64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile)); |
| <a name="l01569"></a>01569 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#ab9923767082c7a76924b31493e60d42c">z_off64_t</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzoffset64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile)); |
| <a name="l01570"></a>01570 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> adler32_combine64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#ab9923767082c7a76924b31493e60d42c">z_off64_t</a>)); |
| <a name="l01571"></a>01571 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> crc32_combine64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#ab9923767082c7a76924b31493e60d42c">z_off64_t</a>)); |
| <a name="l01572"></a>01572 <span class="preprocessor">#endif</span> |
| <a name="l01573"></a>01573 <span class="preprocessor"></span> |
| <a name="l01574"></a>01574 <span class="preprocessor">#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0</span> |
| <a name="l01575"></a>01575 <span class="preprocessor"></span><span class="preprocessor"># define gzopen gzopen64</span> |
| <a name="l01576"></a>01576 <span class="preprocessor"></span><span class="preprocessor"># define gzseek gzseek64</span> |
| <a name="l01577"></a>01577 <span class="preprocessor"></span><span class="preprocessor"># define gztell gztell64</span> |
| <a name="l01578"></a>01578 <span class="preprocessor"></span><span class="preprocessor"># define gzoffset gzoffset64</span> |
| <a name="l01579"></a>01579 <span class="preprocessor"></span><span class="preprocessor"># define adler32_combine adler32_combine64</span> |
| <a name="l01580"></a>01580 <span class="preprocessor"></span><span class="preprocessor"># define crc32_combine crc32_combine64</span> |
| <a name="l01581"></a>01581 <span class="preprocessor"></span><span class="preprocessor"># ifdef _LARGEFILE64_SOURCE</span> |
| <a name="l01582"></a>01582 <span class="preprocessor"></span> <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> gzFile <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzopen64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *)); |
| <a name="l01583"></a>01583 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzseek64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile, <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a>, <span class="keywordtype">int</span>)); |
| <a name="l01584"></a>01584 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gztell64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile)); |
| <a name="l01585"></a>01585 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzoffset64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile)); |
| <a name="l01586"></a>01586 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> adler32_combine64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a>)); |
| <a name="l01587"></a>01587 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> crc32_combine64 <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a>)); |
| <a name="l01588"></a>01588 <span class="preprocessor"># endif</span> |
| <a name="l01589"></a>01589 <span class="preprocessor"></span><span class="preprocessor">#else</span> |
| <a name="l01590"></a>01590 <span class="preprocessor"></span> <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> gzFile <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzopen <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *)); |
| <a name="l01591"></a>01591 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzseek <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile, <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a>, <span class="keywordtype">int</span>)); |
| <a name="l01592"></a>01592 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gztell <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile)); |
| <a name="l01593"></a>01593 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> gzoffset <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((gzFile)); |
| <a name="l01594"></a>01594 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> adler32_combine <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a>)); |
| <a name="l01595"></a>01595 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> crc32_combine <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#acd2a5701a3aecf6700d2c66c606ecb40">uLong</a>, <a class="code" href="zconf_8h.html#a8cf4661a88ec12823d7cbdd3fa629eb0">z_off_t</a>)); |
| <a name="l01596"></a>01596 <span class="preprocessor">#endif</span> |
| <a name="l01597"></a>01597 <span class="preprocessor"></span> |
| <a name="l01598"></a>01598 <span class="comment">/* hack for buggy compilers */</span> |
| <a name="l01599"></a>01599 <span class="preprocessor">#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)</span> |
| <a name="l01600"></a><a class="code" href="structinternal__state.html#ab000a3e3c901dd063859521988ad7e52">01600</a> <span class="preprocessor"></span> <span class="keyword">struct </span><a class="code" href="structinternal__state.html">internal_state</a> {<span class="keywordtype">int</span> <a class="code" href="structinternal__state.html#ab000a3e3c901dd063859521988ad7e52">dummy</a>;}; |
| <a name="l01601"></a>01601 <span class="preprocessor">#endif</span> |
| <a name="l01602"></a>01602 <span class="preprocessor"></span> |
| <a name="l01603"></a>01603 <span class="comment">/* undocumented functions */</span> |
| <a name="l01604"></a>01604 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> zError <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keywordtype">int</span>)); |
| <a name="l01605"></a>01605 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateSyncPoint <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp)); |
| <a name="l01606"></a>01606 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keyword">const</span> <a class="code" href="zconf_8h.html#a0426a5a0ed418ec4ae15af8281c64254">uLongf</a> * <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> get_crc_table <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((<span class="keywordtype">void</span>)); |
| <a name="l01607"></a>01607 <a class="code" href="zconf_8h.html#a49b7f5eccfcc99e53178581632bc9589">ZEXTERN</a> <span class="keywordtype">int</span> <a class="code" href="zconf_8h.html#a181415878f03b95a7094309d824a14b6">ZEXPORT</a> inflateUndermine <a class="code" href="zconf_8h.html#aa6c3c093d0900e1d96d07c91b53c1b5d">OF</a>((z_streamp, <span class="keywordtype">int</span>)); |
| <a name="l01608"></a>01608 |
| <a name="l01609"></a>01609 <span class="preprocessor">#ifdef __cplusplus</span> |
| <a name="l01610"></a>01610 <span class="preprocessor"></span>} |
| <a name="l01611"></a>01611 <span class="preprocessor">#endif</span> |
| <a name="l01612"></a>01612 <span class="preprocessor"></span> |
| <a name="l01613"></a>01613 <span class="preprocessor">#endif </span><span class="comment">/* ZLIB_H */</span> |
| </pre></div></div> |
| </div> |
| <div id="nav-path" class="navpath"> |
| <ul> |
| <li class="navelem"><a class="el" href="zlib_8h.html">zlib.h</a> </li> |
| <li class="footer">Generated on Tue Apr 12 2011 for activemq-cpp-3.3.0 by  |
| <a href="http://www.doxygen.org/index.html"> |
| <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li> |
| </ul> |
| </div> |
| |
| </body> |
| </html> |