[9] | 1 | /* zutil.h (internal interface of the zlib compression library) */ |
---|
| 2 | |
---|
| 3 | /* Modified by Andrew Makhorin <mao@gnu.org>, April 2011 */ |
---|
| 4 | |
---|
| 5 | /* Copyright (C) 1995-2010 Jean-loup Gailly |
---|
| 6 | * For conditions of distribution and use, see copyright notice in |
---|
| 7 | * zlib.h */ |
---|
| 8 | |
---|
| 9 | /* WARNING: this file should *not* be used by applications. It is |
---|
| 10 | part of the implementation of the compression library and is |
---|
| 11 | subject to change. Applications should only use zlib.h. */ |
---|
| 12 | |
---|
| 13 | #ifndef ZUTIL_H |
---|
| 14 | #define ZUTIL_H |
---|
| 15 | |
---|
| 16 | #define ZLIB_INTERNAL |
---|
| 17 | |
---|
| 18 | #include "zlib.h" |
---|
| 19 | |
---|
| 20 | #include <stddef.h> |
---|
| 21 | #include <string.h> |
---|
| 22 | #include <stdlib.h> |
---|
| 23 | |
---|
| 24 | #define local static |
---|
| 25 | |
---|
| 26 | typedef unsigned char uch; |
---|
| 27 | typedef uch uchf; |
---|
| 28 | typedef unsigned short ush; |
---|
| 29 | typedef ush ushf; |
---|
| 30 | typedef unsigned long ulg; |
---|
| 31 | |
---|
| 32 | extern const char * const z_errmsg[10]; |
---|
| 33 | |
---|
| 34 | #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] |
---|
| 35 | |
---|
| 36 | #define ERR_RETURN(strm, err) \ |
---|
| 37 | return (strm->msg = (char *)ERR_MSG(err), (err)) |
---|
| 38 | |
---|
| 39 | #define DEF_WBITS MAX_WBITS |
---|
| 40 | |
---|
| 41 | #if MAX_MEM_LEVEL >= 8 |
---|
| 42 | #define DEF_MEM_LEVEL 8 |
---|
| 43 | #else |
---|
| 44 | #define DEF_MEM_LEVEL MAX_MEM_LEVEL |
---|
| 45 | #endif |
---|
| 46 | |
---|
| 47 | #define STORED_BLOCK 0 |
---|
| 48 | #define STATIC_TREES 1 |
---|
| 49 | #define DYN_TREES 2 |
---|
| 50 | |
---|
| 51 | #define MIN_MATCH 3 |
---|
| 52 | #define MAX_MATCH 258 |
---|
| 53 | |
---|
| 54 | #define PRESET_DICT 0x20 |
---|
| 55 | |
---|
| 56 | #define OS_CODE 0x03 /* assume Unix */ |
---|
| 57 | |
---|
| 58 | #define HAVE_MEMCPY 1 |
---|
| 59 | #define zmemcpy memcpy |
---|
| 60 | #define zmemzero(dest, len) memset(dest, 0, len) |
---|
| 61 | |
---|
| 62 | #ifdef DEBUG |
---|
| 63 | #include <stdio.h> |
---|
| 64 | extern int ZLIB_INTERNAL z_verbose; |
---|
| 65 | extern void ZLIB_INTERNAL z_error OF((char *m)); |
---|
| 66 | #define Assert(cond, msg) { if(!(cond)) z_error(msg); } |
---|
| 67 | #define Trace(x) { if (z_verbose >= 0) fprintf x; } |
---|
| 68 | #define Tracev(x) { if (z_verbose > 0) fprintf x; } |
---|
| 69 | #define Tracevv(x) {if (z_verbose > 1) fprintf x; } |
---|
| 70 | #define Tracec(c, x) {if (z_verbose > 0 && (c)) fprintf x; } |
---|
| 71 | #define Tracecv(c, x) {if (z_verbose > 1 && (c)) fprintf x; } |
---|
| 72 | #else |
---|
| 73 | #define Assert(cond, msg) |
---|
| 74 | #define Trace(x) |
---|
| 75 | #define Tracev(x) |
---|
| 76 | #define Tracevv(x) |
---|
| 77 | #define Tracec(c, x) |
---|
| 78 | #define Tracecv(c, x) |
---|
| 79 | #endif |
---|
| 80 | |
---|
| 81 | voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, |
---|
| 82 | unsigned size)); |
---|
| 83 | void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); |
---|
| 84 | |
---|
| 85 | #define ZALLOC(strm, items, size) \ |
---|
| 86 | (*((strm)->zalloc))((strm)->opaque, (items), (size)) |
---|
| 87 | #define ZFREE(strm, addr) \ |
---|
| 88 | (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) |
---|
| 89 | #define TRY_FREE(s, p) { if (p) ZFREE(s, p); } |
---|
| 90 | |
---|
| 91 | #endif |
---|
| 92 | |
---|
| 93 | /* eof */ |
---|