]> git.ipfire.org Git - thirdparty/zlib-ng.git/log
thirdparty/zlib-ng.git
8 years agoCMakeLists.txt: We can't use check_c_source_runs() when cross-compiling. 88/head
Mika Lindqvist [Thu, 28 Apr 2016 18:46:17 +0000 (21:46 +0300)] 
CMakeLists.txt: We can't use check_c_source_runs() when cross-compiling.

8 years agoAdd initial support for ARM NEON vector instructions.
Mika Lindqvist [Sun, 10 Apr 2016 16:59:03 +0000 (19:59 +0300)] 
Add initial support for ARM NEON vector instructions.

8 years agoOptimize fill_window_c.
Mika Lindqvist [Sun, 10 Apr 2016 10:34:53 +0000 (13:34 +0300)] 
Optimize fill_window_c.

8 years agoAdd initial support for AARCH64.
Mika Lindqvist [Tue, 5 Apr 2016 12:28:35 +0000 (15:28 +0300)] 
Add initial support for AARCH64.

8 years agoAdd support for ARM ACLE instructions.
Mika Lindqvist [Sat, 2 Apr 2016 00:11:43 +0000 (03:11 +0300)] 
Add support for ARM ACLE instructions.

8 years agoAdd ARM implementation of CTZL for Visual C++.
Mika Lindqvist [Sun, 30 Oct 2016 12:36:09 +0000 (14:36 +0200)] 
Add ARM implementation of CTZL for Visual C++.

