2 /*-------------------------------------------------------------*/
3 /*--- Public header file for the library. ---*/
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
17 This program is released under the terms of the license contained
19 ------------------------------------------------------------------ */
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)
51 unsigned int avail_in;
52 unsigned int total_in_lo32;
53 unsigned int total_in_hi32;
56 unsigned int avail_out;
57 unsigned int total_out_lo32;
58 unsigned int total_out_hi32;
62 void *(*bzalloc)(void *,int,int);
63 void (*bzfree)(void *,void *);
74 /* Need a definitition for FILE */
81 /* windows.h define small to char */
85 # define BZ_API(func) WINAPI func
86 # define BZ_EXTERN extern
88 /* import windows dll dynamically */
89 # define BZ_API(func) (WINAPI * func)
93 # define BZ_API(func) func
94 # define BZ_EXTERN extern
98 /*-- Core (low-level) library functions --*/
100 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
107 BZ_EXTERN int BZ_API(BZ2_bzCompress) (
112 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
116 BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
122 BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
126 BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
132 /*-- High(er) level library functions --*/
135 #define BZ_MAX_UNUSED 5000
139 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
148 BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
153 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
160 BZ_EXTERN int BZ_API(BZ2_bzRead) (
167 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
175 BZ_EXTERN void BZ_API(BZ2_bzWrite) (
182 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
186 unsigned int* nbytes_in,
187 unsigned int* nbytes_out
190 BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
194 unsigned int* nbytes_in_lo32,
195 unsigned int* nbytes_in_hi32,
196 unsigned int* nbytes_out_lo32,
197 unsigned int* nbytes_out_hi32
202 /*-- Utility functions --*/
204 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
206 unsigned int* destLen,
208 unsigned int sourceLen,
214 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
216 unsigned int* destLen,
218 unsigned int sourceLen,
225 Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
226 to support better zlib compatibility.
227 This code is not _officially_ part of libbzip2 (yet);
228 I haven't tested it, documented it, or considered the
229 threading-safeness of it.
230 If this code breaks, please contact both Yoshioka and me.
233 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
238 BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
243 BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
248 BZ_EXTERN int BZ_API(BZ2_bzread) (
254 BZ_EXTERN int BZ_API(BZ2_bzwrite) (
260 BZ_EXTERN int BZ_API(BZ2_bzflush) (
264 BZ_EXTERN void BZ_API(BZ2_bzclose) (
268 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
280 /*-------------------------------------------------------------*/
281 /*--- end bzlib.h ---*/
282 /*-------------------------------------------------------------*/