diff options
author | peter <peter@FreeBSD.org> | 1999-01-10 09:53:51 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-01-10 09:53:51 +0000 |
commit | 67d696bb6279a8160b637faab547f897d198dcbc (patch) | |
tree | a075f94f5fb1b4c98d4588db3f8ca675ccde9aa0 /lib | |
parent | 220de345140182e6dd7f4c662050f3b9fdda2066 (diff) | |
download | FreeBSD-src-67d696bb6279a8160b637faab547f897d198dcbc.zip FreeBSD-src-67d696bb6279a8160b637faab547f897d198dcbc.tar.gz |
Merge changes from vendor branch (1.1.1 -> 1.1.3) into mainline.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libz/adler32.c | 2 | ||||
-rw-r--r-- | lib/libz/compress.c | 2 | ||||
-rw-r--r-- | lib/libz/crc32.c | 2 | ||||
-rw-r--r-- | lib/libz/deflate.c | 10 | ||||
-rw-r--r-- | lib/libz/deflate.h | 8 | ||||
-rw-r--r-- | lib/libz/example.c | 30 | ||||
-rw-r--r-- | lib/libz/gzio.c | 39 | ||||
-rw-r--r-- | lib/libz/minigzip.c | 5 | ||||
-rw-r--r-- | lib/libz/trees.c | 54 | ||||
-rw-r--r-- | lib/libz/uncompr.c | 2 | ||||
-rw-r--r-- | lib/libz/zconf.h | 73 | ||||
-rw-r--r-- | lib/libz/zutil.c | 10 | ||||
-rw-r--r-- | lib/libz/zutil.h | 23 |
13 files changed, 157 insertions, 103 deletions
diff --git a/lib/libz/adler32.c b/lib/libz/adler32.c index b1f71ce..16cf9a7 100644 --- a/lib/libz/adler32.c +++ b/lib/libz/adler32.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* $FreeBSD$ */ +/* @(#) $Id$ */ #include "zlib.h" diff --git a/lib/libz/compress.c b/lib/libz/compress.c index 31c51e6..1cee470 100644 --- a/lib/libz/compress.c +++ b/lib/libz/compress.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* $FreeBSD$ */ +/* @(#) $Id$ */ #include "zlib.h" diff --git a/lib/libz/crc32.c b/lib/libz/crc32.c index 2e98580..a91101a 100644 --- a/lib/libz/crc32.c +++ b/lib/libz/crc32.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* $FreeBSD$ */ +/* @(#) $Id$ */ #include "zlib.h" diff --git a/lib/libz/deflate.c b/lib/libz/deflate.c index dc8c76c..cfa0505 100644 --- a/lib/libz/deflate.c +++ b/lib/libz/deflate.c @@ -47,12 +47,12 @@ * */ -/* $FreeBSD$ */ +/* @(#) $Id: deflate.c,v 1.1.1.3 1999/01/10 09:46:53 peter Exp $ */ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.1.1 Copyright 1995-1998 Jean-loup Gailly "; + " deflate 1.1.3 Copyright 1995-1998 Jean-loup Gailly "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -608,11 +608,13 @@ int ZEXPORT deflateCopy (dest, source) deflate_state *ss; ushf *overlay; - ss = source->state; - if (source == Z_NULL || dest == Z_NULL || ss == Z_NULL) { + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { return Z_STREAM_ERROR; } + + ss = source->state; + *dest = *source; ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); diff --git a/lib/libz/deflate.h b/lib/libz/deflate.h index 5cf65ec..112a15e 100644 --- a/lib/libz/deflate.h +++ b/lib/libz/deflate.h @@ -8,7 +8,7 @@ subject to change. Applications should only use zlib.h. */ -/* $FreeBSD$ */ +/* @(#) $Id: deflate.h,v 1.1.1.3 1999/01/10 09:46:53 peter Exp $ */ #ifndef _DEFLATE_H #define _DEFLATE_H @@ -230,12 +230,12 @@ typedef struct internal_state { ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ - ulg compressed_len; /* total bit length of compressed file */ uInt matches; /* number of string matches in current block */ int last_eob_len; /* bit length of EOB code for last block */ #ifdef DEBUG - ulg bits_sent; /* bit length of the compressed data */ + ulg compressed_len; /* total bit length of compressed file mod 2^32 */ + ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ #endif ush bi_buf; @@ -268,7 +268,7 @@ typedef struct internal_state { /* in trees.c */ void _tr_init OF((deflate_state *s)); int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -ulg _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, +void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, int eof)); void _tr_align OF((deflate_state *s)); void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, diff --git a/lib/libz/example.c b/lib/libz/example.c index e313c55..ed718cb 100644 --- a/lib/libz/example.c +++ b/lib/libz/example.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* $FreeBSD$ */ +/* @(#) $Id: example.c,v 1.1.1.3 1999/01/10 09:46:54 peter Exp $ */ #include <stdio.h> #include "zlib.h" @@ -15,6 +15,12 @@ extern void exit OF((int)); #endif +#if defined(VMS) || defined(RISCOS) +# define TESTFILE "foo-gz" +#else +# define TESTFILE "foo.gz" +#endif + #define CHECK_ERR(err, msg) { \ if (err != Z_OK) { \ fprintf(stderr, "%s error: %d\n", msg, err); \ @@ -71,7 +77,7 @@ void test_compress(compr, comprLen, uncompr, uncomprLen) fprintf(stderr, "bad uncompress\n"); exit(1); } else { - printf("uncompress(): %s\n", uncompr); + printf("uncompress(): %s\n", (char *)uncompr); } } @@ -79,8 +85,8 @@ void test_compress(compr, comprLen, uncompr, uncomprLen) * Test read/write of .gz files */ void test_gzio(out, in, uncompr, uncomprLen) - const char *out; /* output file */ - const char *in; /* input file */ + const char *out; /* compressed output file */ + const char *in; /* compressed input file */ Byte *uncompr; int uncomprLen; { @@ -121,13 +127,13 @@ void test_gzio(out, in, uncompr, uncomprLen) fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); exit(1); } else { - printf("gzread(): %s\n", uncompr); + printf("gzread(): %s\n", (char *)uncompr); } pos = gzseek(file, -8L, SEEK_CUR); if (pos != 6 || gztell(file) != pos) { fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - pos, gztell(file)); + (long)pos, (long)gztell(file)); exit(1); } @@ -146,7 +152,7 @@ void test_gzio(out, in, uncompr, uncomprLen) fprintf(stderr, "bad gzgets after gzseek\n"); exit(1); } else { - printf("gzgets() after gzseek: %s\n", uncompr); + printf("gzgets() after gzseek: %s\n", (char *)uncompr); } gzclose(file); @@ -227,7 +233,7 @@ void test_inflate(compr, comprLen, uncompr, uncomprLen) fprintf(stderr, "bad inflate\n"); exit(1); } else { - printf("inflate(): %s\n", uncompr); + printf("inflate(): %s\n", (char *)uncompr); } } @@ -406,7 +412,7 @@ void test_sync(compr, comprLen, uncompr, uncomprLen) err = inflateEnd(&d_stream); CHECK_ERR(err, "inflateEnd"); - printf("after inflateSync(): hel%s\n", uncompr); + printf("after inflateSync(): hel%s\n", (char *)uncompr); } /* =========================================================================== @@ -492,7 +498,7 @@ void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) fprintf(stderr, "bad inflate with dict\n"); exit(1); } else { - printf("inflate with dictionary: %s\n", uncompr); + printf("inflate with dictionary: %s\n", (char *)uncompr); } } @@ -528,8 +534,8 @@ int main(argc, argv) } test_compress(compr, comprLen, uncompr, uncomprLen); - test_gzio((argc > 1 ? argv[1] : "foo.gz"), - (argc > 2 ? argv[2] : "foo.gz"), + test_gzio((argc > 1 ? argv[1] : TESTFILE), + (argc > 2 ? argv[2] : TESTFILE), uncompr, (int)uncomprLen); test_deflate(compr, comprLen); diff --git a/lib/libz/gzio.c b/lib/libz/gzio.c index e3782d5..b2090b8 100644 --- a/lib/libz/gzio.c +++ b/lib/libz/gzio.c @@ -5,7 +5,7 @@ * Compile this file with -DNO_DEFLATE to avoid the compression code. */ -/* $FreeBSD$ */ +/* @(#) $Id: gzio.c,v 1.1.1.3 1999/01/10 09:46:54 peter Exp $ */ #include <stdio.h> @@ -13,8 +13,16 @@ struct internal_state {int dummy;}; /* for buggy compilers */ -#define Z_BUFSIZE 16384 -#define Z_PRINTF_BUFSIZE 4096 +#ifndef Z_BUFSIZE +# ifdef MAXSEG_64K +# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ +# else +# define Z_BUFSIZE 16384 +# endif +#endif +#ifndef Z_PRINTF_BUFSIZE +# define Z_PRINTF_BUFSIZE 4096 +#endif #define ALLOC(size) malloc(size) #define TRYFREE(p) {if (p) free(p);} @@ -132,8 +140,12 @@ local gzFile gz_open (path, mode, fd) s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); err = inflateInit2(&(s->stream), -MAX_WBITS); - /* windowBits is passed < 0 to tell that there is no zlib header */ - + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra "dummy" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are + * present after the compressed stream. + */ if (err != Z_OK || s->inbuf == Z_NULL) { return destroy(s), (gzFile)Z_NULL; } @@ -379,6 +391,7 @@ int ZEXPORT gzread (file, buf, len) len -= s->stream.avail_out; s->stream.total_in += (uLong)len; s->stream.total_out += (uLong)len; + if (len == 0) s->z_eof = 1; return (int)len; } if (s->stream.avail_in == 0 && !s->z_eof) { @@ -401,10 +414,14 @@ int ZEXPORT gzread (file, buf, len) s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); start = s->stream.next_out; - if (getLong(s) != s->crc || getLong(s) != s->stream.total_out) { + if (getLong(s) != s->crc) { s->z_err = Z_DATA_ERROR; } else { - /* Check for concatenated .gz files: */ + (void)getLong(s); + /* The uncompressed length returned by above getlong() may + * be different from s->stream.total_out) in case of + * concatenated .gz files. Check for such files: + */ check_header(s); if (s->z_err == Z_OK) { uLong total_in = s->stream.total_in; @@ -572,7 +589,7 @@ int ZEXPORT gzputs(file, s) gzFile file; const char *s; { - return gzwrite(file, (const voidp)s, (unsigned)strlen(s)); + return gzwrite(file, (char*)s, (unsigned)strlen(s)); } @@ -657,7 +674,7 @@ z_off_t ZEXPORT gzseek (file, offset, whence) return -1L; #else if (whence == SEEK_SET) { - offset -= s->stream.total_out; + offset -= s->stream.total_in; } if (offset < 0) return -1L; @@ -732,6 +749,7 @@ int ZEXPORT gzrewind (file) s->z_eof = 0; s->stream.avail_in = 0; s->stream.next_in = s->inbuf; + s->crc = crc32(0L, Z_NULL, 0); if (s->startpos == 0) { /* not a compressed file */ rewind(s->file); @@ -780,7 +798,8 @@ local void putLong (file, x) } /* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets + Reads a long in LSB order from the given gz_stream. Sets z_err in case + of error. */ local uLong getLong (s) gz_stream *s; diff --git a/lib/libz/minigzip.c b/lib/libz/minigzip.c index 487632e..180b39d 100644 --- a/lib/libz/minigzip.c +++ b/lib/libz/minigzip.c @@ -13,7 +13,7 @@ * or in pipe mode. */ -/* $FreeBSD$ */ +/* @(#) $Id: minigzip.c,v 1.1.1.3 1999/01/10 09:46:57 peter Exp $ */ #include <stdio.h> #include "zlib.h" @@ -48,6 +48,9 @@ # define GZ_SUFFIX "-gz" # define fileno(file) file->__file #endif +#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include <unix.h> /* for fileno */ +#endif #ifndef WIN32 /* unlink already in stdio.h for WIN32 */ extern int unlink OF((const char *)); diff --git a/lib/libz/trees.c b/lib/libz/trees.c index 2497001..b02b527 100644 --- a/lib/libz/trees.c +++ b/lib/libz/trees.c @@ -29,7 +29,7 @@ * Addison-Wesley, 1983. ISBN 0-201-06672-6. */ -/* $FreeBSD$ */ +/* @(#) $Id: trees.c,v 1.1.1.3 1999/01/10 09:46:57 peter Exp $ */ /* #define GEN_TREES_H */ @@ -250,6 +250,13 @@ local void tr_static_init() if (static_init_done) return; + /* For some embedded targets, global variables are not initialized: */ + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; + /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { @@ -378,8 +385,6 @@ void _tr_init(s) { tr_static_init(); - s->compressed_len = 0L; - s->l_desc.dyn_tree = s->dyn_ltree; s->l_desc.stat_desc = &static_l_desc; @@ -393,6 +398,7 @@ void _tr_init(s) s->bi_valid = 0; s->last_eob_len = 8; /* enough lookahead for inflate */ #ifdef DEBUG + s->compressed_len = 0L; s->bits_sent = 0L; #endif @@ -865,9 +871,10 @@ void _tr_stored_block(s, buf, stored_len, eof) int eof; /* true if this is the last block for a file */ { send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ +#ifdef DEBUG s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; - +#endif copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ } @@ -887,7 +894,9 @@ void _tr_align(s) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif bi_flush(s); /* Of the 10 bits for the empty block, we have already sent * (10 - bi_valid) bits. The lookahead for the last real code (before @@ -897,7 +906,9 @@ void _tr_align(s) if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG s->compressed_len += 10L; +#endif bi_flush(s); } s->last_eob_len = 7; @@ -905,10 +916,9 @@ void _tr_align(s) /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. This function - * returns the total compressed length for the file so far. + * trees or store, and output the encoded block to the zip file. */ -ulg _tr_flush_block(s, buf, stored_len, eof) +void _tr_flush_block(s, buf, stored_len, eof) deflate_state *s; charf *buf; /* input block, or NULL if too old */ ulg stored_len; /* length of input block */ @@ -955,25 +965,6 @@ ulg _tr_flush_block(s, buf, stored_len, eof) opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } - /* If compression failed and this is the first and last block, - * and if the .zip file can be seeked (to rewrite the local header), - * the whole file is transformed into a stored file: - */ -#ifdef STORED_FILE_OK -# ifdef FORCE_STORED_FILE - if (eof && s->compressed_len == 0L) { /* force stored file */ -# else - if (stored_len <= opt_lenb && eof && s->compressed_len==0L && seekable()) { -# endif - /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */ - if (buf == (charf*)0) error ("block vanished"); - - copy_block(buf, (unsigned)stored_len, 0); /* without header */ - s->compressed_len = stored_len << 3; - s->method = STORED; - } else -#endif /* STORED_FILE_OK */ - #ifdef FORCE_STORED if (buf != (char*)0) { /* force stored block */ #else @@ -995,25 +986,32 @@ ulg _tr_flush_block(s, buf, stored_len, eof) #endif send_bits(s, (STATIC_TREES<<1)+eof, 3); compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); +#ifdef DEBUG s->compressed_len += 3 + s->static_len; +#endif } else { send_bits(s, (DYN_TREES<<1)+eof, 3); send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1); compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); +#ifdef DEBUG s->compressed_len += 3 + s->opt_len; +#endif } Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ init_block(s); if (eof) { bi_windup(s); +#ifdef DEBUG s->compressed_len += 7; /* align on byte boundary */ +#endif } Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*eof)); - - return s->compressed_len >> 3; } /* =========================================================================== diff --git a/lib/libz/uncompr.c b/lib/libz/uncompr.c index b1bd9fc..d103321 100644 --- a/lib/libz/uncompr.c +++ b/lib/libz/uncompr.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* $FreeBSD$ */ +/* @(#) $Id$ */ #include "zlib.h" diff --git a/lib/libz/zconf.h b/lib/libz/zconf.h index 5b71e4b..f06124f 100644 --- a/lib/libz/zconf.h +++ b/lib/libz/zconf.h @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* $FreeBSD$ */ +/* @(#) $Id: zconf.h,v 1.1.1.3 1999/01/10 09:46:58 peter Exp $ */ #ifndef _ZCONF_H #define _ZCONF_H @@ -91,8 +91,8 @@ # define NO_DUMMY_DECL #endif -/* Borland C incorrectly complains about missing returns: */ -#if defined(__BORLANDC__) +/* Old Borland C incorrectly complains about missing returns: */ +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) # define NEED_DUMMY_RETURN #endif @@ -148,7 +148,7 @@ /* MSC small or medium model */ # define SMALL_MEDIUM # ifdef _MSC_VER -# define FAR __far +# define FAR _far # else # define FAR far # endif @@ -156,42 +156,68 @@ #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) # ifndef __32BIT__ # define SMALL_MEDIUM -# define FAR __far +# define FAR _far # endif #endif /* Compile with -DZLIB_DLL for Windows DLL support */ -#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL) -# ifdef FAR -# undef FAR +#if defined(ZLIB_DLL) +# if defined(_WINDOWS) || defined(WINDOWS) +# ifdef FAR +# undef FAR +# endif +# include <windows.h> +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR _cdecl _export +# endif # endif -# include <windows.h> -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV +# if defined (__BORLANDC__) +# if (__BORLANDC__ >= 0x0500) && defined (WIN32) +# include <windows.h> +# define ZEXPORT __declspec(dllexport) WINAPI +# define ZEXPORTRVA __declspec(dllexport) WINAPIV +# else +# if defined (_Windows) && defined (__DLL__) +# define ZEXPORT _export +# define ZEXPORTVA _export +# endif +# endif +# endif +#endif + +#if defined (__BEOS__) +# if defined (ZLIB_DLL) +# define ZEXTERN extern __declspec(dllexport) # else -# define ZEXPORTVA FAR _cdecl _export +# define ZEXTERN extern __declspec(dllimport) # endif -#else -# if defined (__BORLANDC__) && defined (_Windows) && defined (__DLL__) -# define ZEXPORT _export -# define ZEXPORTVA _export -# else -# define ZEXPORT -# define ZEXPORTVA -# endif +#endif + +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif +#ifndef ZEXTERN +# define ZEXTERN extern #endif #ifndef FAR # define FAR #endif +#if !defined(MACOS) && !defined(TARGET_OS_MAC) typedef unsigned char Byte; /* 8 bits */ +#endif typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ -#if defined(__BORLANDC__) && defined(SMALL_MEDIUM) - /* Borland C/C++ ignores FAR inside typedef */ +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ # define Bytef Byte FAR #else typedef Byte FAR Bytef; @@ -217,6 +243,7 @@ typedef uLong FAR uLongf; #ifndef SEEK_SET # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif #ifndef z_off_t # define z_off_t long diff --git a/lib/libz/zutil.c b/lib/libz/zutil.c index 0d12b55..60340c8 100644 --- a/lib/libz/zutil.c +++ b/lib/libz/zutil.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* $FreeBSD$ */ +/* @(#) $Id: zutil.c,v 1.1.1.3 1999/01/10 09:46:59 peter Exp $ */ #include "zutil.h" @@ -60,7 +60,7 @@ const char * ZEXPORT zError(err) void zmemcpy(dest, source, len) Bytef* dest; - Bytef* source; + const Bytef* source; uInt len; { if (len == 0) return; @@ -70,8 +70,8 @@ void zmemcpy(dest, source, len) } int zmemcmp(s1, s2, len) - Bytef* s1; - Bytef* s2; + const Bytef* s1; + const Bytef* s2; uInt len; { uInt j; @@ -178,7 +178,7 @@ void zcfree (voidpf opaque, voidpf ptr) # define MY_ZCALLOC -#if (!defined(_MSC_VER) || (_MSC_VER < 600)) +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) # define _halloc halloc # define _hfree hfree #endif diff --git a/lib/libz/zutil.h b/lib/libz/zutil.h index 3843e0d..429339f 100644 --- a/lib/libz/zutil.h +++ b/lib/libz/zutil.h @@ -8,7 +8,7 @@ subject to change. Applications should only use zlib.h. */ -/* $FreeBSD$ */ +/* @(#) $Id: zutil.h,v 1.1.1.3 1999/01/10 09:46:59 peter Exp $ */ #ifndef _Z_UTIL_H #define _Z_UTIL_H @@ -75,7 +75,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #ifdef MSDOS # define OS_CODE 0x00 -# ifdef __TURBOC__ +# if defined(__TURBOC__) || defined(__BORLANDC__) # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) /* Allow compilation with ANSI keywords only enabled */ void _Cdecl farfree( void *block ); @@ -112,13 +112,12 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #if defined(MACOS) || defined(TARGET_OS_MAC) # define OS_CODE 0x07 -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -#endif -#if defined(__MWERKS__) && !defined(fdopen) -# if __dest_os != __be_os && __dest_os != __win32_os -# define fdopen(fd,mode) NULL +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include <unix.h> /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif # endif #endif @@ -134,7 +133,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # define fdopen(fd,mode) NULL /* No fdopen() */ #endif -#if (defined(_MSC_VER) && (_MSC_VER >= 600)) +#if (defined(_MSC_VER) && (_MSC_VER > 600)) # define fdopen(fd,type) _fdopen(fd,type) #endif @@ -182,8 +181,8 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # define zmemzero(dest, len) memset(dest, 0, len) # endif #else - extern void zmemcpy OF((Bytef* dest, Bytef* source, uInt len)); - extern int zmemcmp OF((Bytef* s1, Bytef* s2, uInt len)); + 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)); #endif |