Commit Graph

154 Commits

Author SHA1 Message Date
Mark Adler f8719f5ae5 Speed up software CRC-32 computation by a factor of 1.5 to 3.
Use the interleaved method of Kadatch and Jenkins in order to make
use of pipelined instructions through multiple ALUs in a single
core. This also speeds up and simplifies the combination of CRCs,
and updates the functions to pre-calculate and use an operator for
CRC combination.
2018-12-26 12:26:52 -08:00
Mark Adler 41d86c73b2 Add crc32_combine_gen() and crc32_combine_op() for fast combines.
When the same len2 is used repeatedly, it is faster to use
crc32_combine_gen() to generate an operator, that is then used to
combine CRCs with crc32_combine_op().
2018-11-04 10:31:46 -08:00
Mark Adler e99813dbfe Correct the initialization requirements for deflateInit2(). 2018-01-31 13:24:12 -08:00
Mark Adler bf88202e31 Emphasize the need to continue decompressing gzip members. 2018-01-08 18:16:05 -08:00
Mark Adler a577351394 Make the names in functions declarations identical to definitions. 2017-10-12 20:03:51 -07:00
Mark Adler f9694097dd Permit a deflateParams() parameter change as soon as possible.
This commit allows a parameter change even if the input data has
not all been compressed and copied to the application output
buffer, so long as all of the input data has been compressed to
the internal pending output buffer. This also allows an immediate
deflateParams change so long as there have been no deflate calls
since initialization or reset.
2017-02-15 22:38:55 -08:00
Mark Adler 5ff989033e Cygwin does not have _wopen(), so do not create gzopen_w() there. 2017-01-16 09:38:36 -08:00
Mark Adler 7d60b86782 Change version number to 1.2.11.1. 2017-01-15 22:46:03 -08:00
Mark Adler cacf7f1d4e zlib 1.2.11 2017-01-15 09:29:40 -08:00
Mark Adler cbbd20302c Permit immediate deflateParams changes before any deflate input.
This permits deflateParams to change the strategy and level right
after deflateInit, without having to wait until a header has been
written. The parameters can be changed immediately up until the
first deflate call that consumes any input data.
2017-01-15 09:29:40 -08:00
Mark Adler 11ceaed751 Change version number to 1.2.10.1. 2017-01-15 09:07:08 -08:00
Mark Adler 4a090adef8 zlib 1.2.10 2017-01-02 18:21:29 -08:00
Mark Adler 52aa5501ec Minor edits and clarifications of comments. 2017-01-01 22:24:37 -08:00
Mark Adler 20e472546e Change version number to zlib 1.2.9.1. 2017-01-01 22:24:17 -08:00
Mark Adler 2fa463bacf zlib 1.2.9 2016-12-31 23:37:10 -08:00
Mark Adler b9ae6f0079 Add crc32_z() and adler32_z() functions with size_t lengths. 2016-12-31 17:50:52 -08:00
Mark Adler 50dca6d127 Fix init macros to use z_ prefix when requested. 2016-12-30 20:00:56 -08:00
Mark Adler ee7d7b5dda Add deflateGetDictionary() function.
Per request, but its utility is likely to be very limited. See the
comments in zlib.h.
2016-12-30 16:29:56 -08:00
Mark Adler 77bc4f8944 Add gzfwrite(), duplicating the interface of fwrite(). 2016-12-04 18:47:34 -08:00
Mark Adler 44dfd831d2 Add gzfread(), duplicating the interface of fread(). 2016-12-04 18:35:41 -08:00
Mark Adler 123f9cfaf7 Clean up gz* function return values.
In some cases the return values did not match the documentation,
or the documentation did not document all of the return values.
gzprintf() now consistently returns negative values on error,
which matches the behavior of the stdio fprintf() function.
2016-12-04 07:48:47 -08:00
Mark Adler 7161ad76e2 Assure that deflateParams() will not switch functions mid-block.
This alters the specification in zlib.h, so that deflateParams()
will not change any parameters if there is not enough output space
in the event that a block is emitted in order to allow switching
the compression function.
2016-12-04 07:48:47 -08:00
Mark Adler 37281ac222 Add uncompress2() function, which returns the input size used. 2016-12-04 07:48:47 -08:00
Mark Adler 001300d0d9 Minor edits to the documentation in source file contents. 2016-12-04 07:48:41 -08:00
Mark Adler 03614c56ad Fix some typos. 2016-10-30 08:49:01 -07:00
Mark Adler 77fd7e56bf Document the rejection of 256-byte window requests in zlib.h. 2016-10-24 16:00:51 -07:00
Mark Adler ebbc57393d Avoid recursive gzgetc() macro call.
Recursive macro calls are normally caught by the preprocessor and
avoided. This commit avoids the possibility of a problem entirely.
2016-10-14 13:16:07 -07:00
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