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
97 #define BZ_EXTERN extern
100 /*-- Core (low-level) library functions --*/
102 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
109 BZ_EXTERN int BZ_API(BZ2_bzCompress) (
114 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
118 BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
124 BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
128 BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
134 /*-- High(er) level library functions --*/
137 #define BZ_MAX_UNUSED 5000
141 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
150 BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
155 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
162 BZ_EXTERN int BZ_API(BZ2_bzRead) (
169 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
177 BZ_EXTERN void BZ_API(BZ2_bzWrite) (
184 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
188 unsigned int* nbytes_in,
189 unsigned int* nbytes_out
192 BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
196 unsigned int* nbytes_in_lo32,
197 unsigned int* nbytes_in_hi32,
198 unsigned int* nbytes_out_lo32,
199 unsigned int* nbytes_out_hi32
204 /*-- Utility functions --*/
206 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
208 unsigned int* destLen,
210 unsigned int sourceLen,
216 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
218 unsigned int* destLen,
220 unsigned int sourceLen,
227 Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
228 to support better zlib compatibility.
229 This code is not _officially_ part of libbzip2 (yet);
230 I haven't tested it, documented it, or considered the
231 threading-safeness of it.
232 If this code breaks, please contact both Yoshioka and me.
235 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
240 BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
245 BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
250 BZ_EXTERN int BZ_API(BZ2_bzread) (
256 BZ_EXTERN int BZ_API(BZ2_bzwrite) (
262 BZ_EXTERN int BZ_API(BZ2_bzflush) (
266 BZ_EXTERN void BZ_API(BZ2_bzclose) (
270 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
282 /*-------------------------------------------------------------*/
283 /*--- end bzlib.h ---*/
284 /*-------------------------------------------------------------*/