author | Ryan C. Gordon <icculus@icculus.org> |
Mon, 14 Mar 2005 11:49:30 +0000 | |
changeset 691 | 71d9affe0d8a |
parent 602 | 691c1eadb8b7 |
permissions | -rw-r--r-- |
602
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1 |
/* zlib.h -- interface of the 'zlib' general purpose compression library |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
2 |
version 1.2.1, November 17th, 2003 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
3 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
4 |
Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
5 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
6 |
This software is provided 'as-is', without any express or implied |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
7 |
warranty. In no event will the authors be held liable for any damages |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
8 |
arising from the use of this software. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
9 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
10 |
Permission is granted to anyone to use this software for any purpose, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
11 |
including commercial applications, and to alter it and redistribute it |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
12 |
freely, subject to the following restrictions: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
13 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
14 |
1. The origin of this software must not be misrepresented; you must not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
15 |
claim that you wrote the original software. If you use this software |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
16 |
in a product, an acknowledgment in the product documentation would be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
17 |
appreciated but is not required. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
18 |
2. Altered source versions must be plainly marked as such, and must not be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
19 |
misrepresented as being the original software. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
20 |
3. This notice may not be removed or altered from any source distribution. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
21 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
22 |
Jean-loup Gailly Mark Adler |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
23 |
jloup@gzip.org madler@alumni.caltech.edu |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
24 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
25 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
26 |
The data format used by the zlib library is described by RFCs (Request for |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
27 |
Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
28 |
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
29 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
30 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
31 |
#ifndef ZLIB_H |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
32 |
#define ZLIB_H |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
33 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
34 |
#include "zconf.h" |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
35 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
36 |
#ifdef __cplusplus |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
37 |
extern "C" { |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
38 |
#endif |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
39 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
40 |
#define ZLIB_VERSION "1.2.1" |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
41 |
#define ZLIB_VERNUM 0x1210 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
42 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
43 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
44 |
The 'zlib' compression library provides in-memory compression and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
45 |
decompression functions, including integrity checks of the uncompressed |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
46 |
data. This version of the library supports only one compression method |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
47 |
(deflation) but other algorithms will be added later and will have the same |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
48 |
stream interface. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
49 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
50 |
Compression can be done in a single step if the buffers are large |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
51 |
enough (for example if an input file is mmap'ed), or can be done by |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
52 |
repeated calls of the compression function. In the latter case, the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
53 |
application must provide more input and/or consume the output |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
54 |
(providing more output space) before each call. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
55 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
56 |
The compressed data format used by the in-memory functions is the zlib |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
57 |
format, which is a zlib wrapper documented in RFC 1950, wrapped around a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
58 |
deflate stream, which is itself documented in RFC 1951. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
59 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
60 |
The library also supports reading and writing files in gzip (.gz) format |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
61 |
with an interface similar to that of stdio using the functions that start |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
62 |
with "gz". The gzip format is different from the zlib format. gzip is a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
63 |
gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
64 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
65 |
The zlib format was designed to be compact and fast for use in memory |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
66 |
and on communications channels. The gzip format was designed for single- |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
67 |
file compression on file systems, has a larger header than zlib to maintain |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
68 |
directory information, and uses a different, slower check method than zlib. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
69 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
70 |
This library does not provide any functions to write gzip files in memory. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
71 |
However such functions could be easily written using zlib's deflate function, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
72 |
the documentation in the gzip RFC, and the examples in gzio.c. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
73 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
74 |
The library does not install any signal handler. The decoder checks |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
75 |
the consistency of the compressed data, so the library should never |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
76 |
crash even in case of corrupted input. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
77 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
78 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
79 |
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
80 |
typedef void (*free_func) OF((voidpf opaque, voidpf address)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
81 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
82 |
struct internal_state; |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
83 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
84 |
typedef struct z_stream_s { |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
85 |
Bytef *next_in; /* next input byte */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
86 |
uInt avail_in; /* number of bytes available at next_in */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
87 |
uLong total_in; /* total nb of input bytes read so far */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
88 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
89 |
Bytef *next_out; /* next output byte should be put there */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
90 |
uInt avail_out; /* remaining free space at next_out */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
91 |
uLong total_out; /* total nb of bytes output so far */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
92 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
93 |
char *msg; /* last error message, NULL if no error */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
94 |
struct internal_state FAR *state; /* not visible by applications */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
95 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
96 |
alloc_func zalloc; /* used to allocate the internal state */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
97 |
free_func zfree; /* used to free the internal state */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
98 |
voidpf opaque; /* private data object passed to zalloc and zfree */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
99 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
100 |
int data_type; /* best guess about the data type: ascii or binary */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
101 |
uLong adler; /* adler32 value of the uncompressed data */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
102 |
uLong reserved; /* reserved for future use */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
103 |
} z_stream; |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
104 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
105 |
typedef z_stream FAR *z_streamp; |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
106 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
107 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
108 |
The application must update next_in and avail_in when avail_in has |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
109 |
dropped to zero. It must update next_out and avail_out when avail_out |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
110 |
has dropped to zero. The application must initialize zalloc, zfree and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
111 |
opaque before calling the init function. All other fields are set by the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
112 |
compression library and must not be updated by the application. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
113 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
114 |
The opaque value provided by the application will be passed as the first |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
115 |
parameter for calls of zalloc and zfree. This can be useful for custom |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
116 |
memory management. The compression library attaches no meaning to the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
117 |
opaque value. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
118 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
119 |
zalloc must return Z_NULL if there is not enough memory for the object. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
120 |
If zlib is used in a multi-threaded application, zalloc and zfree must be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
121 |
thread safe. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
122 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
123 |
On 16-bit systems, the functions zalloc and zfree must be able to allocate |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
124 |
exactly 65536 bytes, but will not be required to allocate more than this |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
125 |
if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
126 |
pointers returned by zalloc for objects of exactly 65536 bytes *must* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
127 |
have their offset normalized to zero. The default allocation function |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
128 |
provided by this library ensures this (see zutil.c). To reduce memory |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
129 |
requirements and avoid any allocation of 64K objects, at the expense of |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
130 |
compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
131 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
132 |
The fields total_in and total_out can be used for statistics or |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
133 |
progress reports. After compression, total_in holds the total size of |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
134 |
the uncompressed data and may be saved for use in the decompressor |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
135 |
(particularly if the decompressor wants to decompress everything in |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
136 |
a single step). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
137 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
138 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
139 |
/* constants */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
140 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
141 |
#define Z_NO_FLUSH 0 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
142 |
#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
143 |
#define Z_SYNC_FLUSH 2 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
144 |
#define Z_FULL_FLUSH 3 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
145 |
#define Z_FINISH 4 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
146 |
#define Z_BLOCK 5 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
147 |
/* Allowed flush values; see deflate() and inflate() below for details */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
148 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
149 |
#define Z_OK 0 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
150 |
#define Z_STREAM_END 1 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
151 |
#define Z_NEED_DICT 2 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
152 |
#define Z_ERRNO (-1) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
153 |
#define Z_STREAM_ERROR (-2) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
154 |
#define Z_DATA_ERROR (-3) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
155 |
#define Z_MEM_ERROR (-4) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
156 |
#define Z_BUF_ERROR (-5) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
157 |
#define Z_VERSION_ERROR (-6) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
158 |
/* Return codes for the compression/decompression functions. Negative |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
159 |
* values are errors, positive values are used for special but normal events. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
160 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
161 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
162 |
#define Z_NO_COMPRESSION 0 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
163 |
#define Z_BEST_SPEED 1 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
164 |
#define Z_BEST_COMPRESSION 9 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
165 |
#define Z_DEFAULT_COMPRESSION (-1) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
166 |
/* compression levels */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
167 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
168 |
#define Z_FILTERED 1 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
169 |
#define Z_HUFFMAN_ONLY 2 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
170 |
#define Z_RLE 3 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
171 |
#define Z_DEFAULT_STRATEGY 0 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
172 |
/* compression strategy; see deflateInit2() below for details */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
173 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
174 |
#define Z_BINARY 0 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
175 |
#define Z_ASCII 1 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
176 |
#define Z_UNKNOWN 2 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
177 |
/* Possible values of the data_type field (though see inflate()) */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
178 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
179 |
#define Z_DEFLATED 8 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
180 |
/* The deflate compression method (the only one supported in this version) */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
181 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
182 |
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
183 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
184 |
#define zlib_version zlibVersion() |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
185 |
/* for compatibility with versions < 1.0.2 */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
186 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
187 |
/* basic functions */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
188 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
189 |
ZEXTERN const char * ZEXPORT zlibVersion OF((void)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
190 |
/* The application can compare zlibVersion and ZLIB_VERSION for consistency. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
191 |
If the first character differs, the library code actually used is |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
192 |
not compatible with the zlib.h header file used by the application. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
193 |
This check is automatically made by deflateInit and inflateInit. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
194 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
195 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
196 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
197 |
ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
198 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
199 |
Initializes the internal stream state for compression. The fields |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
200 |
zalloc, zfree and opaque must be initialized before by the caller. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
201 |
If zalloc and zfree are set to Z_NULL, deflateInit updates them to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
202 |
use default allocation functions. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
203 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
204 |
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
205 |
1 gives best speed, 9 gives best compression, 0 gives no compression at |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
206 |
all (the input data is simply copied a block at a time). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
207 |
Z_DEFAULT_COMPRESSION requests a default compromise between speed and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
208 |
compression (currently equivalent to level 6). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
209 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
210 |
deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
211 |
enough memory, Z_STREAM_ERROR if level is not a valid compression level, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
212 |
Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
213 |
with the version assumed by the caller (ZLIB_VERSION). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
214 |
msg is set to null if there is no error message. deflateInit does not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
215 |
perform any compression: this will be done by deflate(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
216 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
217 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
218 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
219 |
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
220 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
221 |
deflate compresses as much data as possible, and stops when the input |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
222 |
buffer becomes empty or the output buffer becomes full. It may introduce some |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
223 |
output latency (reading input without producing any output) except when |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
224 |
forced to flush. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
225 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
226 |
The detailed semantics are as follows. deflate performs one or both of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
227 |
following actions: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
228 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
229 |
- Compress more input starting at next_in and update next_in and avail_in |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
230 |
accordingly. If not all input can be processed (because there is not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
231 |
enough room in the output buffer), next_in and avail_in are updated and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
232 |
processing will resume at this point for the next call of deflate(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
233 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
234 |
- Provide more output starting at next_out and update next_out and avail_out |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
235 |
accordingly. This action is forced if the parameter flush is non zero. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
236 |
Forcing flush frequently degrades the compression ratio, so this parameter |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
237 |
should be set only when necessary (in interactive applications). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
238 |
Some output may be provided even if flush is not set. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
239 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
240 |
Before the call of deflate(), the application should ensure that at least |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
241 |
one of the actions is possible, by providing more input and/or consuming |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
242 |
more output, and updating avail_in or avail_out accordingly; avail_out |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
243 |
should never be zero before the call. The application can consume the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
244 |
compressed output when it wants, for example when the output buffer is full |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
245 |
(avail_out == 0), or after each call of deflate(). If deflate returns Z_OK |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
246 |
and with zero avail_out, it must be called again after making room in the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
247 |
output buffer because there might be more output pending. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
248 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
249 |
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
250 |
flushed to the output buffer and the output is aligned on a byte boundary, so |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
251 |
that the decompressor can get all input data available so far. (In particular |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
252 |
avail_in is zero after the call if enough output space has been provided |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
253 |
before the call.) Flushing may degrade compression for some compression |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
254 |
algorithms and so it should be used only when necessary. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
255 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
256 |
If flush is set to Z_FULL_FLUSH, all output is flushed as with |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
257 |
Z_SYNC_FLUSH, and the compression state is reset so that decompression can |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
258 |
restart from this point if previous compressed data has been damaged or if |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
259 |
random access is desired. Using Z_FULL_FLUSH too often can seriously degrade |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
260 |
the compression. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
261 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
262 |
If deflate returns with avail_out == 0, this function must be called again |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
263 |
with the same value of the flush parameter and more output space (updated |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
264 |
avail_out), until the flush is complete (deflate returns with non-zero |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
265 |
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
266 |
avail_out is greater than six to avoid repeated flush markers due to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
267 |
avail_out == 0 on return. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
268 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
269 |
If the parameter flush is set to Z_FINISH, pending input is processed, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
270 |
pending output is flushed and deflate returns with Z_STREAM_END if there |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
271 |
was enough output space; if deflate returns with Z_OK, this function must be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
272 |
called again with Z_FINISH and more output space (updated avail_out) but no |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
273 |
more input data, until it returns with Z_STREAM_END or an error. After |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
274 |
deflate has returned Z_STREAM_END, the only possible operations on the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
275 |
stream are deflateReset or deflateEnd. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
276 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
277 |
Z_FINISH can be used immediately after deflateInit if all the compression |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
278 |
is to be done in a single step. In this case, avail_out must be at least |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
279 |
the value returned by deflateBound (see below). If deflate does not return |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
280 |
Z_STREAM_END, then it must be called again as described above. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
281 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
282 |
deflate() sets strm->adler to the adler32 checksum of all input read |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
283 |
so far (that is, total_in bytes). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
284 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
285 |
deflate() may update data_type if it can make a good guess about |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
286 |
the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
287 |
binary. This field is only for information purposes and does not affect |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
288 |
the compression algorithm in any manner. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
289 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
290 |
deflate() returns Z_OK if some progress has been made (more input |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
291 |
processed or more output produced), Z_STREAM_END if all input has been |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
292 |
consumed and all output has been produced (only when flush is set to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
293 |
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
294 |
if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
295 |
(for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
296 |
fatal, and deflate() can be called again with more input and more output |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
297 |
space to continue compressing. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
298 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
299 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
300 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
301 |
ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
302 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
303 |
All dynamically allocated data structures for this stream are freed. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
304 |
This function discards any unprocessed input and does not flush any |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
305 |
pending output. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
306 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
307 |
deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
308 |
stream state was inconsistent, Z_DATA_ERROR if the stream was freed |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
309 |
prematurely (some input or output was discarded). In the error case, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
310 |
msg may be set but then points to a static string (which must not be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
311 |
deallocated). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
312 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
313 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
314 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
315 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
316 |
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
317 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
318 |
Initializes the internal stream state for decompression. The fields |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
319 |
next_in, avail_in, zalloc, zfree and opaque must be initialized before by |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
320 |
the caller. If next_in is not Z_NULL and avail_in is large enough (the exact |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
321 |
value depends on the compression method), inflateInit determines the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
322 |
compression method from the zlib header and allocates all data structures |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
323 |
accordingly; otherwise the allocation will be deferred to the first call of |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
324 |
inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
325 |
use default allocation functions. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
326 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
327 |
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
328 |
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
329 |
version assumed by the caller. msg is set to null if there is no error |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
330 |
message. inflateInit does not perform any decompression apart from reading |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
331 |
the zlib header if present: this will be done by inflate(). (So next_in and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
332 |
avail_in may be modified, but next_out and avail_out are unchanged.) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
333 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
334 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
335 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
336 |
ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
337 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
338 |
inflate decompresses as much data as possible, and stops when the input |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
339 |
buffer becomes empty or the output buffer becomes full. It may introduce |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
340 |
some output latency (reading input without producing any output) except when |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
341 |
forced to flush. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
342 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
343 |
The detailed semantics are as follows. inflate performs one or both of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
344 |
following actions: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
345 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
346 |
- Decompress more input starting at next_in and update next_in and avail_in |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
347 |
accordingly. If not all input can be processed (because there is not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
348 |
enough room in the output buffer), next_in is updated and processing |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
349 |
will resume at this point for the next call of inflate(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
350 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
351 |
- Provide more output starting at next_out and update next_out and avail_out |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
352 |
accordingly. inflate() provides as much output as possible, until there |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
353 |
is no more input data or no more space in the output buffer (see below |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
354 |
about the flush parameter). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
355 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
356 |
Before the call of inflate(), the application should ensure that at least |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
357 |
one of the actions is possible, by providing more input and/or consuming |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
358 |
more output, and updating the next_* and avail_* values accordingly. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
359 |
The application can consume the uncompressed output when it wants, for |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
360 |
example when the output buffer is full (avail_out == 0), or after each |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
361 |
call of inflate(). If inflate returns Z_OK and with zero avail_out, it |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
362 |
must be called again after making room in the output buffer because there |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
363 |
might be more output pending. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
364 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
365 |
The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
366 |
Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
367 |
output as possible to the output buffer. Z_BLOCK requests that inflate() stop |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
368 |
if and when it get to the next deflate block boundary. When decoding the zlib |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
369 |
or gzip format, this will cause inflate() to return immediately after the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
370 |
header and before the first block. When doing a raw inflate, inflate() will |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
371 |
go ahead and process the first block, and will return when it gets to the end |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
372 |
of that block, or when it runs out of data. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
373 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
374 |
The Z_BLOCK option assists in appending to or combining deflate streams. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
375 |
Also to assist in this, on return inflate() will set strm->data_type to the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
376 |
number of unused bits in the last byte taken from strm->next_in, plus 64 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
377 |
if inflate() is currently decoding the last block in the deflate stream, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
378 |
plus 128 if inflate() returned immediately after decoding an end-of-block |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
379 |
code or decoding the complete header up to just before the first byte of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
380 |
deflate stream. The end-of-block will not be indicated until all of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
381 |
uncompressed data from that block has been written to strm->next_out. The |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
382 |
number of unused bits may in general be greater than seven, except when |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
383 |
bit 7 of data_type is set, in which case the number of unused bits will be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
384 |
less than eight. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
385 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
386 |
inflate() should normally be called until it returns Z_STREAM_END or an |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
387 |
error. However if all decompression is to be performed in a single step |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
388 |
(a single call of inflate), the parameter flush should be set to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
389 |
Z_FINISH. In this case all pending input is processed and all pending |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
390 |
output is flushed; avail_out must be large enough to hold all the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
391 |
uncompressed data. (The size of the uncompressed data may have been saved |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
392 |
by the compressor for this purpose.) The next operation on this stream must |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
393 |
be inflateEnd to deallocate the decompression state. The use of Z_FINISH |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
394 |
is never required, but can be used to inform inflate that a faster approach |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
395 |
may be used for the single inflate() call. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
396 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
397 |
In this implementation, inflate() always flushes as much output as |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
398 |
possible to the output buffer, and always uses the faster approach on the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
399 |
first call. So the only effect of the flush parameter in this implementation |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
400 |
is on the return value of inflate(), as noted below, or when it returns early |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
401 |
because Z_BLOCK is used. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
402 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
403 |
If a preset dictionary is needed after this call (see inflateSetDictionary |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
404 |
below), inflate sets strm-adler to the adler32 checksum of the dictionary |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
405 |
chosen by the compressor and returns Z_NEED_DICT; otherwise it sets |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
406 |
strm->adler to the adler32 checksum of all output produced so far (that is, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
407 |
total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
408 |
below. At the end of the stream, inflate() checks that its computed adler32 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
409 |
checksum is equal to that saved by the compressor and returns Z_STREAM_END |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
410 |
only if the checksum is correct. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
411 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
412 |
inflate() will decompress and check either zlib-wrapped or gzip-wrapped |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
413 |
deflate data. The header type is detected automatically. Any information |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
414 |
contained in the gzip header is not retained, so applications that need that |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
415 |
information should instead use raw inflate, see inflateInit2() below, or |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
416 |
inflateBack() and perform their own processing of the gzip header and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
417 |
trailer. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
418 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
419 |
inflate() returns Z_OK if some progress has been made (more input processed |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
420 |
or more output produced), Z_STREAM_END if the end of the compressed data has |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
421 |
been reached and all uncompressed output has been produced, Z_NEED_DICT if a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
422 |
preset dictionary is needed at this point, Z_DATA_ERROR if the input data was |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
423 |
corrupted (input stream not conforming to the zlib format or incorrect check |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
424 |
value), Z_STREAM_ERROR if the stream structure was inconsistent (for example |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
425 |
if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
426 |
Z_BUF_ERROR if no progress is possible or if there was not enough room in the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
427 |
output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
428 |
inflate() can be called again with more input and more output space to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
429 |
continue decompressing. If Z_DATA_ERROR is returned, the application may then |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
430 |
call inflateSync() to look for a good compression block if a partial recovery |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
431 |
of the data is desired. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
432 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
433 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
434 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
435 |
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
436 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
437 |
All dynamically allocated data structures for this stream are freed. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
438 |
This function discards any unprocessed input and does not flush any |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
439 |
pending output. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
440 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
441 |
inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
442 |
was inconsistent. In the error case, msg may be set but then points to a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
443 |
static string (which must not be deallocated). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
444 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
445 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
446 |
/* Advanced functions */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
447 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
448 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
449 |
The following functions are needed only in some special applications. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
450 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
451 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
452 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
453 |
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
454 |
int level, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
455 |
int method, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
456 |
int windowBits, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
457 |
int memLevel, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
458 |
int strategy)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
459 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
460 |
This is another version of deflateInit with more compression options. The |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
461 |
fields next_in, zalloc, zfree and opaque must be initialized before by |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
462 |
the caller. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
463 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
464 |
The method parameter is the compression method. It must be Z_DEFLATED in |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
465 |
this version of the library. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
466 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
467 |
The windowBits parameter is the base two logarithm of the window size |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
468 |
(the size of the history buffer). It should be in the range 8..15 for this |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
469 |
version of the library. Larger values of this parameter result in better |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
470 |
compression at the expense of memory usage. The default value is 15 if |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
471 |
deflateInit is used instead. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
472 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
473 |
windowBits can also be -8..-15 for raw deflate. In this case, -windowBits |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
474 |
determines the window size. deflate() will then generate raw deflate data |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
475 |
with no zlib header or trailer, and will not compute an adler32 check value. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
476 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
477 |
windowBits can also be greater than 15 for optional gzip encoding. Add |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
478 |
16 to windowBits to write a simple gzip header and trailer around the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
479 |
compressed data instead of a zlib wrapper. The gzip header will have no |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
480 |
file name, no extra data, no comment, no modification time (set to zero), |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
481 |
no header crc, and the operating system will be set to 255 (unknown). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
482 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
483 |
The memLevel parameter specifies how much memory should be allocated |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
484 |
for the internal compression state. memLevel=1 uses minimum memory but |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
485 |
is slow and reduces compression ratio; memLevel=9 uses maximum memory |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
486 |
for optimal speed. The default value is 8. See zconf.h for total memory |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
487 |
usage as a function of windowBits and memLevel. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
488 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
489 |
The strategy parameter is used to tune the compression algorithm. Use the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
490 |
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
491 |
filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
492 |
string match), or Z_RLE to limit match distances to one (run-length |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
493 |
encoding). Filtered data consists mostly of small values with a somewhat |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
494 |
random distribution. In this case, the compression algorithm is tuned to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
495 |
compress them better. The effect of Z_FILTERED is to force more Huffman |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
496 |
coding and less string matching; it is somewhat intermediate between |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
497 |
Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
498 |
Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
499 |
parameter only affects the compression ratio but not the correctness of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
500 |
compressed output even if it is not set appropriately. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
501 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
502 |
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
503 |
memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
504 |
method). msg is set to null if there is no error message. deflateInit2 does |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
505 |
not perform any compression: this will be done by deflate(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
506 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
507 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
508 |
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
509 |
const Bytef *dictionary, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
510 |
uInt dictLength)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
511 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
512 |
Initializes the compression dictionary from the given byte sequence |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
513 |
without producing any compressed output. This function must be called |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
514 |
immediately after deflateInit, deflateInit2 or deflateReset, before any |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
515 |
call of deflate. The compressor and decompressor must use exactly the same |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
516 |
dictionary (see inflateSetDictionary). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
517 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
518 |
The dictionary should consist of strings (byte sequences) that are likely |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
519 |
to be encountered later in the data to be compressed, with the most commonly |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
520 |
used strings preferably put towards the end of the dictionary. Using a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
521 |
dictionary is most useful when the data to be compressed is short and can be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
522 |
predicted with good accuracy; the data can then be compressed better than |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
523 |
with the default empty dictionary. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
524 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
525 |
Depending on the size of the compression data structures selected by |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
526 |
deflateInit or deflateInit2, a part of the dictionary may in effect be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
527 |
discarded, for example if the dictionary is larger than the window size in |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
528 |
deflate or deflate2. Thus the strings most likely to be useful should be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
529 |
put at the end of the dictionary, not at the front. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
530 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
531 |
Upon return of this function, strm->adler is set to the adler32 value |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
532 |
of the dictionary; the decompressor may later use this value to determine |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
533 |
which dictionary has been used by the compressor. (The adler32 value |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
534 |
applies to the whole dictionary even if only a subset of the dictionary is |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
535 |
actually used by the compressor.) If a raw deflate was requested, then the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
536 |
adler32 value is not computed and strm->adler is not set. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
537 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
538 |
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
539 |
parameter is invalid (such as NULL dictionary) or the stream state is |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
540 |
inconsistent (for example if deflate has already been called for this stream |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
541 |
or if the compression method is bsort). deflateSetDictionary does not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
542 |
perform any compression: this will be done by deflate(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
543 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
544 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
545 |
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
546 |
z_streamp source)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
547 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
548 |
Sets the destination stream as a complete copy of the source stream. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
549 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
550 |
This function can be useful when several compression strategies will be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
551 |
tried, for example when there are several ways of pre-processing the input |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
552 |
data with a filter. The streams that will be discarded should then be freed |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
553 |
by calling deflateEnd. Note that deflateCopy duplicates the internal |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
554 |
compression state which can be quite large, so this strategy is slow and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
555 |
can consume lots of memory. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
556 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
557 |
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
558 |
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
559 |
(such as zalloc being NULL). msg is left unchanged in both source and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
560 |
destination. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
561 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
562 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
563 |
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
564 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
565 |
This function is equivalent to deflateEnd followed by deflateInit, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
566 |
but does not free and reallocate all the internal compression state. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
567 |
The stream will keep the same compression level and any other attributes |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
568 |
that may have been set by deflateInit2. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
569 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
570 |
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
571 |
stream state was inconsistent (such as zalloc or state being NULL). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
572 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
573 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
574 |
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
575 |
int level, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
576 |
int strategy)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
577 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
578 |
Dynamically update the compression level and compression strategy. The |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
579 |
interpretation of level and strategy is as in deflateInit2. This can be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
580 |
used to switch between compression and straight copy of the input data, or |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
581 |
to switch to a different kind of input data requiring a different |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
582 |
strategy. If the compression level is changed, the input available so far |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
583 |
is compressed with the old level (and may be flushed); the new level will |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
584 |
take effect only at the next call of deflate(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
585 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
586 |
Before the call of deflateParams, the stream state must be set as for |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
587 |
a call of deflate(), since the currently available input may have to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
588 |
be compressed and flushed. In particular, strm->avail_out must be non-zero. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
589 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
590 |
deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
591 |
stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
592 |
if strm->avail_out was zero. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
593 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
594 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
595 |
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
596 |
uLong sourceLen)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
597 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
598 |
deflateBound() returns an upper bound on the compressed size after |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
599 |
deflation of sourceLen bytes. It must be called after deflateInit() |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
600 |
or deflateInit2(). This would be used to allocate an output buffer |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
601 |
for deflation in a single pass, and so would be called before deflate(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
602 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
603 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
604 |
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
605 |
int bits, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
606 |
int value)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
607 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
608 |
deflatePrime() inserts bits in the deflate output stream. The intent |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
609 |
is that this function is used to start off the deflate output with the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
610 |
bits leftover from a previous deflate stream when appending to it. As such, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
611 |
this function can only be used for raw deflate, and must be used before the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
612 |
first deflate() call after a deflateInit2() or deflateReset(). bits must be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
613 |
less than or equal to 16, and that many of the least significant bits of |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
614 |
value will be inserted in the output. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
615 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
616 |
deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
617 |
stream state was inconsistent. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
618 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
619 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
620 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
621 |
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
622 |
int windowBits)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
623 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
624 |
This is another version of inflateInit with an extra parameter. The |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
625 |
fields next_in, avail_in, zalloc, zfree and opaque must be initialized |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
626 |
before by the caller. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
627 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
628 |
The windowBits parameter is the base two logarithm of the maximum window |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
629 |
size (the size of the history buffer). It should be in the range 8..15 for |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
630 |
this version of the library. The default value is 15 if inflateInit is used |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
631 |
instead. windowBits must be greater than or equal to the windowBits value |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
632 |
provided to deflateInit2() while compressing, or it must be equal to 15 if |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
633 |
deflateInit2() was not used. If a compressed stream with a larger window |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
634 |
size is given as input, inflate() will return with the error code |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
635 |
Z_DATA_ERROR instead of trying to allocate a larger window. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
636 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
637 |
windowBits can also be -8..-15 for raw inflate. In this case, -windowBits |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
638 |
determines the window size. inflate() will then process raw deflate data, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
639 |
not looking for a zlib or gzip header, not generating a check value, and not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
640 |
looking for any check values for comparison at the end of the stream. This |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
641 |
is for use with other formats that use the deflate compressed data format |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
642 |
such as zip. Those formats provide their own check values. If a custom |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
643 |
format is developed using the raw deflate format for compressed data, it is |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
644 |
recommended that a check value such as an adler32 or a crc32 be applied to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
645 |
the uncompressed data as is done in the zlib, gzip, and zip formats. For |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
646 |
most applications, the zlib format should be used as is. Note that comments |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
647 |
above on the use in deflateInit2() applies to the magnitude of windowBits. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
648 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
649 |
windowBits can also be greater than 15 for optional gzip decoding. Add |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
650 |
32 to windowBits to enable zlib and gzip decoding with automatic header |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
651 |
detection, or add 16 to decode only the gzip format (the zlib format will |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
652 |
return a Z_DATA_ERROR). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
653 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
654 |
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
655 |
memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
656 |
memLevel). msg is set to null if there is no error message. inflateInit2 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
657 |
does not perform any decompression apart from reading the zlib header if |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
658 |
present: this will be done by inflate(). (So next_in and avail_in may be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
659 |
modified, but next_out and avail_out are unchanged.) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
660 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
661 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
662 |
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
663 |
const Bytef *dictionary, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
664 |
uInt dictLength)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
665 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
666 |
Initializes the decompression dictionary from the given uncompressed byte |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
667 |
sequence. This function must be called immediately after a call of inflate |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
668 |
if this call returned Z_NEED_DICT. The dictionary chosen by the compressor |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
669 |
can be determined from the adler32 value returned by this call of |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
670 |
inflate. The compressor and decompressor must use exactly the same |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
671 |
dictionary (see deflateSetDictionary). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
672 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
673 |
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
674 |
parameter is invalid (such as NULL dictionary) or the stream state is |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
675 |
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
676 |
expected one (incorrect adler32 value). inflateSetDictionary does not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
677 |
perform any decompression: this will be done by subsequent calls of |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
678 |
inflate(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
679 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
680 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
681 |
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
682 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
683 |
Skips invalid compressed data until a full flush point (see above the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
684 |
description of deflate with Z_FULL_FLUSH) can be found, or until all |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
685 |
available input is skipped. No output is provided. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
686 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
687 |
inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
688 |
if no more input was provided, Z_DATA_ERROR if no flush point has been found, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
689 |
or Z_STREAM_ERROR if the stream structure was inconsistent. In the success |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
690 |
case, the application may save the current current value of total_in which |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
691 |
indicates where valid compressed data was found. In the error case, the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
692 |
application may repeatedly call inflateSync, providing more input each time, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
693 |
until success or end of the input data. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
694 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
695 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
696 |
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
697 |
z_streamp source)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
698 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
699 |
Sets the destination stream as a complete copy of the source stream. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
700 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
701 |
This function can be useful when randomly accessing a large stream. The |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
702 |
first pass through the stream can periodically record the inflate state, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
703 |
allowing restarting inflate at those points when randomly accessing the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
704 |
stream. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
705 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
706 |
inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
707 |
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
708 |
(such as zalloc being NULL). msg is left unchanged in both source and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
709 |
destination. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
710 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
711 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
712 |
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
713 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
714 |
This function is equivalent to inflateEnd followed by inflateInit, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
715 |
but does not free and reallocate all the internal decompression state. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
716 |
The stream will keep attributes that may have been set by inflateInit2. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
717 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
718 |
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
719 |
stream state was inconsistent (such as zalloc or state being NULL). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
720 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
721 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
722 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
723 |
ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
724 |
unsigned char FAR *window)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
725 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
726 |
Initialize the internal stream state for decompression using inflateBack() |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
727 |
calls. The fields zalloc, zfree and opaque in strm must be initialized |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
728 |
before the call. If zalloc and zfree are Z_NULL, then the default library- |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
729 |
derived memory allocation routines are used. windowBits is the base two |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
730 |
logarithm of the window size, in the range 8..15. window is a caller |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
731 |
supplied buffer of that size. Except for special applications where it is |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
732 |
assured that deflate was used with small window sizes, windowBits must be 15 |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
733 |
and a 32K byte window must be supplied to be able to decompress general |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
734 |
deflate streams. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
735 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
736 |
See inflateBack() for the usage of these routines. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
737 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
738 |
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
739 |
the paramaters are invalid, Z_MEM_ERROR if the internal state could not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
740 |
be allocated, or Z_VERSION_ERROR if the version of the library does not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
741 |
match the version of the header file. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
742 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
743 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
744 |
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
745 |
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
746 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
747 |
ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
748 |
in_func in, void FAR *in_desc, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
749 |
out_func out, void FAR *out_desc)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
750 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
751 |
inflateBack() does a raw inflate with a single call using a call-back |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
752 |
interface for input and output. This is more efficient than inflate() for |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
753 |
file i/o applications in that it avoids copying between the output and the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
754 |
sliding window by simply making the window itself the output buffer. This |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
755 |
function trusts the application to not change the output buffer passed by |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
756 |
the output function, at least until inflateBack() returns. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
757 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
758 |
inflateBackInit() must be called first to allocate the internal state |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
759 |
and to initialize the state with the user-provided window buffer. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
760 |
inflateBack() may then be used multiple times to inflate a complete, raw |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
761 |
deflate stream with each call. inflateBackEnd() is then called to free |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
762 |
the allocated state. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
763 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
764 |
A raw deflate stream is one with no zlib or gzip header or trailer. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
765 |
This routine would normally be used in a utility that reads zip or gzip |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
766 |
files and writes out uncompressed files. The utility would decode the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
767 |
header and process the trailer on its own, hence this routine expects |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
768 |
only the raw deflate stream to decompress. This is different from the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
769 |
normal behavior of inflate(), which expects either a zlib or gzip header and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
770 |
trailer around the deflate stream. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
771 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
772 |
inflateBack() uses two subroutines supplied by the caller that are then |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
773 |
called by inflateBack() for input and output. inflateBack() calls those |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
774 |
routines until it reads a complete deflate stream and writes out all of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
775 |
uncompressed data, or until it encounters an error. The function's |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
776 |
parameters and return types are defined above in the in_func and out_func |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
777 |
typedefs. inflateBack() will call in(in_desc, &buf) which should return the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
778 |
number of bytes of provided input, and a pointer to that input in buf. If |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
779 |
there is no input available, in() must return zero--buf is ignored in that |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
780 |
case--and inflateBack() will return a buffer error. inflateBack() will call |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
781 |
out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
782 |
should return zero on success, or non-zero on failure. If out() returns |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
783 |
non-zero, inflateBack() will return with an error. Neither in() nor out() |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
784 |
are permitted to change the contents of the window provided to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
785 |
inflateBackInit(), which is also the buffer that out() uses to write from. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
786 |
The length written by out() will be at most the window size. Any non-zero |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
787 |
amount of input may be provided by in(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
788 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
789 |
For convenience, inflateBack() can be provided input on the first call by |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
790 |
setting strm->next_in and strm->avail_in. If that input is exhausted, then |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
791 |
in() will be called. Therefore strm->next_in must be initialized before |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
792 |
calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
793 |
immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
794 |
must also be initialized, and then if strm->avail_in is not zero, input will |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
795 |
initially be taken from strm->next_in[0 .. strm->avail_in - 1]. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
796 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
797 |
The in_desc and out_desc parameters of inflateBack() is passed as the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
798 |
first parameter of in() and out() respectively when they are called. These |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
799 |
descriptors can be optionally used to pass any information that the caller- |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
800 |
supplied in() and out() functions need to do their job. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
801 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
802 |
On return, inflateBack() will set strm->next_in and strm->avail_in to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
803 |
pass back any unused input that was provided by the last in() call. The |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
804 |
return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
805 |
if in() or out() returned an error, Z_DATA_ERROR if there was a format |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
806 |
error in the deflate stream (in which case strm->msg is set to indicate the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
807 |
nature of the error), or Z_STREAM_ERROR if the stream was not properly |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
808 |
initialized. In the case of Z_BUF_ERROR, an input or output error can be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
809 |
distinguished using strm->next_in which will be Z_NULL only if in() returned |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
810 |
an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
811 |
out() returning non-zero. (in() will always be called before out(), so |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
812 |
strm->next_in is assured to be defined if out() returns non-zero.) Note |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
813 |
that inflateBack() cannot return Z_OK. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
814 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
815 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
816 |
ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
817 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
818 |
All memory allocated by inflateBackInit() is freed. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
819 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
820 |
inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
821 |
state was inconsistent. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
822 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
823 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
824 |
ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
825 |
/* Return flags indicating compile-time options. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
826 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
827 |
Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
828 |
1.0: size of uInt |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
829 |
3.2: size of uLong |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
830 |
5.4: size of voidpf (pointer) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
831 |
7.6: size of z_off_t |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
832 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
833 |
Compiler, assembler, and debug options: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
834 |
8: DEBUG |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
835 |
9: ASMV or ASMINF -- use ASM code |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
836 |
10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
837 |
11: 0 (reserved) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
838 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
839 |
One-time table building (smaller code, but not thread-safe if true): |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
840 |
12: BUILDFIXED -- build static block decoding tables when needed |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
841 |
13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
842 |
14,15: 0 (reserved) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
843 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
844 |
Library content (indicates missing functionality): |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
845 |
16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
846 |
deflate code when not needed) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
847 |
17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
848 |
and decode gzip streams (to avoid linking crc code) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
849 |
18-19: 0 (reserved) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
850 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
851 |
Operation variations (changes in library functionality): |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
852 |
20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
853 |
21: FASTEST -- deflate algorithm with only one, lowest compression level |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
854 |
22,23: 0 (reserved) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
855 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
856 |
The sprintf variant used by gzprintf (zero is best): |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
857 |
24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
858 |
25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
859 |
26: 0 = returns value, 1 = void -- 1 means inferred string length returned |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
860 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
861 |
Remainder: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
862 |
27-31: 0 (reserved) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
863 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
864 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
865 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
866 |
/* utility functions */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
867 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
868 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
869 |
The following utility functions are implemented on top of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
870 |
basic stream-oriented functions. To simplify the interface, some |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
871 |
default options are assumed (compression level and memory usage, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
872 |
standard memory allocation functions). The source code of these |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
873 |
utility functions can easily be modified if you need special options. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
874 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
875 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
876 |
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
877 |
const Bytef *source, uLong sourceLen)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
878 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
879 |
Compresses the source buffer into the destination buffer. sourceLen is |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
880 |
the byte length of the source buffer. Upon entry, destLen is the total |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
881 |
size of the destination buffer, which must be at least the value returned |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
882 |
by compressBound(sourceLen). Upon exit, destLen is the actual size of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
883 |
compressed buffer. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
884 |
This function can be used to compress a whole file at once if the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
885 |
input file is mmap'ed. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
886 |
compress returns Z_OK if success, Z_MEM_ERROR if there was not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
887 |
enough memory, Z_BUF_ERROR if there was not enough room in the output |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
888 |
buffer. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
889 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
890 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
891 |
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
892 |
const Bytef *source, uLong sourceLen, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
893 |
int level)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
894 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
895 |
Compresses the source buffer into the destination buffer. The level |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
896 |
parameter has the same meaning as in deflateInit. sourceLen is the byte |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
897 |
length of the source buffer. Upon entry, destLen is the total size of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
898 |
destination buffer, which must be at least the value returned by |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
899 |
compressBound(sourceLen). Upon exit, destLen is the actual size of the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
900 |
compressed buffer. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
901 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
902 |
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
903 |
memory, Z_BUF_ERROR if there was not enough room in the output buffer, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
904 |
Z_STREAM_ERROR if the level parameter is invalid. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
905 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
906 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
907 |
ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
908 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
909 |
compressBound() returns an upper bound on the compressed size after |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
910 |
compress() or compress2() on sourceLen bytes. It would be used before |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
911 |
a compress() or compress2() call to allocate the destination buffer. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
912 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
913 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
914 |
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
915 |
const Bytef *source, uLong sourceLen)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
916 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
917 |
Decompresses the source buffer into the destination buffer. sourceLen is |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
918 |
the byte length of the source buffer. Upon entry, destLen is the total |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
919 |
size of the destination buffer, which must be large enough to hold the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
920 |
entire uncompressed data. (The size of the uncompressed data must have |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
921 |
been saved previously by the compressor and transmitted to the decompressor |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
922 |
by some mechanism outside the scope of this compression library.) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
923 |
Upon exit, destLen is the actual size of the compressed buffer. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
924 |
This function can be used to decompress a whole file at once if the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
925 |
input file is mmap'ed. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
926 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
927 |
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
928 |
enough memory, Z_BUF_ERROR if there was not enough room in the output |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
929 |
buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
930 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
931 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
932 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
933 |
typedef voidp gzFile; |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
934 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
935 |
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
936 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
937 |
Opens a gzip (.gz) file for reading or writing. The mode parameter |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
938 |
is as in fopen ("rb" or "wb") but can also include a compression level |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
939 |
("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
940 |
Huffman only compression as in "wb1h", or 'R' for run-length encoding |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
941 |
as in "wb1R". (See the description of deflateInit2 for more information |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
942 |
about the strategy parameter.) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
943 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
944 |
gzopen can be used to read a file which is not in gzip format; in this |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
945 |
case gzread will directly read from the file without decompression. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
946 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
947 |
gzopen returns NULL if the file could not be opened or if there was |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
948 |
insufficient memory to allocate the (de)compression state; errno |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
949 |
can be checked to distinguish the two cases (if errno is zero, the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
950 |
zlib error is Z_MEM_ERROR). */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
951 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
952 |
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
953 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
954 |
gzdopen() associates a gzFile with the file descriptor fd. File |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
955 |
descriptors are obtained from calls like open, dup, creat, pipe or |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
956 |
fileno (in the file has been previously opened with fopen). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
957 |
The mode parameter is as in gzopen. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
958 |
The next call of gzclose on the returned gzFile will also close the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
959 |
file descriptor fd, just like fclose(fdopen(fd), mode) closes the file |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
960 |
descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
961 |
gzdopen returns NULL if there was insufficient memory to allocate |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
962 |
the (de)compression state. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
963 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
964 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
965 |
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
966 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
967 |
Dynamically update the compression level or strategy. See the description |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
968 |
of deflateInit2 for the meaning of these parameters. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
969 |
gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
970 |
opened for writing. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
971 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
972 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
973 |
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
974 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
975 |
Reads the given number of uncompressed bytes from the compressed file. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
976 |
If the input file was not in gzip format, gzread copies the given number |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
977 |
of bytes into the buffer. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
978 |
gzread returns the number of uncompressed bytes actually read (0 for |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
979 |
end of file, -1 for error). */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
980 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
981 |
ZEXTERN int ZEXPORT gzwrite OF((gzFile file, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
982 |
voidpc buf, unsigned len)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
983 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
984 |
Writes the given number of uncompressed bytes into the compressed file. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
985 |
gzwrite returns the number of uncompressed bytes actually written |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
986 |
(0 in case of error). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
987 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
988 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
989 |
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
990 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
991 |
Converts, formats, and writes the args to the compressed file under |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
992 |
control of the format string, as in fprintf. gzprintf returns the number of |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
993 |
uncompressed bytes actually written (0 in case of error). The number of |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
994 |
uncompressed bytes written is limited to 4095. The caller should assure that |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
995 |
this limit is not exceeded. If it is exceeded, then gzprintf() will return |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
996 |
return an error (0) with nothing written. In this case, there may also be a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
997 |
buffer overflow with unpredictable consequences, which is possible only if |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
998 |
zlib was compiled with the insecure functions sprintf() or vsprintf() |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
999 |
because the secure snprintf() or vsnprintf() functions were not available. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1000 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1001 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1002 |
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1003 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1004 |
Writes the given null-terminated string to the compressed file, excluding |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1005 |
the terminating null character. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1006 |
gzputs returns the number of characters written, or -1 in case of error. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1007 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1008 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1009 |
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1010 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1011 |
Reads bytes from the compressed file until len-1 characters are read, or |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1012 |
a newline character is read and transferred to buf, or an end-of-file |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1013 |
condition is encountered. The string is then terminated with a null |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1014 |
character. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1015 |
gzgets returns buf, or Z_NULL in case of error. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1016 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1017 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1018 |
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1019 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1020 |
Writes c, converted to an unsigned char, into the compressed file. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1021 |
gzputc returns the value that was written, or -1 in case of error. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1022 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1023 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1024 |
ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1025 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1026 |
Reads one byte from the compressed file. gzgetc returns this byte |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1027 |
or -1 in case of end of file or error. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1028 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1029 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1030 |
ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1031 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1032 |
Push one character back onto the stream to be read again later. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1033 |
Only one character of push-back is allowed. gzungetc() returns the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1034 |
character pushed, or -1 on failure. gzungetc() will fail if a |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1035 |
character has been pushed but not read yet, or if c is -1. The pushed |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1036 |
character will be discarded if the stream is repositioned with gzseek() |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1037 |
or gzrewind(). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1038 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1039 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1040 |
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1041 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1042 |
Flushes all pending output into the compressed file. The parameter |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1043 |
flush is as in the deflate() function. The return value is the zlib |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1044 |
error number (see function gzerror below). gzflush returns Z_OK if |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1045 |
the flush parameter is Z_FINISH and all output could be flushed. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1046 |
gzflush should be called only when strictly necessary because it can |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1047 |
degrade compression. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1048 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1049 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1050 |
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1051 |
z_off_t offset, int whence)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1052 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1053 |
Sets the starting position for the next gzread or gzwrite on the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1054 |
given compressed file. The offset represents a number of bytes in the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1055 |
uncompressed data stream. The whence parameter is defined as in lseek(2); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1056 |
the value SEEK_END is not supported. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1057 |
If the file is opened for reading, this function is emulated but can be |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1058 |
extremely slow. If the file is opened for writing, only forward seeks are |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1059 |
supported; gzseek then compresses a sequence of zeroes up to the new |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1060 |
starting position. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1061 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1062 |
gzseek returns the resulting offset location as measured in bytes from |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1063 |
the beginning of the uncompressed stream, or -1 in case of error, in |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1064 |
particular if the file is opened for writing and the new starting position |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1065 |
would be before the current position. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1066 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1067 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1068 |
ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1069 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1070 |
Rewinds the given file. This function is supported only for reading. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1071 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1072 |
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1073 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1074 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1075 |
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1076 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1077 |
Returns the starting position for the next gzread or gzwrite on the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1078 |
given compressed file. This position represents a number of bytes in the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1079 |
uncompressed data stream. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1080 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1081 |
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1082 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1083 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1084 |
ZEXTERN int ZEXPORT gzeof OF((gzFile file)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1085 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1086 |
Returns 1 when EOF has previously been detected reading the given |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1087 |
input stream, otherwise zero. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1088 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1089 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1090 |
ZEXTERN int ZEXPORT gzclose OF((gzFile file)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1091 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1092 |
Flushes all pending output if necessary, closes the compressed file |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1093 |
and deallocates all the (de)compression state. The return value is the zlib |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1094 |
error number (see function gzerror below). |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1095 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1096 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1097 |
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1098 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1099 |
Returns the error message for the last error which occurred on the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1100 |
given compressed file. errnum is set to zlib error number. If an |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1101 |
error occurred in the file system and not in the compression library, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1102 |
errnum is set to Z_ERRNO and the application may consult errno |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1103 |
to get the exact error code. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1104 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1105 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1106 |
ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1107 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1108 |
Clears the error and end-of-file flags for file. This is analogous to the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1109 |
clearerr() function in stdio. This is useful for continuing to read a gzip |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1110 |
file that is being written concurrently. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1111 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1112 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1113 |
/* checksum functions */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1114 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1115 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1116 |
These functions are not related to compression but are exported |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1117 |
anyway because they might be useful in applications using the |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1118 |
compression library. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1119 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1120 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1121 |
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1122 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1123 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1124 |
Update a running Adler-32 checksum with the bytes buf[0..len-1] and |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1125 |
return the updated checksum. If buf is NULL, this function returns |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1126 |
the required initial value for the checksum. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1127 |
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1128 |
much faster. Usage example: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1129 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1130 |
uLong adler = adler32(0L, Z_NULL, 0); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1131 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1132 |
while (read_buffer(buffer, length) != EOF) { |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1133 |
adler = adler32(adler, buffer, length); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1134 |
} |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1135 |
if (adler != original_adler) error(); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1136 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1137 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1138 |
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1139 |
/* |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1140 |
Update a running crc with the bytes buf[0..len-1] and return the updated |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1141 |
crc. If buf is NULL, this function returns the required initial value |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1142 |
for the crc. Pre- and post-conditioning (one's complement) is performed |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1143 |
within this function so it shouldn't be done by the application. |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1144 |
Usage example: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1145 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1146 |
uLong crc = crc32(0L, Z_NULL, 0); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1147 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1148 |
while (read_buffer(buffer, length) != EOF) { |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1149 |
crc = crc32(crc, buffer, length); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1150 |
} |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1151 |
if (crc != original_crc) error(); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1152 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1153 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1154 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1155 |
/* various hacks, don't look :) */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1156 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1157 |
/* deflateInit and inflateInit are macros to allow checking the zlib version |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1158 |
* and the compiler's view of z_stream: |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1159 |
*/ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1160 |
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1161 |
const char *version, int stream_size)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1162 |
ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1163 |
const char *version, int stream_size)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1164 |
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1165 |
int windowBits, int memLevel, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1166 |
int strategy, const char *version, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1167 |
int stream_size)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1168 |
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1169 |
const char *version, int stream_size)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1170 |
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1171 |
unsigned char FAR *window, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1172 |
const char *version, |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1173 |
int stream_size)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1174 |
#define deflateInit(strm, level) \ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1175 |
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1176 |
#define inflateInit(strm) \ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1177 |
inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1178 |
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1179 |
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1180 |
(strategy), ZLIB_VERSION, sizeof(z_stream)) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1181 |
#define inflateInit2(strm, windowBits) \ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1182 |
inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1183 |
#define inflateBackInit(strm, windowBits, window) \ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1184 |
inflateBackInit_((strm), (windowBits), (window), \ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1185 |
ZLIB_VERSION, sizeof(z_stream)) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1186 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1187 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1188 |
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1189 |
struct internal_state {int dummy;}; /* hack for buggy compilers */ |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1190 |
#endif |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1191 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1192 |
ZEXTERN const char * ZEXPORT zError OF((int err)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1193 |
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1194 |
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1195 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1196 |
#ifdef __cplusplus |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1197 |
} |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1198 |
#endif |
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1199 |
|
691c1eadb8b7
Upgraded internal zlib to 1.2.1 (thanks, Adam!)
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1200 |
#endif /* ZLIB_H */ |