source: rtems/cpukit/zlib/zutil.h @ c130387

5
Last change on this file since c130387 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 7.0 KB
Line 
1/* zutil.h -- internal interface and configuration of the compression library
2 * Copyright (C) 1995-2010 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#ifndef ZUTIL_H
12#define ZUTIL_H
13
14#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
15#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
16#else
17#  define ZLIB_INTERNAL
18#endif
19
20#include "zlib.h"
21
22#ifdef STDC
23#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
24#    include <stddef.h>
25#  endif
26#  include <string.h>
27#  include <stdlib.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
35typedef unsigned char  uch;
36typedef uch FAR uchf;
37typedef unsigned short ush;
38typedef ush FAR ushf;
39typedef unsigned long  ulg;
40
41extern 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#ifdef AMIGA
93#  define OS_CODE  0x01
94#endif
95
96#if defined(VAXC) || defined(VMS)
97#  define OS_CODE  0x02
98#  define F_OPEN(name, mode) \
99     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
100#endif
101
102#if defined(ATARI) || defined(atarist)
103#  define OS_CODE  0x05
104#endif
105
106#ifdef OS2
107#  define OS_CODE  0x06
108#  ifdef M_I86
109#    include <malloc.h>
110#  endif
111#endif
112
113#if defined(MACOS) || defined(TARGET_OS_MAC)
114#  define OS_CODE  0x07
115#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
116#    include <unix.h> /* for fdopen */
117#  else
118#    ifndef fdopen
119#      define fdopen(fd,mode) NULL /* No fdopen() */
120#    endif
121#  endif
122#endif
123
124#ifdef TOPS20
125#  define OS_CODE  0x0a
126#endif
127
128#ifdef WIN32
129#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
130#    define OS_CODE  0x0b
131#  endif
132#endif
133
134#ifdef __50SERIES /* Prime/PRIMOS */
135#  define OS_CODE  0x0f
136#endif
137
138#if defined(_BEOS_) || defined(RISCOS)
139#  define fdopen(fd,mode) NULL /* No fdopen() */
140#endif
141
142#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
143#  if defined(_WIN32_WCE)
144#    define fdopen(fd,mode) NULL /* No fdopen() */
145#    ifndef _PTRDIFF_T_DEFINED
146       typedef int ptrdiff_t;
147#      define _PTRDIFF_T_DEFINED
148#    endif
149#  else
150#    define fdopen(fd,type)  _fdopen(fd,type)
151#  endif
152#endif
153
154#if defined(__BORLANDC__)
155  #pragma warn -8004
156  #pragma warn -8008
157  #pragma warn -8066
158#endif
159
160/* provide prototypes for these when building zlib without LFS */
161#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
162    ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
163    ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
164#endif
165
166        /* common defaults */
167
168#ifndef OS_CODE
169#  define OS_CODE  0x03  /* assume Unix */
170#endif
171
172#ifndef F_OPEN
173#  define F_OPEN(name, mode) fopen((name), (mode))
174#endif
175
176         /* functions */
177
178#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
179#  ifndef HAVE_VSNPRINTF
180#    define HAVE_VSNPRINTF
181#  endif
182#endif
183#if defined(__CYGWIN__)
184#  ifndef HAVE_VSNPRINTF
185#    define HAVE_VSNPRINTF
186#  endif
187#endif
188#ifndef HAVE_VSNPRINTF
189#  ifdef MSDOS
190     /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
191        but for now we just assume it doesn't. */
192#    define NO_vsnprintf
193#  endif
194#  ifdef __TURBOC__
195#    define NO_vsnprintf
196#  endif
197#  ifdef WIN32
198     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
199#    if !defined(vsnprintf) && !defined(NO_vsnprintf)
200#      if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
201#         define vsnprintf _vsnprintf
202#      endif
203#    endif
204#  endif
205#  ifdef __SASC
206#    define NO_vsnprintf
207#  endif
208#endif
209#ifdef VMS
210#  define NO_vsnprintf
211#endif
212
213#if defined(pyr)
214#  define NO_MEMCPY
215#endif
216#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
217 /* Use our own functions for small and medium model with MSC <= 5.0.
218  * You may have to use the same strategy for Borland C (untested).
219  * The __SC__ check is for Symantec.
220  */
221#  define NO_MEMCPY
222#endif
223#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
224#  define HAVE_MEMCPY
225#endif
226#ifdef HAVE_MEMCPY
227#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
228#    define zmemcpy _fmemcpy
229#    define zmemcmp _fmemcmp
230#    define zmemzero(dest, len) _fmemset(dest, 0, len)
231#  else
232#    define zmemcpy memcpy
233#    define zmemcmp memcmp
234#    define zmemzero(dest, len) memset(dest, 0, len)
235#  endif
236#else
237   void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
238   int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
239   void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
240#endif
241
242/* Diagnostic functions */
243#ifdef DEBUG
244#  include <stdio.h>
245   extern int ZLIB_INTERNAL z_verbose;
246   extern void ZLIB_INTERNAL z_error OF((char *m));
247#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
248#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
249#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
250#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
251#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
252#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
253#else
254#  define Assert(cond,msg)
255#  define Trace(x)
256#  define Tracev(x)
257#  define Tracevv(x)
258#  define Tracec(c,x)
259#  define Tracecv(c,x)
260#endif
261
262
263voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
264                        unsigned size));
265void ZLIB_INTERNAL zcfree  OF((voidpf opaque, voidpf ptr));
266
267#define ZALLOC(strm, items, size) \
268           (*((strm)->zalloc))((strm)->opaque, (items), (size))
269#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
270#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
271
272#endif /* ZUTIL_H */
Note: See TracBrowser for help on using the repository browser.