]> git.ipfire.org Git - thirdparty/zlib-ng.git/log
thirdparty/zlib-ng.git
2 years agoCorrect indents
Piotr Kubaj [Sat, 12 Nov 2022 00:51:22 +0000 (01:51 +0100)] 
Correct indents

2 years agoFix configure script for FreeBSD/powerpc*
Piotr Kubaj [Mon, 3 Oct 2022 23:43:02 +0000 (01:43 +0200)] 
Fix configure script for FreeBSD/powerpc*

2 years agoAdd FreeBSD/powerpc* support to cmake/detect-intrinsics.cmake
Piotr Kubaj [Tue, 27 Sep 2022 22:57:46 +0000 (00:57 +0200)] 
Add FreeBSD/powerpc* support to cmake/detect-intrinsics.cmake

2 years agoFix build on FreeBSD/powerpc*
Piotr Kubaj [Tue, 6 Sep 2022 17:19:15 +0000 (19:19 +0200)] 
Fix build on FreeBSD/powerpc*

Use elf_aux_info() instead of getauxval() on FreeBSD.

2 years agoAllow gtest_zlib to be manually disabled
Cameron Cawley [Thu, 13 Oct 2022 17:52:50 +0000 (18:52 +0100)] 
Allow gtest_zlib to be manually disabled

2 years agoPrefix shared functions to prevent symbol conflict when linking native api against...
Nathan Moinvaziri [Sat, 25 Jun 2022 22:25:22 +0000 (15:25 -0700)] 
Prefix shared functions to prevent symbol conflict when linking native api against compat api.

2 years agoAdd missing symbol name mangling
Dženan Zukić [Thu, 4 Aug 2022 20:55:30 +0000 (16:55 -0400)] 
Add missing symbol name mangling

See https://github.com/InsightSoftwareConsortium/ITK/issues/3530

2 years agoIncrease ghostflow-director max-size for crc32_braid_tbl.h
Dženan Zukić [Thu, 4 Aug 2022 21:47:33 +0000 (17:47 -0400)] 
Increase ghostflow-director max-size for crc32_braid_tbl.h

2 years agoIBM zSystems DFLTCC: Do not update strm.adler for raw streams
Ilya Leoshkevich [Thu, 22 Dec 2022 09:34:57 +0000 (10:34 +0100)] 
IBM zSystems DFLTCC: Do not update strm.adler for raw streams

