echo >> configure.log
-# conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
-# (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
-# return value. The most secure result is vsnprintf() with a return value. snprintf() with a
-# return value is secure as well, but then gzprintf() will be limited to 20 arguments.
+# Check for ANSI C compliant compiler
cat > $test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
#include "zconf.h"
int main()
{
-#ifndef STDC
- choke me
-#endif
+#ifdef STDC
return 0;
+#endif
+ return 1;
}
EOF
if try $CC -c $CFLAGS $test.c; then
- echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
-
- echo >> configure.log
- cat > $test.c <<EOF
-#include <stdio.h>
-#include <stdarg.h>
-int mytest(const char *fmt, ...)
-{
- char buf[20];
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
- return 0;
-}
-int main()
-{
- return (mytest("Hello%d\n", 1));
-}
-EOF
- if try $CC $CFLAGS -o $test $test.c; then
- echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
-
- echo >> configure.log
- cat >$test.c <<EOF
-#include <stdio.h>
-#include <stdarg.h>
-int mytest(const char *fmt, ...)
-{
- int n;
- char buf[20];
- va_list ap;
- va_start(ap, fmt);
- n = vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
- return n;
-}
-int main()
-{
- return (mytest("Hello%d\n", 1));
-}
-EOF
-
- if try $CC -c $CFLAGS $test.c; then
- echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
- else
- CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
- SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
- echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
- echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
- echo " can build but will be open to possible string-format security" | tee -a configure.log
- echo " vulnerabilities." | tee -a configure.log
- fi
- else
- CFLAGS="$CFLAGS -DNO_vsnprintf"
- SFLAGS="$SFLAGS -DNO_vsnprintf"
- echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
- echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
- echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
- echo " vulnerabilities." | tee -a configure.log
-
- echo >> configure.log
- cat >$test.c <<EOF
-#include <stdio.h>
-#include <stdarg.h>
-int mytest(const char *fmt, ...)
-{
- int n;
- char buf[20];
- va_list ap;
- va_start(ap, fmt);
- n = vsprintf(buf, fmt, ap);
- va_end(ap);
- return n;
-}
-int main()
-{
- return (mytest("Hello%d\n", 1));
-}
-EOF
-
- if try $CC -c $CFLAGS $test.c; then
- echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
- else
- CFLAGS="$CFLAGS -DHAS_vsprintf_void"
- SFLAGS="$SFLAGS -DHAS_vsprintf_void"
- echo "Checking for return value of vsprintf()... No." | tee -a configure.log
- echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
- echo " can build but will be open to possible string-format security" | tee -a configure.log
- echo " vulnerabilities." | tee -a configure.log
- fi
- fi
+ echo "Checking for ANSI C compliant compiler... Yes." | tee -a configure.log
+ :
else
- echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
-
- echo >> configure.log
- cat >$test.c <<EOF
-#include <stdio.h>
-int mytest()
-{
- char buf[20];
- snprintf(buf, sizeof(buf), "%s", "foo");
- return 0;
-}
-int main()
-{
- return (mytest());
-}
-EOF
-
- if try $CC $CFLAGS -o $test $test.c; then
- echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
-
- echo >> configure.log
- cat >$test.c <<EOF
-#include <stdio.h>
-int mytest()
-{
- char buf[20];
- return snprintf(buf, sizeof(buf), "%s", "foo");
-}
-int main()
-{
- return (mytest());
-}
-EOF
-
- if try $CC -c $CFLAGS $test.c; then
- echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
- else
- CFLAGS="$CFLAGS -DHAS_snprintf_void"
- SFLAGS="$SFLAGS -DHAS_snprintf_void"
- echo "Checking for return value of snprintf()... No." | tee -a configure.log
- echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
- echo " can build but will be open to possible string-format security" | tee -a configure.log
- echo " vulnerabilities." | tee -a configure.log
- fi
- else
- CFLAGS="$CFLAGS -DNO_snprintf"
- SFLAGS="$SFLAGS -DNO_snprintf"
- echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
- echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
- echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
- echo " vulnerabilities." | tee -a configure.log
-
- echo >> configure.log
- cat >$test.c <<EOF
-#include <stdio.h>
-int mytest()
-{
- char buf[20];
- return sprintf(buf, "%s", "foo");
-}
-int main()
-{
- return (mytest());
-}
-EOF
-
- if try $CC -c $CFLAGS $test.c; then
- echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
- else
- CFLAGS="$CFLAGS -DHAS_sprintf_void"
- SFLAGS="$SFLAGS -DHAS_sprintf_void"
- echo "Checking for return value of sprintf()... No." | tee -a configure.log
- echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
- echo " can build but will be open to possible string-format security" | tee -a configure.log
- echo " vulnerabilities." | tee -a configure.log
- fi
- fi
+ echo "Checking for ANSI C compliant compiler... No." | tee -a configure.log
+ echo "Error: ANSI C compatible compiler needed, cannot continue." | tee -a configure.log
+ leave 1
fi
# see if we can hide zlib internal symbols that are linked between separate source files
# endif /* !DYNAMIC_CRC_TABLE */
#endif /* MAKECRCH */
-#include "zutil.h" /* for STDC definitions */
+#include "zutil.h"
#define local static
#ifndef DEBUG
/* Inline versions of _tr_tally for speed: */
-#if defined(GEN_TREES_H) || !defined(STDC)
+#if defined(GEN_TREES_H)
extern uch ZLIB_INTERNAL _length_code[];
extern uch ZLIB_INTERNAL _dist_code[];
#else
#include <stdio.h>
#include "zlib.h"
-#ifdef STDC
-# include <string.h>
-# include <stdlib.h>
-# include <limits.h>
-#endif
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
#include <fcntl.h>
#ifdef _WIN32
# define NO_GZCOMPRESS
#endif
-#if defined(STDC99) || defined(__CYGWIN__)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-
-#ifndef HAVE_VSNPRINTF
-# ifdef WIN32
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
-# if !defined(vsnprintf) && !defined(NO_vsnprintf)
-# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
-# define vsnprintf _vsnprintf
-# endif
+#if !defined(STDC99) && !defined(__CYGWIN__) && defined(WIN32)
+# if !defined(vsnprintf)
+# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
+# define vsnprintf _vsnprintf
# endif
# endif
#endif
#endif
/* compile with -Dlocal if your debugger can't find static symbols */
-/* gz* functions always use library allocation functions */
-#ifndef STDC
- extern voidp malloc OF((uInt size));
- extern void free OF((voidpf ptr));
-#endif
-
/* get errno and strerror definition */
#if defined UNDER_CE
# include <windows.h>
*(state->path) = 0;
else
#endif
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(state->path, len + 1, "%s", (const char *)path);
-#else
- strcpy(state->path, path);
-#endif
/* compute the flags for open() */
oflag =
if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
return NULL;
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); /* for debugging */
-#else
- sprintf(path, "<fd:%d>", fd); /* for debugging */
-#endif
gz = gz_open(path, fd, mode);
free(path);
return gz;
state->err = Z_MEM_ERROR;
return;
}
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
"%s%s%s", state->path, ": ", msg);
-#else
- strcpy(state->msg, state->path);
- strcat(state->msg, ": ");
- strcat(state->msg, msg);
-#endif
return;
}
return ret == 0 && len != 0 ? -1 : ret;
}
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
#include <stdarg.h>
/* -- see zlib.h -- */
/* do the printf() into the input buffer, put length in len */
size = (int)(state->size);
state->in[size - 1] = 0;
-#ifdef NO_vsnprintf
-# ifdef HAS_vsprintf_void
- (void)vsprintf((char *)(state->in), format, va);
- for (len = 0; len < size; len++)
- if (state->in[len] == 0) break;
-# else
- len = vsprintf((char *)(state->in), format, va);
-# endif
-#else
-# ifdef HAS_vsnprintf_void
- (void)vsnprintf((char *)(state->in), size, format, va);
- len = strlen((char *)(state->in));
-# else
len = vsnprintf((char *)(state->in), size, format, va);
-# endif
-#endif
/* check that printf() results fit in buffer */
if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
return ret;
}
-#else /* !STDC && !Z_HAVE_STDARG_H */
-
-/* -- see zlib.h -- */
-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
- gzFile file;
- const char *format;
- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
-{
- int size, len;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that can really pass pointer in ints */
- if (sizeof(int) != sizeof(void *))
- return 0;
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* make sure we have some buffer space */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* do the printf() into the input buffer, put length in len */
- size = (int)(state->size);
- state->in[size - 1] = 0;
-#ifdef NO_snprintf
-# ifdef HAS_sprintf_void
- sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- for (len = 0; len < size; len++)
- if (state->in[len] == 0) break;
-# else
- len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#else
-# ifdef HAS_snprintf_void
- snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- len = strlen((char *)(state->in));
-# else
- len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6,
- a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18,
- a19, a20);
-# endif
-#endif
-
- /* check that printf() results fit in buffer */
- if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
- return 0;
-
- /* update buffer and position, defer compression until needed */
- strm->avail_in = (unsigned)len;
- strm->next_in = state->in;
- state->x.pos += len;
- return len;
-}
-
-#endif
-
/* -- see zlib.h -- */
int ZEXPORT gzflush(file, flush)
gzFile file;
#include "zlib.h"
#include <stdio.h>
-#ifdef STDC
-# include <string.h>
-# include <stdlib.h>
-#endif
+#include <string.h>
+#include <stdlib.h>
-#if defined(VMS) || defined(RISCOS)
-# define TESTFILE "foo-gz"
-#else
-# define TESTFILE "foo.gz"
-#endif
+#define TESTFILE "foo.gz"
#define CHECK_ERR(err, msg) { \
if (err != Z_OK) { \
#include "zlib.h"
#include <stdio.h>
-#ifdef STDC
-# include <string.h>
-# include <stdlib.h>
-#endif
+#include <string.h>
+#include <stdlib.h>
#ifdef USE_MMAP
# include <sys/types.h>
exit(1);
}
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX);
-#else
- strcpy(outfile, file);
- strcat(outfile, GZ_SUFFIX);
-#endif
in = fopen(file, "rb");
if (in == NULL) {
exit(1);
}
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(buf, sizeof(buf), "%s", file);
-#else
- strcpy(buf, file);
-#endif
if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
infile = file;
} else {
outfile = file;
infile = buf;
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX);
-#else
- strcat(infile, GZ_SUFFIX);
-#endif
}
in = gzopen(infile, "rb");
if (in == NULL) {
gzFile file;
char *bname, outmode[20];
-#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(outmode, sizeof(outmode), "%s", "wb6 ");
-#else
- strcpy(outmode, "wb6 ");
-#endif
prog = argv[0];
bname = strrchr(argv[0], '/');
#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
-#if defined(GEN_TREES_H) || !defined(STDC)
+#if defined(GEN_TREES_H)
/* non ANSI compilers may not accept trees.h */
ZLIB_INTERNAL ct_data static_ltree[L_CODES+2];
*/
local void tr_static_init()
{
-#if defined(GEN_TREES_H) || !defined(STDC)
+#if defined(GEN_TREES_H)
static int static_init_done = 0;
int n; /* iterates over tree elements */
int bits; /* bit counter */
# ifdef GEN_TREES_H
gen_trees_header();
# endif
-#endif /* defined(GEN_TREES_H) || !defined(STDC) */
+#endif /* defined(GEN_TREES_H) */
}
/* ===========================================================================
# endif
#endif
+#ifndef STDC
+# define STDC
+#endif
+
#ifdef __STDC_VERSION__
-# ifndef STDC
-# define STDC
-# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(WINDOWS) || defined(WIN32))
-# define STDC
-#endif
-#if !defined(STDC) && defined(__HOS_AIX__)
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const /* note: need a more gentle solution here */
-# endif
-#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
/* Type declarations */
#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
+# define OF(args) args
#endif
#ifndef Z_ARG /* function prototypes for stdarg */
-# if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# define Z_ARG(args) args
-# else
-# define Z_ARG(args) ()
-# endif
+# define Z_ARG(args) args
#endif
#if defined(WINDOWS) || defined(WIN32)
typedef uInt uIntf;
typedef uLong uLongf;
-#ifdef STDC
- typedef void const *voidpc;
- typedef void *voidpf;
- typedef void *voidp;
-#else
- typedef Byte const *voidpc;
- typedef Byte *voidpf;
- typedef Byte *voidp;
-#endif
+typedef void const *voidpc;
+typedef void *voidpf;
+typedef void *voidp;
-#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
+#if !defined(Z_U4) && !defined(Z_SOLO)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# define Z_HAVE_STDARG_H
#endif
-#ifdef STDC
-# ifndef Z_SOLO
-# include <sys/types.h> /* for off_t */
-# endif
-#endif
-
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# ifndef Z_SOLO
-# include <stdarg.h> /* for va_list */
-# endif
+#ifndef Z_SOLO
+# include <sys/types.h> /* for off_t */
+# include <stdarg.h> /* for va_list */
#endif
#ifdef _WIN32
#endif
#ifdef __STDC_VERSION__
-# ifndef STDC
-# define STDC
-# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(WINDOWS) || defined(WIN32))
-# define STDC
-#endif
-#if !defined(STDC) && defined(__HOS_AIX__)
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const /* note: need a more gentle solution here */
-# endif
-#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
/* Type declarations */
#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
+# define OF(args) args
#endif
#ifndef Z_ARG /* function prototypes for stdarg */
-# if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# define Z_ARG(args) args
-# else
-# define Z_ARG(args) ()
-# endif
+# define Z_ARG(args) args
#endif
#if defined(WINDOWS) || defined(WIN32)
typedef uInt uIntf;
typedef uLong uLongf;
-#ifdef STDC
- typedef void const *voidpc;
- typedef void *voidpf;
- typedef void *voidp;
-#else
- typedef Byte const *voidpc;
- typedef Byte *voidpf;
- typedef Byte *voidp;
-#endif
+typedef void const *voidpc;
+typedef void *voidpf;
+typedef void *voidp;
-#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
+#if !defined(Z_U4) && !defined(Z_SOLO)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# define Z_HAVE_STDARG_H
#endif
-#ifdef STDC
-# ifndef Z_SOLO
-# include <sys/types.h> /* for off_t */
-# endif
-#endif
-
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# ifndef Z_SOLO
-# include <stdarg.h> /* for va_list */
-# endif
+#ifndef Z_SOLO
+# include <sys/types.h> /* for off_t */
+# include <stdarg.h> /* for va_list */
#endif
#ifdef _WIN32
#endif
#ifdef __STDC_VERSION__
-# ifndef STDC
-# define STDC
-# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(WINDOWS) || defined(WIN32))
-# define STDC
-#endif
-#if !defined(STDC) && defined(__HOS_AIX__)
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const /* note: need a more gentle solution here */
-# endif
-#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
/* Type declarations */
#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
+# define OF(args) args
#endif
#ifndef Z_ARG /* function prototypes for stdarg */
-# if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# define Z_ARG(args) args
-# else
-# define Z_ARG(args) ()
-# endif
+# define Z_ARG(args) args
#endif
#if defined(WINDOWS) || defined(WIN32)
typedef uInt uIntf;
typedef uLong uLongf;
-#ifdef STDC
- typedef void const *voidpc;
- typedef void *voidpf;
- typedef void *voidp;
-#else
- typedef Byte const *voidpc;
- typedef Byte *voidpf;
- typedef Byte *voidp;
-#endif
+typedef void const *voidpc;
+typedef void *voidpf;
+typedef void *voidp;
-#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
+#if !defined(Z_U4) && !defined(Z_SOLO)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# define Z_HAVE_STDARG_H
#endif
-#ifdef STDC
-# ifndef Z_SOLO
-# include <sys/types.h> /* for off_t */
-# endif
-#endif
-
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# ifndef Z_SOLO
-# include <stdarg.h> /* for va_list */
-# endif
+#ifndef Z_SOLO
+# include <sys/types.h> /* for off_t */
+# include <stdarg.h> /* for va_list */
#endif
#ifdef _WIN32
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
#if defined(_WIN32) && !defined(Z_SOLO)
-ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
- const char *mode));
+ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, const char *mode));
#endif
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# ifndef Z_SOLO
-ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
- const char *format,
- va_list va));
-# endif
+#ifndef Z_SOLO
+ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, const char *format, va_list va));
#endif
#ifdef __cplusplus
#endif
#ifdef FASTEST
flags += 1L << 21;
-#endif
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# ifdef NO_vsnprintf
- flags += 1L << 25;
-# ifdef HAS_vsprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_vsnprintf_void
- flags += 1L << 26;
-# endif
-# endif
-#else
- flags += 1L << 24;
-# ifdef NO_snprintf
- flags += 1L << 25;
-# ifdef HAS_sprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_snprintf_void
- flags += 1L << 26;
-# endif
-# endif
#endif
return flags;
}
int errno = 0;
#endif
-#ifndef HAVE_MEMCPY
-
-void ZLIB_INTERNAL zmemcpy(dest, source, len)
- Bytef* dest;
- const Bytef* source;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = *source++; /* ??? to be unrolled */
- } while (--len != 0);
-}
-
-int ZLIB_INTERNAL zmemcmp(s1, s2, len)
- const Bytef* s1;
- const Bytef* s2;
- uInt len;
-{
- uInt j;
-
- for (j = 0; j < len; j++) {
- if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
- }
- return 0;
-}
-
-void ZLIB_INTERNAL zmemzero(dest, len)
- Bytef* dest;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = 0; /* ??? to be unrolled */
- } while (--len != 0);
-}
-#endif
-
#ifndef Z_SOLO
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
-#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern voidp calloc OF((uInt items, uInt size));
-extern void free OF((voidpf ptr));
-#endif
-
voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
voidpf opaque;
unsigned items;
#include "zlib.h"
-#if defined(STDC) && !defined(Z_SOLO)
+#ifndef Z_SOLO
# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
# include <stddef.h>
# endif
/* functions */
-#if defined(pyr) || defined(Z_SOLO)
-# define NO_MEMCPY
-#endif
-#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
- /* Use our own functions for small and medium model with MSC <= 5.0.
- * You may have to use the same strategy for Borland C (untested).
- * The __SC__ check is for Symantec.
- */
-# define NO_MEMCPY
-#endif
-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
-# define HAVE_MEMCPY
-#endif
-#ifdef HAVE_MEMCPY
-# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
-# define zmemcpy _fmemcpy
-# define zmemcmp _fmemcmp
-# define zmemzero(dest, len) _fmemset(dest, 0, len)
-# else
-# define zmemcpy memcpy
-# define zmemcmp memcmp
-# define zmemzero(dest, len) memset(dest, 0, len)
-# endif
-#else
- 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
+#define zmemcpy memcpy
+#define zmemcmp memcmp
+#define zmemzero(dest, len) memset(dest, 0, len)
/* Diagnostic functions */
#ifdef DEBUG
# define ZSWAP32(q) _bswap(q)
#else
-#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
+# define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
#endif /* ZSWAP32 */