activemq-cpp-3.4.0

src/main/decaf/internal/util/zip/zutil.h

Go to the documentation of this file.
00001 /* zutil.h -- internal interface and configuration of the compression library
00002  * Copyright (C) 1995-2010 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005 
00006 /* WARNING: this file should *not* be used by applications. It is
00007    part of the implementation of the compression library and is
00008    subject to change. Applications should only use zlib.h.
00009  */
00010 
00011 /* @(#) $Id$ */
00012 
00013 #ifndef ZUTIL_H
00014 #define ZUTIL_H
00015 
00016 #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
00017 #  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
00018 #else
00019 #  define ZLIB_INTERNAL
00020 #endif
00021 
00022 #include "zlib.h"
00023 
00024 #ifdef STDC
00025 #  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
00026 #    include <stddef.h>
00027 #  endif
00028 #  include <string.h>
00029 #  include <stdlib.h>
00030 #endif
00031 
00032 #ifndef local
00033 #  define local static
00034 #endif
00035 /* compile with -Dlocal if your debugger can't find static symbols */
00036 
00037 typedef unsigned char  uch;
00038 typedef uch FAR uchf;
00039 typedef unsigned short ush;
00040 typedef ush FAR ushf;
00041 typedef unsigned long  ulg;
00042 
00043 extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
00044 /* (size given to avoid silly warnings with Visual C++) */
00045 
00046 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
00047 
00048 #define ERR_RETURN(strm,err) \
00049   return (strm->msg = (char*)ERR_MSG(err), (err))
00050 /* To be used only when the state is known to be valid */
00051 
00052         /* common constants */
00053 
00054 #ifndef DEF_WBITS
00055 #  define DEF_WBITS MAX_WBITS
00056 #endif
00057 /* default windowBits for decompression. MAX_WBITS is for compression only */
00058 
00059 #if MAX_MEM_LEVEL >= 8
00060 #  define DEF_MEM_LEVEL 8
00061 #else
00062 #  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
00063 #endif
00064 /* default memLevel */
00065 
00066 #define STORED_BLOCK 0
00067 #define STATIC_TREES 1
00068 #define DYN_TREES    2
00069 /* The three kinds of block type */
00070 
00071 #define MIN_MATCH  3
00072 #define MAX_MATCH  258
00073 /* The minimum and maximum match lengths */
00074 
00075 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
00076 
00077         /* target dependencies */
00078 
00079 #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
00080 #  define OS_CODE  0x00
00081 #  if defined(__TURBOC__) || defined(__BORLANDC__)
00082 #    if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
00083        /* Allow compilation with ANSI keywords only enabled */
00084        void _Cdecl farfree( void *block );
00085        void *_Cdecl farmalloc( unsigned long nbytes );
00086 #    else
00087 #      include <alloc.h>
00088 #    endif
00089 #  else /* MSC or DJGPP */
00090 #    include <malloc.h>
00091 #  endif
00092 #endif
00093 
00094 #ifdef AMIGA
00095 #  define OS_CODE  0x01
00096 #endif
00097 
00098 #if defined(VAXC) || defined(VMS)
00099 #  define OS_CODE  0x02
00100 #  define F_OPEN(name, mode) \
00101      fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
00102 #endif
00103 
00104 #if defined(ATARI) || defined(atarist)
00105 #  define OS_CODE  0x05
00106 #endif
00107 
00108 #ifdef OS2
00109 #  define OS_CODE  0x06
00110 #  ifdef M_I86
00111 #    include <malloc.h>
00112 #  endif
00113 #endif
00114 
00115 #if defined(MACOS) || defined(TARGET_OS_MAC)
00116 #  define OS_CODE  0x07
00117 #  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
00118 #    include <unix.h> /* for fdopen */
00119 #  else
00120 #    ifndef fdopen
00121 #      define fdopen(fd,mode) NULL /* No fdopen() */
00122 #    endif
00123 #  endif
00124 #endif
00125 
00126 #ifdef TOPS20
00127 #  define OS_CODE  0x0a
00128 #endif
00129 
00130 #ifdef WIN32
00131 #  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
00132 #    define OS_CODE  0x0b
00133 #  endif
00134 #endif
00135 
00136 #ifdef __50SERIES /* Prime/PRIMOS */
00137 #  define OS_CODE  0x0f
00138 #endif
00139 
00140 #if defined(_BEOS_) || defined(RISCOS)
00141 #  define fdopen(fd,mode) NULL /* No fdopen() */
00142 #endif
00143 
00144 #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
00145 #  if defined(_WIN32_WCE)
00146 #    define fdopen(fd,mode) NULL /* No fdopen() */
00147 #    ifndef _PTRDIFF_T_DEFINED
00148        typedef int ptrdiff_t;
00149 #      define _PTRDIFF_T_DEFINED
00150 #    endif
00151 #  else
00152 #    define fdopen(fd,type)  _fdopen(fd,type)
00153 #  endif
00154 #endif
00155 
00156 #if defined(__BORLANDC__)
00157   #pragma warn -8004
00158   #pragma warn -8008
00159   #pragma warn -8066
00160 #endif
00161 
00162 /* provide prototypes for these when building zlib without LFS */
00163 #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
00164     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
00165     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
00166 #endif
00167 
00168         /* common defaults */
00169 
00170 #ifndef OS_CODE
00171 #  define OS_CODE  0x03  /* assume Unix */
00172 #endif
00173 
00174 #ifndef F_OPEN
00175 #  define F_OPEN(name, mode) fopen((name), (mode))
00176 #endif
00177 
00178          /* functions */
00179 
00180 #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
00181 #  ifndef HAVE_VSNPRINTF
00182 #    define HAVE_VSNPRINTF
00183 #  endif
00184 #endif
00185 #if defined(__CYGWIN__)
00186 #  ifndef HAVE_VSNPRINTF
00187 #    define HAVE_VSNPRINTF
00188 #  endif
00189 #endif
00190 #ifndef HAVE_VSNPRINTF
00191 #  ifdef MSDOS
00192      /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
00193         but for now we just assume it doesn't. */
00194 #    define NO_vsnprintf
00195 #  endif
00196 #  ifdef __TURBOC__
00197 #    define NO_vsnprintf
00198 #  endif
00199 #  ifdef WIN32
00200      /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
00201 #    if !defined(vsnprintf) && !defined(NO_vsnprintf)
00202 #      if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
00203 #         define vsnprintf _vsnprintf
00204 #      endif
00205 #    endif
00206 #  endif
00207 #  ifdef __SASC
00208 #    define NO_vsnprintf
00209 #  endif
00210 #endif
00211 #ifdef VMS
00212 #  define NO_vsnprintf
00213 #endif
00214 
00215 #if defined(pyr)
00216 #  define NO_MEMCPY
00217 #endif
00218 #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
00219  /* Use our own functions for small and medium model with MSC <= 5.0.
00220   * You may have to use the same strategy for Borland C (untested).
00221   * The __SC__ check is for Symantec.
00222   */
00223 #  define NO_MEMCPY
00224 #endif
00225 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
00226 #  define HAVE_MEMCPY
00227 #endif
00228 #ifdef HAVE_MEMCPY
00229 #  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
00230 #    define zmemcpy _fmemcpy
00231 #    define zmemcmp _fmemcmp
00232 #    define zmemzero(dest, len) _fmemset(dest, 0, len)
00233 #  else
00234 #    define zmemcpy memcpy
00235 #    define zmemcmp memcmp
00236 #    define zmemzero(dest, len) memset(dest, 0, len)
00237 #  endif
00238 #else
00239    void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
00240    int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
00241    void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
00242 #endif
00243 
00244 /* Diagnostic functions */
00245 #ifdef DEBUG
00246 #  include <stdio.h>
00247    extern int ZLIB_INTERNAL z_verbose;
00248    extern void ZLIB_INTERNAL z_error OF((char *m));
00249 #  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
00250 #  define Trace(x) {if (z_verbose>=0) fprintf x ;}
00251 #  define Tracev(x) {if (z_verbose>0) fprintf x ;}
00252 #  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
00253 #  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
00254 #  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
00255 #else
00256 #  define Assert(cond,msg)
00257 #  define Trace(x)
00258 #  define Tracev(x)
00259 #  define Tracevv(x)
00260 #  define Tracec(c,x)
00261 #  define Tracecv(c,x)
00262 #endif
00263 
00264 
00265 voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
00266                         unsigned size));
00267 void ZLIB_INTERNAL zcfree  OF((voidpf opaque, voidpf ptr));
00268 
00269 #define ZALLOC(strm, items, size) \
00270            (*((strm)->zalloc))((strm)->opaque, (items), (size))
00271 #define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
00272 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
00273 
00274 #endif /* ZUTIL_H */