8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / common / bzip2 / bzlib.h
blobfbfb462b92e7de7e93c36dec7c6242343a9b87e6
2 /*-------------------------------------------------------------*/
3 /*--- Public header file for the library. ---*/
4 /*--- bzlib.h ---*/
5 /*-------------------------------------------------------------*/
7 /* ------------------------------------------------------------------
8 This file is part of bzip2/libbzip2, a program and library for
9 lossless, block-sorting data compression.
11 bzip2/libbzip2 version 1.0.6 of 6 September 2010
12 Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 README file.
17 This program is released under the terms of the license contained
18 in the file LICENSE.
19 ------------------------------------------------------------------ */
21 #ifndef _BZLIB_H
22 #define _BZLIB_H
24 #ifdef _KERNEL
25 #define BZ_NO_STDIO
26 #endif
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 #define BZ_RUN 0
33 #define BZ_FLUSH 1
34 #define BZ_FINISH 2
36 #define BZ_OK 0
37 #define BZ_RUN_OK 1
38 #define BZ_FLUSH_OK 2
39 #define BZ_FINISH_OK 3
40 #define BZ_STREAM_END 4
41 #define BZ_SEQUENCE_ERROR (-1)
42 #define BZ_PARAM_ERROR (-2)
43 #define BZ_MEM_ERROR (-3)
44 #define BZ_DATA_ERROR (-4)
45 #define BZ_DATA_ERROR_MAGIC (-5)
46 #define BZ_IO_ERROR (-6)
47 #define BZ_UNEXPECTED_EOF (-7)
48 #define BZ_OUTBUFF_FULL (-8)
49 #define BZ_CONFIG_ERROR (-9)
51 typedef
52 struct {
53 char *next_in;
54 unsigned int avail_in;
55 unsigned int total_in_lo32;
56 unsigned int total_in_hi32;
58 char *next_out;
59 unsigned int avail_out;
60 unsigned int total_out_lo32;
61 unsigned int total_out_hi32;
63 void *state;
65 void *(*bzalloc)(void *,int,int);
66 void (*bzfree)(void *,void *);
67 void *opaque;
69 bz_stream;
72 #ifndef BZ_IMPORT
73 #define BZ_EXPORT
74 #endif
76 #ifndef BZ_NO_STDIO
77 /* Need a definitition for FILE */
78 #include <stdio.h>
79 #endif
81 #ifdef _WIN32
82 # include <windows.h>
83 # ifdef small
84 /* windows.h define small to char */
85 # undef small
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 # define BZ_EXTERN extern
98 #endif
101 /*-- Core (low-level) library functions --*/
103 #define BZ2_BZALLOC_ALIGN (64)
105 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
106 bz_stream* strm,
107 int blockSize100k,
108 int verbosity,
109 int workFactor
112 BZ_EXTERN int BZ_API(BZ2_bzCompressInitSize) (
113 int blockSize100k
116 BZ_EXTERN int BZ_API(BZ2_bzCompressReset) (
117 bz_stream* strm
120 BZ_EXTERN int BZ_API(BZ2_bzCompress) (
121 bz_stream* strm,
122 int action
125 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
126 bz_stream* strm
129 BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
130 bz_stream *strm,
131 int verbosity,
132 int small
135 BZ_EXTERN int BZ_API(BZ2_bzDecompressReset) (
136 bz_stream* strm
139 BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
140 bz_stream* strm
143 BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
144 bz_stream *strm
147 BZ_EXTERN const char * BZ_API(BZ2_bzErrorString) (
148 int error_code
153 /*-- High(er) level library functions --*/
155 #ifndef BZ_NO_STDIO
156 #define BZ_MAX_UNUSED 5000
158 typedef void BZFILE;
160 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
161 int* bzerror,
162 FILE* f,
163 int verbosity,
164 int small,
165 void* unused,
166 int nUnused
169 BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
170 int* bzerror,
171 BZFILE* b
174 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
175 int* bzerror,
176 BZFILE* b,
177 void** unused,
178 int* nUnused
181 BZ_EXTERN int BZ_API(BZ2_bzRead) (
182 int* bzerror,
183 BZFILE* b,
184 void* buf,
185 int len
188 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
189 int* bzerror,
190 FILE* f,
191 int blockSize100k,
192 int verbosity,
193 int workFactor
196 BZ_EXTERN void BZ_API(BZ2_bzWrite) (
197 int* bzerror,
198 BZFILE* b,
199 void* buf,
200 int len
203 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
204 int* bzerror,
205 BZFILE* b,
206 int abandon,
207 unsigned int* nbytes_in,
208 unsigned int* nbytes_out
211 BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
212 int* bzerror,
213 BZFILE* b,
214 int abandon,
215 unsigned int* nbytes_in_lo32,
216 unsigned int* nbytes_in_hi32,
217 unsigned int* nbytes_out_lo32,
218 unsigned int* nbytes_out_hi32
220 #endif
223 /*-- Utility functions --*/
225 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
226 char* dest,
227 unsigned int* destLen,
228 char* source,
229 unsigned int sourceLen,
230 int blockSize100k,
231 int verbosity,
232 int workFactor
235 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
236 char* dest,
237 unsigned int* destLen,
238 char* source,
239 unsigned int sourceLen,
240 int small,
241 int verbosity
245 /*--
246 Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
247 to support better zlib compatibility.
248 This code is not _officially_ part of libbzip2 (yet);
249 I haven't tested it, documented it, or considered the
250 threading-safeness of it.
251 If this code breaks, please contact both Yoshioka and me.
252 --*/
254 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
255 void
258 #ifndef BZ_NO_STDIO
259 BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
260 const char *path,
261 const char *mode
264 BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
265 int fd,
266 const char *mode
269 BZ_EXTERN int BZ_API(BZ2_bzread) (
270 BZFILE* b,
271 void* buf,
272 int len
275 BZ_EXTERN int BZ_API(BZ2_bzwrite) (
276 BZFILE* b,
277 void* buf,
278 int len
281 BZ_EXTERN int BZ_API(BZ2_bzflush) (
282 BZFILE* b
285 BZ_EXTERN void BZ_API(BZ2_bzclose) (
286 BZFILE* b
289 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
290 BZFILE *b,
291 int *errnum
293 #endif
295 #ifdef __cplusplus
297 #endif
299 /*-------------------------------------------------------------*/
300 /*--- end bzlib.h ---*/
301 /*-------------------------------------------------------------*/
302 #endif /* _BZLIB_H */