1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66#ifndef _BZLIB_H
67#define _BZLIB_H
68
69
70#define BZ_NO_STDIO
71#define BZ_NO_COMPRESS
72
73
74#ifdef __cplusplus
75extern "C" {
76#endif
77
78#define BZ_RUN 0
79#define BZ_FLUSH 1
80#define BZ_FINISH 2
81
82#define BZ_OK 0
83#define BZ_RUN_OK 1
84#define BZ_FLUSH_OK 2
85#define BZ_FINISH_OK 3
86#define BZ_STREAM_END 4
87#define BZ_SEQUENCE_ERROR (-1)
88#define BZ_PARAM_ERROR (-2)
89#define BZ_MEM_ERROR (-3)
90#define BZ_DATA_ERROR (-4)
91#define BZ_DATA_ERROR_MAGIC (-5)
92#define BZ_IO_ERROR (-6)
93#define BZ_UNEXPECTED_EOF (-7)
94#define BZ_OUTBUFF_FULL (-8)
95#define BZ_CONFIG_ERROR (-9)
96
97typedef
98 struct {
99 char *next_in;
100 unsigned int avail_in;
101 unsigned int total_in_lo32;
102 unsigned int total_in_hi32;
103
104 char *next_out;
105 unsigned int avail_out;
106 unsigned int total_out_lo32;
107 unsigned int total_out_hi32;
108
109 void *state;
110
111 void *(*bzalloc)(void *,int,int);
112 void (*bzfree)(void *,void *);
113 void *opaque;
114 }
115 bz_stream;
116
117
118#ifndef BZ_IMPORT
119#define BZ_EXPORT
120#endif
121
122#ifdef _WIN32
123# include <windows.h>
124# ifdef small
125
126# undef small
127# endif
128# ifdef BZ_EXPORT
129# define BZ_API(func) WINAPI func
130# define BZ_EXTERN extern
131# else
132
133# define BZ_API(func) (WINAPI * func)
134# define BZ_EXTERN
135# endif
136#else
137# define BZ_API(func) func
138# define BZ_EXTERN extern
139#endif
140
141
142
143
144BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
145 bz_stream* strm,
146 int blockSize100k,
147 int verbosity,
148 int workFactor
149 );
150
151BZ_EXTERN int BZ_API(BZ2_bzCompress) (
152 bz_stream* strm,
153 int action
154 );
155
156BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
157 bz_stream* strm
158 );
159
160BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
161 bz_stream *strm,
162 int verbosity,
163 int small
164 );
165
166BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
167 bz_stream* strm
168 );
169
170BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
171 bz_stream *strm
172 );
173
174
175
176
177#ifndef BZ_NO_STDIO
178#define BZ_MAX_UNUSED 5000
179
180
181#include <stdio.h>
182
183typedef void BZFILE;
184
185BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
186 int* bzerror,
187 FILE* f,
188 int verbosity,
189 int small,
190 void* unused,
191 int nUnused
192 );
193
194BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
195 int* bzerror,
196 BZFILE* b
197 );
198
199BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
200 int* bzerror,
201 BZFILE* b,
202 void** unused,
203 int* nUnused
204 );
205
206BZ_EXTERN int BZ_API(BZ2_bzRead) (
207 int* bzerror,
208 BZFILE* b,
209 void* buf,
210 int len
211 );
212
213BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
214 int* bzerror,
215 FILE* f,
216 int blockSize100k,
217 int verbosity,
218 int workFactor
219 );
220
221BZ_EXTERN void BZ_API(BZ2_bzWrite) (
222 int* bzerror,
223 BZFILE* b,
224 void* buf,
225 int len
226 );
227
228BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
229 int* bzerror,
230 BZFILE* b,
231 int abandon,
232 unsigned int* nbytes_in,
233 unsigned int* nbytes_out
234 );
235
236BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
237 int* bzerror,
238 BZFILE* b,
239 int abandon,
240 unsigned int* nbytes_in_lo32,
241 unsigned int* nbytes_in_hi32,
242 unsigned int* nbytes_out_lo32,
243 unsigned int* nbytes_out_hi32
244 );
245#endif
246
247
248
249
250BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
251 char* dest,
252 unsigned int* destLen,
253 char* source,
254 unsigned int sourceLen,
255 int blockSize100k,
256 int verbosity,
257 int workFactor
258 );
259
260BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
261 char* dest,
262 unsigned int* destLen,
263 char* source,
264 unsigned int sourceLen,
265 int small,
266 int verbosity
267 );
268
269
270
271
272
273
274
275
276
277
278
279
280BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
281 void
282 );
283
284#ifndef BZ_NO_STDIO
285BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
286 const char *path,
287 const char *mode
288 );
289
290BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
291 int fd,
292 const char *mode
293 );
294
295BZ_EXTERN int BZ_API(BZ2_bzread) (
296 BZFILE* b,
297 void* buf,
298 int len
299 );
300
301BZ_EXTERN int BZ_API(BZ2_bzwrite) (
302 BZFILE* b,
303 void* buf,
304 int len
305 );
306
307BZ_EXTERN int BZ_API(BZ2_bzflush) (
308 BZFILE* b
309 );
310
311BZ_EXTERN void BZ_API(BZ2_bzclose) (
312 BZFILE* b
313 );
314
315BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
316 BZFILE *b,
317 int *errnum
318 );
319#endif
320
321#ifdef __cplusplus
322}
323#endif
324
325#endif
326
327
328
329
330