summary refs log tree commit diff
path: root/doc/zlib/inflateInit2.3
blob: 5b8b49ac2ebc13b9326f40e6c4a7af32baad44db (plain) (blame)
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
.Dd January 15, 2017
.Dt INFLATEINIT2 3
.Os
.
.Sh NAME
.Nm inflateInit2
.Nd inflate compression options
.
.Sh LIBRARY
.Lb libz
.
.Sh SYNOPSIS
.In zlib.h
.Ft int
.Fn inflateInit2 "z_streamp strm" "int windowBits"
.
.Sh DESCRIPTION
This is another version of
.Xr inflateInit 3
with an extra parameter.
The fields
.Fa next_in ,
.Fa avail_in ,
.Fa zalloc ,
.Fa zfree
and
.Fa opaque
must be initialized before by the caller.
.
.Pp
The
.Fa windowBits
parameter is the base two logarithm
of the maximum window size
(the size of the history buffer).
It should be in the range 8..15
for this version of the library.
The default value is 15 if
.Xr inflateInit 3
is used instead.
.Fa windowBits
must be greater than or equal to the
.Fa windowBits
value provided to
.Xr deflateInit2 3
while compressing,
or it must be equal to 15 if
.Xr deflateInit2 3
was not used.
If a compressed stream with a larger window size
is given as input,
.Xr inflate 3
will return with the error code
.Dv Z_DATA_ERROR
instead of trying to allocate a larger window.
.
.Pp
.Fa windowBits
can also be zero
to request that
.Xr inflate 3
use the window size
in the zlib header
of the compressed stream.
.
.Pp
.Fa windowBits
can also be -8..-15
for raw inflate.
In this case,
.Fa -windowBits
determines the window size.
.Xr inflate 3
will then process raw deflate data,
not looking for a zlib or gzip header,
not generating a check value,
and not looking for any check values
for comparison at the end of the stream.
This is for use with other formats
that use the deflate compressed data format
such as zip.
Those formats provide their own check values.
If a custom format is developed
using the raw deflate format for compressed data,
it is recommended that a check value
such as an Adler-32 or a CRC-32
be applied to the uncompressed data
as is done in the zlib, gzip and zip formats.
For most applications,
the zlib format should be used as is.
Note that comments above on the use in
.Xr deflateInit2 3
applies to the magnitude of
.Fa windowBits .
.
.Pp
.Fa windowBits
can also be greater than 15
for optional gzip decoding.
Add 32 to
.Fa windowBits
to enable zlib and gzip decoding
with automatic header detection,
or add 16 to decode only the gzip format
.Po
the zlib format will return a
.Dv Z_DATA_ERROR
.Pc .
If a gzip stream is being decoded,
.Fa strm->adler
is a CRC-32 instead of an Adler-32.
Unlike the
.Xr gunzip 1
utility and
.Xr gzread 3 ,
.Xr inflate 3
will not automatically decode
concatenated gzip streams.
.Xr inflate 3
will return
.Dv Z_STREAM_END
at the end of the gzip stream.
The state would need to be reset
to continue decoding a subsequent gzip stream.
.
.Pp
.Fn inflateInit2
does not perform any decompression
apart from possibly reading the zlib header if present:
actual decompression will be done by
.Xr inflate 3 .
.Po
So
.Fa next_in
and
.Fa avail_in
may be modified,
but
.Fa next_out
and
.Fa avail_out
are unused and unchanged.
.Pc \&
The current implementation of
.Fn inflateInit2
does not process any header information \(em
that is deferred until
.Xr inflate 3
is called.
.
.Sh RETURN VALUES
.Fn inflateInit2
returns
.Dv Z_OK
if success,
.Dv Z_MEM_ERROR
if there was not enough memory,
.Dv Z_VERSION_ERROR
if the zlib library version
is incompatible with the version assumed by the caller,
or
.Dv Z_STREAM_ERROR
if the parameters are invalid,
such as a null pointer to the structure.
.Fa msg
is set to null if there is no error message.
.
.Sh SEE ALSO
.Xr deflateInit2 3 ,
.Xr inflateInit 3 ,
.Xr inflatePrime 3
.
.Sh HISTORY
This manual page was converted from
.In zlib.h
to mdoc format by
.An June McEnroe Aq Mt june@causal.agency .
.
.Sh AUTHORS
.An Jean-loup Gailly Aq Mt jloup@gzip.org
.An Mark Adler Aq Mt madler@alumni.caltech.edu
tr class='nohover-highlight'> 11 is what I use on macOS, but I feel like my eyes are working harder here. 2021-02-07Fully configure and rebind cwmJune McEnroe This is sort of a mix of trying to emulate macOS somewhat for my muscle memory and just rebinding some of the cwm defaults to use 4- rather than M-. 2021-02-07Add BintiJune McEnroe 2021-02-07Finish configuring xtermJune McEnroe 2021-02-06Enable tapping, reverse scroll, set scaling in wsconsctlJune McEnroe 2021-02-06Set root window to black on purple snowJune McEnroe 2021-02-06Add xmodmap configurationJune McEnroe 2021-02-06Add initial OpenBSD X configurationJune McEnroe cwm still needs a lot more rebinding, and I need to actually look at its other options. xterm definitely still needs some configuration, but I at least managed to get it to use a decent looking font. Very happy that OpenBSD includes Luxi Mono, which is what my usual font, Go Mono, is based on anyway. Still missing is xmodmap and such. 2021-02-06Add xterm output to schemeJune McEnroe