Commit Graph

727 Commits

Author SHA1 Message Date
Mika Lindqvist
53204685c0 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.
2017-02-16 11:19:57 +01:00
Hans Kristian Rosbach
bcb013d915 Fix leftover charf 2017-02-15 12:34:51 +01:00
Hans Kristian Rosbach
e22a588783 Merge pull request #85 from mtl1979/cleanup
Cleanup configure and Makefile.in
2017-02-14 07:55:30 +01:00
Mika Lindqvist
28de23397f
quick_send_bits: variable 'code' is not used anymore. 2017-02-13 23:41:30 +02:00
Mika Lindqvist
174ee8972d
Fix build with nmake. 2017-02-13 23:36:20 +02:00
Mika Lindqvist
b65b5c8905 Add --native flag to configure
* When using gcc, it will detect instruction sets available on host CPU
2017-02-13 22:05:53 +01:00
Hans Kristian Rosbach
681a6d6664 Merge branch 'hacknslash6' of github.com:Dead2/zlib-ng into hacknslash6 2017-02-13 21:07:20 +01:00
Hans Kristian Rosbach
1d274d950b Use default osx version for travis build, seems travis has some capacity issues. 2017-02-13 21:02:42 +01:00
Mika Lindqvist
fbfa3e5d44 Makefile.in: Update rule to reset zconf.h.cmakein 2017-02-13 21:01:08 +01:00
Mika Lindqvist
4b24097fe8 Add dependency tracking for ARCH files. 2017-02-13 20:59:32 +01:00
Mika Lindqvist
2db3861bad Cleanup configure and makefiles 2017-02-13 20:59:21 +01:00
Hans Kristian Rosbach
15641f1450 Merge pull request #86 from mtl1979/archclean
Replace remaining Z_NULL instances with NULL.
2017-02-13 20:46:50 +01:00
Hans Kristian Rosbach
c6bc599b14 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.
2017-02-13 20:38:35 +01:00
Hans Kristian Rosbach
fab6deeea5 Restructure travis config and add tests for osx.
Also start doing builds on ubuntu trusty (14.04) instead of precise (12.04).
2017-02-13 20:20:06 +01:00
Hans Kristian Rosbach
25a3298169 Merge pull request #87 from mtl1979/cvefix
Fix so Travis doesn't unnecessarily fail on CVE tests without --zlib-compat.
2017-02-13 20:14:00 +01:00
Mika Lindqvist
f86c1c4195
Fix so Travis doesn't fail on CVE tests without --zlib-compat. 2017-02-13 19:28:32 +02:00
Mika Lindqvist
15ae16292c
Replace remaining Z_NULL instances with NULL. 2017-02-13 18:17:37 +02:00
Hans Kristian Rosbach
f8a8728522 Merge pull request #84 from mtl1979/archclean
Cleanup architure-dependent code
2017-02-13 15:17:40 +01:00
Mika Lindqvist
463834a82e
Move Visual C++ workaround for CTZL to arch/x86. 2017-02-13 13:18:47 +02:00
Mika Lindqvist
5bbf5a6eee
MSVC: Use _tzcnt_u32() if available. 2017-02-13 13:18:47 +02:00
Mika Lindqvist
debd37a1c0
Move instruction set specific crc32 code to arch directories. 2017-02-13 13:18:43 +02:00
Mika Lindqvist
ce6e4db152
CMakeLists.txt: Cleanup. 2017-02-13 13:14:53 +02:00
Mika Lindqvist
f5913691d8
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.
2017-02-13 12:42:03 +02:00
Mika Lindqvist
73005929c9
Require cmake 2.8.4.
* Add duplicate check to add_intrinsics_option().
2017-02-13 12:42:02 +02:00
René J.V. Bertin
0b8418eabf
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.
2017-02-13 12:41:50 +02:00
René J.V. Bertin
82b13dd4bd
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.
2017-02-13 12:41:04 +02:00
René J.V. Bertin
9939d96ddb
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;
2017-02-13 12:41:04 +02:00
René J.V. Bertin
3f3e12e666
architecture checks translated from configure to cmake; initial draft 2017-02-13 12:41:00 +02:00
Phil Vachon
45a5149c6a Initialize block_open state
On deflation context creation, initialize the block_open state to 0 to
ensure that no uninitialized values are used.
2017-02-13 10:16:55 +01:00
Phil Vachon
302d456950 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.
2017-02-13 10:16:51 +01:00
Phil Vachon
fc7aa0a86f 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.
2017-02-13 10:16:46 +01:00
Mark Adler
21bffda72c zlib 1.2.11 2017-02-13 10:16:17 +01:00
Mark Adler
5c01bb54f2 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-02-13 10:12:11 +01:00
Mark Adler
ae98290ecd 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 ...
2017-02-13 10:08:53 +01:00
Mark Adler
01c23ef53a Update vestigial comment from very old Info-ZIP deflate. 2017-02-13 10:08:35 +01:00
Mark Adler
ddb617c886 Fix deflate stored bug when pulling last block from window.
And some cosmetic cleanups.
2017-02-13 10:08:21 +01:00
Hans Kristian Rosbach
8630ff26b9 Remove files to be installed before copying them in Makefile.in.
Based on upstream commit c7d77756d01210790b6d87442eba83dcc586a305
2017-02-13 10:07:29 +01:00
Mark Adler
4135626a9a Fix bug in gzwrite.c that produced corrupt gzip files. 2017-02-09 11:55:44 +01:00
Mark Adler
5317a69f29 Fix bug in deflate_stored() for zero-length input. 2017-02-09 11:54:38 +01:00
Mark Adler
4017599aa0 Minor edits and clarifications of comments. 2017-02-09 11:51:08 +01:00
Mark Adler
61a36de691 Avoid warnings on snprintf() return value. 2017-02-09 11:49:52 +01:00
Mark Adler
2a51c84f6c zlib 1.2.9 2017-02-09 11:39:40 +01:00
Mark Adler
73ba5ea69e Add crc32_z() and adler32_z() functions with size_t lengths. 2017-02-09 11:21:35 +01:00
Mark Adler
cd0071573c Use a uniform approach for the largest value of an unsigned type. 2017-02-07 10:38:47 +01:00
Mark Adler
a7edd5a1a6 Avoid some random compiler warnings on various platforms. 2017-02-07 10:33:09 +01:00
Hans Kristian Rosbach
e65557d2e2 Fix typo from 'Add deflateGetDictionary() function' causing compilation failure. 2017-02-07 10:18:18 +01:00
Mark Adler
2dfd7fb72b Detect clang in cc version. 2017-02-06 14:53:18 +01:00
Hans Kristian Rosbach
9e13c989b2 Add deflateGetDictionary() function.
Per request, but its utility is likely to be very limited. See the
comments in zlib.h.

Based on upstream ee7d7b5dda25c111e61e19ac7b476c26aa6f3020
2017-02-06 14:43:48 +01:00
Mark Adler
ca5fbeb1b8 No need to check for NULL argument to free(). 2017-02-06 14:33:54 +01:00
Mark Adler
23b4bb3ec4 Avoid use of DEBUG macro -- change to ZLIB_DEBUG. 2017-02-06 14:33:22 +01:00