+++ /dev/null
-/** @file\r
- zutil.h -- internal interface and configuration of the compression library\r
-\r
- Copyright (C) 2015, Daryl McDaniel.<BR>\r
- * Copyright (C) 1995-2013 Jean-loup Gailly.\r
- * For conditions of distribution and use, see copyright notice in zlib.h\r
-**/\r
-\r
-/* WARNING: this file should *not* be used by applications. It is\r
- part of the implementation of the compression library and is\r
- subject to change. Applications should only use zlib.h.\r
- */\r
-\r
-/* @(#) $Id$ */\r
-\r
-#ifndef ZUTIL_H\r
-#define ZUTIL_H\r
-\r
-#ifdef HAVE_HIDDEN\r
-# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))\r
-#else\r
-# define ZLIB_INTERNAL\r
-#endif\r
-\r
-#include "zlib.h"\r
-\r
-#if defined(UEFI_C_SOURCE) || (defined(STDC) && !defined(Z_SOLO))\r
-# if !(defined(_WIN32_WCE) && defined(_MSC_VER))\r
-# include <stddef.h>\r
-# endif\r
-# include <string.h>\r
-# include <stdlib.h>\r
-#endif\r
-\r
-#ifdef Z_SOLO\r
- typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */\r
-#endif\r
-\r
-#ifndef local\r
-# define local static\r
-#endif\r
-/* compile with -Dlocal if your debugger can't find static symbols */\r
-\r
-typedef unsigned char uch;\r
-typedef uch FAR uchf;\r
-typedef unsigned short ush;\r
-typedef ush FAR ushf;\r
-typedef unsigned long ulg;\r
-\r
-extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */\r
-/* (size given to avoid silly warnings with Visual C++) */\r
-\r
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]\r
-\r
-#define ERR_RETURN(strm,err) \\r
- return (strm->msg = ERR_MSG(err), (err))\r
-/* To be used only when the state is known to be valid */\r
-\r
- /* common constants */\r
-\r
-#ifndef DEF_WBITS\r
-# define DEF_WBITS MAX_WBITS\r
-#endif\r
-/* default windowBits for decompression. MAX_WBITS is for compression only */\r
-\r
-#if MAX_MEM_LEVEL >= 8\r
-# define DEF_MEM_LEVEL 8\r
-#else\r
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL\r
-#endif\r
-/* default memLevel */\r
-\r
-#define STORED_BLOCK 0\r
-#define STATIC_TREES 1\r
-#define DYN_TREES 2\r
-/* The three kinds of block type */\r
-\r
-#define MIN_MATCH 3\r
-#define MAX_MATCH 258\r
-/* The minimum and maximum match lengths */\r
-\r
-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */\r
-\r
- /* target dependencies */\r
-\r
-#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))\r
-# define OS_CODE 0x00\r
-# ifndef Z_SOLO\r
-# if defined(__TURBOC__) || defined(__BORLANDC__)\r
-# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))\r
- /* Allow compilation with ANSI keywords only enabled */\r
- void _Cdecl farfree( void *block );\r
- void *_Cdecl farmalloc( unsigned long nbytes );\r
-# else\r
-# include <alloc.h>\r
-# endif\r
-# else /* MSC or DJGPP */\r
-# include <malloc.h>\r
-# endif\r
-# endif\r
-#endif\r
-\r
-#ifdef AMIGA\r
-# define OS_CODE 0x01\r
-#endif\r
-\r
-#if defined(VAXC) || defined(VMS)\r
-# define OS_CODE 0x02\r
-# define F_OPEN(name, mode) \\r
- fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")\r
-#endif\r
-\r
-#if defined(ATARI) || defined(atarist)\r
-# define OS_CODE 0x05\r
-#endif\r
-\r
-#ifdef OS2\r
-# define OS_CODE 0x06\r
-# if defined(M_I86) && !defined(Z_SOLO)\r
-# include <malloc.h>\r
-# endif\r
-#endif\r
-\r
-#if defined(MACOS) || defined(TARGET_OS_MAC)\r
-# define OS_CODE 0x07\r
-# ifndef Z_SOLO\r
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os\r
-# include <unix.h> /* for fdopen */\r
-# else\r
-# ifndef fdopen\r
-# define fdopen(fd,mode) NULL /* No fdopen() */\r
-# endif\r
-# endif\r
-# endif\r
-#endif\r
-\r
-#ifdef TOPS20\r
-# define OS_CODE 0x0a\r
-#endif\r
-\r
-#ifdef WIN32\r
-# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */\r
-# define OS_CODE 0x0b\r
-# endif\r
-#endif\r
-\r
-#ifdef __50SERIES /* Prime/PRIMOS */\r
-# define OS_CODE 0x0f\r
-#endif\r
-\r
-#if defined(_BEOS_) || defined(RISCOS)\r
-# define fdopen(fd,mode) NULL /* No fdopen() */\r
-#endif\r
-\r
-#if !defined(UEFI_C_SOURCE) && (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined(__INTERIX)\r
-# if defined(_WIN32_WCE)\r
-# define fdopen(fd,mode) NULL /* No fdopen() */\r
-# ifndef _PTRDIFF_T_DEFINED\r
- typedef int ptrdiff_t;\r
-# define _PTRDIFF_T_DEFINED\r
-# endif\r
-# else\r
-# define fdopen(fd,type) _fdopen(fd,type)\r
-# endif\r
-#endif\r
-\r
-#if defined(__BORLANDC__) && !defined(MSDOS)\r
- #pragma warn -8004\r
- #pragma warn -8008\r
- #pragma warn -8066\r
-#endif\r
-\r
-/* provide prototypes for these when building zlib without LFS */\r
-#if !defined(_WIN32) && \\r
- (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)\r
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));\r
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));\r
-#endif\r
-\r
- /* common defaults */\r
-\r
-#ifndef OS_CODE\r
-# define OS_CODE 0x03 /* assume Unix */\r
-#endif\r
-\r
-#ifndef F_OPEN\r
-# define F_OPEN(name, mode) fopen((name), (mode))\r
-#endif\r
-\r
- /* functions */\r
-\r
-#if defined(pyr) || defined(Z_SOLO)\r
-# define NO_MEMCPY\r
-#endif\r
-#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)\r
- /* Use our own functions for small and medium model with MSC <= 5.0.\r
- * You may have to use the same strategy for Borland C (untested).\r
- * The __SC__ check is for Symantec.\r
- */\r
-# define NO_MEMCPY\r
-#endif\r
-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)\r
-# define HAVE_MEMCPY\r
-#endif\r
-#ifdef HAVE_MEMCPY\r
-# ifdef SMALL_MEDIUM /* MSDOS small or medium model */\r
-# define zmemcpy _fmemcpy\r
-# define zmemcmp _fmemcmp\r
-# define zmemzero(dest, len) _fmemset(dest, 0, len)\r
-# else\r
-# define zmemcpy memcpy\r
-# define zmemcmp memcmp\r
-# define zmemzero(dest, len) memset(dest, 0, len)\r
-# endif\r
-#else\r
- void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));\r
- int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));\r
- void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));\r
-#endif\r
-\r
-/* Diagnostic functions */\r
-#ifdef DEBUG\r
-# include <stdio.h>\r
- extern int ZLIB_INTERNAL z_verbose;\r
- extern void ZLIB_INTERNAL z_error OF((char *m));\r
-# define Assert(cond,msg) {if(!(cond)) z_error(msg);}\r
-# define Trace(x) {if (z_verbose>=0) fprintf x ;}\r
-# define Tracev(x) {if (z_verbose>0) fprintf x ;}\r
-# define Tracevv(x) {if (z_verbose>1) fprintf x ;}\r
-# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}\r
-# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}\r
-#else\r
-# define Assert(cond,msg)\r
-# define Trace(x)\r
-# define Tracev(x)\r
-# define Tracevv(x)\r
-# define Tracec(c,x)\r
-# define Tracecv(c,x)\r
-#endif\r
-\r
-#ifndef Z_SOLO\r
- voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,\r
- unsigned size));\r
- void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));\r
-#endif\r
-\r
-#define ZALLOC(strm, items, size) \\r
- (*((strm)->zalloc))((strm)->opaque, (items), (size))\r
-#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))\r
-#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}\r
-\r
-/* Reverse the bytes in a 32-bit value */\r
-#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \\r
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))\r
-\r
-#endif /* ZUTIL_H */\r