00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 #ifndef _BZLIB_H
00063 #define _BZLIB_H
00064
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif
00068
00069 #define BZ_RUN 0
00070 #define BZ_FLUSH 1
00071 #define BZ_FINISH 2
00072
00073 #define BZ_OK 0
00074 #define BZ_RUN_OK 1
00075 #define BZ_FLUSH_OK 2
00076 #define BZ_FINISH_OK 3
00077 #define BZ_STREAM_END 4
00078 #define BZ_SEQUENCE_ERROR (-1)
00079 #define BZ_PARAM_ERROR (-2)
00080 #define BZ_MEM_ERROR (-3)
00081 #define BZ_DATA_ERROR (-4)
00082 #define BZ_DATA_ERROR_MAGIC (-5)
00083 #define BZ_IO_ERROR (-6)
00084 #define BZ_UNEXPECTED_EOF (-7)
00085 #define BZ_OUTBUFF_FULL (-8)
00086
00087 typedef
00088 struct {
00089 char *next_in;
00090 unsigned int avail_in;
00091 unsigned int total_in;
00092
00093 char *next_out;
00094 unsigned int avail_out;
00095 unsigned int total_out;
00096
00097 void *state;
00098
00099 void *(*bzalloc)(void *,int,int);
00100 void (*bzfree)(void *,void *);
00101 void *opaque;
00102 }
00103 bz_stream;
00104
00105
00106 #ifndef BZ_IMPORT
00107 #define BZ_EXPORT
00108 #endif
00109
00110 #ifdef _WIN32
00111 # include <stdio.h>
00112 # include <windows.h>
00113 # ifdef small
00114
00115 # undef small
00116 # endif
00117 # ifdef BZ_EXPORT
00118 # define BZ_API(func) WINAPI func
00119 # define BZ_EXTERN extern
00120 # else
00121
00122 # define BZ_API(func) (WINAPI * func)
00123 # define BZ_EXTERN
00124 # endif
00125 #else
00126 # define BZ_API(func) func
00127 # define BZ_EXTERN extern
00128 #endif
00129
00130
00131
00132
00133 BZ_EXTERN int BZ_API(bzCompressInit) (
00134
00135 bz_stream* strm,
00136 int blockSize100k,
00137 int verbosity,
00138 int workFactor
00139 );
00140
00141 BZ_EXTERN int BZ_API(bzCompress) (
00142 bz_stream* strm,
00143 int action
00144 );
00145
00146 BZ_EXTERN int BZ_API(bzCompressEnd) (
00147 bz_stream* strm
00148 );
00149
00150 BZ_EXTERN int BZ_API(bzDecompressInit) (
00151 bz_stream *strm,
00152 int verbosity,
00153 int small
00154 );
00155
00156 BZ_EXTERN int BZ_API(bzDecompress) (
00157 bz_stream* strm
00158 );
00159
00160 BZ_EXTERN int BZ_API(bzDecompressEnd) (
00161 bz_stream *strm
00162 );
00163
00164
00165
00166
00167
00168 #ifndef BZ_NO_STDIO
00169 #define BZ_MAX_UNUSED 5000
00170
00171 typedef void BZFILE;
00172
00173 BZ_EXTERN BZFILE* BZ_API(bzReadOpen) (
00174 int* bzerror,
00175 FILE* f,
00176 int verbosity,
00177 int small,
00178 void* unused,
00179 int nUnused
00180 );
00181
00182 BZ_EXTERN void BZ_API(bzReadClose) (
00183 int* bzerror,
00184 BZFILE* b
00185 );
00186
00187 BZ_EXTERN void BZ_API(bzReadGetUnused) (
00188 int* bzerror,
00189 BZFILE* b,
00190 void** unused,
00191 int* nUnused
00192 );
00193
00194 BZ_EXTERN int BZ_API(bzRead) (
00195 int* bzerror,
00196 BZFILE* b,
00197 void* buf,
00198 int len
00199 );
00200
00201 BZ_EXTERN BZFILE* BZ_API(bzWriteOpen) (
00202 int* bzerror,
00203 FILE* f,
00204 int blockSize100k,
00205 int verbosity,
00206 int workFactor
00207 );
00208
00209 BZ_EXTERN void BZ_API(bzWrite) (
00210 int* bzerror,
00211 BZFILE* b,
00212 void* buf,
00213 int len
00214 );
00215
00216 BZ_EXTERN void BZ_API(bzWriteClose) (
00217 int* bzerror,
00218 BZFILE* b,
00219 int abandon,
00220 unsigned int* nbytes_in,
00221 unsigned int* nbytes_out
00222 );
00223 #endif
00224
00225
00226
00227
00228 BZ_EXTERN int BZ_API(bzBuffToBuffCompress) (
00229 char* dest,
00230 unsigned int* destLen,
00231 char* source,
00232 unsigned int sourceLen,
00233 int blockSize100k,
00234 int verbosity,
00235 int workFactor
00236 );
00237
00238 BZ_EXTERN int BZ_API(bzBuffToBuffDecompress) (
00239 char* dest,
00240 unsigned int* destLen,
00241 char* source,
00242 unsigned int sourceLen,
00243 int small,
00244 int verbosity
00245 );
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258 BZ_EXTERN const char * BZ_API(bzlibVersion) (
00259 void
00260 );
00261
00262 #ifndef BZ_NO_STDIO
00263 BZ_EXTERN BZFILE * BZ_API(bzopen) (
00264 const char *path,
00265 const char *mode
00266 );
00267
00268 BZ_EXTERN BZFILE * BZ_API(bzdopen) (
00269 int fd,
00270 const char *mode
00271 );
00272
00273 BZ_EXTERN int BZ_API(bzread) (
00274 BZFILE* b,
00275 void* buf,
00276 int len
00277 );
00278
00279 BZ_EXTERN int BZ_API(bzwrite) (
00280 BZFILE* b,
00281 void* buf,
00282 int len
00283 );
00284
00285 BZ_EXTERN int BZ_API(bzflush) (
00286 BZFILE* b
00287 );
00288
00289 BZ_EXTERN void BZ_API(bzclose) (
00290 BZFILE* b
00291 );
00292
00293 BZ_EXTERN const char * BZ_API(bzerror) (
00294 BZFILE *b,
00295 int *errnum
00296 );
00297 #endif
00298
00299 #ifdef __cplusplus
00300 }
00301 #endif
00302
00303 #endif
00304
00305
00306
00307