1 /* $NetBSD: bzlib.h,v 1.1.1.2 2012/05/07 00:41:46 wiz Exp $ */
4 /*-------------------------------------------------------------*/
5 /*--- Public header file for the library. ---*/
7 /*-------------------------------------------------------------*/
9 /* ------------------------------------------------------------------
10 This file is part of bzip2/libbzip2, a program and library for
11 lossless, block-sorting data compression.
13 bzip2/libbzip2 version 1.0.6 of 6 September 2010
14 Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
16 Please read the WARNING, DISCLAIMER and PATENTS sections in the
19 This program is released under the terms of the license contained
21 ------------------------------------------------------------------ */
38 #define BZ_FINISH_OK 3
39 #define BZ_STREAM_END 4
40 #define BZ_SEQUENCE_ERROR (-1)
41 #define BZ_PARAM_ERROR (-2)
42 #define BZ_MEM_ERROR (-3)
43 #define BZ_DATA_ERROR (-4)
44 #define BZ_DATA_ERROR_MAGIC (-5)
45 #define BZ_IO_ERROR (-6)
46 #define BZ_UNEXPECTED_EOF (-7)
47 #define BZ_OUTBUFF_FULL (-8)
48 #define BZ_CONFIG_ERROR (-9)
53 unsigned int avail_in
;
54 unsigned int total_in_lo32
;
55 unsigned int total_in_hi32
;
58 unsigned int avail_out
;
59 unsigned int total_out_lo32
;
60 unsigned int total_out_hi32
;
64 void *(*bzalloc
)(void *,int,int);
65 void (*bzfree
)(void *,void *);
76 /* Need a definitition for FILE */
83 /* windows.h define small to char */
87 # define BZ_API(func) WINAPI func
88 # define BZ_EXTERN extern
90 /* import windows dll dynamically */
91 # define BZ_API(func) (WINAPI * func)
95 # define BZ_API(func) func
96 # 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 /*-------------------------------------------------------------*/