Commit Graph

294 Commits

Author SHA1 Message Date
Mark Adler
c661c374e8 Do not return Z_BUF_ERROR if deflateParam() has nothing to write.
If the compressed data was already at a block boundary, then
deflateParam() would report Z_BUF_ERROR, because there was nothing
to write.  With this patch, Z_OK is returned in that case.
2013-03-24 22:15:04 -07:00
Mark Adler
81c3068b9a In Makefile uninstall, don't rm if preceding cd fails. 2013-03-24 16:57:32 -07:00
Mark Adler
d3b613e320 Minor spacing cleanup in a comment in gzguts.h. 2013-03-24 16:56:05 -07:00
Enrico Weigelt, metux IT service
318a5e190e Add man pages for minizip and miniunzip. 2013-03-24 16:28:41 -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
0aac8cf7c4 Clean up the addition of gzvprintf. 2013-03-23 23:47:15 -07:00
Mark Adler
f0546c8e34 Clean up the addition of inflateGetDictionary. 2013-03-23 23:32:58 -07:00
Mark Adler
03ff48cc67 Remove runtime check in configure for four-byte integer type.
That didn't work when cross-compiling.  Simply rely on limits.h.
If a compiler does not have limits.h, then zconf.h.in should be
modified to define Z_U4 as an unsiged four-byte integer type in
order for crc32() to be fast.

This also simplifies and makes more portable to check for a four-
byte type using limits.h.
2013-03-23 22:30:09 -07:00
Mark Adler
66fcefbb2f Fix configure for Sun shell. 2013-03-23 13:50:10 -07:00
Mark Adler
b06dee4369 Add gzvprintf() as an undocumented function in zlib.
The function is only available if stdarg.h is available.
2013-03-22 18:32:37 -07:00
Mark Adler
dd5d0940e9 Add vc11 and vc12 build files to contrib/vstudio. 2013-03-22 17:38:37 -07:00
Mark Adler
a2d71e8e66 Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h. 2013-02-24 00:16:24 -08:00
Like Ma
bc7e017112 Suport i686 and amd64 assembler builds in CMakeLists.txt.
* Use -DASM686=1 to build with i686 asm.
 * Use -DAMD64=1 to build with amd64 asm.
2013-02-24 00:02:36 -08:00
E. Timothy Uy
64a77facc0 Add TOP support to win32/Makefile.msc.
Facilitate multi-platform compilation, e.g.:
nmake -f pathto\zlib\win32\Makefile.msc TOP=pathto\zlib
2013-02-23 23:47:00 -08:00
Fredrik Orderud
79a7058be4 Simplify contrib/vstudio/vc10 with 'd' suffix. 2013-02-23 23:44:00 -08:00
takacsd
63ba7582b8 Fix types in contrib/minizip to match result of get_crc_table(). 2013-02-23 23:32:30 -08:00
Jason Williams
00dfee0b2e Fix casting error in contrib/testzlib/testzlib.c. 2013-02-23 23:28:45 -08:00
Will Glynn
27b7723222 Don't specify --version-script on Apple platforms in CMakeLists.txt.
Mac OS X's linker (derived from LLVM, not GNU binutils) does not support
--version-script. Don't specify it on this platform.
2013-02-23 23:11:15 -08:00
Will Glynn
bb97bc9d50 Quote --version-script argument in CMakeLists.txt.
Previously, spaces in ${CMAKE_CURRENT_SOURCE_PATH} would expand into
multiple linker arguments.
2013-02-23 23:03:42 -08:00
Greg Domjan
b116fb588d Add contrib/vstudio/vc10 pre-build step for static only.
Also correct typo for 64-bit debug build.
2013-02-23 22:56:32 -08:00
Mark Adler
5afbdabacd Add _tr_flush_bits to the external symbols prefixed by --zprefix. 2013-02-23 20:56:23 -08:00
Mark Adler
d211ecdf02 Use underscored I/O function names for WINAPI_FAMILY.
Suggested by E. Timothy Uy.
2013-02-23 20:27:13 -08:00
Mark Adler
931aa25aea Update inflateBack() comments, since inflate() can be faster. 2013-02-23 20:12:20 -08:00
Mark Adler
51370f3656 Fix serious but very rare decompression bug in inftrees.c.
inftrees.c compared the number of used table entries to the maximum
allowed value using >= instead of >.  This patch fixes those to use
>.  The bug was discovered by Ignat Kolesnichenko of Yandex LC
where they have run petabytes of data through zlib.  Triggering the
bug is apparently very rare, seeing as how it has been out there in
the wild for almost three years before being discovered.  The bug
is instantiated only if the exact maximum number of decoding table
entries, ENOUGH_DISTS or ENOUGH_LENS is used by the block being
decoded, resulting in the false positive of overflowing the table.
2013-02-18 21:47:00 -08:00
Mark Adler
10056909c0 Check for invalid code length codes in contrib/puff.
Without this fix, it would be possible to construct inputs to puff
that would cause it to segfault.
2013-01-21 10:17:45 -08:00
Mark Adler
b6c5057ca1 Fix comparisons of differently signed integers in contrib/blast. 2012-10-24 22:50:23 -07:00
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