123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- #ifndef ZUTIL_H
- #define ZUTIL_H
- #define ZLIB_INTERNAL
- #include "zlib.h"
- #ifdef STDC
- # ifndef _WIN32_WCE
- # include <stddef.h>
- # endif
- # include <string.h>
- # include <stdlib.h>
- #endif
- #ifdef NO_ERRNO_H
- # ifdef _WIN32_WCE
-
- # define errno z_errno
- # endif
- extern int errno;
- #else
- # ifndef _WIN32_WCE
- # include <errno.h>
- # endif
- #endif
- #ifndef local
- # define local static
- #endif
- typedef unsigned char uch;
- typedef uch FAR uchf;
- typedef unsigned short ush;
- typedef ush FAR ushf;
- typedef unsigned long ulg;
- extern const char * const z_errmsg[10];
- #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
- #define ERR_RETURN(strm,err) \
- return (strm->msg = (char*)ERR_MSG(err), (err))
-
- #ifndef DEF_WBITS
- # define DEF_WBITS MAX_WBITS
- #endif
- #if MAX_MEM_LEVEL >= 8
- # define DEF_MEM_LEVEL 8
- #else
- # define DEF_MEM_LEVEL MAX_MEM_LEVEL
- #endif
- #define STORED_BLOCK 0
- #define STATIC_TREES 1
- #define DYN_TREES 2
- #define MIN_MATCH 3
- #define MAX_MATCH 258
-
- #ifdef CONFIG_GZIP_COMPRESSED
- #define PRESET_DICT 0x20
- # define OS_CODE 0x03
- #endif
- #include <linux/string.h>
- #define zmemcpy memcpy
- #define zmemcmp memcmp
- #define zmemzero(dest, len) memset(dest, 0, len)
- #ifdef DEBUG
- extern int z_verbose;
- extern void z_error OF((char *m));
- # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
- # define Trace(x) {if (z_verbose>=0) fprintf x ;}
- # define Tracev(x) {if (z_verbose>0) fprintf x ;}
- # define Tracevv(x) {if (z_verbose>1) fprintf x ;}
- # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
- # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
- #else
- # define Assert(cond,msg)
- # define Trace(x)
- # define Tracev(x)
- # define Tracevv(x)
- # define Tracec(c,x)
- # define Tracecv(c,x)
- #endif
- voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
- void zcfree OF((voidpf opaque, voidpf ptr, unsigned size));
- #define ZALLOC(strm, items, size) \
- (*((strm)->zalloc))((strm)->opaque, (items), (size))
- #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr), 0)
- #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
- #endif
|