www.pudn.com > 200410111032011273DESMD5ZLIB算法源代码.rar > Zutil.h
/* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ #ifndef _Z_UTIL_H #define _Z_UTIL_H #include "zlib.h" #include#include #include #include /* compile with -Dlocal if your debugger can't find static symbols */ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ return (strm->msg = (char*)ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ /* common constants */ #define DEF_WBITS MAX_WBITS /* default windowBits for decompression. MAX_WBITS is for compression only */ /*#if MAX_MEM_LEVEL >= 8 # define DEF_MEM_LEVEL 8 #else*/ #define DEF_MEM_LEVEL MAX_MEM_LEVEL //#endif /* default memLevel */ #define STORED_BLOCK 0 #define STATIC_TREES 1 #define DYN_TREES 2 /* The three kinds of block type */ #define MIN_MATCH 3 #define MAX_MATCH 258 /* The minimum and maximum match lengths */ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ /* functions */ typedef unsigned long (*check_func)(unsigned long check, const BYTE *buf, unsigned int len); void *zcalloc(void *opaque, unsigned items, unsigned size); void zcfree (void *opaque, void *ptr); #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (void *)(addr)) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} #endif /* _Z_UTIL_H */