Commit Graph

177 Commits

Author SHA1 Message Date
Mark Adler 7096424f23 Clean up type conversions. 2016-10-11 22:15:50 -07:00
Mark Adler 3fb251b363 Remove dummy structure declarations for old buggy compilers.
While woolly mammoths still roamed the Earth and before Atlantis
sunk into the ocean, there were C compilers that could not handle
forward structure references, e.g. "struct name;". zlib dutifully
provided a work-around for such compilers. That work-around is no
longer needed, and, per the recommendation of a security audit of
the zlib code by Trail of Bits and TrustInSoft, in support of the
Mozilla Foundation, should be removed since what a compiler will
do with this is technically undefined. From the report: "there is
no telling what interactions the bug could have in the future with
link-time optimizations and type-based alias analyses, both
features that are present (but not default) in clang."
2016-09-21 20:34:04 -07:00
Mark Adler 9852c209ac Add option to not compute or check check values.
The undocumented (except in these commit comments) function
inflateValidate(strm, check) can be called after an inflateInit(),
inflateInit2(), or inflateReset2() with check equal to zero to
turn off the check value (CRC-32 or Adler-32) computation and
comparison. Calling with check not equal to zero turns checking
back on. This should only be called immediately after the init or
reset function. inflateReset() does not change the state, so a
previous inflateValidate() setting will remain in effect.

This also turns off validation of the gzip header CRC when
present.

This should only be used when a zlib or gzip stream has already
been checked, and repeated decompressions of the same stream no
longer need to be validated.
2016-09-20 18:55:37 -07:00
Mark Adler 44ae761dc2 Clean up portability for shifts and integer sizes. 2015-09-05 18:56:55 -07:00
Mark Adler 43bfaba3d7 Align deflateParams() and its documentation in zlib.h.
This updates the documentation to reflect the behavior of
deflateParams() when it is not able to compress all of the input
data provided so far due to insufficient output space.  It also
assures that data provided is compressed before the parameter
changes, even if at the beginning of the stream.
2015-08-02 00:06:28 -07:00
Mark Adler b4ce6caf09 Compile the gzopen_w() function when __CYGWIN__ defined. 2015-08-01 17:38:56 -07:00
Mark Adler 5701f48cf5 Clarify deflateReset() documentation.
It previously could have been misinterpreted to mean that parameter
changes after deflateInit2() would be reversed, which is not the
case.
2015-07-28 23:19:50 -07:00
Mark Adler 51a223def4 Avoid use of DEBUG macro -- change to ZLIB_DEBUG. 2015-07-28 22:44:31 -07:00
Mark Adler b56d1c62ee Add comment about not using windowBits of 8 for deflate(). 2015-07-28 21:06:06 -07:00
Mark Adler 95698093f0 Improve speed of gzprintf() in transparent mode. 2015-07-05 18:14:53 -07:00
Mark Adler 9cbda797c1 Note in zlib.h that compress() uses Z_DEFAULT_COMPRESSION. 2014-04-26 08:12:37 -07:00
Mark Adler ceeb615f46 Change version number to 1.2.8.1. 2013-05-02 23:12:54 -07:00
Mark Adler 5089329162 zlib 1.2.8 2013-04-28 17:23:49 -07:00
Mark Adler 2dad5389af Correct spelling error in zlib.h. 2013-04-28 15:57:11 -07:00
Mark Adler e8fee0ea7b Change version number to 1.2.8. 2013-04-28 15:57:10 -07:00
Mark Adler b7bc388454 zlib 1.2.7.3 2013-04-13 21:18:35 -07:00
Mark Adler 388a285cb8 Change version number to 1.2.7.3. 2013-04-13 18:58:46 -07:00
Mark Adler 139c67fc87 zlib 1.2.7.2 2013-04-13 18:15:42 -07:00
Mark Adler 8a93f49c86 Change version number to 1.2.7.2. 2013-04-13 08:08:57 -07:00
Mark Adler 0b16609409 zlib 1.2.7.1 2013-03-24 22:47:59 -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 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 931aa25aea Update inflateBack() comments, since inflate() can be faster. 2013-02-23 20:12:20 -08: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 dca9e1d6f3 Add inflateGetDictionary() function. 2012-05-26 23:25:35 -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 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 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 da32fd2892 Improve inflate() documentation on the use of Z_FINISH. 2012-03-14 11:16:22 -07:00
Mark Adler 8dc21b17a6 Allow the use of -Wundef when compiling or using zlib. 2012-03-13 23:19:38 -07: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 d81e7213b7 Restore gzgetc_ for backward compatibility with 1.2.6. 2012-02-18 14:15:17 -08:00
Mark Adler 72e2c8f088 Change version number to 1.2.7. 2012-02-12 16:15:47 -08:00
Mark Adler 94acb3c1a0 zlib 1.2.6.1 2012-02-12 14:20:33 -08:00
Mark Adler 75143f819f Fix minor typo in zlib.h comments [Rześniowiecki]. 2012-02-11 00:31:24 -08:00
Mark Adler 1a4ba8cd91 Remove unnecessary gzgetc_ function. 2012-02-10 23:55:12 -08:00
Mark Adler 55b8b5fec1 Put gzflags() functionality back in zutil.c.
gzflags() was put in gzwrite.c in order to be compiled exactly the
same as gzprintf(), so that it was guaranteed to return the correct
information.  However that causes a static linkage to zlib to bring
in many routines that are often not used.  All that is required to
duplicate the compilation environment of gzprintf() is to include
gzguts.h.  So that is now done in zutil.c to assure that the correct
flags are returned.
2012-02-01 23:25:34 -08:00
Mark Adler 98e5787e1b Fix problem with ./configure --prefix and gzgetc macro. 2012-01-30 23:55:14 -08:00
Mark Adler 7b3f71ba5f Change version number to 1.2.6.1. 2012-01-29 21:15:24 -08:00
Mark Adler e75de023b6 zlib 1.2.6 2012-01-29 10:13:15 -08:00
Mark Adler 0ddfbd2346 Change version number to 1.2.6. 2012-01-16 16:44:29 -08:00
Mark Adler defd366a41 zlib 1.2.5.3 2012-01-15 18:58:21 -08:00
Mark Adler 263b1a05b0 Allow deflatePrime() to insert bits in the middle of a stream.
This allows the insertion of multiple empty static blocks for the
purpose of efficiently bringing a stream to a byte boundary.
2012-01-07 14:03:07 -08:00
Mark Adler 19761b8506 Permit Z_NULL arguments to deflatePending.
This avoids having to create useless variables for return values
that aren't needed.
2011-12-29 00:15:44 -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 df60b50769 Change version numbers to 1.2.5.3. 2011-12-18 12:07:25 -08:00
Mark Adler fe61dfb8a2 zlib 1.2.5.2 2011-12-18 10:39:45 -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 421c7a61f0 Have inflate() with Z_FINISH avoid the allocation of a window.
inflate() avoided that allocation normally, until it was modified to
update the window on a normal completion so that inflateResetKeep()
could work.  This patch restores that behavior, but only when
Z_FINISH is used successfully to complete an inflation of a stream in
a single call of inflate().  The comments in zlib.h have been updated
accordingly.
2011-12-10 22:33:24 -08:00
Mark Adler afe7cf78d5 Enable dictionary setting in middle of stream, and keeping the dictionary.
This patch adds the deflateResetKeep() function to retain the sliding
window for the next deflate operation, and fixes an inflateResetKeep()
problem that came from inflate() not updating the window when the
stream completed.  This enables constructing and decompressing a series
of concatenated deflate streams where each can depend on the history of
uncompressed data that precedes it.

