Commit Graph

268 Commits

Author SHA1 Message Date
Mark Adler
b8522e0264 Add note to contrib/blast to use binary mode in stdio. 2012-10-24 22:47:37 -07:00
Mark Adler
e69a9ceee0 Check for input buffer malloc failure in examples/gzappend.c. 2012-10-11 16:10:59 -07:00
Mark Adler
c4888637ea Fix bug in gzclose() when gzwrite() runs out of memory.
If the deflateInit2() called for the first gzwrite() failed with a
Z_MEM_ERROR, then a subsequent gzclose() would try to free an
already freed pointer.  This fixes that.
2012-10-01 22:52:16 -07:00
Mark Adler
0cf495a1ca Fix bug where gzopen(), gzclose() would write an empty file.
A gzopen() to write (mode "w") followed immediately by a gzclose()
would output an empty zero-length file.  What it should do is write
an empty gzip file, with the gzip header, empty deflate content,
and gzip trailer totalling 20 bytes.  This fixes it to do that.
2012-09-29 22:37:55 -07:00
Mark Adler
bd143f1c0a Fix memory allocation error in examples/zran.c [Nor]. 2012-09-29 22:37:55 -07:00
Mark Adler
aa566e86c4 Fix unintialized value bug in gzputc() introduced by const patches.
Avoid the use of an uninitialized value when the write buffers have
not been initialized.  A recent change to avoid the use of strm->
next_in in order to resolve some const conflicts added the use of
state->in in its place.  This patch avoids the use of state->in
when it is not initialized.  Nothing bad would actually happen,
since two variables set to the same unintialized value are
subtracted.  However valgrind was rightly complaining.  So this
fixes that.
2012-08-24 15:02:28 -07:00
Mark Adler
17068938ce Avoid shift equal to bits in type (caused endless loop).
Also clean up comparisons between different types, and some odd
indentation problems that showed up somehow.

A new endless loop was introduced by the clang compiler, which
apparently does odd things when the right operand of << is equal to
or greater than the number of bits in the type.  The C standard in
fact states that the behavior of << is undefined in that case.  The
loop was rewritten to use single-bit shifts.
2012-08-18 18:07:26 -07:00
Mark Adler
3d9df6ecf8 Clean up examples/gzlog.[ch] comparisons of different types. 2012-08-18 18:07:04 -07:00
Mark Adler
a2981775a9 Clean up examples/gzjoin.c for z_const usage. 2012-08-14 00:30:44 -07:00
Mark Adler
aa210a1b84 Fix example/gzappend.c for proper z_const usage. 2012-08-14 00:29:58 -07:00
Mark Adler
360c3e9532 Update examples/gun.c for proper z_const usage. 2012-08-13 21:49:10 -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
fb4e0599a5 Fix argument checks in gzlog_compress() and gzlog_write(). 2012-07-08 17:01:13 -07:00
Mark Adler
aef4174dd2 Remove unused variable in infback9.c. 2012-07-08 16:48:36 -07:00
Birunthan Mohanathas
f51cc49c94 Fix comment typos in unzip.h and unzip.c. 2012-07-08 16:34:08 -07:00
Thomas Roß
d0c7331258 Update copyright year in win32/zlib1.rc. 2012-07-06 21:49:55 -07:00
Thomas Roß
486ef7b4b4 Fix CMake compilation of static lib for MSVC2010 x64. 2012-07-06 21:49:20 -07:00
Mark Adler
bfac156463 Fix configure check for veracity of compiler error return codes.
There were two problems before that this fixes.  One was that the
check for the compiler error return code preceded the determination
of the compiler and its options.  The other was that the checks
for compiler and library characteristics could be fooled if the
error options were set to reject K&R-style C.  configure now aborts
if the compiler produces a hard error on K&R-style C.

