os/ossrv/compressionlibs/ziplib/test/oldezlib/Zlib/zutil.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/compressionlibs/ziplib/test/oldezlib/Zlib/zutil.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,220 @@
     1.4 +/* zutil.h -- internal interface and configuration of the compression library
     1.5 + * Copyright (C) 1995-1998 Jean-loup Gailly.
     1.6 + * For conditions of distribution and use, see copyright notice in zlib.h
     1.7 + */
     1.8 +
     1.9 +/* WARNING: this file should *not* be used by applications. It is
    1.10 +   part of the implementation of the compression library and is
    1.11 +   subject to change. Applications should only use zlib.h.
    1.12 + */
    1.13 +
    1.14 +/* @(#) $Id$ */
    1.15 +
    1.16 +#ifndef _Z_UTIL_H
    1.17 +#define _Z_UTIL_H
    1.18 +
    1.19 +#include "zlib.h"
    1.20 +
    1.21 +#ifdef STDC
    1.22 +#  include <stddef.h>
    1.23 +#  include <string.h>
    1.24 +#  include <stdlib.h>
    1.25 +#endif
    1.26 +#ifdef NO_ERRNO_H
    1.27 +    extern int errno;
    1.28 +#else
    1.29 +#   include <errno.h>
    1.30 +#endif
    1.31 +
    1.32 +#ifndef local
    1.33 +#  define local static
    1.34 +#endif
    1.35 +/* compile with -Dlocal if your debugger can't find static symbols */
    1.36 +
    1.37 +typedef unsigned char  uch;
    1.38 +typedef uch FAR uchf;
    1.39 +typedef unsigned short ush;
    1.40 +typedef ush FAR ushf;
    1.41 +typedef unsigned long  ulg;
    1.42 +
    1.43 +extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
    1.44 +/* (size given to avoid silly warnings with Visual C++) */
    1.45 +
    1.46 +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
    1.47 +
    1.48 +#define ERR_RETURN(strm,err) \
    1.49 +  return (strm->msg = (char*)ERR_MSG(err), (err))
    1.50 +/* To be used only when the state is known to be valid */
    1.51 +
    1.52 +        /* common constants */
    1.53 +
    1.54 +#ifndef DEF_WBITS
    1.55 +#  define DEF_WBITS MAX_WBITS
    1.56 +#endif
    1.57 +/* default windowBits for decompression. MAX_WBITS is for compression only */
    1.58 +
    1.59 +#if MAX_MEM_LEVEL >= 8
    1.60 +#  define DEF_MEM_LEVEL 8
    1.61 +#else
    1.62 +#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
    1.63 +#endif
    1.64 +/* default memLevel */
    1.65 +
    1.66 +#define STORED_BLOCK 0
    1.67 +#define STATIC_TREES 1
    1.68 +#define DYN_TREES    2
    1.69 +/* The three kinds of block type */
    1.70 +
    1.71 +#define MIN_MATCH  3
    1.72 +#define MAX_MATCH  258
    1.73 +/* The minimum and maximum match lengths */
    1.74 +
    1.75 +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
    1.76 +
    1.77 +        /* target dependencies */
    1.78 +
    1.79 +#ifdef MSDOS
    1.80 +#  define OS_CODE  0x00
    1.81 +#  if defined(__TURBOC__) || defined(__BORLANDC__)
    1.82 +#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
    1.83 +       /* Allow compilation with ANSI keywords only enabled */
    1.84 +       void _Cdecl farfree( void *block );
    1.85 +       void *_Cdecl farmalloc( unsigned long nbytes );
    1.86 +#    else
    1.87 +#     include <alloc.h>
    1.88 +#    endif
    1.89 +#  else /* MSC or DJGPP */
    1.90 +#    include <malloc.h>
    1.91 +#  endif
    1.92 +#endif
    1.93 +
    1.94 +#ifdef OS2
    1.95 +#  define OS_CODE  0x06
    1.96 +#endif
    1.97 +
    1.98 +#ifdef WIN32 /* Window 95 & Windows NT */
    1.99 +#  define OS_CODE  0x0b
   1.100 +#endif
   1.101 +
   1.102 +#if defined(VAXC) || defined(VMS)
   1.103 +#  define OS_CODE  0x02
   1.104 +#  define F_OPEN(name, mode) \
   1.105 +     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
   1.106 +#endif
   1.107 +
   1.108 +#ifdef AMIGA
   1.109 +#  define OS_CODE  0x01
   1.110 +#endif
   1.111 +
   1.112 +#if defined(ATARI) || defined(atarist)
   1.113 +#  define OS_CODE  0x05
   1.114 +#endif
   1.115 +
   1.116 +#if defined(MACOS) || defined(TARGET_OS_MAC)
   1.117 +#  define OS_CODE  0x07
   1.118 +#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
   1.119 +#    include <unix.h> /* for fdopen */
   1.120 +#  else
   1.121 +#    ifndef fdopen
   1.122 +#      define fdopen(fd,mode) NULL /* No fdopen() */
   1.123 +#    endif
   1.124 +#  endif
   1.125 +#endif
   1.126 +
   1.127 +#ifdef __50SERIES /* Prime/PRIMOS */
   1.128 +#  define OS_CODE  0x0F
   1.129 +#endif
   1.130 +
   1.131 +#ifdef TOPS20
   1.132 +#  define OS_CODE  0x0a
   1.133 +#endif
   1.134 +
   1.135 +#if defined(_BEOS_) || defined(RISCOS)
   1.136 +#  define fdopen(fd,mode) NULL /* No fdopen() */
   1.137 +#endif
   1.138 +
   1.139 +#if (defined(_MSC_VER) && (_MSC_VER > 600))
   1.140 +#  define fdopen(fd,type)  _fdopen(fd,type)
   1.141 +#endif
   1.142 +
   1.143 +
   1.144 +        /* Common defaults */
   1.145 +
   1.146 +#ifndef OS_CODE
   1.147 +#  define OS_CODE  0x03  /* assume Unix */
   1.148 +#endif
   1.149 +
   1.150 +#ifndef F_OPEN
   1.151 +#  define F_OPEN(name, mode) fopen((name), (mode))
   1.152 +#endif
   1.153 +
   1.154 +         /* functions */
   1.155 +
   1.156 +#ifdef HAVE_STRERROR
   1.157 +   extern char *strerror OF((int));
   1.158 +#  define zstrerror(errnum) strerror(errnum)
   1.159 +#else
   1.160 +#  define zstrerror(errnum) ""
   1.161 +#endif
   1.162 +
   1.163 +#if defined(pyr)
   1.164 +#  define NO_MEMCPY
   1.165 +#endif
   1.166 +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
   1.167 + /* Use our own functions for small and medium model with MSC <= 5.0.
   1.168 +  * You may have to use the same strategy for Borland C (untested).
   1.169 +  * The __SC__ check is for Symantec.
   1.170 +  */
   1.171 +#  define NO_MEMCPY
   1.172 +#endif
   1.173 +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
   1.174 +#  define HAVE_MEMCPY
   1.175 +#endif
   1.176 +#ifdef HAVE_MEMCPY
   1.177 +#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
   1.178 +#    define zmemcpy _fmemcpy
   1.179 +#    define zmemcmp _fmemcmp
   1.180 +#    define zmemzero(dest, len) _fmemset(dest, 0, len)
   1.181 +#  else
   1.182 +#    define zmemcpy memcpy
   1.183 +#    define zmemcmp memcmp
   1.184 +#    define zmemzero(dest, len) memset(dest, 0, len)
   1.185 +#  endif
   1.186 +#else
   1.187 +   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
   1.188 +   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
   1.189 +   extern void zmemzero OF((Bytef* dest, uInt len));
   1.190 +#endif
   1.191 +
   1.192 +/* Diagnostic functions */
   1.193 +#ifdef DEBUG
   1.194 +#  include <stdio.h>
   1.195 +   extern int z_verbose;
   1.196 +   extern void z_error    OF((char *m));
   1.197 +#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
   1.198 +#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
   1.199 +#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
   1.200 +#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
   1.201 +#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
   1.202 +#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
   1.203 +#else
   1.204 +#  define Assert(cond,msg)
   1.205 +#  define Trace(x)
   1.206 +#  define Tracev(x)
   1.207 +#  define Tracevv(x)
   1.208 +#  define Tracec(c,x)
   1.209 +#  define Tracecv(c,x)
   1.210 +#endif
   1.211 +
   1.212 +
   1.213 +typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
   1.214 +				       uInt len));
   1.215 +voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
   1.216 +void   zcfree  OF((voidpf opaque, voidpf ptr));
   1.217 +
   1.218 +#define ZALLOC(strm, items, size) \
   1.219 +           (*((strm)->zalloc))((strm)->opaque, (items), (size))
   1.220 +#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
   1.221 +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
   1.222 +
   1.223 +#endif /* _Z_UTIL_H */