1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate * Use is subject to license terms. 4*0Sstevel@tonic-gate */ 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gate /* 7*0Sstevel@tonic-gate * zutil.h -- internal interface and configuration of the compression library 8*0Sstevel@tonic-gate * Copyright (C) 1995-1998 Jean-loup Gailly. 9*0Sstevel@tonic-gate * For conditions of distribution and use, see copyright notice in zlib.h 10*0Sstevel@tonic-gate */ 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gate #ifndef _ZUTIL_H 13*0Sstevel@tonic-gate #define _ZUTIL_H 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gate #include <sys/types.h> 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate #ifdef __cplusplus 20*0Sstevel@tonic-gate extern "C" { 21*0Sstevel@tonic-gate #endif 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gate #include "zlib.h" 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gate #ifndef local 26*0Sstevel@tonic-gate # define local static 27*0Sstevel@tonic-gate #endif 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate typedef unsigned char uch; 30*0Sstevel@tonic-gate typedef uch FAR uchf; 31*0Sstevel@tonic-gate typedef unsigned short ush; 32*0Sstevel@tonic-gate typedef ush FAR ushf; 33*0Sstevel@tonic-gate typedef unsigned long ulg; 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate /* common constants */ 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate #ifndef DEF_WBITS 38*0Sstevel@tonic-gate # define DEF_WBITS MAX_WBITS 39*0Sstevel@tonic-gate #endif 40*0Sstevel@tonic-gate /* default windowBits for decompression. MAX_WBITS is for compression only */ 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate #if MAX_MEM_LEVEL >= 8 43*0Sstevel@tonic-gate # define DEF_MEM_LEVEL 8 44*0Sstevel@tonic-gate #else 45*0Sstevel@tonic-gate # define DEF_MEM_LEVEL MAX_MEM_LEVEL 46*0Sstevel@tonic-gate #endif 47*0Sstevel@tonic-gate /* default memLevel */ 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gate #define STORED_BLOCK 0 50*0Sstevel@tonic-gate #define STATIC_TREES 1 51*0Sstevel@tonic-gate #define DYN_TREES 2 52*0Sstevel@tonic-gate /* The three kinds of block type */ 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate #define MIN_MATCH 3 55*0Sstevel@tonic-gate #define MAX_MATCH 258 56*0Sstevel@tonic-gate /* The minimum and maximum match lengths */ 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate #define Assert(cond,msg) 61*0Sstevel@tonic-gate #define Trace(x) 62*0Sstevel@tonic-gate #define Tracev(x) 63*0Sstevel@tonic-gate #define Tracevv(x) 64*0Sstevel@tonic-gate #define Tracec(c,x) 65*0Sstevel@tonic-gate #define Tracecv(c,x) 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate typedef uLong (ZEXPORT *check_func)(uLong check, const Bytef *buf, uInt len); 68*0Sstevel@tonic-gate extern void zmemcpy(Bytef* dest, const Bytef* source, uInt len); 69*0Sstevel@tonic-gate voidpf zcalloc(voidpf opaque, unsigned items, unsigned size); 70*0Sstevel@tonic-gate void zcfree(voidpf opaque, voidpf ptr); 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate #define ZALLOC(strm, items, size) \ 73*0Sstevel@tonic-gate (*((strm)->zalloc))((strm)->opaque, (items), (size)) 74*0Sstevel@tonic-gate #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) 75*0Sstevel@tonic-gate #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate #ifdef __cplusplus 78*0Sstevel@tonic-gate } 79*0Sstevel@tonic-gate #endif 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate #endif /* _ZUTIL_H */ 82