Commit Graph

24 Commits

Author SHA1 Message Date
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