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