Commit Graph

48 Commits

Author SHA1 Message Date
Mark Adler
2fa463bacf zlib 1.2.9 2016-12-31 23:37:10 -08:00
Mark Adler
61b91f27f8 Make z_size_t unsigned long for non-standard C.
Also declare z_size_t when compiling solo.
2016-12-31 17:50:39 -08:00
Mark Adler
cca27e95cf Avoid the need for ssize_t.
Limit read() and write() requests to sizes that fit in an int.
This allows storing the return value in an int, and avoiding the
need to use or construct an ssize_t type. This is required for
Microsoft C, whose _read and _write functions take an unsigned
request and return an int.
2016-12-31 10:06:40 -08:00
Mark Adler
f3fcb92cf6 Use intptr_t for z_ssize_t on MSVC. 2016-12-30 23:42:22 -08:00
Mark Adler
50dca6d127 Fix init macros to use z_ prefix when requested. 2016-12-30 20:00:56 -08:00
Mark Adler
3f8c768745 Fix compile option for when z_size_t needs to be a long long. 2016-12-04 17:19:36 -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
001300d0d9 Minor edits to the documentation in source file contents. 2016-12-04 07:48:41 -08: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
bddc968b14 Do not force Z_CONST for C++.
Forcing Z_CONST resulted in an issue when compiling Firefox.  Now
if someone wants to compile zlib as C++ code (which it isn't), now
they will need to #define Z_CONST themselves.
2013-04-28 15:57:11 -07:00
Mark Adler
5d33c62c7d Change check for a four-byte type back to hexadecimal. 2013-04-13 15:54:03 -07: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
0aac8cf7c4 Clean up the addition of gzvprintf. 2013-03-23 23:47:15 -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
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
a2d71e8e66 Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h. 2013-02-24 00:16:24 -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
dca9e1d6f3 Add inflateGetDictionary() function. 2012-05-26 23:25:35 -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
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
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
dbe0bed739 Add gzopen_w() in Windows for wide character path names. 2012-03-16 20:53:09 -07:00
Mark Adler
50a1738fcb Make sure that unistd.h is included before using _LFS64_LARGEFILE. 2012-03-14 10:30:41 -07:00
Mark Adler
b18595d4c6 Repair some damage caused by -Wundef allowance. 2012-03-14 09:18:15 -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
80f3e39eb8 Avoid using __int64 for gcc or solo compilation. 2012-02-20 09:24:30 -08:00
Mark Adler
d63c888039 Use __WATCOMC__ instead of __WATCOM__. 2012-02-18 23:11:49 -08:00
Mark Adler
10fca844b1 Include unistd.h for Watcom C. 2012-02-18 15:37:37 -08:00
Mark Adler
d81e7213b7 Restore gzgetc_ for backward compatibility with 1.2.6. 2012-02-18 14:15:17 -08:00
Mark Adler
455adc3029 Expunge gzgetc_ from configuration files. 2012-02-13 23:34:48 -08:00
Mark Adler
94acb3c1a0 zlib 1.2.6.1 2012-02-12 14:20:33 -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
a8d23bb675 Include gz_header definition when compiling zlib solo. 2012-02-01 23:04:20 -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
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
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
34538d8a93 Include zconf.h.cmakein for windows large file support. 2011-10-01 10:19:36 -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
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
67cc20d004 zlib 1.2.4-pre1 2011-09-09 23:32:36 -07:00