12 13 Redistribution and use in source and binary forms, with or without 14 modification, are permitted provided that the following conditions 15 are met: 16 17 1. Redistributions of source code must retain the above copyright 18 notice, this list of conditions and the following disclaimer. 19 20 2. The origin of this software must not be misrepresented; you must 21 not claim that you wrote the original software. If you use this 22 software in a product, an acknowledgment in the product 23 documentation would be appreciated but is not required. 24 25 3. Altered source versions must be plainly marked as such, and must 26 not be misrepresented as being the original software. 27 28 4. The name of the author may not be used to endorse or promote 29 products derived from this software without specific prior written 30 permission. 31 32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 44 Julian Seward, Cambridge, UK.
| 12 13 Redistribution and use in source and binary forms, with or without 14 modification, are permitted provided that the following conditions 15 are met: 16 17 1. Redistributions of source code must retain the above copyright 18 notice, this list of conditions and the following disclaimer. 19 20 2. The origin of this software must not be misrepresented; you must 21 not claim that you wrote the original software. If you use this 22 software in a product, an acknowledgment in the product 23 documentation would be appreciated but is not required. 24 25 3. Altered source versions must be plainly marked as such, and must 26 not be misrepresented as being the original software. 27 28 4. The name of the author may not be used to endorse or promote 29 products derived from this software without specific prior written 30 permission. 31 32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 44 Julian Seward, Cambridge, UK.
|
115 116#ifdef _WIN32 117# include <windows.h> 118# ifdef small 119 /* windows.h define small to char */ 120# undef small 121# endif 122# ifdef BZ_EXPORT 123# define BZ_API(func) WINAPI func 124# define BZ_EXTERN extern 125# else 126 /* import windows dll dynamically */ 127# define BZ_API(func) (WINAPI * func) 128# define BZ_EXTERN 129# endif 130#else 131# define BZ_API(func) func 132# define BZ_EXTERN extern 133#endif 134 135 136/*-- Core (low-level) library functions --*/ 137 138BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 139 bz_stream* strm, 140 int blockSize100k, 141 int verbosity, 142 int workFactor 143 ); 144 145BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 146 bz_stream* strm, 147 int action 148 ); 149 150BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 151 bz_stream* strm 152 ); 153 154BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 155 bz_stream *strm, 156 int verbosity, 157 int small 158 ); 159 160BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 161 bz_stream* strm 162 ); 163 164BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 165 bz_stream *strm 166 ); 167 168 169 170/*-- High(er) level library functions --*/ 171 172#ifndef BZ_NO_STDIO 173#define BZ_MAX_UNUSED 5000 174 175typedef void BZFILE; 176 177BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 178 int* bzerror, 179 FILE* f, 180 int verbosity, 181 int small, 182 void* unused, 183 int nUnused 184 ); 185 186BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 187 int* bzerror, 188 BZFILE* b 189 ); 190 191BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 192 int* bzerror, 193 BZFILE* b, 194 void** unused, 195 int* nUnused 196 ); 197 198BZ_EXTERN int BZ_API(BZ2_bzRead) ( 199 int* bzerror, 200 BZFILE* b, 201 void* buf, 202 int len 203 ); 204 205BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 206 int* bzerror, 207 FILE* f, 208 int blockSize100k, 209 int verbosity, 210 int workFactor 211 ); 212 213BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 214 int* bzerror, 215 BZFILE* b, 216 void* buf, 217 int len 218 ); 219 220BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 221 int* bzerror, 222 BZFILE* b, 223 int abandon, 224 unsigned int* nbytes_in, 225 unsigned int* nbytes_out 226 ); 227 228BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 229 int* bzerror, 230 BZFILE* b, 231 int abandon, 232 unsigned int* nbytes_in_lo32, 233 unsigned int* nbytes_in_hi32, 234 unsigned int* nbytes_out_lo32, 235 unsigned int* nbytes_out_hi32 236 ); 237#endif 238 239 240/*-- Utility functions --*/ 241 242BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 243 char* dest, 244 unsigned int* destLen, 245 char* source, 246 unsigned int sourceLen, 247 int blockSize100k, 248 int verbosity, 249 int workFactor 250 ); 251 252BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 253 char* dest, 254 unsigned int* destLen, 255 char* source, 256 unsigned int sourceLen, 257 int small, 258 int verbosity 259 ); 260 261 262/*-- 263 Code contributed by Yoshioka Tsuneo 264 (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp), 265 to support better zlib compatibility. 266 This code is not _officially_ part of libbzip2 (yet); 267 I haven't tested it, documented it, or considered the 268 threading-safeness of it. 269 If this code breaks, please contact both Yoshioka and me. 270--*/ 271 272BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( 273 void 274 ); 275 276#ifndef BZ_NO_STDIO 277BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( 278 const char *path, 279 const char *mode 280 ); 281 282BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( 283 int fd, 284 const char *mode 285 ); 286 287BZ_EXTERN int BZ_API(BZ2_bzread) ( 288 BZFILE* b, 289 void* buf, 290 int len 291 ); 292 293BZ_EXTERN int BZ_API(BZ2_bzwrite) ( 294 BZFILE* b, 295 void* buf, 296 int len 297 ); 298 299BZ_EXTERN int BZ_API(BZ2_bzflush) ( 300 BZFILE* b 301 ); 302 303BZ_EXTERN void BZ_API(BZ2_bzclose) ( 304 BZFILE* b 305 ); 306 307BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( 308 BZFILE *b, 309 int *errnum 310 ); 311#endif 312 313#ifdef __cplusplus 314} 315#endif 316 317#endif 318 319/*-------------------------------------------------------------*/ 320/*--- end bzlib.h ---*/ 321/*-------------------------------------------------------------*/
| 117 118#ifdef _WIN32 119# include <windows.h> 120# ifdef small 121 /* windows.h define small to char */ 122# undef small 123# endif 124# ifdef BZ_EXPORT 125# define BZ_API(func) WINAPI func 126# define BZ_EXTERN extern 127# else 128 /* import windows dll dynamically */ 129# define BZ_API(func) (WINAPI * func) 130# define BZ_EXTERN 131# endif 132#else 133# define BZ_API(func) func 134# define BZ_EXTERN extern 135#endif 136 137 138/*-- Core (low-level) library functions --*/ 139 140BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 141 bz_stream* strm, 142 int blockSize100k, 143 int verbosity, 144 int workFactor 145 ); 146 147BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 148 bz_stream* strm, 149 int action 150 ); 151 152BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 153 bz_stream* strm 154 ); 155 156BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 157 bz_stream *strm, 158 int verbosity, 159 int small 160 ); 161 162BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 163 bz_stream* strm 164 ); 165 166BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 167 bz_stream *strm 168 ); 169 170 171 172/*-- High(er) level library functions --*/ 173 174#ifndef BZ_NO_STDIO 175#define BZ_MAX_UNUSED 5000 176 177typedef void BZFILE; 178 179BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 180 int* bzerror, 181 FILE* f, 182 int verbosity, 183 int small, 184 void* unused, 185 int nUnused 186 ); 187 188BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 189 int* bzerror, 190 BZFILE* b 191 ); 192 193BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 194 int* bzerror, 195 BZFILE* b, 196 void** unused, 197 int* nUnused 198 ); 199 200BZ_EXTERN int BZ_API(BZ2_bzRead) ( 201 int* bzerror, 202 BZFILE* b, 203 void* buf, 204 int len 205 ); 206 207BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 208 int* bzerror, 209 FILE* f, 210 int blockSize100k, 211 int verbosity, 212 int workFactor 213 ); 214 215BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 216 int* bzerror, 217 BZFILE* b, 218 void* buf, 219 int len 220 ); 221 222BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 223 int* bzerror, 224 BZFILE* b, 225 int abandon, 226 unsigned int* nbytes_in, 227 unsigned int* nbytes_out 228 ); 229 230BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 231 int* bzerror, 232 BZFILE* b, 233 int abandon, 234 unsigned int* nbytes_in_lo32, 235 unsigned int* nbytes_in_hi32, 236 unsigned int* nbytes_out_lo32, 237 unsigned int* nbytes_out_hi32 238 ); 239#endif 240 241 242/*-- Utility functions --*/ 243 244BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 245 char* dest, 246 unsigned int* destLen, 247 char* source, 248 unsigned int sourceLen, 249 int blockSize100k, 250 int verbosity, 251 int workFactor 252 ); 253 254BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 255 char* dest, 256 unsigned int* destLen, 257 char* source, 258 unsigned int sourceLen, 259 int small, 260 int verbosity 261 ); 262 263 264/*-- 265 Code contributed by Yoshioka Tsuneo 266 (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp), 267 to support better zlib compatibility. 268 This code is not _officially_ part of libbzip2 (yet); 269 I haven't tested it, documented it, or considered the 270 threading-safeness of it. 271 If this code breaks, please contact both Yoshioka and me. 272--*/ 273 274BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( 275 void 276 ); 277 278#ifndef BZ_NO_STDIO 279BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( 280 const char *path, 281 const char *mode 282 ); 283 284BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( 285 int fd, 286 const char *mode 287 ); 288 289BZ_EXTERN int BZ_API(BZ2_bzread) ( 290 BZFILE* b, 291 void* buf, 292 int len 293 ); 294 295BZ_EXTERN int BZ_API(BZ2_bzwrite) ( 296 BZFILE* b, 297 void* buf, 298 int len 299 ); 300 301BZ_EXTERN int BZ_API(BZ2_bzflush) ( 302 BZFILE* b 303 ); 304 305BZ_EXTERN void BZ_API(BZ2_bzclose) ( 306 BZFILE* b 307 ); 308 309BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( 310 BZFILE *b, 311 int *errnum 312 ); 313#endif 314 315#ifdef __cplusplus 316} 317#endif 318 319#endif 320 321/*-------------------------------------------------------------*/ 322/*--- end bzlib.h ---*/ 323/*-------------------------------------------------------------*/
|