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 */
71 #define BZ_NO_COMPRESS
72 /* End of configuration for U-Boot environment */
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)
100 unsigned int avail_in
;
101 unsigned int total_in_lo32
;
102 unsigned int total_in_hi32
;
105 unsigned int avail_out
;
106 unsigned int total_out_lo32
;
107 unsigned int total_out_hi32
;
111 void *(*bzalloc
)(void *,int,int);
112 void (*bzfree
)(void *,void *);
123 # include <windows.h>
125 /* windows.h define small to char */
129 # define BZ_API(func) WINAPI func
130 # define BZ_EXTERN extern
132 /* import windows dll dynamically */
133 # define BZ_API(func) (WINAPI * func)
137 # define BZ_API(func) func
138 # define BZ_EXTERN extern
142 /*-- Core (low-level) library functions --*/
144 BZ_EXTERN
int BZ_API(BZ2_bzCompressInit
) (
151 BZ_EXTERN
int BZ_API(BZ2_bzCompress
) (
156 BZ_EXTERN
int BZ_API(BZ2_bzCompressEnd
) (
160 BZ_EXTERN
int BZ_API(BZ2_bzDecompressInit
) (
166 BZ_EXTERN
int BZ_API(BZ2_bzDecompress
) (
170 BZ_EXTERN
int BZ_API(BZ2_bzDecompressEnd
) (
175 /*-- High(er) level library functions --*/
178 #define BZ_MAX_UNUSED 5000
180 /* Need a definitition for FILE */
185 BZ_EXTERN BZFILE
* BZ_API(BZ2_bzReadOpen
) (
194 BZ_EXTERN
void BZ_API(BZ2_bzReadClose
) (
199 BZ_EXTERN
void BZ_API(BZ2_bzReadGetUnused
) (
206 BZ_EXTERN
int BZ_API(BZ2_bzRead
) (
213 BZ_EXTERN BZFILE
* BZ_API(BZ2_bzWriteOpen
) (
221 BZ_EXTERN
void BZ_API(BZ2_bzWrite
) (
228 BZ_EXTERN
void BZ_API(BZ2_bzWriteClose
) (
232 unsigned int* nbytes_in
,
233 unsigned int* nbytes_out
236 BZ_EXTERN
void BZ_API(BZ2_bzWriteClose64
) (
240 unsigned int* nbytes_in_lo32
,
241 unsigned int* nbytes_in_hi32
,
242 unsigned int* nbytes_out_lo32
,
243 unsigned int* nbytes_out_hi32
248 /*-- Utility functions --*/
250 BZ_EXTERN
int BZ_API(BZ2_bzBuffToBuffCompress
) (
252 unsigned int* destLen
,
254 unsigned int sourceLen
,
260 BZ_EXTERN
int BZ_API(BZ2_bzBuffToBuffDecompress
) (
262 unsigned int* destLen
,
264 unsigned int sourceLen
,
271 Code contributed by Yoshioka Tsuneo
272 (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
273 to support better zlib compatibility.
274 This code is not _officially_ part of libbzip2 (yet);
275 I haven't tested it, documented it, or considered the
276 threading-safeness of it.
277 If this code breaks, please contact both Yoshioka and me.
280 BZ_EXTERN
const char * BZ_API(BZ2_bzlibVersion
) (
285 BZ_EXTERN BZFILE
* BZ_API(BZ2_bzopen
) (
290 BZ_EXTERN BZFILE
* BZ_API(BZ2_bzdopen
) (
295 BZ_EXTERN
int BZ_API(BZ2_bzread
) (
301 BZ_EXTERN
int BZ_API(BZ2_bzwrite
) (
307 BZ_EXTERN
int BZ_API(BZ2_bzflush
) (
311 BZ_EXTERN
void BZ_API(BZ2_bzclose
) (
315 BZ_EXTERN
const char * BZ_API(BZ2_bzerror
) (
327 /*-------------------------------------------------------------*/
328 /*--- end bzlib.h ---*/
329 /*-------------------------------------------------------------*/