This generalizes deflateSetDictionary() and inflateSetDictionary() to
permit setting the dictionary in the middle of a stream for raw deflate
and inflate.  This in combination with the Keep functions enables a
scheme for updating files block by block with the transmission of
compressed data, where blocks are sent with deflateResetKeep() to
retain history for better compression, and deflateSetDictionary() is
used for blocks already present at the receiver to skip compression but
insert that data in the history, again for better compression.  The
corresponding inflate calls are done on the receiver side.
2011-12-08 00:13:52 -08:00
Mark Adler 6715208bdb Change ON macro to Z_ARG to avoid application conflicts.
Using "ON" was a dumb idea, since it is common to have macros with
names like ON and OFF.  In fact, defining the OF macro back in 1995
was a bad idea, but now we're stuck with it.  Attempts to rename OF
to something else breaks many applications.
2011-11-13 13:35:02 -08:00
Mark Adler e8576790be Note behavior of uncompress() to provide as much data as it can. 2011-10-23 12:25:55 -07:00
Mark Adler 6dbf1d1026 Add comment to gzdopen() in zlib.h to use dup() when using fileno().
A problem surfaced in a multi-threaded application where fileno() was
used to get a file descriptor from an fopen(), which was then fed to
gzdopen().  The problem occurred when the gzclose() followed by the
fclose() tried to close the same file descriptor twice.  If fclose()
were not done, there would be a memory leak.  The only way out is to
dup() the file descriptor so that gzclose() closes the duplicated
file descriptor, and fclose() closes the original file descriptor.
2011-10-20 09:07:58 -07:00
Mark Adler 5ab9f47745 Add #define ZLIB_CONST option to use const in the z_stream interface.
This permits compilers to check for the proper treatment of next_in and
msg in the z_stream structure.  This is an option instead of the default
in order to preserve backward compatibility.  Some applications make use
of the z_stream structure outside of zlib, and perform operations such
as free(strm->next_in), which would not be permitted when next_in is
const.  The #define ZLIB_CONST needs to precede the #include "zlib.h">,
in order to make next_in and msg const pointers in the z_stream type.
2011-10-18 23:05:37 -07:00
Mark Adler 77b47d55f1 Add undocumented inflateResetKeep() function for CAB file decoding.
The Microsoft CAB file format compresses each block with completed
deflate streams that depend on the sliding window history of the
previous block in order to decode.  inflateResetKeep() does what
inflateReset() does, except the sliding window history from the
previous inflate operation is retained.
2011-10-07 23:13:37 -07:00
Mark Adler f442c1e89e Add a ./config --solo option to make zlib subset with no libary use
A common request has been the ability to compile zlib to require no
other libraries.  This --solo option provides that ability.  The price
is that the gz*, compress*, and uncompress functions are eliminated,
and that the user must provide memory allocation and free routines to
deflate and inflate when initializing.
2011-10-07 02:11:56 -07: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 3c9d261809 Correct documentation of gzdirect() since junk at end now ignored. 2011-10-02 12:13:50 -07:00
Mark Adler be959acf80 Clarify how gzopen() appends in zlib.h comments. 2011-10-02 12:09:29 -07:00
Mark Adler 00c836e325 Merge vestigial vsnprintf determination from zutil.h to gzguts.h.
This also moves some of the same from zconf.h to gzguts.h. A new
function, gzflags(), was created to pass the compilation flags
related to vsnprintf usage back to zlibCompileFlags() in zutil.c.
In the process, various compiler configuration files were updated
to include gzflags(), as well as the new gzgetc_() function added
when the gzgetc() macro was introduced in a previous patch.
2011-10-02 11:15:00 -07:00
Mark Adler 8768ba98af Fix gzclose() to return the actual error last encountered. 2011-09-30 22:19:12 -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 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 d6cbbd5c64 Change version numbers to 1.2.5.2 and release dates
Also added "-motley" to ZLIB_VERSION in zlib.h, so that versions
in-between 1.2.5.1 and 1.2.5.2 that are pulled down from github
can be identified as such if bugs are reported on them.
2011-09-11 11:16:41 -07:00
Mark Adler 10daf0d4d7 zlib 1.2.5.1 2011-09-11 11:04:49 -07:00
Mark Adler 9712272c78 zlib 1.2.5 2011-09-09 23:35:10 -07:00
Mark Adler 7301420248 zlib 1.2.4.5 2011-09-09 23:34:55 -07:00
Mark Adler a7d70663cf zlib 1.2.4.4 2011-09-09 23:34:45 -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 a1141160bc zlib 1.2.4 2011-09-09 23:33:59 -07:00
Mark Adler 59ca2179ff zlib 1.2.4-pre2 2011-09-09 23:33:23 -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
Mark Adler f6194ef39a zlib 1.2.3.4 2011-09-09 23:26:40 -07:00
Mark Adler 639be99788 zlib 1.2.3.3 2011-09-09 23:26:29 -07:00
Mark Adler d6231142d2 zlib 1.2.3.2 2011-09-09 23:25:38 -07:00
Mark Adler b1c19ca6d8 zlib 1.2.3.1 2011-09-09 23:25:27 -07:00
Mark Adler abf180a067 zlib 1.2.3 2011-09-09 23:25:17 -07:00
Mark Adler 9c3a583021 zlib 1.2.2.4 2011-09-09 23:24:52 -07:00
Mark Adler 6b8233bfe0 zlib 1.2.2.3 2011-09-09 23:24:43 -07:00
Mark Adler 0484693e17 zlib 1.2.2.2 2011-09-09 23:24:33 -07:00
Mark Adler 9811b53dd9 zlib 1.2.2.1 2011-09-09 23:24:24 -07:00
Mark Adler 79fbcdc939 zlib 1.2.2 2011-09-09 23:24:02 -07:00
Mark Adler 7a6955760b zlib 1.2.1.2 2011-09-09 23:23:45 -07:00
Mark Adler f0e76a6634 zlib 1.2.1.1 2011-09-09 23:23:38 -07:00
Mark Adler 7a33a861d1 zlib 1.2.1 2011-09-09 23:23:27 -07:00
Mark Adler a2506218cd zlib 1.2.0.8 2011-09-09 23:23:14 -07:00
Mark Adler b97ec631c6 zlib 1.2.0.7 2011-09-09 23:23:01 -07:00
Mark Adler f81ba93d4a zlib 1.2.0.6 2011-09-09 23:22:48 -07:00
Mark Adler 4b5a43a219 zlib 1.2.0.5 2011-09-09 23:22:37 -07:00
Mark Adler 086e982175 zlib 1.2.0.4 2011-09-09 23:22:30 -07:00