bowen liu
/
mbed-os-example-blinky
ex
Fork of mbed-os-example-mbed5-blinky by
Embed:
(wiki syntax)
Show/hide line numbers
zutil.h
00001 /* zutil.h -- internal interface and configuration of the compression library 00002 * Copyright (C) 1995-2013 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 #ifdef HAVE_HIDDEN 00017 # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) 00018 #else 00019 # define ZLIB_INTERNAL 00020 #endif 00021 00022 #include "zlib.h" 00023 00024 #if defined(STDC) && !defined(Z_SOLO) 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 #ifdef Z_SOLO 00033 typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ 00034 #endif 00035 00036 #ifndef local 00037 # define local static 00038 #endif 00039 /* compile with -Dlocal if your debugger can't find static symbols */ 00040 00041 typedef unsigned char uch; 00042 typedef uch FAR uchf; 00043 typedef unsigned short ush; 00044 typedef ush FAR ushf; 00045 typedef unsigned long ulg; 00046 00047 extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ 00048 /* (size given to avoid silly warnings with Visual C++) */ 00049 00050 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] 00051 00052 #define ERR_RETURN(strm,err) \ 00053 return (strm->msg = ERR_MSG(err), (err)) 00054 /* To be used only when the state is known to be valid */ 00055 00056 /* common constants */ 00057 00058 #ifndef DEF_WBITS 00059 # define DEF_WBITS MAX_WBITS 00060 #endif 00061 /* default windowBits for decompression. MAX_WBITS is for compression only */ 00062 00063 #if MAX_MEM_LEVEL >= 8 00064 # define DEF_MEM_LEVEL 8 00065 #else 00066 # define DEF_MEM_LEVEL MAX_MEM_LEVEL 00067 #endif 00068 /* default memLevel */ 00069 00070 #define STORED_BLOCK 0 00071 #define STATIC_TREES 1 00072 #define DYN_TREES 2 00073 /* The three kinds of block type */ 00074 00075 #define MIN_MATCH 3 00076 #define MAX_MATCH 258 00077 /* The minimum and maximum match lengths */ 00078 00079 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ 00080 00081 /* target dependencies */ 00082 00083 #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) 00084 # define OS_CODE 0x00 00085 # ifndef Z_SOLO 00086 # if defined(__TURBOC__) || defined(__BORLANDC__) 00087 # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) 00088 /* Allow compilation with ANSI keywords only enabled */ 00089 void _Cdecl farfree( void *block ); 00090 void *_Cdecl farmalloc( unsigned long nbytes ); 00091 # else 00092 # include <alloc.h> 00093 # endif 00094 # else /* MSC or DJGPP */ 00095 # include <malloc.h> 00096 # endif 00097 # endif 00098 #endif 00099 00100 #ifdef AMIGA 00101 # define OS_CODE 0x01 00102 #endif 00103 00104 #if defined(VAXC) || defined(VMS) 00105 # define OS_CODE 0x02 00106 # define F_OPEN(name, mode) \ 00107 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") 00108 #endif 00109 00110 #if defined(ATARI) || defined(atarist) 00111 # define OS_CODE 0x05 00112 #endif 00113 00114 #ifdef OS2 00115 # define OS_CODE 0x06 00116 # if defined(M_I86) && !defined(Z_SOLO) 00117 # include <malloc.h> 00118 # endif 00119 #endif 00120 00121 #if defined(MACOS) || defined(TARGET_OS_MAC) 00122 # define OS_CODE 0x07 00123 # ifndef Z_SOLO 00124 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os 00125 # include <unix.h> /* for fdopen */ 00126 # else 00127 # ifndef fdopen 00128 # define fdopen(fd,mode) NULL /* No fdopen() */ 00129 # endif 00130 # endif 00131 # endif 00132 #endif 00133 00134 #ifdef TOPS20 00135 # define OS_CODE 0x0a 00136 #endif 00137 00138 #ifdef WIN32 00139 # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ 00140 # define OS_CODE 0x0b 00141 # endif 00142 #endif 00143 00144 #ifdef __50SERIES /* Prime/PRIMOS */ 00145 # define OS_CODE 0x0f 00146 #endif 00147 00148 #if defined(_BEOS_) || defined(RISCOS) 00149 # define fdopen(fd,mode) NULL /* No fdopen() */ 00150 #endif 00151 00152 #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX 00153 # if defined(_WIN32_WCE) 00154 # define fdopen(fd,mode) NULL /* No fdopen() */ 00155 # ifndef _PTRDIFF_T_DEFINED 00156 typedef int ptrdiff_t; 00157 # define _PTRDIFF_T_DEFINED 00158 # endif 00159 # else 00160 # define fdopen(fd,type) _fdopen(fd,type) 00161 # endif 00162 #endif 00163 00164 #if defined(__BORLANDC__) && !defined(MSDOS) 00165 #pragma warn -8004 00166 #pragma warn -8008 00167 #pragma warn -8066 00168 #endif 00169 00170 /* provide prototypes for these when building zlib without LFS */ 00171 #if !defined(_WIN32) && \ 00172 (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) 00173 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); 00174 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); 00175 #endif 00176 00177 /* common defaults */ 00178 00179 #ifndef OS_CODE 00180 # define OS_CODE 0x03 /* assume Unix */ 00181 #endif 00182 00183 #ifndef F_OPEN 00184 # define F_OPEN(name, mode) fopen((name), (mode)) 00185 #endif 00186 00187 /* functions */ 00188 00189 #if defined(pyr) || defined(Z_SOLO) 00190 # define NO_MEMCPY 00191 #endif 00192 #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) 00193 /* Use our own functions for small and medium model with MSC <= 5.0. 00194 * You may have to use the same strategy for Borland C (untested). 00195 * The __SC__ check is for Symantec. 00196 */ 00197 # define NO_MEMCPY 00198 #endif 00199 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) 00200 # define HAVE_MEMCPY 00201 #endif 00202 #ifdef HAVE_MEMCPY 00203 # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ 00204 # define zmemcpy _fmemcpy 00205 # define zmemcmp _fmemcmp 00206 # define zmemzero(dest, len) _fmemset(dest, 0, len) 00207 # else 00208 # define zmemcpy memcpy 00209 # define zmemcmp memcmp 00210 # define zmemzero(dest, len) memset(dest, 0, len) 00211 # endif 00212 #else 00213 void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); 00214 int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); 00215 void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); 00216 #endif 00217 00218 /* Diagnostic functions */ 00219 #ifdef DEBUG 00220 # include <stdio.h> 00221 extern int ZLIB_INTERNAL z_verbose; 00222 extern void ZLIB_INTERNAL z_error OF((char *m)); 00223 # define Assert(cond,msg) {if(!(cond)) z_error(msg);} 00224 # define Trace(x) {if (z_verbose>=0) fprintf x ;} 00225 # define Tracev(x) {if (z_verbose>0) fprintf x ;} 00226 # define Tracevv(x) {if (z_verbose>1) fprintf x ;} 00227 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} 00228 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} 00229 #else 00230 # define Assert(cond,msg) 00231 # define Trace(x) 00232 # define Tracev(x) 00233 # define Tracevv(x) 00234 # define Tracec(c,x) 00235 # define Tracecv(c,x) 00236 #endif 00237 00238 #ifndef Z_SOLO 00239 voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, 00240 unsigned size)); 00241 void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); 00242 #endif 00243 00244 #define ZALLOC(strm, items, size) \ 00245 (*((strm)->zalloc))((strm)->opaque, (items), (size)) 00246 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) 00247 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} 00248 00249 /* Reverse the bytes in a 32-bit value */ 00250 #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ 00251 (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) 00252 00253 #endif /* ZUTIL_H */
Generated on Tue Jul 12 2022 16:28:54 by 1.7.2