2 * This file is a modified version of bzlib.h from the bzip2-1.0.2
3 * distribution which can be found at http://sources.redhat.com/bzip2/
6 /*-------------------------------------------------------------*/
7 /*--- Public header file for the library. ---*/
9 /*-------------------------------------------------------------*/
12 This file is a part of bzip2 and/or libbzip2, a program and
13 library for lossless, block-sorting data compression.
15 Copyright (C) 1996-2002 Julian R Seward. All rights reserved.
17 Redistribution and use in source and binary forms, with or without
18 modification, are permitted provided that the following conditions
21 1. Redistributions of source code must retain the above copyright
22 notice, this list of conditions and the following disclaimer.
24 2. The origin of this software must not be misrepresented; you must
25 not claim that you wrote the original software. If you use this
26 software in a product, an acknowledgment in the product
27 documentation would be appreciated but is not required.
29 3. Altered source versions must be plainly marked as such, and must
30 not be misrepresented as being the original software.
32 4. The name of the author may not be used to endorse or promote
33 products derived from this software without specific prior written
36 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
37 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
38 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
40 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
42 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
45 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
46 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48 Julian Seward, Cambridge, UK.
50 bzip2/libbzip2 version 1.0 of 21 March 2000
52 This program is based on (at least) the work of:
62 For more information on these sources, see the manual.
69 /* Configure for U-Boot environment */
72 #ifndef CONFIG_SANDBOX
73 #define BZ_NO_COMPRESS
75 /* End of configuration for U-Boot environment */
88 #define BZ_FINISH_OK 3
89 #define BZ_STREAM_END 4
90 #define BZ_SEQUENCE_ERROR (-1)
91 #define BZ_PARAM_ERROR (-2)
92 #define BZ_MEM_ERROR (-3)
93 #define BZ_DATA_ERROR (-4)
94 #define BZ_DATA_ERROR_MAGIC (-5)
95 #define BZ_IO_ERROR (-6)
96 #define BZ_UNEXPECTED_EOF (-7)
97 #define BZ_OUTBUFF_FULL (-8)
98 #define BZ_CONFIG_ERROR (-9)
103 unsigned int avail_in;
104 unsigned int total_in_lo32;
105 unsigned int total_in_hi32;
108 unsigned int avail_out;
109 unsigned int total_out_lo32;
110 unsigned int total_out_hi32;
114 void *(*bzalloc)(void *,int,int);
115 void (*bzfree)(void *,void *);
126 # include <windows.h>
128 /* windows.h define small to char */
132 # define BZ_API(func) WINAPI func
133 # define BZ_EXTERN extern
135 /* import windows dll dynamically */
136 # define BZ_API(func) (WINAPI * func)
140 # define BZ_API(func) func
141 # define BZ_EXTERN extern
145 /*-- Core (low-level) library functions --*/
147 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
154 BZ_EXTERN int BZ_API(BZ2_bzCompress) (
159 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
163 BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
169 BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
173 BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
178 /*-- High(er) level library functions --*/
181 #define BZ_MAX_UNUSED 5000
183 /* Need a definitition for FILE */
188 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
197 BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
202 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
209 BZ_EXTERN int BZ_API(BZ2_bzRead) (
216 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
224 BZ_EXTERN void BZ_API(BZ2_bzWrite) (
231 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
235 unsigned int* nbytes_in,
236 unsigned int* nbytes_out
239 BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
243 unsigned int* nbytes_in_lo32,
244 unsigned int* nbytes_in_hi32,
245 unsigned int* nbytes_out_lo32,
246 unsigned int* nbytes_out_hi32
251 /*-- Utility functions --*/
253 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
255 unsigned int* destLen,
257 unsigned int sourceLen,
263 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
265 unsigned int* destLen,
267 unsigned int sourceLen,
274 Code contributed by Yoshioka Tsuneo
275 (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
276 to support better zlib compatibility.
277 This code is not _officially_ part of libbzip2 (yet);
278 I haven't tested it, documented it, or considered the
279 threading-safeness of it.
280 If this code breaks, please contact both Yoshioka and me.
283 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
288 BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
293 BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
298 BZ_EXTERN int BZ_API(BZ2_bzread) (
304 BZ_EXTERN int BZ_API(BZ2_bzwrite) (
310 BZ_EXTERN int BZ_API(BZ2_bzflush) (
314 BZ_EXTERN void BZ_API(BZ2_bzclose) (
318 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
330 /*-------------------------------------------------------------*/
331 /*--- end bzlib.h ---*/
332 /*-------------------------------------------------------------*/