Commit Graph

35 Commits

Author SHA1 Message Date
Mark Adler
2fa463bacf zlib 1.2.9 2016-12-31 23:37:10 -08:00
Mark Adler
cca27e95cf Avoid the need for ssize_t.
Limit read() and write() requests to sizes that fit in an int.
This allows storing the return value in an int, and avoiding the
need to use or construct an ssize_t type. This is required for
Microsoft C, whose _read and _write functions take an unsigned
request and return an int.
2016-12-31 10:06:40 -08:00
Mark Adler
feafcfaa05 No need to check for NULL argument to free(). 2016-12-30 14:30:52 -08:00
Mark Adler
44dfd831d2 Add gzfread(), duplicating the interface of fread(). 2016-12-04 18:35:41 -08:00
Mark Adler
ca50ebd4df Create z_size_t and z_ssize_t types.
Normally these are set to size_t and ssize_t. But if they do not
exist, then they are set to the smallest integer type that can
contain a pointer. size_t is unsigned and ssize_t is signed.
2016-12-04 07:48:48 -08:00
Mark Adler
7096424f23 Clean up type conversions. 2016-10-11 22:15:50 -07:00
Mark Adler
0b16609409 zlib 1.2.7.1 2013-03-24 22:47:59 -07:00
Mark Adler
e9f0b78443 Add casts and consts to ease user conversion to C++.
You would still need to run zlib2ansi on all of the *.c files.
2013-03-24 16:09:08 -07:00
Mark Adler
62d6112a79 Clean up the usage of z_const and respect const usage within zlib.
This patch allows zlib to compile cleanly with the -Wcast-qual gcc
warning enabled, but only if ZLIB_CONST is defined, which adds
const to next_in and msg in z_stream and in the in_func prototype.
A --const option is added to ./configure which adds -DZLIB_CONST
to the compile flags, and adds -Wcast-qual to the compile flags
when ZLIBGCCWARN is set in the environment.
2012-08-13 00:02:40 -07:00
Mark Adler
6a181356bd Fix gzgetc undefine when Z_PREFIX set [Turk]. 2012-05-17 21:13:23 -07:00
Mark Adler
d81e7213b7 Restore gzgetc_ for backward compatibility with 1.2.6. 2012-02-18 14:15:17 -08:00
Mark Adler
d1714a57c5 Replace use of memmove() with a simple copy for portability.
SunOS 4.1 doesn't have memmove(), and there may be others.  memcpy()
should not be used for overlapping copies, so here a simple copy is
implemented that works for the particular direction of the overlap,
which is where the destination precedes the source.
2012-02-18 13:37:45 -08:00
Mark Adler
94acb3c1a0 zlib 1.2.6.1 2012-02-12 14:20:33 -08:00
Mark Adler
1a4ba8cd91 Remove unnecessary gzgetc_ function. 2012-02-10 23:55:12 -08:00
Mark Adler
3d85f02a09 Restore gzgetc function for binary compatibility.
Newly compiled applications will use the gzgetc macro.
2011-12-18 14:47:08 -08:00
Mark Adler
2556706d67 Document gzread() capability to read concurrently written files.
Also since gzread() will no longer return an error for an incomplete
gzip file, have gzclose() return an error if the last gzread() ended
in the middle of a gzip stream.
2011-12-14 04:21:00 -08:00
Mark Adler
850a198ff1 Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF.
Z_BUF_ERROR was also being used for an unsuccessful gzungetc and for buffer
lengths that didn't fit in an int.  Those uses were changed to Z_DATA_ERROR
in order to assure that Z_BUF_ERROR occurs only when a premature end of
input occurs, indicating that gzclearerr() can be used.
2011-12-13 22:29:37 -08:00
Mark Adler
377173b57e Fix bug in gzread.c when end-of-file is reached. 2011-12-11 23:30:56 -08:00
Mark Adler
98f5779f42 Fix gzeof() to behave just like feof() when read is not past end of file.
Before, gzeof() would return true (accurately) when the last read request
went just up to the end of the uncompressed data.  In the analogous case,
feof() would return false, only returning true when a read request goes
past the end of the file.  This patch corrects gzeof() to behave in the
same way as feof(), as noted in the zlib.h documentation.
2011-12-11 18:22:04 -08:00
Mark Adler
26a99cd895 Add a transparent write mode to gzopen() when 'T' is in the mode. 2011-10-02 13:34:29 -07:00
Mark Adler
a4f7c65374 Update copyright dates on gz* source files. 2011-09-30 22:26:04 -07:00
Mark Adler
acfc85772a Change gzgetc() to a macro for speed (~40% speedup in testing). 2011-09-26 22:50:28 -07:00
Mark Adler
8e0d212910 Simplify gzseek() now that raw after gzip is ignored. 2011-09-26 18:34:07 -07:00
Mark Adler
5ad116abda Allow gzread() and related to continue after gzclearerr().
Before this fix, gzread() would lose data if a premature end of file
was encountered.  This prevented gzread() from being used on a file
that was being written concurrently.  Now gzread() returns all of the
data it has available before indicating a premature end of file.

This also changes the error returned on a premature end of file from
Z_DATA_ERROR to Z_BUF_ERROR.  This allows the user to determine if
the error is recoverable, which it is if Z_BUF_ERROR is returned.  If
a Z_DATA_ERROR is returned, then the error is not recoverable.

This patch replaces the functionality of a previous patch that fixed
reading through an empty gzip stream in a concatenation of gzip
streams.

To implement this fix, a noticeable rewrite of gzread.c was needed.
The patch has the added advantage of using inflate's gzip processing
instead of replicating the functionality in gzread.c.  This makes the
gz code a little simpler.
2011-09-26 00:57:26 -07:00
Mark Adler
a9ae24b653 Change gzread() and related to ignore junk after gzip streams.
Previously the new gz* functions (introduced in 1.2.4) would read and
return raw data after the last gzip stream.  This is inconsistent with
the behavior of gzip and the previous versions of zlib.  Now when one
or more gzip streams have been decoded from the file, which is then
followed by data that is not a gzip stream (as detemined by not finding
the magic header), then that subsequent trailing garbage is ignored,
and no error is returned.
2011-09-24 10:26:07 -07:00
Mark Adler
8824da8f01 Correct error in comment for gz_make(). 2011-09-24 08:33:38 -07:00
Mark Adler
0a81dc026c Fix bug in gzgets() for a concatenated empty gzip stream. 2011-09-24 00:29:46 -07:00
Mark Adler
f32370e542 Correct spelling error in gzread.c 2011-09-24 00:09:31 -07:00
Mark Adler
05d47d2627 zlib 1.2.4.1 2011-09-09 23:34:22 -07:00
Mark Adler
67cc20d004 zlib 1.2.4-pre1 2011-09-09 23:32:36 -07:00
Mark Adler
7751bd4c71 zlib 1.2.3.9 2011-09-09 23:27:26 -07:00
Mark Adler
e0ff940e1a zlib 1.2.3.8 2011-09-09 23:27:17 -07:00
Mark Adler
7df877eccd zlib 1.2.3.7 2011-09-09 23:27:08 -07:00
Mark Adler
dc5a43ebfa zlib 1.2.3.6 2011-09-09 23:26:58 -07:00
Mark Adler
d004b04783 zlib 1.2.3.5 2011-09-09 23:26:49 -07:00