Commit Graph

105 Commits

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