Commit d38dd9240f2d ("IBM Z DFLTCC: Fix updating strm.adler with
inflate()") broke libxml2, as can be seen with the repro from [1]:

    $ echo "<a></a>" | gzip >file.xml.gz
    $ python3 -c 'import libxml2; libxml2.parseFile("file.xml.gz")'
    file.xml.gz:1: parser error : Document is empty

This is because libxml2 expects strm.adler to be untouched for raw
streams.

Fix this and a similar issue in deflate by adding state->wrap checks.
Add tests.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2155328
[2] https://gitlab.gnome.org/GNOME/libxml2/-/blob/v2.10.3/xzlib.c#L607

2 years agoForce ppc64le to ubuntu 20.04 to prevent illegal instruction.
Nathan Moinvaziri [Tue, 27 Dec 2022 22:42:22 +0000 (14:42 -0800)] 
Force ppc64le to ubuntu 20.04 to prevent illegal instruction.

2 years agoForce sparc64 to ubuntu 20.04 to prevent segfault.
Nathan Moinvaziri [Tue, 27 Dec 2022 22:24:40 +0000 (14:24 -0800)] 
Force sparc64 to ubuntu 20.04 to prevent segfault.

2 years agoFixed MSAN failed to allocate error on Ubuntu 22.
Nathan Moinvaziri [Tue, 27 Dec 2022 23:27:13 +0000 (15:27 -0800)] 
Fixed MSAN failed to allocate error on Ubuntu 22.

https://github.com/llvm/llvm-project/issues/55785

2 years agoUse Clang 11.1.0 sources same as Clang version on Ubuntu 22.
Nathan Moinvaziri [Tue, 27 Dec 2022 23:25:07 +0000 (15:25 -0800)] 
Use Clang 11.1.0 sources same as Clang version on Ubuntu 22.

2 years agoTell scan-build ASSERT_TRUE() behaves like assert().
Mika T. Lindqvist [Thu, 15 Dec 2022 04:51:51 +0000 (06:51 +0200)] 
Tell scan-build ASSERT_TRUE() behaves like assert().

2 years agollvm-cov-11 needs llvm-11 on Ubuntu 22.04.
Mika T. Lindqvist [Sun, 11 Dec 2022 14:26:00 +0000 (16:26 +0200)] 
llvm-cov-11 needs llvm-11 on Ubuntu 22.04.

2 years agoIBM zSystems DFLTCC: Support inflate with small window
Ilya Leoshkevich [Thu, 20 Oct 2022 00:28:47 +0000 (02:28 +0200)] 
IBM zSystems DFLTCC: Support inflate with small window

There is no hardware control for DFLTCC window size, and because of
that supporting small windows for deflate is not trivial: one has to
make sure that DFLTCC does not emit large distances, which most likely
entails somehow trimming the window and/or input in order to make sure
that whave + avail_in <= wsize.

But inflate is much easier: one only has to allocate enough space. Do
that in dfltcc_alloc_window(), and also introduce ZCOPY_WINDOW() in
order to copy everything, not just what the software implementation
cares about.

After this change, software and hardware window formats no longer
match: the software will use wbits and wsize, and the hardware will use
HB_BITS and HB_SIZE. Unlike deflate, inflate does not switch between
software and hardware implementations mid-stream, which leaves only
inflateSetDictionary() and inflateGetDictionary() interesting.

2 years agoAdd CodeQL workflow for GitHub code scanning
LGTM Migrator [Wed, 9 Nov 2022 11:28:47 +0000 (11:28 +0000)] 
Add CodeQL workflow for GitHub code scanning

2 years agoFixed cast to smaller integer type on MSYS2 Clang64.
Nathan Moinvaziri [Sat, 19 Nov 2022 23:03:41 +0000 (15:03 -0800)] 
Fixed cast to smaller integer type on MSYS2 Clang64.

zlib/crc32_braid.c:128:24: error: cast to smaller integer type 'unsigned long'
 from 'const uint8_t *' (aka 'const unsigned char *')

2 years agoUpdate wine32 dependencies for Ubuntu 22.04
Mika T. Lindqvist [Sun, 4 Dec 2022 17:51:12 +0000 (19:51 +0200)] 
Update wine32 dependencies for Ubuntu 22.04

2 years agoUbuntu 22.04 CI image doesn't have clang-11 installed.
Mika T. Lindqvist [Mon, 5 Dec 2022 12:06:09 +0000 (14:06 +0200)] 
Ubuntu 22.04 CI image doesn't have clang-11 installed.

2 years agoUse CMake detection for Emscripten due to a bug in vcpkg.
Ingvar Stepanyan [Fri, 4 Nov 2022 16:31:13 +0000 (16:31 +0000)] 
Use CMake detection for Emscripten due to a bug in vcpkg.

When installing for wasm32 with vcpkg, CMake's try_run does not end up running
with the correct compiler. This issue has been mention in a few existing vcpkg
portfiles.

Alternatively, we could check the VCPKG_TARGET_ARCHITECTURE variable for wasm32
but instead we check for EMSCRIPTEN CMake variable.

2 years agoAll overriding the emulator used by configure script with EMU_RUN.
Nathan Moinvaziri [Mon, 10 Oct 2022 01:41:50 +0000 (18:41 -0700)] 
All overriding the emulator used by configure script with EMU_RUN.

2 years agoUpload generated makefiles when configure runs fail.
Nathan Moinvaziri [Mon, 22 Aug 2022 01:59:45 +0000 (18:59 -0700)] 
Upload generated makefiles when configure runs fail.

2 years agoAdded cmake and configure matrix runs for Emscripten.
Nathan Moinvaziri [Mon, 22 Aug 2022 01:37:14 +0000 (18:37 -0700)] 
Added cmake and configure matrix runs for Emscripten.

2 years agoRemove unused qemu-run variable from configure workflow matrix.
Nathan Moinvaziri [Mon, 22 Aug 2022 00:48:25 +0000 (17:48 -0700)] 
Remove unused qemu-run variable from configure workflow matrix.

The configure script automatically determines this with variable QEMU_ARCH.

2 years agoDon't run deflate concurrency Google Test for Emscripten/WASM32.
Nathan Moinvaziri [Sat, 20 Aug 2022 16:09:55 +0000 (09:09 -0700)] 
Don't run deflate concurrency Google Test for Emscripten/WASM32.

2 years agoTurn off tests for Emscripten that use large amounts of data.
Nathan Moinvaziri [Mon, 22 Aug 2022 02:26:32 +0000 (19:26 -0700)] 
Turn off tests for Emscripten that use large amounts of data.

2 years agoAdd support for compiling to WebAssembly using Emscripten.
Piotr Sikora [Mon, 22 Aug 2022 00:41:54 +0000 (17:41 -0700)] 
Add support for compiling to WebAssembly using Emscripten.

Co-authored-by: Nathan Moinvaziri <nathan@nathanm.com>
3 years agoSupport using aligned_alloc() for memory allocation
Cameron Cawley [Thu, 13 Oct 2022 13:59:18 +0000 (14:59 +0100)] 
Support using aligned_alloc() for memory allocation

3 years agoIntroduce ZLIBNG_ENABLE_TESTS
Ilya Leoshkevich [Tue, 27 Sep 2022 22:50:36 +0000 (00:50 +0200)] 
Introduce ZLIBNG_ENABLE_TESTS

This patch adds the ability to run zlib-ng test suite against the
original zlib as follows:

    cmake -DZLIB_COMPAT=ON -DZLIBNG_ENABLE_TESTS=OFF .
    make
    LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu make test

The benefit of this is that modifications to the original zlib can be
tested with a more extensive zlib-ng's testsuite, and the assumptions
that the zlib-ng tests make can be validated against the original zlib.

In addition to a number of tests that exercise purely zlib-ng specific
API, there are a few that expect zlib-ng specific behavior from the
original zlib API:

- deflate() (obviously) emits different streams
- zlib-ng's deflatePrime() can take more than 16 bits
- zVersion() returns a different string

Adjust or disable the respective tests for ZLIBNG_ENABLE_TESTS=OFF.

3 years agoMakefile.in: distclean should remove zlib.pc instead of clean
tch69 [Thu, 27 Oct 2022 14:42:19 +0000 (21:42 +0700)] 
Makefile.in: distclean should remove zlib.pc instead of clean

3 years agoDetect the availability of _Thread_local using a configure check
Cameron Cawley [Thu, 29 Sep 2022 18:30:31 +0000 (19:30 +0100)] 
Detect the availability of _Thread_local using a configure check

3 years agoEnable and fix -Wimplicit-fallthrough warnings
Cameron Cawley [Thu, 13 Oct 2022 15:07:37 +0000 (16:07 +0100)] 
Enable and fix -Wimplicit-fallthrough warnings

3 years ago[MinGW] Disable GCC warning about using MS format specifiers in ISO C conformant...
Mika Lindqvist [Thu, 13 Oct 2022 15:18:52 +0000 (18:18 +0300)] 
[MinGW] Disable GCC warning about using MS format specifiers in ISO C conformant code

3 years agoFix typo in README.md
Cameron Cawley [Wed, 12 Oct 2022 21:21:21 +0000 (22:21 +0100)] 
Fix typo in README.md

3 years agoFix deflate() with Z_BEST_COMPRESSION ignoring the dictionary
Ilya Leoshkevich [Thu, 20 Oct 2022 04:28:44 +0000 (06:28 +0200)] 
Fix deflate() with Z_BEST_COMPRESSION ignoring the dictionary

deflate_slow() uses s->quick_insert_string(), while
deflateSetDictionary() uses functable.insert_string(). These functions
use different hashing algorithms, which leads to deflate_slow()
ignoring the dictionary.

Fix by using s->insert_string() instead of functable.insert_string(),
which is set by lm_set_level() and matches what deflate_*() uses
(suggested by Mika Lindqvist).

3 years agoImprove Microsoft Visual Studio CI
Vladislav Shchapov [Sun, 2 Oct 2022 11:23:25 +0000 (16:23 +0500)] 
Improve Microsoft Visual Studio CI

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
3 years agoFix crc32_fold_pclmulqdq.c(241): error C2719: 'fold3': formal parameter with requeste...
Vladislav Shchapov [Sun, 2 Oct 2022 13:16:24 +0000 (18:16 +0500)] 
Fix crc32_fold_pclmulqdq.c(241): error C2719: 'fold3': formal parameter with requested alignment of 16 won't be aligned (MSVC 2015 Win32).

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
3 years agoFix missing intrinsics (MSVS 2015, 2017)
Vladislav Shchapov [Tue, 11 Oct 2022 13:12:16 +0000 (18:12 +0500)] 
Fix missing intrinsics (MSVS 2015, 2017)

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
3 years agoFix AVX2 detect
Vladislav Shchapov [Sun, 2 Oct 2022 18:01:52 +0000 (23:01 +0500)] 
Fix AVX2 detect

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
3 years agoFix memcpy() overflow in adler32_fold.c and crc32_fold.c
Mika Lindqvist [Wed, 5 Oct 2022 10:58:28 +0000 (13:58 +0300)] 
Fix memcpy() overflow in adler32_fold.c and crc32_fold.c
* On 32-bit platforms, last parameter of memcpy() is limited to SSIZE_MAX, but is likely to overlap if used

3 years agoFix compiler warnings when ARM_NEON_HASLD4 is undefined
Cameron Cawley [Sat, 1 Oct 2022 15:01:52 +0000 (16:01 +0100)] 
Fix compiler warnings when ARM_NEON_HASLD4 is undefined

3 years agoSimplify feature checks in neon_intrins.h
Cameron Cawley [Thu, 29 Sep 2022 20:45:39 +0000 (21:45 +0100)] 
Simplify feature checks in neon_intrins.h

3 years agoMove the NEON compatibility defines into a separate file
Cameron Cawley [Thu, 29 Sep 2022 18:55:34 +0000 (19:55 +0100)] 
Move the NEON compatibility defines into a separate file

3 years agoUse static inline in x86_features.c
Cameron Cawley [Sun, 25 Sep 2022 20:42:36 +0000 (21:42 +0100)] 
Use static inline in x86_features.c

3 years agoCheck that the OS supports saving the YMM registers before enabling AVX2
Cameron Cawley [Sun, 25 Sep 2022 19:11:14 +0000 (20:11 +0100)] 
Check that the OS supports saving the YMM registers before enabling AVX2

3 years agoUse short decompress option name for gzip compatibility. #1347
Nathan Moinvaziri [Wed, 28 Sep 2022 16:38:06 +0000 (09:38 -0700)] 
Use short decompress option name for gzip compatibility. #1347

Long option names in BusyBoxy is an optional feature, so use short option
names by default.

3 years agoRemove unused tryboth() function
Hans Kristian Rosbach [Sun, 25 Sep 2022 15:59:44 +0000 (17:59 +0200)] 
Remove unused tryboth() function

3 years agovpclmulqdq compilation fails without avx512f also enabled
Hans Kristian Rosbach [Wed, 14 Sep 2022 19:30:43 +0000 (21:30 +0200)] 
vpclmulqdq compilation fails without avx512f also enabled

3 years agoMake visibility tests run the same way as the other tests.
Hans Kristian Rosbach [Wed, 14 Sep 2022 19:29:41 +0000 (21:29 +0200)] 
Make visibility tests run the same way as the other tests.
Fix indentation.

3 years agoDon't try to link gz* objects twice.
Hans Kristian Rosbach [Wed, 14 Sep 2022 19:27:48 +0000 (21:27 +0200)] 
Don't try to link gz* objects twice.

3 years agoRemove errant space in cmake posix specifier
Hans Kristian Rosbach [Wed, 14 Sep 2022 19:26:32 +0000 (21:26 +0200)] 
Remove errant space in cmake posix specifier

3 years agoIBM Z DFLTCC: Fix updating strm.adler with inflate()
Ilya Leoshkevich [Sat, 17 Sep 2022 13:32:29 +0000 (15:32 +0200)] 
IBM Z DFLTCC: Fix updating strm.adler with inflate()

inflate() does not update strm.adler with DFLTCC.
Add a missing assignment to dfltcc_inflate() to fix this.
Note that deflate() is not affected.
Also add a test to prevent regressions.

3 years ago[Compat] Don't use uint32_t for z_crc_t
Mika Lindqvist [Sun, 11 Sep 2022 13:15:10 +0000 (16:15 +0300)] 
[Compat] Don't use uint32_t for z_crc_t
* We don't include stdint.h as it must be included before stdarg.h and other headers might include stdarg.h before us

See #1342

3 years agomsvc/armv7: disable crc32_acle
Shawn Hoffman [Tue, 6 Sep 2022 20:11:16 +0000 (13:11 -0700)] 
msvc/armv7: disable crc32_acle
msvc compiler targeting 32bit arm supports
only armv7 and lacks these intrinsics

3 years agoFixed casting warning from uint64_t to size_t in adler32_copy benchmarks
Nathan Moinvaziri [Sun, 11 Sep 2022 19:36:59 +0000 (15:36 -0400)] 
Fixed casting warning from uint64_t to size_t in adler32_copy benchmarks

3 years agoFixed undefined variable random_ints in adler32_copy benchmarks.
Nathan Moinvaziri [Sun, 11 Sep 2022 19:36:33 +0000 (15:36 -0400)] 
Fixed undefined variable random_ints in adler32_copy benchmarks.

3 years agoPin Google Benchmark to v1.7.0 since master tag has been removed.
Nathan Moinvaziri [Sun, 11 Sep 2022 19:35:24 +0000 (15:35 -0400)] 
Pin Google Benchmark to v1.7.0 since master tag has been removed.

3 years agoInflate: Increase max root table sizes to 10 and 9
Dougall Johnson [Mon, 22 Aug 2022 00:57:39 +0000 (10:57 +1000)] 
Inflate: Increase max root table sizes to 10 and 9

This increases the size of the `codes` array by 1920 bytes (33%), but
improves performance a little. Root table size is still limited by the
maximum code length in use, so tiny files typically see no change to
table-building time, as they don't use longer codes.

3 years agoFix build failure introduced by 8df665005952cdbe7dc995d409ffe4f861e7a83e
Mika Lindqvist [Sun, 11 Sep 2022 15:57:02 +0000 (18:57 +0300)] 
Fix build failure introduced by 8df665005952cdbe7dc995d409ffe4f861e7a83e
* We need absolute path for libz.a

3 years agoFix wine32 dependencies for MinGW i686.
Mika Lindqvist [Mon, 29 Aug 2022 07:50:05 +0000 (10:50 +0300)] 
Fix wine32 dependencies for MinGW i686.
* Downgrade broken libgd3

3 years agoAdd CVE-2022-37434 test.
Vladislav Shchapov [Fri, 19 Aug 2022 11:33:59 +0000 (16:33 +0500)] 
Add CVE-2022-37434 test.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
3 years agoIf the extra field was larger than the space the user provided with
Mika Lindqvist [Fri, 19 Aug 2022 12:00:21 +0000 (15:00 +0300)] 
If the extra field was larger than the space the user provided with
inflateGetHeader(), and if multiple calls of inflate() delivered
the extra header data, then there could be a buffer overflow of the
provided space. This commit assures that provided space is not
exceeded.

See #1323.

3 years agoformat Vcpkg
FrankXie [Fri, 26 Aug 2022 02:19:03 +0000 (19:19 -0700)] 
format Vcpkg

3 years agoformat and add vcpkg headings.
FrankXie [Fri, 26 Aug 2022 02:16:00 +0000 (19:16 -0700)] 
format and add vcpkg headings.

3 years agoAdd vcpkg installation instructions
FrankXie [Thu, 25 Aug 2022 03:02:12 +0000 (20:02 -0700)] 
Add vcpkg installation instructions

3 years agoAdd add_subdirectory test.
Vladislav Shchapov [Wed, 17 Aug 2022 16:06:37 +0000 (21:06 +0500)] 
Add add_subdirectory test.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
3 years agoFix build as subproject.
Vladislav Shchapov [Wed, 17 Aug 2022 13:13:39 +0000 (18:13 +0500)] 
Fix build as subproject.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
3 years agofix ACLE detection on msvc/arm64
Shawn Hoffman [Sun, 24 Jul 2022 04:01:04 +0000 (21:01 -0700)] 
fix ACLE detection on msvc/arm64

3 years agomsvc/arm64: fix narrowing/signed conversion warning in NEON_accum32
Shawn Hoffman [Sun, 24 Jul 2022 04:01:47 +0000 (21:01 -0700)] 
msvc/arm64: fix narrowing/signed conversion warning in NEON_accum32

3 years agoRemove extra compiler names
Long Nguyen [Sat, 13 Aug 2022 03:38:02 +0000 (10:38 +0700)] 
Remove extra compiler names

3 years agoSet `CMAKE_*_COMPILER_TARGET` to full triplet for mingw toolchains
Long Nguyen [Tue, 12 Jul 2022 09:27:52 +0000 (16:27 +0700)] 
Set `CMAKE_*_COMPILER_TARGET` to full triplet for mingw toolchains

3 years agoRemove ZLIB_DUAL_LINK option to simplify dual link tests.
Nathan Moinvaziri [Sat, 20 Aug 2022 16:55:49 +0000 (09:55 -0700)] 
Remove ZLIB_DUAL_LINK option to simplify dual link tests.

3 years agoActually run `configure` CI on macOS with GCC
Mosè Giordano [Wed, 24 Aug 2022 19:39:03 +0000 (20:39 +0100)] 
Actually run `configure` CI on macOS with GCC

`gcc` is an alias for Apple Clang on macOS.  See for example https://github.com/zlib-ng/zlib-ng/runs/7963904948?check_suite_focus=true
```
gcc -O2  -std=c11 -Wall -fPIC -DNDEBUG -DHAVE_POSIX_MEMALIGN -DWITH_GZFILEOP -fno-semantic-interposition -DHAVE_VISIBILITY_HIDDEN -DHAVE_VISIBILITY_INTERNAL -DHAVE_BUILTIN_CTZ -DHAVE_BUILTIN_CTZLL -DX86_FEATURES -DX86_AVX2 -DX86_AVX2_ADLER32 -DX86_AVX_CHUNKSET -DX86_AVX512 -DX86_AVX512_ADLER32 -DX86_MASK_INTRIN -DX86_AVX512VNNI -DX86_AVX512VNNI_ADLER32 -DX86_SSE41 -DX86_SSE42_CRC_HASH -DX86_SSE42_ADLER32 -DX86_SSE42_CRC_INTRIN -DX86_SSE2 -DX86_SSE2_CHUNKSET -DX86_SSSE3 -DX86_SSSE3_ADLER32 -DX86_PCLMULQDQ_CRC -DPIC -I/Users/runner/work/zlib-ng/zlib-ng -c -o adler32.lo /Users/runner/work/zlib-ng/zlib-ng/adler32.c
clang: warning: argument unused during compilation: '-fno-semantic-interposition' [-Wunused-command-line-argument]
```

In order to use the real GCC you have to call `gcc-9`, `gcc-10`, or `gcc-11`: https://github.com/actions/runner-images/blob/06dd4c14e4aa8c14febdd8d6cf123b8d770b4e4a/images/macos/macos-11-Readme.md#language-and-runtime.

3 years agoFixed content already populated error in CMake scripts. #1327
Nathan Moinvaziri [Sun, 21 Aug 2022 17:03:32 +0000 (10:03 -0700)] 
Fixed content already populated error in CMake scripts. #1327

Should only need to use either FetchContent_MakeAvailable or
FetchContent_GetProperties and FetchContent_Populate but not both methods. We
use the later for CMake compatibility with lower versions.

3 years agocmake: respect custom `RC` flags and delete `GCC_WINDRES`
Viktor Szakats [Sun, 17 Jul 2022 19:33:01 +0000 (19:33 +0000)] 
cmake: respect custom `RC` flags and delete `GCC_WINDRES`

Before this patch, `zlib.rc` was compiled using a manual command [1] when
using the MinGW (and MSYS/Cygwin) toolchains. This method ignores
`CMAKE_RC_FLAGS` and offers no other way to pass a custom flag, breaking
the build in cases where a custom `windres` option is required. E.g.
`--target=` or `-I` on some platforms and configuration, in particular
with `llvm-windres`.

This patch deletes the special case for these toolchains and lets CMake
compile the `.rc` file the default way used for all Windows targets.

I'm not entirely sure why this special case was added back in 2011. The
need to pass `-DGCC_WINDRES` is my suspect. We can resolve this much
simpler by adding this line for the targets that require it:
   set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DGCC_WINDRES")

But, the `.rc` line protected by `GCC_WINDRES`, these days work just fine
with `windres`. Moreover, that protected line are oboslete flags from the
16-bit era, which for a long time have no effect, as documented here:
<https://docs.microsoft.com/windows/win32/menurc/common-resource-attributes>

So, this patch deletes `GCC_WINDRES` from the project entirely.

[1] dc5a43e

3 years agoReorganize cmake scripts for tests.
Nathan Moinvaziri [Mon, 4 Jul 2022 18:53:46 +0000 (11:53 -0700)] 
Reorganize cmake scripts for tests.

* Moves cmake scripts for testing into test/cmake.
* Separates out related add_tests into separate cmake scripts.
* Moves building test binaries into CMakeLists.txt in test directory.

3 years agoFix inflateBack to detect invalid input with distances too far.
Mark Adler [Thu, 30 Jun 2022 19:04:27 +0000 (12:04 -0700)] 
Fix inflateBack to detect invalid input with distances too far.

3 years agoDon't use unaligned access for memcpy instructions due to GCC 11 assuming it is align...
Nathan Moinvaziri [Wed, 29 Jun 2022 15:57:11 +0000 (08:57 -0700)] 
Don't use unaligned access for memcpy instructions due to GCC 11 assuming it is aligned in certain instances.

3 years agoTreat arm64 as aarch64 for Apple M1.
Mika Lindqvist [Sat, 9 Jul 2022 09:33:02 +0000 (12:33 +0300)] 
Treat arm64 as aarch64 for Apple M1.

3 years agoFixed functions declared without a prototype warning in tools.
Nathan Moinvaziri [Sat, 2 Jul 2022 20:59:19 +0000 (13:59 -0700)] 
Fixed functions declared without a prototype warning in tools.

  tools/maketrees.c:101:29: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
static void gen_trees_header()

  tools/makecrct.c:65:27: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
static void make_crc_table()

3 years agoDon't use zlib fork identifier in copyright statement.
Nathan Moinvaziri [Thu, 30 Jun 2022 18:23:23 +0000 (11:23 -0700)] 
Don't use zlib fork identifier in copyright statement.

3 years agoUse 15 (0xf) for ZLIB_VER_SUBREVISION to indicate zlib fork.
Nathan Moinvaziri [Thu, 30 Jun 2022 18:23:37 +0000 (11:23 -0700)] 
Use 15 (0xf) for ZLIB_VER_SUBREVISION to indicate zlib fork.

3 years agoSet max time for job to complete to 60 minutes.
Nathan Moinvaziri [Sun, 19 Jun 2022 21:42:57 +0000 (14:42 -0700)] 
Set max time for job to complete to 60 minutes.

3 years agoUse msvc-dev-cmd to set the development environment.
Nathan Moinvaziri [Sun, 19 Jun 2022 20:33:56 +0000 (13:33 -0700)] 
Use msvc-dev-cmd to set the development environment.

3 years agoSplit long workflow commands into separate lines for easier readability.
Nathan Moinvaziri [Fri, 24 Jun 2022 18:22:41 +0000 (11:22 -0700)] 
Split long workflow commands into separate lines for easier readability.

3 years agoAdded whitespace separation between steps in fuzzer workflow.
Nathan Moinvaziri [Sun, 19 Jun 2022 20:19:29 +0000 (13:19 -0700)] 
Added whitespace separation between steps in fuzzer workflow.

3 years agoRemove unused sanitizer options in configure workflow.
Nathan Moinvaziri [Sun, 19 Jun 2022 20:19:11 +0000 (13:19 -0700)] 
Remove unused sanitizer options in configure workflow.

3 years agoUse working-directory property for run actions instead of changing directory.
Nathan Moinvaziri [Sun, 19 Jun 2022 20:19:53 +0000 (13:19 -0700)] 
Use working-directory property for run actions instead of changing directory.

3 years agoCollapse workflow multiline run actions into single line.
Nathan Moinvaziri [Sun, 19 Jun 2022 20:17:02 +0000 (13:17 -0700)] 
Collapse workflow multiline run actions into single line.

3 years agoClean up workflow and job names. Remove CI prefix because it is redundant.
Nathan Moinvaziri [Fri, 24 Jun 2022 14:38:40 +0000 (07:38 -0700)] 
Clean up workflow and job names. Remove CI prefix because it is redundant.

3 years agoUpgrade to actions/checkout@v3.
Nathan Moinvaziri [Sun, 19 Jun 2022 19:44:47 +0000 (12:44 -0700)] 
Upgrade to actions/checkout@v3.

3 years agoFixed conversion warning with level in compress_bound unit tests.
Nathan Moinvaziri [Wed, 29 Jun 2022 16:00:53 +0000 (09:00 -0700)] 
Fixed conversion warning with level in compress_bound unit tests.

  test_compress_bound.cc(43,1): warning C4267: 'argument': conversion from 'size_t' to 'int32_t', possible loss of data

3 years agoUninstall strawberryperl
Ilya Leoshkevich [Mon, 27 Jun 2022 18:16:54 +0000 (20:16 +0200)] 
Uninstall strawberryperl

strawberryperl installs /c/Strawberry/c/bin/libstdc++-6.dll, which is
incompatible with the mingw64 one. zlib-ng does not need perl, so
simply remove it.

3 years agoearly return as requested
Lucy Phipps [Wed, 8 Jun 2022 17:48:19 +0000 (18:48 +0100)] 
early return as requested

3 years agoremove UNROLL_MORE as suggested
Lucinda May Phipps [Tue, 7 Jun 2022 13:59:39 +0000 (14:59 +0100)] 
remove UNROLL_MORE as suggested

3 years agocrc32_acle.c: make logic more consistent
Lucinda May Phipps [Fri, 13 May 2022 07:48:17 +0000 (08:48 +0100)] 
crc32_acle.c: make logic more consistent

3 years agoBump _POSIX_C_SOURCE to 200809 for strdup()
Ilya Leoshkevich [Tue, 28 Jun 2022 08:51:39 +0000 (10:51 +0200)] 
Bump _POSIX_C_SOURCE to 200809 for strdup()

Google Test uses strdup(), which makes building tests fail on a fresh
MSYS2 setup:

In file included from zlib-ng/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h:40,
                 from zlib-ng/_deps/googletest-src/googletest/include/gtest/gtest.h:62,
                 from zlib-ng/test/test_compress.cc:17:
zlib-ng/_deps/googletest-src/googletest/include/gtest/internal/gtest-port.h: In function ‘char* testing::internal::posix::StrDup(const char*)’:
zlib-ng/_deps/googletest-src/googletest/include/gtest/internal/gtest-port.h:2046:47: error: ‘strdup’ was not declared in this scope; did you mean ‘StrDup’?
 2046 | inline char* StrDup(const char* src) { return strdup(src); }
      |                                               ^~~~~~
      |                                               StrDup

Bump _POSIX_C_SOURCE to enable this function. An alternative solution
would be to define _POSIX_C_SOURCE in test/CMakeLists.txt, but having a
bigger value for zlib-ng itself should not hurt.

Include zbuild.h earlier in minideflate.c in order to make the new
setting take effect for this file.

3 years agoImprove the swizzle of the memory magazine fed in a chunk copy for neon
Adam Stylinski [Thu, 2 Jun 2022 22:46:56 +0000 (18:46 -0400)] 
Improve the swizzle of the memory magazine fed in a chunk copy for neon

Like the x86 variant, we can leverage the same tables to load a vector
register worth of values. This shows a vast improvement in places where
very large run length encodes can be found in the lz runs.

3 years agoAdded workflow to test linking zlib and zlib-ng compat against native zlib-ng.
Nathan Moinvaziri [Sun, 19 Jun 2022 15:52:38 +0000 (08:52 -0700)] 
Added workflow to test linking zlib and zlib-ng compat against native zlib-ng.