1 2 /*-------------------------------------------------------------*/ 3 /*--- Public header file for the library. ---*/ 4 /*--- bzlib.h ---*/ 5 /*-------------------------------------------------------------*/ 6 7 /* ------------------------------------------------------------------ 8 This file is part of bzip2/libbzip2, a program and library for 9 lossless, block-sorting data compression. 10 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org> 13 This file was modified for ClamAV by aCaB <acab@clamav.net> 14 15 This program is released under the terms of the license contained 16 in the file COPYING.bzip2. 17 ------------------------------------------------------------------ */ 18 19 20 #ifndef _NSIS_BZLIB_H 21 #define _NSIS_BZLIB_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #define BZ_RUN 0 28 #define BZ_FLUSH 1 29 #define BZ_FINISH 2 30 31 #define BZ_OK 0 32 #define BZ_RUN_OK 1 33 #define BZ_FLUSH_OK 2 34 #define BZ_FINISH_OK 3 35 #define BZ_STREAM_END 4 36 #define BZ_SEQUENCE_ERROR (-1) 37 #define BZ_PARAM_ERROR (-2) 38 #define BZ_MEM_ERROR (-3) 39 #define BZ_DATA_ERROR (-4) 40 #define BZ_DATA_ERROR_MAGIC (-5) 41 #define BZ_IO_ERROR (-6) 42 #define BZ_UNEXPECTED_EOF (-7) 43 #define BZ_OUTBUFF_FULL (-8) 44 #define BZ_CONFIG_ERROR (-9) 45 46 typedef 47 struct { 48 unsigned char *next_in; 49 unsigned int avail_in; 50 unsigned int total_in_lo32; 51 unsigned int total_in_hi32; 52 53 unsigned char *next_out; 54 unsigned int avail_out; 55 unsigned int total_out_lo32; 56 unsigned int total_out_hi32; 57 58 void *state; 59 60 void *(*bzalloc)(void *,int,int); 61 void (*bzfree)(void *,void *); 62 void *opaque; 63 } 64 nsis_bzstream; 65 66 67 #ifndef BZ_IMPORT 68 #define BZ_EXPORT 69 #endif 70 71 #ifndef BZ_NO_STDIO 72 /* Need a definitition for FILE */ 73 #include <stdio.h> 74 #endif 75 76 77 #define BZ_API(func) func 78 #define BZ_EXTERN extern 79 80 81 /*-- Core (low-level) library functions --*/ 82 /* aCaB 83 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 84 nsis_bzstream* strm, 85 int blockSize100k, 86 int verbosity, 87 int workFactor 88 ); 89 90 BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 91 nsis_bzstream* strm, 92 int action 93 ); 94 95 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 96 nsis_bzstream* strm 97 ); 98 */ 99 BZ_EXTERN int BZ_API(nsis_BZ2_bzDecompressInit) ( 100 nsis_bzstream *strm, 101 int verbosity, 102 int small 103 ); 104 105 BZ_EXTERN int BZ_API(nsis_BZ2_bzDecompress) ( 106 nsis_bzstream* strm 107 ); 108 109 BZ_EXTERN int BZ_API(nsis_BZ2_bzDecompressEnd) ( 110 nsis_bzstream *strm 111 ); 112 113 114 115 /*-- High(er) level library functions --*/ 116 /* aCaB 117 #ifndef BZ_NO_STDIO 118 #define BZ_MAX_UNUSED 5000 119 120 typedef void BZFILE; 121 122 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 123 int* bzerror, 124 FILE* f, 125 int verbosity, 126 int small, 127 void* unused, 128 int nUnused 129 ); 130 131 BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 132 int* bzerror, 133 BZFILE* b 134 ); 135 136 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 137 int* bzerror, 138 BZFILE* b, 139 void** unused, 140 int* nUnused 141 ); 142 143 BZ_EXTERN int BZ_API(BZ2_bzRead) ( 144 int* bzerror, 145 BZFILE* b, 146 void* buf, 147 int len 148 ); 149 150 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 151 int* bzerror, 152 FILE* f, 153 int blockSize100k, 154 int verbosity, 155 int workFactor 156 ); 157 158 BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 159 int* bzerror, 160 BZFILE* b, 161 void* buf, 162 int len 163 ); 164 165 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 166 int* bzerror, 167 BZFILE* b, 168 int abandon, 169 unsigned int* nbytes_in, 170 unsigned int* nbytes_out 171 ); 172 173 BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 174 int* bzerror, 175 BZFILE* b, 176 int abandon, 177 unsigned int* nbytes_in_lo32, 178 unsigned int* nbytes_in_hi32, 179 unsigned int* nbytes_out_lo32, 180 unsigned int* nbytes_out_hi32 181 ); 182 #endif 183 */ 184 /*-- Utility functions --*/ 185 /* aCaB 186 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 187 char* dest, 188 unsigned int* destLen, 189 char* source, 190 unsigned int sourceLen, 191 int blockSize100k, 192 int verbosity, 193 int workFactor 194 ); 195 196 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 197 char* dest, 198 unsigned int* destLen, 199 char* source, 200 unsigned int sourceLen, 201 int small, 202 int verbosity 203 ); 204 */ 205 206 /*-- 207 Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) 208 to support better zlib compatibility. 209 This code is not _officially_ part of libbzip2 (yet); 210 I haven't tested it, documented it, or considered the 211 threading-safeness of it. 212 If this code breaks, please contact both Yoshioka and me. 213 --*/ 214 /* aCaB 215 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( 216 void 217 ); 218 219 #ifndef BZ_NO_STDIO 220 BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( 221 const char *path, 222 const char *mode 223 ); 224 225 BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( 226 int fd, 227 const char *mode 228 ); 229 230 BZ_EXTERN int BZ_API(BZ2_bzread) ( 231 BZFILE* b, 232 void* buf, 233 int len 234 ); 235 236 BZ_EXTERN int BZ_API(BZ2_bzwrite) ( 237 BZFILE* b, 238 void* buf, 239 int len 240 ); 241 242 BZ_EXTERN int BZ_API(BZ2_bzflush) ( 243 BZFILE* b 244 ); 245 246 BZ_EXTERN void BZ_API(BZ2_bzclose) ( 247 BZFILE* b 248 ); 249 250 BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( 251 BZFILE *b, 252 int *errnum 253 ); 254 #endif 255 */ 256 #ifdef __cplusplus 257 } 258 #endif 259 260 #endif 261 262 /*-------------------------------------------------------------*/ 263 /*--- end bzlib.h ---*/ 264 /*-------------------------------------------------------------*/ 265