From 8e0d0c74472e2f72ae697ccc07429f8af159207e Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Fri, 18 Mar 2011 10:11:45 +0000 Subject: Import from zlib-1.2.5 --- cpukit/zlib/gzguts.h | 34 +++++++++++++++++----------------- cpukit/zlib/zutil.h | 49 ++++++++++++++++++------------------------------- 2 files changed, 35 insertions(+), 48 deletions(-) (limited to 'cpukit/zlib') diff --git a/cpukit/zlib/gzguts.h b/cpukit/zlib/gzguts.h index 0e7ed4330a..0f8fb79f87 100644 --- a/cpukit/zlib/gzguts.h +++ b/cpukit/zlib/gzguts.h @@ -5,14 +5,18 @@ #ifdef _LARGEFILE64_SOURCE # ifndef _LARGEFILE_SOURCE -# define _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 # endif # ifdef _FILE_OFFSET_BITS # undef _FILE_OFFSET_BITS # endif #endif -#define ZLIB_INTERNAL +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif #include #include "zlib.h" @@ -44,7 +48,7 @@ #endif /* get errno and strerror definition */ -#if defined UNDER_CE && defined NO_ERRNO_H +#if defined UNDER_CE # include # define zstrerror() gz_strwinerror((DWORD)GetLastError()) #else @@ -56,16 +60,12 @@ # endif #endif -/* MVS fdopen() */ -#ifdef __MVS__ - #pragma map (fdopen , "\174\174FDOPEN") - FILE *fdopen(int, const char *); -#endif - -#ifdef _LARGEFILE64_SOURCE -# define z_off64_t off64_t -#else -# define z_off64_t z_off_t +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); #endif /* default i/o buffer size -- double this for output when reading */ @@ -116,9 +116,9 @@ typedef struct { typedef gz_state FAR *gz_statep; /* shared functions */ -ZEXTERN void ZEXPORT gz_error OF((gz_statep, int, const char *)); -#if defined UNDER_CE && defined NO_ERRNO_H -ZEXTERN char ZEXPORT *gz_strwinerror OF((DWORD error)); +void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); +#if defined UNDER_CE +char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); #endif /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t @@ -127,6 +127,6 @@ ZEXTERN char ZEXPORT *gz_strwinerror OF((DWORD error)); #ifdef INT_MAX # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) #else -ZEXTERN unsigned ZEXPORT gz_intmax OF((void)); +unsigned ZLIB_INTERNAL gz_intmax OF((void)); # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) #endif diff --git a/cpukit/zlib/zutil.h b/cpukit/zlib/zutil.h index 025035dbe9..258fa88799 100644 --- a/cpukit/zlib/zutil.h +++ b/cpukit/zlib/zutil.h @@ -13,7 +13,12 @@ #ifndef ZUTIL_H #define ZUTIL_H -#define ZLIB_INTERNAL +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + #include "zlib.h" #ifdef STDC @@ -24,19 +29,6 @@ # include #endif -#if defined(UNDER_CE) && defined(NO_ERRNO_H) -# define zseterrno(ERR) SetLastError((DWORD)(ERR)) -# define zerrno() ((int)GetLastError()) -#else -# ifdef NO_ERRNO_H - extern int errno; -# else -# include -# endif -# define zseterrno(ERR) do { errno = (ERR); } while (0) -# define zerrno() errno -#endif - #ifndef local # define local static #endif @@ -167,10 +159,10 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #pragma warn -8066 #endif -#ifdef _LARGEFILE64_SOURCE -# define z_off64_t off64_t -#else -# define z_off64_t z_off_t +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); #endif /* common defaults */ @@ -181,12 +173,6 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #ifndef F_OPEN # define F_OPEN(name, mode) fopen((name), (mode)) -#endif - -#ifdef _LARGEFILE64_SOURCE -# define F_OPEN64(name, mode) fopen64((name), (mode)) -#else -# define F_OPEN64(name, mode) fopen((name), (mode)) #endif /* functions */ @@ -250,16 +236,16 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define zmemzero(dest, len) memset(dest, 0, len) # endif #else - extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - extern void zmemzero OF((Bytef* dest, uInt len)); + void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); #endif /* Diagnostic functions */ #ifdef DEBUG # include - extern int z_verbose; - extern void z_error OF((char *m)); + extern int ZLIB_INTERNAL z_verbose; + extern void ZLIB_INTERNAL z_error OF((char *m)); # define Assert(cond,msg) {if(!(cond)) z_error(msg);} # define Trace(x) {if (z_verbose>=0) fprintf x ;} # define Tracev(x) {if (z_verbose>0) fprintf x ;} @@ -276,8 +262,9 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #endif -voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); -void zcfree OF((voidpf opaque, voidpf ptr)); +voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, + unsigned size)); +void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) -- cgit v1.2.3