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