Apply float abi flag to all files in cmake (same as configure).
Don't override -mfloat-abi if set via -DCMAKE_C_FLAGS in cmake.
Only set -mfloat-abi=softfp if compiler ends in eabi in cmake. (same as configure).
Fixed integer casting and signed comparison warning in test_gzio.
example.c(199,57): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
example.c:207:32: warning: comparison between signed and unsigned integer expressions
Fixed wrong size being used in calloc in test_deflate_set_header.
CID 293478 (#1 of 1): Wrong size argument (SIZEOF_MISMATCH)
suspicious_sizeof: Passing argument 1UL to function calloc that returns a pointer of type zng_gz_header * is suspicious because a multiple of sizeof (zng_gz_header) /*80*/ is expected.
Fixed avail_out == 0 conditional not returning need_more in deflate_quick.
Fixed ending block when returning need_more caused problems with inflate.
So instead of ending the block each time the function returns to finish the last block, we check upon start to see if it is the last block and if the last block has been started, and if not it will close the previous block and start the last block.
Clean up header includes for Win32 and ARM.
Fixed MSVC compiler warning in storechunk for ARM Neon.
Fixed arm_neon.h include for memchunk for ARM Neon.
Matheus Castanho [Mon, 22 Jun 2020 14:02:10 +0000 (11:02 -0300)]
Add POWER8_VSX_SLIDEHASH macro
The slide_hash optimization for POWER currently depends on POWER8 macro
to be enabled. Switch this to use POWER8_VSX_SLIDEHASH instead to better
match the naming scheme used by other archs.
cmake: Use consistent arch names for POWER targets
The arch detection code used by cmake build exports ppc arch names in an
abbreviated way, e.g. ppc64le instead of powerpc64le. Some parts of
CMakeLists.txt are using the longer form instead, which will not
properly match the desired subarch as expected. Switch to using the
longer form everywhere for consistency with 'configure' script and with
arch names obtained when running under QEMU.
Rogerio Alves [Mon, 9 Dec 2019 17:40:53 +0000 (14:40 -0300)]
Adler32 vector optimization for Power.
This commit implements a Power (POWER8+) vector optimization for Adler32
checksum using VSX (vector) instructions. The VSX adler32 checksum is up
to 10x fast than the adler32 baseline code.
Don [Tue, 9 Jun 2020 16:19:06 +0000 (09:19 -0700)]
Determine whether platform supports dll declspec
Clang contains __has_declspec_attribute for MSVC compatibility. This can be
used to determine whether __declspec is available. Use this to determine if
dllimport/dllexport should be used when exporting the zlib API.
Fixed deflate_quick to not emit a block when there is no available input. Pigz requires no blocks to be emitted in certain instances when calling deflate with Z_BLOCK.
Fixed end block not being emitted between calls to deflate_quick causing invalid stored block lengths in certain instances.
Don [Tue, 9 Jun 2020 16:57:05 +0000 (09:57 -0700)]
Remove Borland C++ compiler references
There are a few guards checking for Borland C++ 5.0 or greater which was released
in 1996. While there is still a descendent of this compiler in Embarcadero C++ Builder
its value for __BORLANDC__ is greater than 0x500 so it is safe to remove these guards.
Fixed variable set but not used static analysis warning in example.
example.c:84:14: warning: variable ‘read’ set but not used [-Wunused-but-set-variable]
int err, read;
example.c:198:5: warning: Value stored to 'read' is never read [deadcode.DeadStores]
read = PREFIX(gzfread)(uncompr, uncomprLen, 1, file);
For gzseek, gzoffset, gzopen, adler32_combine, crc32_combine and crc32_combine_gen, export 32-bit and 64-bit versions for zlib-compatible api and only 64-bit version (without 64 suffix) for zlib-ng native api.
Fixed wrong 64-bit casting in deflatePrime potentially causing bits to be lost.
Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2).
Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value.
Results might not be an expected value.
Matheus Castanho [Wed, 27 May 2020 13:06:09 +0000 (10:06 -0300)]
Add optimized slide_hash for POWER processors
This commit introduces a new slide_hash function that
uses VSX vector instructions to slide 8 hash elements at a time,
instead of just one as the standard code does.