Debian Codegraph @

include/bzlib.h

raw symbols SCIP
1
2 /*-------------------------------------------------------------*/
3 /*--- Public header file for the library. ---*/
4 /*--- bzlib.h ---*/
5 /*-------------------------------------------------------------*/
6
7 /* ------------------------------------------------------------------
8 This file is part of bzip2/libbzip2, a program and library for
9 lossless, block-sorting data compression.
10
11 bzip2/libbzip2 version 1.1.0 of 6 September 2010
12 Copyright (C) 1996-2010 Julian Seward <[email protected]>
13
14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 README file.
16
17 This program is released under the terms of the license contained
18 in the file LICENSE.
19 ------------------------------------------------------------------ */
20
21
22 #ifndef _BZLIB_H
23 #define _BZLIB_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #define BZ_RUN 0
30 #define BZ_FLUSH 1
31 #define BZ_FINISH 2
32
33 #define BZ_OK 0
34 #define BZ_RUN_OK 1
35 #define BZ_FLUSH_OK 2
36 #define BZ_FINISH_OK 3
37 #define BZ_STREAM_END 4
38 #define BZ_SEQUENCE_ERROR (-1)
39 #define BZ_PARAM_ERROR (-2)
40 #define BZ_MEM_ERROR (-3)
41 #define BZ_DATA_ERROR (-4)
42 #define BZ_DATA_ERROR_MAGIC (-5)
43 #define BZ_IO_ERROR (-6)
44 #define BZ_UNEXPECTED_EOF (-7)
45 #define BZ_OUTBUFF_FULL (-8)
46 #define BZ_CONFIG_ERROR (-9)
47
48 typedef
49 struct {
50 char *next_in;
51 unsigned int avail_in;
52 unsigned int total_in_lo32;
53 unsigned int total_in_hi32;
54
55 char *next_out;
56 unsigned int avail_out;
57 unsigned int total_out_lo32;
58 unsigned int total_out_hi32;
59
60 void *state;
61
62 void *(*bzalloc)(void *,int,int);
63 void (*bzfree)(void *,void *);
64 void *opaque;
65 }
66 bz_stream;
67
68
69 #ifndef BZ_IMPORT
70 #define BZ_EXPORT
71 #endif
72
73 #ifndef BZ_NO_STDIO
74 /* Need a definitition for FILE */
75 #include <stdio.h>
76 #endif
77
78 #ifdef _WIN32
79 # include <windows.h>
80 # ifdef small
81 /* windows.h define small to char */
82 # undef small
83 # endif
84 # ifndef WINAPI
85 # define WINAPI
86 # endif
87 # ifdef BZ_EXPORT
88 # define BZ_API(func) WINAPI func
89 # define BZ_EXTERN extern
90 # else
91 /* import windows dll dynamically */
92 # define BZ_API(func) (WINAPI * func)
93 # define BZ_EXTERN
94 # endif
95 #else
96 # define BZ_API(func) func
97 #endif
98
99 #ifndef BZ_EXTERN
100 #define BZ_EXTERN extern
101 #endif
102
103 /*-- Core (low-level) library functions --*/
104
105 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
106 bz_stream* strm,
107 int blockSize100k,
108 int verbosity,
109 int workFactor
110 );
111
112 BZ_EXTERN int BZ_API(BZ2_bzCompress) (
113 bz_stream* strm,
114 int action
115 );
116
117 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
118 bz_stream* strm
119 );
120
121 BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
122 bz_stream *strm,
123 int verbosity,
124 int small
125 );
126
127 BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
128 bz_stream* strm
129 );
130
131 BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
132 bz_stream *strm
133 );
134
135
136
137 /*-- High(er) level library functions --*/
138
139 #ifndef BZ_NO_STDIO
140 #define BZ_MAX_UNUSED 5000
141
142 typedef void BZFILE;
143
144 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
145 int* bzerror,
146 FILE* f,
147 int verbosity,
148 int small,
149 void* unused,
150 int nUnused
151 );
152
153 BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
154 int* bzerror,
155 BZFILE* b
156 );
157
158 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
159 int* bzerror,
160 BZFILE* b,
161 void** unused,
162 int* nUnused
163 );
164
165 BZ_EXTERN int BZ_API(BZ2_bzRead) (
166 int* bzerror,
167 BZFILE* b,
168 void* buf,
169 int len
170 );
171
172 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
173 int* bzerror,
174 FILE* f,
175 int blockSize100k,
176 int verbosity,
177 int workFactor
178 );
179
180 BZ_EXTERN void BZ_API(BZ2_bzWrite) (
181 int* bzerror,
182 BZFILE* b,
183 void* buf,
184 int len
185 );
186
187 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
188 int* bzerror,
189 BZFILE* b,
190 int abandon,
191 unsigned int* nbytes_in,
192 unsigned int* nbytes_out
193 );
194
195 BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
196 int* bzerror,
197 BZFILE* b,
198 int abandon,
199 unsigned int* nbytes_in_lo32,
200 unsigned int* nbytes_in_hi32,
201 unsigned int* nbytes_out_lo32,
202 unsigned int* nbytes_out_hi32
203 );
204 #endif
205
206
207 /*-- Utility functions --*/
208
209 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
210 char* dest,
211 unsigned int* destLen,
212 char* source,
213 unsigned int sourceLen,
214 int blockSize100k,
215 int verbosity,
216 int workFactor
217 );
218
219 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
220 char* dest,
221 unsigned int* destLen,
222 char* source,
223 unsigned int sourceLen,
224 int small,
225 int verbosity
226 );
227
228
229 /*--
230 Code contributed by Yoshioka Tsuneo ([email protected])
231 to support better zlib compatibility.
232 This code is not _officially_ part of libbzip2 (yet);
233 I haven't tested it, documented it, or considered the
234 threading-safeness of it.
235 If this code breaks, please contact both Yoshioka and me.
236 --*/
237
238 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
239 void
240 );
241
242 #ifndef BZ_NO_STDIO
243 BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
244 const char *path,
245 const char *mode
246 );
247
248 BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
249 int fd,
250 const char *mode
251 );
252
253 BZ_EXTERN int BZ_API(BZ2_bzread) (
254 BZFILE* b,
255 void* buf,
256 int len
257 );
258
259 BZ_EXTERN int BZ_API(BZ2_bzwrite) (
260 BZFILE* b,
261 void* buf,
262 int len
263 );
264
265 BZ_EXTERN int BZ_API(BZ2_bzflush) (
266 BZFILE* b
267 );
268
269 BZ_EXTERN void BZ_API(BZ2_bzclose) (
270 BZFILE* b
271 );
272
273 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
274 BZFILE *b,
275 int *errnum
276 );
277 #endif
278
279 #ifdef __cplusplus
280 }
281 #endif
282
283 #endif
284
285 /*-------------------------------------------------------------*/
286 /*--- end bzlib.h ---*/
287 /*-------------------------------------------------------------*/