Commit Graph

54 Commits

Author SHA1 Message Date
Mark Adler 6544c3ecb7 Use lseek under WinCE. 2024-02-13 08:00:40 -08:00
Mark Adler fd5fe8b17e Further address Microsoft deprecation warnings. 2024-02-09 20:11:54 -08:00
Mark Adler 985a62d118 Address Microsoft deprecation warnings. 2024-02-08 18:45:49 -08:00
Mark Adler 51b7f2abda zlib 1.3.1 2024-01-22 10:32:37 -08:00
Milan Bulat 01253ecd7e Make the existence of gz_intmax() unconditional.
gz_intmax() is noted in zlib.map. This assures it's always there.
2024-01-17 16:07:14 -08:00
Mark Adler d982514782 Fix bug when using gzflush() with a very small buffer. 2023-08-14 17:01:54 -07:00
Mark Adler e9d5486e66 Remove K&R function definitions from zlib.
C2X has removed K&R definitions from the C function syntax.
Though the standard has not yet been approved, some high-profile
compilers are now issuing warnings when such definitions are
encountered.
2023-04-15 21:17:31 -07:00
Mark Adler 84c6716a48 Minor formatting improvements.
No code changes.
2022-10-05 15:17:52 -07:00
Mark Adler 21767c654d zlib 1.2.12 2022-03-27 16:05:02 -07:00
Mark Adler 79baebe50e Avoid adding empty gzip member after gzflush with Z_FINISH. 2019-04-13 17:08:50 -07:00
Mark Adler a362293745 Avoid a conversion error in gzseek when off_t type too small.
This is a problem in the odd case that the second argument of
LSEEK is a larger type than off_t. Apparently MinGW defines off_t
to be 32 bits, but _lseeki64 has a 64-bit second argument.

Also undo a previous commit to permit MinGW to use _lseeki64.
2017-02-15 22:39:26 -08:00
Mark Adler cacf7f1d4e zlib 1.2.11 2017-01-15 09:29:40 -08:00
Mark Adler 7358ef23c2 Avoid warnings on snprintf() return value. 2017-01-01 22:24:37 -08:00
Mark Adler 2fa463bacf zlib 1.2.9 2016-12-31 23:37:10 -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 123f9cfaf7 Clean up gz* function return values.
In some cases the return values did not match the documentation,
or the documentation did not document all of the return values.
gzprintf() now consistently returns negative values on error,
which matches the behavior of the stdio fprintf() function.
2016-12-04 07:48:47 -08:00
Mark Adler 4423fef8dc Fix gzseek() problem on MinGW due to buggy _lseeki64 there. 2016-01-29 23:24:55 -08:00
Mark Adler b4ce6caf09 Compile the gzopen_w() function when __CYGWIN__ defined. 2015-08-01 17:38:56 -07:00
Mark Adler 95698093f0 Improve speed of gzprintf() in transparent mode. 2015-07-05 18:14:53 -07:00
Mark Adler 72c70060d8 Assure that gzoffset() is correct when appending.
An open() with O_APPEND followed by an lseek() to determine the
position will return zero for a non-empty file, even though the
next write will start at the end of the file.  This commit works
around that by doing an lseek() to the end when appending.
2014-04-24 19:45:36 -04: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 eb90f6a568 Fix bug in 'F' mode for gzopen(). 2012-05-22 22:31:19 -07:00
Mark Adler c58f7ab28d Replace use of unsafe string functions with snprintf if available.
This avoids warnings in OpenBSD that apparently can't be turned
off whenever you link strcpy, strcat, or sprintf.  When snprintf
isn't available, the use of the "unsafe" string functions has
always in fact been safe, since the lengths are all checked before
those functions are called.

We do not use strlcpy or strlcat, since they are not (yet) found on
all systems.  snprintf on the other hand is part of the C standard
library and is very common.
2012-05-02 23:18:38 -07:00
Mark Adler a5d803b7ef Attempt to convert the wchar_t path in gzopen_w() for errors.
The conversion to multi-byte will be locale-specific, but it's
better than nothing and is only to provide more information in the
error message returned by gz_error().  The conversion has no
effect on what's opened.
2012-03-18 14:52:31 -07:00
Mark Adler 04afd39fcc Fix syntax error in gzlib.c. 2012-03-18 14:25:00 -07:00
Mark Adler 8e16df2c3f More fixes for gzopen_w().
Also need to #include <stddef.h> for zlib.h, and need to workaround
the inability to use wide characters in constructed error messages
with zlib's interface.
2012-03-18 09:29:44 -07:00
Mark Adler a1af6e96e3 Fix gzopen_w() type and add #include for the type. 2012-03-17 21:45:01 -07:00
Mark Adler dbe0bed739 Add gzopen_w() in Windows for wide character path names. 2012-03-16 20:53:09 -07:00
Mark Adler 5d5befa4c3 Update copyright years in gzlib.c. 2012-03-10 22:24:08 -08:00
Mark Adler e2abd78a98 Avoid warnings when O_CLOEXEC or O_EXCL are not defined. 2012-03-10 09:54:08 -08:00
Mark Adler 2e04ce0915 Make sure that O_EXCL is used portably. 2012-03-04 11:26:25 -08:00
Mark Adler 755c41dc4b Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen(). 2012-03-03 10:27:57 -08:00
Mark Adler e7289ed5f7 Do not use _lseeki64 under Borland C++ [Truta]. 2011-12-18 22:17:51 -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
Tor Lillqvist 7142fcfeed Always add large file support for windows 2011-10-01 10:02:09 -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 50e440f081 Allow gzrewind() and gzseek() after a premature end-of-file. 2011-09-26 18:20:32 -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 10daf0d4d7 zlib 1.2.5.1 2011-09-11 11:04:49 -07:00
Mark Adler 7301420248 zlib 1.2.4.5 2011-09-09 23:34:55 -07:00
Mark Adler f4498bea28 zlib 1.2.4.3 2011-09-09 23:34:38 -07:00
Mark Adler 7147f24cd7 zlib 1.2.4.2 2011-09-09 23:34:30 -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