Import zlib 1.2.4.1 beta (trimmed)

This commit is contained in:
Xin LI 2010-03-31 17:13:59 +00:00
parent db6fdb68ea
commit a665426b03
14 changed files with 67 additions and 60 deletions

View File

@ -1,6 +1,30 @@
ChangeLog file for zlib
Changes in 1.2.4.1 (28 Mar 2010)
- Remove the use of [a-z] constructs for sed in configure [gentoo 310225]
- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech]
- Restore "for debugging" comment on sprintf() in gzlib.c
- Remove fdopen for MVS from gzguts.h
- Put new README-WIN32.txt in win32 [Rowe]
- Add check for shell to configure and invoke another shell if needed
- Fix big fat stinking bug in gzseek() on uncompressed files
- Remove vestigial F_OPEN64 define in zutil.h
- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE
- Avoid errors on non-LFS systems when applications define LFS macros
- Set EXE to ".exe" in configure for MINGW [Kahle]
- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill]
- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev]
- Add DLL install in win32/makefile.gcc [Bar-Lev]
- Allow Linux* or linux* from uname in configure [Bar-Lev]
- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev]
- Add cross-compilation prefixes to configure [Bar-Lev]
- Match type exactly in gz_load() invocation in gzread.c
- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func
- Provide prototypes for *64 functions when building zlib without LFS
- Don't use -lc when linking shared library on MinGW
- Remove errno.h check in configure and vestigial errno code in zutil.h
Changes in 1.2.4 (14 Mar 2010)
- Fix VER3 extraction in configure for no fourth subversion
- Update zlib.3, add docs to Makefile.in to make .pdf out of it

4
README
View File

@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY
zlib 1.2.4 is a general purpose data compression library. All the code is
zlib 1.2.4.1 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
@ -30,7 +30,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
http://marknelson.us/1997/01/01/zlib-engine/ .
The changes made in version 1.2.4 are documented in the file ChangeLog.
The changes made in version 1.2.4.1 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory contrib/ .

View File

