aboutsummaryrefslogtreecommitdiff
path: root/man/man3/flate.html
blob: 4159103478007de590e637a9133636476e5472b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<head>
<title>flate(3) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>FLATE(3)</b><td align=right><b>FLATE(3)</b>
<tr><td width=20><td colspan=2>
    <br>
<p><font size=+1><b>NAME     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    deflateinit, deflate, deflatezlib, deflateblock, deflatezlibblock,
    inflateinit, inflate, inflatezlib, inflateblock, inflatezlibblock,
    flateerr, mkcrctab, blockcrc, adler32 &ndash; deflate compression<br>
    
</table>
<p><font size=+1><b>SYNOPSIS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>#include &lt;u.h&gt;<br>
    #include &lt;libc.h&gt;<br>
    #include &lt;flate.h&gt; 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deflateinit(void) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deflate(void *wr, int (*w)(void*,void*,int),<br>
     
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            void *rr, int (*r)(void*,void*,int),<br>
             int level, int debug) 
            <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
            
        </table>
        
    </table>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            
            
        </table>
        
    </table>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deflatezlib(void *wr, int (*w)(void*,void*,int),<br>
     
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            void *rr, int (*r)(void*,void*,int),<br>
             int level, int debug) 
            <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
            
        </table>
        
    </table>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            
            
        </table>
        
    </table>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deflateblock(uchar *dst, int dsize,<br>
     
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            uchar *src, int ssize,<br>
             int level, int debug) 
            <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
            
        </table>
        
    </table>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            
            
        </table>
        
    </table>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deflatezlibblock(uchar *dst, int dsize,<br>
     
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            uchar *src, int ssize,<br>
             int level, int debug) 
            <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
            
        </table>
        
    </table>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            
            
        </table>
        
    </table>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inflateinit(void) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inflate(void *wr, int (*w)(void*, void*, int),<br>
     
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            void *getr, int (*get)(void*)) 
            <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
            
        </table>
        
    </table>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            
            
        </table>
        
    </table>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inflatezlib(void *wr, int (*w)(void*, void*, int),<br>
     
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            void *getr, int (*get)(void*)) 
            <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
            
        </table>
        
    </table>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            
            
        </table>
        
    </table>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inflateblock(uchar *dst, int dsize,<br>
     
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            uchar *src, int ssize) 
            <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
            
        </table>
        
    </table>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            
            
        </table>
        
    </table>
    <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inflatezlibblock(uchar *dst, int dsize,<br>
     
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            uchar *src, int ssize) 
            <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
            
        </table>
        
    </table>
    </font></tt>
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        
        <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

            
            
        </table>
        
    </table>
    <tt><font size=+1>char &nbsp;&nbsp;&nbsp;&nbsp;*flateerr(int error) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>ulong &nbsp;&nbsp;&nbsp;*mkcrctab(ulong poly) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>ulong &nbsp;&nbsp;&nbsp;blockcrc(ulong *tab, ulong crc, void *buf, int n) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>ulong &nbsp;&nbsp;&nbsp;adler32(ulong adler, void *buf, int n)<br>
    </font></tt>
</table>
<p><font size=+1><b>DESCRIPTION     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    These routines compress and decompress data using the deflate
    compression algorithm, which is used for most gzip, zip, and zlib
    files. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Deflate</i> compresses input data retrieved by calls to <i>r</i> with arguments
    <i>rr</i>, an input buffer, and a count of bytes to read. <i>R</i> should return
    the number of bytes read; end of input is signaled by returning
    zero, an input error by returning a negative number. The compressed
    output is written to <i>w</i> with arguments <i>wr</i>, the
    output data, and the number of bytes to write. <i>W</i> should return
    the number of bytes written; writing fewer than the requested
    number of bytes is an error. <i>Level</i> indicates the amount of computation
    deflate should do while compressing the data. Higher <i>levels</i> usually
    take more time and produce smaller outputs. Valid
    values are 1 to 9, inclusive; 6 is a good compromise. If <i>debug</i>
    is non-zero, cryptic debugging information is produced on standard
    error. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Inflate</i> reverses the process, converting compressed data into
    uncompressed output. Input is retrieved one byte at a time by
    calling <i>get</i> with the argument <i>getr</i>. End of input of signaled by
    returning a negative value. The uncompressed output is written
    to <i>w</i>, which has the same interface as for <i>deflate</i>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Deflateblock</i> and <i>inflateblock</i> operate on blocks of memory but
    are otherwise similar to <i>deflate</i> and <i>inflate</i>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    The zlib functions are similar, but operate on files with a zlib
    header and trailer. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Deflateinit</i> or <i>inflateinit</i> must be called once before any call
    to the corresponding routines. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    If the above routines fail, they return a negative number indicating
    the problem. The possible values are <i>FlateNoMem</i>, <i>FlateInputFail</i>,
    <i>FlateOutputFail</i>, <i>FlateCorrupted</i>, and <i>FlateInternal</i>. <i>Flateerr</i> converts
    the number into a printable message. <i>FlateOk</i> is defined to be
    zero, the successful return value for <i>deflateinit</i>,
    <i>deflate</i>, <i>deflatezlib</i>, <i>inflateinit</i>, <i>inflate</i>, and <i>inflatezlib</i>. The
    block functions return the number of bytes produced when they
    succeed. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Mkcrctab</i> allocates (using <a href="../man3/malloc.html"><i>malloc</i>(3)</a>), initializes, and returns
    a table for rapid computation of 32 bit CRC values using the polynomial
    <i>poly</i>. <i>Blockcrc</i> uses <i>tab</i>, a table returned by <i>mkcrctab</i>, to update
    <i>crc</i> for the <i>n</i> bytes of data in <i>buf</i>, and returns the new value.
    <i>Crc</i> should initially be zero. <i>Blockcrc</i> pre-conditions and
    post-conditions <i>crc</i> by ones complementation. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Adler32</i> updates the Adler 32-bit checksum of the <i>n</i> butes of data
    in <i>buf.</i> The initial value of <i>adler</i> (that is, its value after seeing
    zero bytes) should be 1.<br>
    
</table>
<p><font size=+1><b>SOURCE     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>/usr/local/plan9/src/libflate<br>
    </font></tt>
</table>

<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>