In addition, aborts of configure are now consistent, and remove
any temporary files.
2012-06-09 23:17:07 -07:00
Mark Adler
977e108047 Delete "--version" file if created by "ar --version" [Richard G.]. 2012-06-09 22:59:54 -07:00
Mark Adler
148b8f630c Cleaner check for whether libtool is Apple or not on Darwin. 2012-06-09 22:59:53 -07:00
Mark Adler
a72bcd5607 On Darwin, only use /usr/bin/libtool if libtool is not Apple.
The original change was to always use /usr/bin/libtool on Darwin,
in order to avoid using a GNU libtool installed by the user in the
path ahead of Apple's libtool.  However someone might install a
more recent Apple libtool ahead of /usr/bin/libtool.  This commit
checks to see if libtool is Apple, and uses /usr/bin/libtool if it
isn't.
2012-06-09 19:15:36 -07:00
Mark Adler
f947435b30 Use _snprintf for snprintf under Microsoft C in test/minigzip.c. 2012-06-03 16:28:40 -07:00
Mark Adler
25e4a3da55 Use _snprintf for snprinf in Microsoft C.
More than a decade later, Microsoft C does not support the C99
standard.  It's good that _snprintf has a different name, since it
does not guarantee that the result is null terminated, as does
snprintf.  However where _snprintf is used under Microsoft C, the
destination string is assured to be long enough, so this will not
be a problem.  This occurs in two places, both in gzlib.c.  Where
sprintf functionality is needed by gzprintf, vsnprintf is used in
the case of Microsoft C.
2012-06-03 12:45:55 -07:00
Mark Adler
ee026accde Correct comment in deflate.h. 2012-06-02 10:16:43 -07:00
Mark Adler
dca9e1d6f3 Add inflateGetDictionary() function. 2012-05-26 23:25:35 -07:00
Mark Adler
eb90f6a568 Fix bug in 'F' mode for gzopen(). 2012-05-22 22:31:19 -07:00
Mark Adler
0a2c92bc66 Eliminate use of mktemp in Makefile (not always available). 2012-05-20 11:32:13 -07:00
Mark Adler
6a181356bd Fix gzgetc undefine when Z_PREFIX set [Turk]. 2012-05-17 21:13:23 -07:00
Mark Adler
3a8e3bd9e5 Avoid including stddef.h on Windows for Z_SOLO compile [Niessink]. 2012-05-03 21:23:45 -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
2689b3cceb Change version number to 1.2.7.1. 2012-05-02 22:38:26 -07:00
Mark Adler
30a1c7065d zlib 1.2.7 2012-05-02 21:12:35 -07:00
Mark Adler
1b09651f89 Add instructions to win32/Makefile.gcc for shared install [Torri]. 2012-05-02 20:17:59 -07:00
Mark Adler
dee3d4ae36 Force the native libtool in Mac OS X to avoid GNU libtool [Beebe]. 2012-05-01 21:17:08 -07:00
Daniel Snider
4373bac37e Fix the path to zlib.map in CMakeLists.txt. 2012-04-29 21:20:45 -07:00
Mark Adler
816e34e1b5 Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler]. 2012-04-29 21:15:12 -07:00
Mark Adler
dbcdbf8c41 Fix location of executable for finding a four-byte integer. 2012-04-29 19:20:05 -07:00
Mark Adler
6c9bd474aa Fix type mismatch between get_crc_table() and crc_table.
crc_table is made using a four-byte integer (when that can be
determined).  However get_crc_table() returned a pointer to an
unsigned long, which could be eight bytes.  This fixes that by
creating a new z_crc_t type for the crc_table.

This type is also used for the BYFOUR crc calculations that depend
on a four-byte type.  The four-byte type can now be determined by
./configure, which also solves a problem where ./configure --solo
would never use BYFOUR.  No the Z_U4 #define indicates that four-
byte integer was found either by ./configure or by zconf.h.
2012-04-29 16:18:12 -07:00
Mark Adler
1be1179083 Avoid race condition for parallel make (-j) running example. 2012-04-22 22:58:06 -07:00
Mark Adler
cc538ebf79 Remove -R. from Solaris shared build (possible security issue). 2012-04-22 18:41:11 -07:00
Mark Adler
6635b78987 Update ./configure for Solaris, support --64 [Mooney]. 2012-04-22 18:27:41 -07:00
Mark Adler
3fb77ac08b Add more comments to configure. 2012-04-01 08:49:00 -07:00
jK
ba04838a74 Fix contrib/minizip compilation in the MinGW environment. 2012-03-26 20:17:41 -07:00
Birunthan Mohanathas
11f4065ea9 Remove gzflags from zlibvc.def in vc9 and vc10. 2012-03-22 22:24:52 -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
Peter Kuemmel
2bd5bd78a6 Look in build directory for zlib.pc in CMakeLists.txt. 2012-03-18 12:24:18 -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
Peter Kuemmel
2c42538c2e Add source directory in CMakeLists.txt for building examples. 2012-03-17 21:45:01 -07:00