@ -221,7 +221,7 @@ const unsigned long FAR * ZEXPORT get_crc_table()
unsigned long ZEXPORT crc32(crc, buf, len)
unsigned long crc;
const unsigned char FAR *buf;
unsigned len;
uInt len;
{
if (buf == Z_NULL) return 0UL;

View File

@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
" deflate 1.2.4 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
" deflate 1.2.4.1 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
/*
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

View File

@ -3,9 +3,9 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifdef _LARGEFILE64_SOURCE
#if _LARGEFILE64_SOURCE == 1
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# endif
# ifdef _FILE_OFFSET_BITS
# undef _FILE_OFFSET_BITS
@ -44,7 +44,7 @@
#endif
/* get errno and strerror definition */
#if defined UNDER_CE && defined NO_ERRNO_H
#if defined UNDER_CE
# include <windows.h>
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
#else
@ -56,13 +56,7 @@
# endif
#endif
/* MVS fdopen() */
#ifdef __MVS__
#pragma map (fdopen , "\174\174FDOPEN")
FILE *fdopen(int, const char *);
#endif
#ifdef _LARGEFILE64_SOURCE
#if _LARGEFILE64_SOURCE == 1
# define z_off64_t off64_t
#else
# define z_off64_t z_off_t
@ -117,7 +111,7 @@ 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
#if defined UNDER_CE
ZEXTERN char ZEXPORT *gz_strwinerror OF((DWORD error));
#endif

10
gzlib.c
View File

@ -5,7 +5,7 @@
#include "gzguts.h"
#ifdef _LARGEFILE64_SOURCE
#if _LARGEFILE64_SOURCE == 1 && _LFS64_LARGEFILE == 1
# define LSEEK lseek64
#else
# define LSEEK lseek
@ -15,7 +15,7 @@
local void gz_reset OF((gz_statep));
local gzFile gz_open OF((const char *, int, const char *));
#if defined UNDER_CE && defined NO_ERRNO_H
#if defined UNDER_CE
/* Map the Windows error number in ERROR to a locale-dependent error message
string and return a pointer to it. Typically, the values for ERROR come
@ -65,7 +65,7 @@ char ZEXPORT *gz_strwinerror (error)
return buf;
}
#endif /* UNDER_CE && NO_ERRNO_H */
#endif /* UNDER_CE */
/* Reset gzip file state */
local void gz_reset(state)
@ -217,7 +217,7 @@ gzFile ZEXPORT gzdopen(fd, mode)
if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL)
return NULL;
sprintf(path, "<fd:%d>", fd);
sprintf(path, "<fd:%d>", fd); /* for debugging */
gz = gz_open(path, fd, mode);
free(path);
return gz;
@ -305,7 +305,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
/* if within raw area while reading, just go there */
if (state->mode == GZ_READ && state->how == COPY &&
state->pos + offset >= state->raw) {
ret = LSEEK(state->fd, offset, SEEK_CUR);
ret = LSEEK(state->fd, offset - state->have, SEEK_CUR);
if (ret == -1)
return -1;
state->have = 0;

View File

@ -55,7 +55,8 @@ local int gz_avail(state)
if (state->err != Z_OK)
return -1;
if (state->eof == 0) {
if (gz_load(state, state->in, state->size, &(strm->avail_in)) == -1)
if (gz_load(state, state->in, state->size,
(unsigned *)&(strm->avail_in)) == -1)
return -1;
strm->next_in = state->in;
}

View File

@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
" inflate 1.2.4 Copyright 1995-2010 Mark Adler ";
" inflate 1.2.4.1 Copyright 1995-2010 Mark Adler ";
/*
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
@ -62,7 +62,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 64, 195};
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 67, 206};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,

View File

@ -54,7 +54,7 @@
extern int unlink OF((const char *));
#endif
#if defined(UNDER_CE) && defined(NO_ERRNO_H)
#if defined(UNDER_CE)
# include <windows.h>
# define perror(s) pwinerror(s)
@ -116,7 +116,7 @@ static void pwinerror (s)
fprintf(stderr, "%s\n", strwinerror(GetLastError ()));
}
#endif /* UNDER_CE && NO_ERRNO_H */
#endif /* UNDER_CE */
#ifndef GZ_SUFFIX
# define GZ_SUFFIX ".gz"

View File

@ -364,7 +364,7 @@ typedef uLong FAR uLongf;
# define Z_HAVE_UNISTD_H
#endif
#ifdef Z_HAVE_UNISTD_H
#if defined(Z_HAVE_UNISTD_H) || _LARGEFILE64_SOURCE == 1
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
@ -375,15 +375,12 @@ typedef uLong FAR uLongf;
# endif
#endif
#ifdef _LARGEFILE64_SOURCE
# include <sys/types.h>
#endif
#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
#endif

4
zlib.3
View File

@ -1,4 +1,4 @@
.TH ZLIB 3 "14 March 2010"
.TH ZLIB 3 "28 Mar 2010"
.SH NAME
zlib \- compression/decompression library
.SH SYNOPSIS
@ -125,7 +125,7 @@ before asking for help.
Send questions and/or comments to zlib@gzip.org,
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
.SH AUTHORS
Version 1.2.4
Version 1.2.4.1
Copyright (C) 1995-2010 Jean-loup Gailly (jloup@gzip.org)
and Mark Adler (madler@alumni.caltech.edu).
.LP

14
zlib.h
View File

@ -1,5 +1,5 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.4, Mar 14th, 2010
version 1.2.4.1, March 28th, 2010
Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
@ -37,12 +37,12 @@
extern "C" {
#endif
#define ZLIB_VERSION "1.2.4"
#define ZLIB_VERNUM 0x1240
#define ZLIB_VERSION "1.2.4.1"
#define ZLIB_VERNUM 0x1241
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2
#define ZLIB_VER_REVISION 4
#define ZLIB_VER_SUBREVISION 0
#define ZLIB_VER_SUBREVISION 1
/*
The 'zlib' compression library provides in-memory compression and
@ -1556,7 +1556,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
inflateBackInit_((strm), (windowBits), (window), \
ZLIB_VERSION, sizeof(z_stream))
#ifdef _LARGEFILE64_SOURCE
#if _LARGEFILE64_SOURCE == 1 && _LFS64_LARGEFILE == 1
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int));
ZEXTERN off64_t ZEXPORT gztell64 OF((gzFile));
@ -1565,14 +1565,14 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t));
#endif
#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS == 64
#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS == 64 && _LFS64_LARGEFILE == 1
# define gzopen gzopen64
# define gzseek gzseek64
# define gztell gztell64
# define gzoffset gzoffset64
# define adler32_combine adler32_combine64
# define crc32_combine crc32_combine64
# ifndef _LARGEFILE64_SOURCE
# if _LARGEFILE64_SOURCE != 1
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int));
ZEXTERN off_t ZEXPORT gztell64 OF((gzFile));

View File

@ -272,7 +272,7 @@ void zcfree (voidpf opaque, voidpf ptr)
# define _hfree hfree
#endif
voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
voidpf zcalloc (voidpf opaque, uInt items, uInt size)
{
if (opaque) opaque = 0; /* to make compiler happy */
return _halloc((long)items, size);

31
zutil.h
View File

@ -24,19 +24,6 @@
# include <stdlib.h>
#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 <errno.h>
# endif
# define zseterrno(ERR) do { errno = (ERR); } while (0)
# define zerrno() errno
#endif
#ifndef local
# define local static
#endif
@ -167,12 +154,22 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#pragma warn -8066
#endif
#ifdef _LARGEFILE64_SOURCE
#if _LARGEFILE64_SOURCE == 1 && _LFS64_LARGEFILE == 1
# define z_off64_t off64_t
#else
# define z_off64_t z_off_t
#endif
/* provide prototypes for these when building zlib without LFS */
#if _LARGEFILE64_SOURCE != 1 || _LFS64_LARGEFILE != 1
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int));
ZEXTERN off_t ZEXPORT gztell64 OF((gzFile));
ZEXTERN off_t ZEXPORT gzoffset64 OF((gzFile));
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off_t));
#endif
/* common defaults */
#ifndef OS_CODE
@ -181,12 +178,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 */