1 /* zutil.h -- internal interface and configuration of the compression library
2  * Copyright (C) 1995-2003 Jean-loup Gailly.
3  * For conditions of distribution and use, see copyright notice in zlib.h
4  */
5 
6 /* WARNING: this file should *not* be used by applications. It is
7    part of the implementation of the compression library and is
8    subject to change. Applications should only use zlib.h.
9  */
10 
11 /* @(#) $Id$ */
12 
13 #ifndef ZUTIL_H
14 #define ZUTIL_H
15 
16 #define ZLIB_INTERNAL
17 #include "zlib.h"
18 
19 #ifdef STDC
20 #  include <stddef.h>
21 #  include <string.h>
22 #  include <stdlib.h>
23 #endif
24 #ifdef NO_ERRNO_H
25     extern int errno;
26 #else
27 #   include <errno.h>
28 #endif
29 
30 #ifndef local
31 #  define local static
32 #endif
33 /* compile with -Dlocal if your debugger can't find static symbols */
34 
35 typedef unsigned char  uch;
36 typedef uch FAR uchf;
37 typedef unsigned short ush;
38 typedef ush FAR ushf;
39 typedef unsigned long  ulg;
40 
41 extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
42 /* (size given to avoid silly warnings with Visual C++) */
43 
44 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
45 
46 #define ERR_RETURN(strm,err) \
47   return (strm->msg = (char*)ERR_MSG(err), (err))
48 /* To be used only when the state is known to be valid */
49 
50         /* common constants */
51 
52 #ifndef DEF_WBITS
53 #  define DEF_WBITS MAX_WBITS
54 #endif
55 /* default windowBits for decompression. MAX_WBITS is for compression only */
56 
57 #if MAX_MEM_LEVEL >= 8
58 #  define DEF_MEM_LEVEL 8
59 #else
60 #  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
61 #endif
62 /* default memLevel */
63 
64 #define STORED_BLOCK 0
65 #define STATIC_TREES 1
66 #define DYN_TREES    2
67 /* The three kinds of block type */
68 
69 #define MIN_MATCH  3
70 #define MAX_MATCH  258
71 /* The minimum and maximum match lengths */
72 
73 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
74 
75         /* target dependencies */
76 
77 #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
78 #  define OS_CODE  0x00
79 #  if defined(__TURBOC__) || defined(__BORLANDC__)
80 #    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
81        /* Allow compilation with ANSI keywords only enabled */
82        void _Cdecl farfree( void *block );
83        void *_Cdecl farmalloc( unsigned long nbytes );
84 #    else
85 #      include <alloc.h>
86 #    endif
87 #  else /* MSC or DJGPP */
88 #    include <malloc.h>
89 #  endif
90 #endif
91 
92 
93 #if (defined(_MSC_VER) && (_MSC_VER > 600))
94 #  if defined(_WIN32_WCE)
95 #    define fdopen(fd,mode) NULL /* No fdopen() */
96 #    ifndef _PTRDIFF_T_DEFINED
97        typedef int ptrdiff_t;
98 #      define _PTRDIFF_T_DEFINED
99 #    endif
100 #  else
101 #    define fdopen(fd,type)  _fdopen(fd,type)
102 #  endif
103 #endif
104 
105 #endif /* ZUTIL_H */
106