diff options
Diffstat (limited to 'sys/lib/libz/zutil.h')
-rw-r--r-- | sys/lib/libz/zutil.h | 106 |
1 files changed, 72 insertions, 34 deletions
diff --git a/sys/lib/libz/zutil.h b/sys/lib/libz/zutil.h index 1b2304d3183..ea9f5aa7ae1 100644 --- a/sys/lib/libz/zutil.h +++ b/sys/lib/libz/zutil.h @@ -1,6 +1,6 @@ -/* $OpenBSD: zutil.h,v 1.12 2002/03/12 00:26:30 millert Exp $ */ +/* $OpenBSD: zutil.h,v 1.13 2003/12/16 23:57:48 millert Exp $ */ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2002 Jean-loup Gailly. + * Copyright (C) 1995-2003 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -10,13 +10,14 @@ */ -#ifndef _Z_UTIL_H -#define _Z_UTIL_H +#ifndef ZUTIL_H +#define ZUTIL_H +#define ZLIB_INTERNAL #include "zlib.h" #ifdef _STANDALONE -#include <lib/libsa/stand.h> +#include <stand.h> #else #ifdef STDC # include <stddef.h> @@ -41,7 +42,7 @@ typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; -extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] @@ -77,7 +78,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ /* target dependencies */ -#ifdef MSDOS +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) # define OS_CODE 0x00 # if defined(__TURBOC__) || defined(__BORLANDC__) # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) @@ -85,19 +86,15 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ void _Cdecl farfree( void *block ); void *_Cdecl farmalloc( unsigned long nbytes ); # else -# include <alloc.h> +# include <alloc.h> # endif # else /* MSC or DJGPP */ # include <malloc.h> # endif #endif -#ifdef OS2 -# define OS_CODE 0x06 -#endif - -#ifdef WIN32 /* Window 95 & Windows NT */ -# define OS_CODE 0x0b +#ifdef AMIGA +# define OS_CODE 0x01 #endif #if defined(VAXC) || defined(VMS) @@ -106,14 +103,14 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") #endif -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - #if defined(ATARI) || defined(atarist) # define OS_CODE 0x05 #endif +#ifdef OS2 +# define OS_CODE 0x06 +#endif + #if defined(MACOS) || defined(TARGET_OS_MAC) # define OS_CODE 0x07 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os @@ -125,24 +122,37 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # endif #endif -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0F -#endif - #ifdef TOPS20 # define OS_CODE 0x0a #endif +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + #if defined(_BEOS_) || defined(RISCOS) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) -# define fdopen(fd,type) _fdopen(fd,type) +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif #endif - - /* Common defaults */ + /* common defaults */ #ifndef OS_CODE # define OS_CODE 0x03 /* assume Unix */ @@ -154,6 +164,36 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ /* functions */ +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS + /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 + /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# define vsnprintf _vsnprintf +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +#endif + #ifdef HAVE_STRERROR extern char *strerror OF((int)); # define zstrerror(errnum) strerror(errnum) @@ -192,15 +232,15 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ /* Diagnostic functions */ #ifdef DEBUG +# include <stdio.h> extern int z_verbose; extern void z_error OF((char *m)); -# define z_error panic # define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) printf x ;} -# define Tracev(x) {if (z_verbose>0) printf x ;} -# define Tracevv(x) {if (z_verbose>1) printf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) printf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) printf x ;} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} #else # define Assert(cond,msg) # define Trace(x) @@ -211,8 +251,6 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #endif -typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf, - uInt len)); voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void zcfree OF((voidpf opaque, voidpf ptr)); @@ -221,4 +259,4 @@ void zcfree OF((voidpf opaque, voidpf ptr)); #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} -#endif /* _Z_UTIL_H */ +#endif /* ZUTIL_H */ |