8 years agoInflate using wider loads and stores and a minimum of branches. (#95)
Simon Hosie [Wed, 22 Mar 2017 17:48:39 +0000 (10:48 -0700)] 
Inflate using wider loads and stores and a minimum of branches. (#95)

* Inflate using wider loads and stores.

In inflate_fast() the output pointer always has plenty of room to write.  This
means that so long as the target is capable, wide un-aligned loads and stores
can be used to transfer several bytes at once.

When the reference distance is too short simply unroll the data a little to
increase the distance.

Change-Id: I59854eb25d2b1e43561c8a2afaf9175bf10cf674

8 years agoLet fill_window_c() and fill_window_sse() use insert_string().
Hans Kristian Rosbach [Fri, 17 Mar 2017 11:17:20 +0000 (12:17 +0100)] 
Let fill_window_c() and fill_window_sse() use insert_string().
And let the code assume MIN_MATCH is 3, so a bulk insert can be used.

8 years agodeflate_medium: Make sure we have enough lookahead before trying to scan for matches.
Mika Lindqvist [Fri, 17 Mar 2017 19:36:38 +0000 (21:36 +0200)] 
deflate_medium: Make sure we have enough lookahead before trying to scan for matches.
* longest_match: Abort if match is in future

8 years agodeflate_medium: Remove broken overlap test.
Mika Lindqvist [Sun, 12 Mar 2017 00:52:54 +0000 (02:52 +0200)] 
deflate_medium: Remove broken overlap test.

8 years agoDon't pass unnecessary stream to fold_[1-4] and partial_fold.
Hans Kristian Rosbach [Fri, 24 Mar 2017 11:03:55 +0000 (12:03 +0100)] 
Don't pass unnecessary stream to fold_[1-4] and partial_fold.
Also fix some whitespace to make the code easier to read, and
better match the rest of the zlib-ng codebase.

8 years agoPrevent potential division-by-zero in gzfwrite and gzfread.
Hans Kristian Rosbach [Fri, 24 Mar 2017 13:27:59 +0000 (14:27 +0100)] 
Prevent potential division-by-zero in gzfwrite and gzfread.

8 years agoChange so travis compiles with warnings enabled, when using configure.
Hans Kristian Rosbach [Fri, 24 Mar 2017 13:10:33 +0000 (14:10 +0100)] 
Change so travis compiles with warnings enabled, when using configure.

8 years agoFix typos.
Mika Lindqvist [Mon, 13 Mar 2017 22:10:43 +0000 (00:10 +0200)] 
Fix typos.

8 years agocall memset for read after write dependences at distance 1
Sebastian Pop [Mon, 27 Feb 2017 17:21:59 +0000 (11:21 -0600)] 
call memset for read after write dependences at distance 1

On a benchmark using zlib to decompress a PNG image this change shows a 20%
speedup.  It makes sense to special case distance = 1 of read after write
dependences because it is possible to replace the loop kernel with a memset
which is usually implemented in assembly in the libc, and because of the
frequency at which distance = 1 appears during the PNG decompression:

Distance Frequency
1 1009001
6 64500
9 29000
3 25500
144 14500
12 10000
15 3500
7 2000
24 1000
21 1000
18 1000
87 500
22 500
192 500

8 years agoUpdate readme file, and add install instructions
Hans Kristian Rosbach [Tue, 28 Feb 2017 09:53:01 +0000 (10:53 +0100)] 
Update readme file, and add install instructions

8 years agoCMakeLists.txt: Fix tests on MinGW.
Mika Lindqvist [Fri, 24 Feb 2017 15:18:06 +0000 (17:18 +0200)] 
CMakeLists.txt: Fix tests on MinGW.

8 years agoType cleanup...
Mika Lindqvist [Fri, 17 Feb 2017 07:55:52 +0000 (09:55 +0200)] 
Type cleanup...
* gz_statep -> gz_state *

8 years agoCMakeLists.txt: Fix configuring under OS/X and MinGW
Mika Lindqvist [Wed, 15 Feb 2017 09:32:28 +0000 (11:32 +0200)] 
CMakeLists.txt: Fix configuring under OS/X and MinGW
* Enable CMAKE_MACOSX_RPATH
* Fix detection of PCLMULQDQ
* Fix detection of off64_t

NOTE: If test for __off64_t succeeds, it should mean bug in our tests

8 years agominigzip: add support for deflate_stored.
Mika Lindqvist [Fri, 17 Feb 2017 13:08:47 +0000 (15:08 +0200)] 
minigzip: add support for deflate_stored.

8 years agotest/example.c: Don't mix unsigned long and size_t.
Mika Lindqvist [Fri, 17 Feb 2017 13:01:24 +0000 (15:01 +0200)] 
test/example.c: Don't mix unsigned long and size_t.

8 years agoSome tests were missing EXE suffix.
Mika Lindqvist [Fri, 17 Feb 2017 12:11:22 +0000 (14:11 +0200)] 
Some tests were missing EXE suffix.

8 years agoLet all platforms defining UNALIGNED_OK use the optimized put_short
Hans Kristian Rosbach [Thu, 23 Feb 2017 08:04:48 +0000 (09:04 +0100)] 
Let all platforms defining UNALIGNED_OK use the optimized put_short
implementation. Also change from pre-increment to post-increment to
prevent a double-store on non-x86 platforms.

8 years agoLet all x86 and x86_64 archs use the new UPDATE_HASH implementation,
Hans Kristian Rosbach [Sat, 18 Feb 2017 18:26:52 +0000 (19:26 +0100)] 
Let all x86 and x86_64 archs use the new UPDATE_HASH implementation,
this improves compression performance and can often provide slightly
better compression.

8 years agoFix bug when level 0 used with Z_HUFFMAN or Z_RLE.
Mark Adler [Fri, 28 Oct 2016 05:50:43 +0000 (22:50 -0700)] 
Fix bug when level 0 used with Z_HUFFMAN or Z_RLE.

Compression level 0 requests no compression, using only stored
blocks. When Z_HUFFMAN or Z_RLE was used with level 0 (granted,
an odd choice, but permitted), the resulting blocks were mostly
fixed or dynamic. The reason is that deflate_stored() was not
being called in that case. The compressed data was valid, but it
was not what the application requested. This commit assures that
only stored blocks are emitted for compression level 0, regardless
of the strategy selected.

8 years agoClean up flushing override for level 1 if deflate_quick is enabled but sse4.2 not...
Hans Kristian Rosbach [Thu, 16 Feb 2017 10:43:40 +0000 (11:43 +0100)] 
Clean up flushing override for level 1 if deflate_quick is enabled but sse4.2 not supported.

8 years agoFix 32bit compilation on x86_64 platform
Hans Kristian Rosbach [Tue, 14 Feb 2017 15:05:53 +0000 (16:05 +0100)] 
Fix 32bit compilation on x86_64 platform

8 years agoType cleanup...
Mika Lindqvist [Tue, 14 Feb 2017 20:10:02 +0000 (22:10 +0200)] 
Type cleanup...
* uInt -> unsigned int
* ulg -> unsigned long

8 years agoUse insert_string instead of UPDATE_HASH to avoid double hashing.
Mika Lindqvist [Tue, 14 Feb 2017 07:51:32 +0000 (09:51 +0200)] 
Use insert_string instead of UPDATE_HASH to avoid double hashing.

8 years agoAvoid hashing same memory location twice by truncating overlapping byte ranges,
Mika Lindqvist [Tue, 14 Feb 2017 09:40:52 +0000 (11:40 +0200)] 
Avoid hashing same memory location twice by truncating overlapping byte ranges,
it's speed optimization as the inner code also checks that previous hash value
is not same as new hash value. Essentially those two checks together makes the
compression a little more efficient as it can remember matches further apart.
As far as I remember from my tests, the secondary path was triggered only twice
in very long uncompressed file, but the gain in compression rate was still noticeable.

8 years agoFix leftover charf
Hans Kristian Rosbach [Tue, 14 Feb 2017 11:19:09 +0000 (12:19 +0100)] 
Fix leftover charf

8 years agoMerge pull request #85 from mtl1979/cleanup
Hans Kristian Rosbach [Tue, 14 Feb 2017 06:55:30 +0000 (07:55 +0100)] 
Merge pull request #85 from mtl1979/cleanup

Cleanup configure and Makefile.in

8 years agoquick_send_bits: variable 'code' is not used anymore. 85/head
Mika Lindqvist [Mon, 13 Feb 2017 21:41:30 +0000 (23:41 +0200)] 
quick_send_bits: variable 'code' is not used anymore.

8 years agoFix build with nmake.
Mika Lindqvist [Mon, 13 Feb 2017 19:50:12 +0000 (21:50 +0200)] 
Fix build with nmake.

8 years agoAdd --native flag to configure
Mika Lindqvist [Sat, 30 Apr 2016 23:12:36 +0000 (02:12 +0300)] 
Add --native flag to configure
* When using gcc, it will detect instruction sets available on host CPU

8 years agoMerge branch 'hacknslash6' of github.com:Dead2/zlib-ng into hacknslash6
Hans Kristian Rosbach [Mon, 13 Feb 2017 20:07:20 +0000 (21:07 +0100)] 
Merge branch 'hacknslash6' of github.com:Dead2/zlib-ng into hacknslash6

8 years agoUse default osx version for travis build, seems travis has some capacity issues.
Hans Kristian Rosbach [Mon, 13 Feb 2017 20:02:42 +0000 (21:02 +0100)] 
Use default osx version for travis build, seems travis has some capacity issues.

8 years agoMakefile.in: Update rule to reset zconf.h.cmakein
Mika Lindqvist [Mon, 13 Feb 2017 16:07:39 +0000 (18:07 +0200)] 
Makefile.in: Update rule to reset zconf.h.cmakein

8 years agoAdd dependency tracking for ARCH files.
Mika Lindqvist [Fri, 29 Apr 2016 13:20:11 +0000 (16:20 +0300)] 
Add dependency tracking for ARCH files.

8 years agoCleanup configure and makefiles
Mika Lindqvist [Wed, 3 Jun 2015 00:20:20 +0000 (03:20 +0300)] 
Cleanup configure and makefiles

8 years agoMerge pull request #86 from mtl1979/archclean
Hans Kristian Rosbach [Mon, 13 Feb 2017 19:46:50 +0000 (20:46 +0100)] 
Merge pull request #86 from mtl1979/archclean

Replace remaining Z_NULL instances with NULL.

8 years agoFix only one half of a macro is executed in the correct side of the conditional,
Hans Kristian Rosbach [Mon, 13 Feb 2017 19:38:35 +0000 (20:38 +0100)] 
Fix only one half of a macro is executed in the correct side of the conditional,
causing the potential for hash corruption on calls to deflateParam() to change
level from 0 to something else.

8 years agoRestructure travis config and add tests for osx.
Hans Kristian Rosbach [Mon, 13 Feb 2017 19:20:06 +0000 (20:20 +0100)] 
Restructure travis config and add tests for osx.
Also start doing builds on ubuntu trusty (14.04) instead of precise (12.04).

8 years agoMerge pull request #87 from mtl1979/cvefix
Hans Kristian Rosbach [Mon, 13 Feb 2017 19:14:00 +0000 (20:14 +0100)] 
Merge pull request #87 from mtl1979/cvefix

Fix so Travis doesn't unnecessarily fail on CVE tests without --zlib-compat.

8 years agoFix so Travis doesn't fail on CVE tests without --zlib-compat. 87/head
Mika Lindqvist [Mon, 13 Feb 2017 17:26:09 +0000 (19:26 +0200)] 
Fix so Travis doesn't fail on CVE tests without --zlib-compat.

8 years agoReplace remaining Z_NULL instances with NULL. 86/head
Mika Lindqvist [Mon, 13 Feb 2017 16:17:37 +0000 (18:17 +0200)] 
Replace remaining Z_NULL instances with NULL.

8 years agoMerge pull request #84 from mtl1979/archclean
Hans Kristian Rosbach [Mon, 13 Feb 2017 14:17:40 +0000 (15:17 +0100)] 
Merge pull request #84 from mtl1979/archclean

Cleanup architure-dependent code

8 years agoMove Visual C++ workaround for CTZL to arch/x86. 84/head
Mika Lindqvist [Sun, 30 Oct 2016 12:12:42 +0000 (14:12 +0200)] 
Move Visual C++ workaround for CTZL to arch/x86.

8 years agoMSVC: Use _tzcnt_u32() if available.
Mika Lindqvist [Tue, 3 May 2016 18:03:54 +0000 (21:03 +0300)] 
MSVC: Use _tzcnt_u32() if available.

8 years agoMove instruction set specific crc32 code to arch directories.
Mika Lindqvist [Mon, 4 Apr 2016 14:01:39 +0000 (17:01 +0300)] 
Move instruction set specific crc32 code to arch directories.

8 years agoCMakeLists.txt: Cleanup.
Mika Lindqvist [Mon, 2 May 2016 11:14:01 +0000 (14:14 +0300)] 
CMakeLists.txt: Cleanup.

8 years agoAdd support for internal attribute
Mika Lindqvist [Thu, 28 Apr 2016 19:48:15 +0000 (22:48 +0300)] 
Add support for internal attribute
The advantage of this over hidden is for example that the compiler can
safely assume that pointers to functions declared internal can never be
passed externally. This allows the compiler to consider optimizations
otherwise impossible.

8 years agoRequire cmake 2.8.4.
Mika Lindqvist [Wed, 27 Apr 2016 13:43:55 +0000 (16:43 +0300)] 
Require cmake 2.8.4.
* Add duplicate check to add_intrinsics_option().

8 years agoCMakeLists.txt: use check_c_source_runs instead of check_c_source_compiles
RenĂ© J.V. Bertin [Thu, 11 Jun 2015 20:08:19 +0000 (22:08 +0200)] 
CMakeLists.txt: use check_c_source_runs instead of check_c_source_compiles
to try to avoid using intrinsics and an instruction set the compiler
knows but the host CPU doesn't support.

8 years agoCMakeLists.txt : preliminary support for MSVC and ICC
RenĂ© J.V. Bertin [Fri, 12 Jun 2015 13:13:49 +0000 (15:13 +0200)] 
CMakeLists.txt : preliminary support for MSVC and ICC

- select the CMAKE_BUILD_TYPE "Release" by default if none has been set,
  to ensure maximum generic optimisation possible on the host platform
- add WITH_NATIVE_INSTRUCTIONS to build with -march=native or its equivalent
  option with other compilers (when we identify those alternatives)
- NATIVEFLAG (-march=native) will be used instead of -msseN/-mpclmul when
  defined/requested

TODO: discuss whether -msseN/-mpclmul should be used only for the files that
need them instead of globally, while NATIVEFLAG can (is supposed to) be used
globally.

8 years agoCMakeLists.txt: better checking for Intel intrinsics.
RenĂ© J.V. Bertin [Thu, 11 Jun 2015 17:20:41 +0000 (19:20 +0200)] 
CMakeLists.txt: better checking for Intel intrinsics.

The checks currently assume that instructions that build also execute.
This is not necessarily true: building with -msse4 on an AMD CPU (a C60)
that only has SSE4a leads to a crash in deflateInit2 when the compiler
apparently uses an unsupported instruction to set
s->hash_bits = memLevel + 7;

8 years agoarchitecture checks translated from configure to cmake; initial draft
RenĂ© J.V. Bertin [Tue, 9 Jun 2015 21:59:37 +0000 (23:59 +0200)] 
architecture checks translated from configure to cmake; initial draft

8 years agoInitialize block_open state
Phil Vachon [Mon, 30 Jan 2017 14:32:29 +0000 (15:32 +0100)] 
Initialize block_open state

On deflation context creation, initialize the block_open state to 0 to
ensure that no uninitialized values are used.

8 years agoAdd block_open state for deflate_quick
Phil Vachon [Mon, 30 Jan 2017 14:28:25 +0000 (15:28 +0100)] 
Add block_open state for deflate_quick

By storing whether or not a block has been opened (or terminated), the
static trees used for the block and the end block markers can be emitted
appropriately.

8 years agoFix Partial Symbol Generation for QUICK deflate
Phil Vachon [Mon, 30 Jan 2017 14:20:20 +0000 (15:20 +0100)] 
Fix Partial Symbol Generation for QUICK deflate

When using deflate_quick() in a streaming fashion and the output buffer
runs out of space while the input buffer still has data, deflate_quick()
would emit partial symbols. Force the deflate_quick() loop to terminate
for a flush before any further processing is done, returning to the main
deflate() routine to do its thing.

8 years agozlib 1.2.11
Mark Adler [Sun, 15 Jan 2017 16:22:16 +0000 (08:22 -0800)] 
zlib 1.2.11

8 years agoPermit immediate deflateParams changes before any deflate input.
Mark Adler [Sun, 15 Jan 2017 16:22:16 +0000 (08:22 -0800)] 
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.

8 years agoUpdate high water mark in deflate_stored.
Mark Adler [Sun, 15 Jan 2017 16:15:55 +0000 (08:15 -0800)] 
Update high water mark in deflate_stored.

This avoids unnecessary filling of bytes in the sliding window
buffer when switching from level zero to a non-zero level. This
also provides a consistent indication of deflate having taken
input for a later commit ...

8 years agoUpdate vestigial comment from very old Info-ZIP deflate.
Mark Adler [Sat, 14 Jan 2017 07:10:03 +0000 (23:10 -0800)] 
Update vestigial comment from very old Info-ZIP deflate.

8 years agoFix deflate stored bug when pulling last block from window.
Mark Adler [Fri, 13 Jan 2017 05:51:20 +0000 (21:51 -0800)] 
Fix deflate stored bug when pulling last block from window.

And some cosmetic cleanups.

8 years agoRemove files to be installed before copying them in Makefile.in.
Hans Kristian Rosbach [Mon, 13 Feb 2017 09:07:29 +0000 (10:07 +0100)] 
Remove files to be installed before copying them in Makefile.in.
Based on upstream commit c7d77756d01210790b6d87442eba83dcc586a305

8 years agoFix bug in gzwrite.c that produced corrupt gzip files.
Mark Adler [Tue, 3 Jan 2017 00:17:43 +0000 (16:17 -0800)] 
Fix bug in gzwrite.c that produced corrupt gzip files.

8 years agoFix bug in deflate_stored() for zero-length input.
Mark Adler [Mon, 2 Jan 2017 23:17:59 +0000 (15:17 -0800)] 
Fix bug in deflate_stored() for zero-length input.

8 years agoMinor edits and clarifications of comments.
Mark Adler [Mon, 2 Jan 2017 04:02:24 +0000 (20:02 -0800)] 
Minor edits and clarifications of comments.

8 years agoAvoid warnings on snprintf() return value.
Mark Adler [Sun, 1 Jan 2017 20:23:04 +0000 (12:23 -0800)] 
Avoid warnings on snprintf() return value.

8 years agozlib 1.2.9
Mark Adler [Sat, 31 Dec 2016 19:41:31 +0000 (11:41 -0800)] 
zlib 1.2.9

8 years agoAdd crc32_z() and adler32_z() functions with size_t lengths.
Mark Adler [Sun, 1 Jan 2017 00:57:26 +0000 (16:57 -0800)] 
Add crc32_z() and adler32_z() functions with size_t lengths.

8 years agoUse a uniform approach for the largest value of an unsigned type.
Mark Adler [Sat, 31 Dec 2016 16:49:17 +0000 (08:49 -0800)] 
Use a uniform approach for the largest value of an unsigned type.

8 years agoAvoid some random compiler warnings on various platforms.
Mark Adler [Sat, 31 Dec 2016 06:05:05 +0000 (22:05 -0800)] 
Avoid some random compiler warnings on various platforms.

8 years agoFix typo from 'Add deflateGetDictionary() function' causing compilation failure.
Hans Kristian Rosbach [Tue, 7 Feb 2017 09:18:18 +0000 (10:18 +0100)] 
Fix typo from 'Add deflateGetDictionary() function' causing compilation failure.

8 years agoDetect clang in cc version.
Mark Adler [Sat, 31 Dec 2016 02:58:46 +0000 (18:58 -0800)] 
Detect clang in cc version.

8 years agoAdd deflateGetDictionary() function.
Hans Kristian Rosbach [Mon, 6 Feb 2017 13:40:29 +0000 (14:40 +0100)] 
Add deflateGetDictionary() function.

Per request, but its utility is likely to be very limited. See the
comments in zlib.h.

Based on upstream ee7d7b5dda25c111e61e19ac7b476c26aa6f3020

8 years agoNo need to check for NULL argument to free().
Mark Adler [Fri, 30 Dec 2016 22:30:52 +0000 (14:30 -0800)] 
No need to check for NULL argument to free().

8 years agoAvoid use of DEBUG macro -- change to ZLIB_DEBUG.
Mark Adler [Wed, 29 Jul 2015 05:44:31 +0000 (22:44 -0700)] 
Avoid use of DEBUG macro -- change to ZLIB_DEBUG.

8 years agoAdd gzfwrite(), duplicating the interface of fwrite().
Mark Adler [Mon, 5 Dec 2016 02:29:43 +0000 (18:29 -0800)] 
Add gzfwrite(), duplicating the interface of fwrite().

8 years agoAdd gzfread(), duplicating the interface of fread().
Hans Kristian Rosbach [Mon, 6 Feb 2017 12:41:56 +0000 (13:41 +0100)] 
Add gzfread(), duplicating the interface of fread().

Based on upstream commit 44dfd831d24f9b627ab666cf0973b0dce98fabba

8 years agoDon't need to emit an empty fixed block when changing parameters.
Mark Adler [Sat, 3 Dec 2016 16:29:57 +0000 (08:29 -0800)] 
Don't need to emit an empty fixed block when changing parameters.

gzsetparams() was using Z_PARTIAL_FLUSH when it could use Z_BLOCK
instead. This commit uses Z_BLOCK, which avoids emitting an
unnecessary ten bits into the stream.

8 years agoClean up gz* function return values.
Mark Adler [Sat, 3 Dec 2016 16:18:56 +0000 (08:18 -0800)] 
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.

8 years agoSpeed up deflation for level 0 (storing).
Mark Adler [Sat, 5 Nov 2016 15:43:29 +0000 (08:43 -0700)] 
Speed up deflation for level 0 (storing).

The previous code slid the window and the hash table and copied
every input byte three times in order to just write the data as
stored blocks with no compression. This commit minimizes sliding
and copying, especially for large input and output buffers.

Level 0 compression is now more than 20 times faster than before
the commit.

Most of the speedup is due to deferring hash table slides until
deflateParams() is called to change the compression level away
from 0. More speedup is due to copying directly from next_in to
next_out when the amounts of available input data and output space
permit it, avoiding the intermediate pending buffer. Additionally,
only the last 32K of the used input data is copied back to the
sliding window when large input buffers are provided.

8 years agoAssure that deflateParams() will not switch functions mid-block.
Mark Adler [Wed, 23 Nov 2016 07:29:19 +0000 (23:29 -0800)] 
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.

8 years agoExplicitly ignore a return value in gzwrite.c.
Mark Adler [Tue, 22 Nov 2016 20:02:29 +0000 (12:02 -0800)] 
Explicitly ignore a return value in gzwrite.c.

8 years agoAdd uncompress2() function, which returns the input size used.
Mark Adler [Wed, 16 Nov 2016 03:45:01 +0000 (20:45 -0700)] 
Add uncompress2() function, which returns the input size used.

8 years agoMinor edits to the documentation in source file contents.
Mark Adler [Mon, 14 Nov 2016 17:19:25 +0000 (10:19 -0700)] 
Minor edits to the documentation in source file contents.

8 years agoFix crc corruption when using x86 PCLMULQDQ optimized crc.
Hans Kristian Rosbach [Thu, 2 Feb 2017 10:31:03 +0000 (11:31 +0100)] 
Fix crc corruption when using x86 PCLMULQDQ optimized crc.
We need to use crc_reset() instead of crc32() to do the reset.

8 years agoFix bugs in creating a very large gzip header.
Mark Adler [Sun, 6 Nov 2016 05:55:34 +0000 (22:55 -0700)] 
Fix bugs in creating a very large gzip header.

8 years agoAdd --debug (-d) option to ./configure to define ZLIB_DEBUG.
Mark Adler [Sun, 30 Oct 2016 16:33:25 +0000 (09:33 -0700)] 
Add --debug (-d) option to ./configure to define ZLIB_DEBUG.

8 years agoUse memcpy for stored blocks.
Mark Adler [Sun, 30 Oct 2016 16:25:32 +0000 (09:25 -0700)] 
Use memcpy for stored blocks.

This speeds up level 0 by about a factor of three, as compared to
the previous byte-at-a-time loop. We can do much better though. A
later commit avoids this copy for level 0 with large buffers,
instead copying directly from the input to the output. This commit
still speeds up storing incompressible data found when compressing
normally.

8 years agoFix some typos.
Mark Adler [Sun, 30 Oct 2016 15:36:13 +0000 (08:36 -0700)] 
Fix some typos.

8 years agoMake a noble effort at setting OS_CODE correctly.
Hans Kristian Rosbach [Wed, 1 Feb 2017 11:33:12 +0000 (12:33 +0100)] 
Make a noble effort at setting OS_CODE correctly.

Based on upstream commit ce12c5cd00628bf8f680c98123a369974d32df15

Original patch notes:
This updates the OS_CODE determination at compile time to match as
closely as possible the operating system mappings documented in
the PKWare APPNOTE.TXT version 6.3.4, section 4.4.2.2. That byte
in the gzip header is used by nobody for anything, as far as I can
tell. However we might as well try to set it appropriately.

8 years agoDo a more thorough check of the state for every stream call.
Mark Adler [Tue, 25 Oct 2016 03:11:41 +0000 (20:11 -0700)] 
Do a more thorough check of the state for every stream call.

This verifies that the state has been initialized, that it is the
expected type of state, deflate or inflate, and that at least the
first several bytes of the internal state have not been clobbered.

8 years agoDocument the rejection of 256-byte window requests in zlib.h.
Mark Adler [Mon, 24 Oct 2016 23:00:51 +0000 (16:00 -0700)] 
Document the rejection of 256-byte window requests in zlib.h.

8 years agoReject a window size of 256 bytes if not using the zlib wrapper.
Mark Adler [Mon, 24 Oct 2016 22:52:19 +0000 (15:52 -0700)] 
Reject a window size of 256 bytes if not using the zlib wrapper.

There is a bug in deflate for windowBits == 8 (256-byte window).
As a result, zlib silently changes a request for 8 to a request
for 9 (512-byte window), and sets the zlib header accordingly so
that the decompressor knows to use a 512-byte window. However if
deflateInit2() is used for raw deflate or gzip streams, then there
is no indication that the request was not honored, and the
application might assume that it can use a 256-byte window when
decompressing. This commit returns an error if the user requests
a 256-byte window when using raw deflate or gzip encoding.

8 years agoAvoid obfuscating use of default case in inftrees.c.
Mark Adler [Fri, 14 Oct 2016 20:30:18 +0000 (13:30 -0700)] 
Avoid obfuscating use of default case in inftrees.c.

8 years agoMove macro definition in deflate.c to where it is used.
Mark Adler [Fri, 14 Oct 2016 20:18:58 +0000 (13:18 -0700)] 
Move macro definition in deflate.c to where it is used.

This avoid defining a macro that is never used when not debugging.

8 years agoAvoid recursive gzgetc() macro call.
Mark Adler [Fri, 14 Oct 2016 20:16:07 +0000 (13:16 -0700)] 
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.