Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libnxz for openSUSE:Factory checked in at 2026-04-29 19:20:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libnxz (Old) and /work/SRC/openSUSE:Factory/.libnxz.new.30200 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libnxz" Wed Apr 29 19:20:48 2026 rev:4 rq:1350017 version:0.65 Changes: -------- --- /work/SRC/openSUSE:Factory/libnxz/libnxz.changes 2025-09-29 16:37:13.427001422 +0200 +++ /work/SRC/openSUSE:Factory/.libnxz.new.30200/libnxz.changes 2026-04-29 19:22:37.976848436 +0200 @@ -1,0 +2,20 @@ +Wed Apr 29 14:26:26 UTC 2026 - Antonio Teixeira <[email protected]> + +- Update to version 0.65: + * Set libnxz version to 0.65 and regenerate files + * Add public endpoint tracing capability for better debugging + * Update a few log messages to be more clear. + * nx_inflate.c: Update flush value in stream during inflate calls + * nx_deflate.c: Reset history_len to 0 in deflateResetKeep + * Fix test_abi failure. + * Fix Deflate without fallback + * Fix bugs in deflateInit API. + * Use NX Dictionary for consistency + * Provide deflateParams definition. + * nx_inflate.c: Submit job to nx when flush parameter is not Z_NO_FLUSH [#203] + * Include standard C headers in adler32 and crc32 tests + * Fix the error after a malloc issue in gzopen + * Remove unused macros + * Add support for big endian crc32 #191 + +------------------------------------------------------------------- Old: ---- libnxz-0.64+git4.2f1ae54.tar.xz New: ---- libnxz-0.65.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libnxz.spec ++++++ --- /var/tmp/diff_new_pack.Asa0Yb/_old 2026-04-29 19:22:38.600873978 +0200 +++ /var/tmp/diff_new_pack.Asa0Yb/_new 2026-04-29 19:22:38.600873978 +0200 @@ -1,7 +1,7 @@ # # spec file for package libnxz # -# Copyright (c) 2025 SUSE LLC and contributors +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global soversion 0 %define libname %{name}%{soversion} Name: libnxz -Version: 0.64+git4.2f1ae54 +Version: 0.65 Release: 0 Summary: Zlib implementation for POWER processors License: Apache-2.0 OR GPL-2.0-or-later ++++++ _service ++++++ --- /var/tmp/diff_new_pack.Asa0Yb/_old 2026-04-29 19:22:38.664876598 +0200 +++ /var/tmp/diff_new_pack.Asa0Yb/_new 2026-04-29 19:22:38.672876924 +0200 @@ -2,9 +2,9 @@ <service name="tar_scm" mode="manual"> <param name="scm">git</param> <param name="url">https://github.com/libnxz/power-gzip</param> - <param name="revision">master</param> + <param name="revision">v0.65</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="versionformat">@PARENT_TAG@+git@TAG_OFFSET@.%h</param> + <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="filename">libnxz</param> </service> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.Asa0Yb/_old 2026-04-29 19:22:38.708878399 +0200 +++ /var/tmp/diff_new_pack.Asa0Yb/_new 2026-04-29 19:22:38.720878890 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/libnxz/power-gzip</param> - <param name="changesrevision">2f1ae5450cac8cc5f93941fd099fbe319e55a319</param></service></servicedata> + <param name="changesrevision">bc216bfc6fea97973782c206a4f7defe639f514c</param></service></servicedata> (No newline at EOF) ++++++ libnxz-0.64+git4.2f1ae54.tar.xz -> libnxz-0.65.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/README.md new/libnxz-0.65/README.md --- old/libnxz-0.64+git4.2f1ae54/README.md 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/README.md 2026-04-25 20:28:42.000000000 +0200 @@ -48,6 +48,18 @@ Use `export NX_GZIP_TRACE=8` to enable statistics trace. +Sometimes, reproducing issues requires observing the sequence of public API +calls — especially when libnxz is used via other languages or SDKs such as JDK. + +To enable API entry tracing, build the library with: + +`./configure CFLAGS="-DNX_API_TRACE"` +Then set export NX_GZIP_VERBOSE=2 at runtime to observe the public API +call sequence in the log output. + +Note: NX_API_TRACE is a compile-time flag. Without it, API tracing adds +zero overhead to the library. + ## Supported Functions List All the zlib supported functions are listed and described at libnxz.h. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/configure new/libnxz-0.65/configure --- old/libnxz-0.64+git4.2f1ae54/configure 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/configure 2026-04-25 20:28:42.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libnxz 0.64. +# Generated by GNU Autoconf 2.69 for libnxz 0.65. # # Report bugs to <https://github.com/libnxz/power-gzip>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libnxz' PACKAGE_TARNAME='libnxz' -PACKAGE_VERSION='0.64' -PACKAGE_STRING='libnxz 0.64' +PACKAGE_VERSION='0.65' +PACKAGE_STRING='libnxz 0.65' PACKAGE_BUGREPORT='https://github.com/libnxz/power-gzip' PACKAGE_URL='' @@ -1387,7 +1387,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libnxz 0.64 to adapt to many kinds of systems. +\`configure' configures libnxz 0.65 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1459,7 +1459,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libnxz 0.64:";; + short | recursive ) echo "Configuration of libnxz 0.65:";; esac cat <<\_ACEOF @@ -1590,7 +1590,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libnxz configure 0.64 +libnxz configure 0.65 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2143,7 +2143,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libnxz $as_me 0.64, which was +It was created by libnxz $as_me 0.65, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3155,7 +3155,7 @@ # Define the identity of the package. PACKAGE='libnxz' - VERSION='0.64' + VERSION='0.65' # Some tools Automake needs. @@ -17735,7 +17735,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libnxz $as_me 0.64, which was +This file was extended by libnxz $as_me 0.65, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17801,7 +17801,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libnxz config.status 0.64 +libnxz config.status 0.65 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/configure.ac new/libnxz-0.65/configure.ac --- old/libnxz-0.64+git4.2f1ae54/configure.ac 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/configure.ac 2026-04-25 20:28:42.000000000 +0200 @@ -4,7 +4,7 @@ # The Automake init of 1.10 requires at least autoconf 2.62 AC_PREREQ([2.69]) -AC_INIT([libnxz],[0.64],[https://github.com/libnxz/power-gzip]) +AC_INIT([libnxz],[0.65],[https://github.com/libnxz/power-gzip]) # Update this value for every release: (A:B:C will map to foo.so.(A-C).C.B) # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html LTCURRENT=$(echo "$PACKAGE_VERSION" | cut -d . -f 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/inc_nx/nx_dbg.h new/libnxz-0.65/inc_nx/nx_dbg.h --- old/libnxz-0.64+git4.2f1ae54/inc_nx/nx_dbg.h 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/inc_nx/nx_dbg.h 2026-04-25 20:28:42.000000000 +0200 @@ -112,6 +112,14 @@ prt("### "fmt, ## __VA_ARGS__); \ }} while (0) +/* Trace public API entry points - compile-time conditional for zero overhead */ +#ifdef NX_API_TRACE +#define prt_api_entry(fmt, ...) \ +prt_info(">>> API Entry: %s: " fmt, __func__, ## __VA_ARGS__) +#else +#define prt_api_entry(fmt, ...) +#endif + /** * str_to_num - Convert string into number and copy with endings like * KiB for kilobyte diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/Versions new/libnxz-0.65/lib/Versions --- old/libnxz-0.64+git4.2f1ae54/lib/Versions 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/Versions 2026-04-25 20:28:42.000000000 +0200 @@ -58,6 +58,7 @@ LIBNXZ_0.63.0 { nx_inflateSyncPoint; + nx_deflateParams; } LIBNXZ_0.61.0; LIBNXZ_0.64.0 { @@ -68,6 +69,10 @@ nx_gzwrite; } LIBNXZ_0.63.0; +LIBNXZ_0.65.0 { + # No new public symbols added as of now +} LIBNXZ_0.64.0; + ZLIB_1.2.0 { compressBound; deflateBound; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/crc32_power.c new/libnxz-0.65/lib/crc32_power.c --- old/libnxz-0.64+git4.2f1ae54/lib/crc32_power.c 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/crc32_power.c 2026-04-25 20:28:42.000000000 +0200 @@ -67,6 +67,16 @@ */ #define GROUP_ENDING_NOP __asm__("ori 2,2,0" ::: "memory") +#ifdef __BIG_ENDIAN__ +#define VEC_PERM(vr, va, vb, vc) vr = vec_perm(va, vb,\ + (__vector unsigned char) vc) +static const __vector unsigned long long vperm_const + __attribute__ ((aligned(16))) = { 0x0F0E0D0C0B0A0908UL, + 0X0706050403020100UL }; +#else +#define VEC_PERM(vr, va, vb, vc) +#endif + unsigned int __attribute__ ((aligned (32))) __crc32_vpmsum(unsigned int crc, const void* p, unsigned long len) { @@ -120,6 +130,7 @@ vconst1 = vec_ld(offset, vcrc_short_const); vdata0 = vec_ld(0, (__vector unsigned long long*) p); + VEC_PERM(vdata0, vdata0, vconst1, vperm_const); /* xor initial value */ vdata0 = vec_xor(vdata0, vcrc); @@ -131,6 +142,7 @@ for (i = 16; i < len; i += 16) { vconst1 = vec_ld(offset + i, vcrc_short_const); vdata0 = vec_ld(i, (__vector unsigned long long*) p); + VEC_PERM(vdata0, vdata0, vconst1, vperm_const); vdata0 = (__vector unsigned long long) __builtin_crypto_vpmsumw( (__vector unsigned int)vdata0, (__vector unsigned int)vconst1); v0 = vec_xor(v0, vdata0); @@ -141,15 +153,27 @@ vdata0 = vec_ld(0, (__vector unsigned long long*) p); vdata1 = vec_ld(16, (__vector unsigned long long*) p); + VEC_PERM(vdata0, vdata0, vdata0, vperm_const); + VEC_PERM(vdata1, vdata1, vdata1, vperm_const); + vdata2 = vec_ld(32, (__vector unsigned long long*) p); vdata3 = vec_ld(48, (__vector unsigned long long*) p); + VEC_PERM(vdata2, vdata2, vdata2, vperm_const); + VEC_PERM(vdata3, vdata3, vdata3, vperm_const); + vdata4 = vec_ld(64, (__vector unsigned long long*) p); vdata5 = vec_ld(80, (__vector unsigned long long*) p); + VEC_PERM(vdata4, vdata4, vdata4, vperm_const); + VEC_PERM(vdata5, vdata5, vdata5, vperm_const); + vdata6 = vec_ld(96, (__vector unsigned long long*) p); vdata7 = vec_ld(112, (__vector unsigned long long*) p); + VEC_PERM(vdata6, vdata6, vdata6, vperm_const); + VEC_PERM(vdata7, vdata7, vdata7, vperm_const); + /* xor in initial value */ vdata0 = vec_xor(vdata0, vcrc); @@ -198,20 +222,28 @@ GROUP_ENDING_NOP; vdata0 = vec_ld(0, (__vector unsigned long long*) p); + VEC_PERM(vdata0, vdata0, vdata0, vperm_const); vdata1 = vec_ld(16, (__vector unsigned long long*) p); + VEC_PERM(vdata1, vdata1, vdata1, vperm_const); vdata2 = vec_ld(32, (__vector unsigned long long*) p); + VEC_PERM(vdata2, vdata2, vdata2, vperm_const); vdata3 = vec_ld(48, (__vector unsigned long long*) p); + VEC_PERM(vdata3, vdata3, vdata3, vperm_const); vdata4 = vec_ld(64, (__vector unsigned long long*) p); + VEC_PERM(vdata4, vdata4, vdata4, vperm_const); vdata5 = vec_ld(80, (__vector unsigned long long*) p); + VEC_PERM(vdata5, vdata5, vdata5, vperm_const); vdata6 = vec_ld(96, (__vector unsigned long long*) p); + VEC_PERM(vdata6, vdata6, vdata6, vperm_const); vdata7 = vec_ld(112, (__vector unsigned long long*) p); + VEC_PERM(vdata7, vdata7, vdata7, vperm_const); p = (char *)p + 128; @@ -228,24 +260,28 @@ va0 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata0, (__vector unsigned long long)vconst2); vdata0 = vec_ld(0, (__vector unsigned long long*) p); + VEC_PERM(vdata0, vdata0, vdata0, vperm_const); GROUP_ENDING_NOP; v1 = vec_xor(v1, va1); va1 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata1, (__vector unsigned long long)vconst2); vdata1 = vec_ld(16, (__vector unsigned long long*) p); + VEC_PERM(vdata1, vdata1, vdata1, vperm_const); GROUP_ENDING_NOP; v2 = vec_xor(v2, va2); va2 = __builtin_crypto_vpmsumd((__vector unsigned long long) vdata2, (__vector unsigned long long)vconst2); vdata2 = vec_ld(32, (__vector unsigned long long*) p); + VEC_PERM(vdata2, vdata2, vdata2, vperm_const); GROUP_ENDING_NOP; v3 = vec_xor(v3, va3); va3 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata3, (__vector unsigned long long)vconst2); vdata3 = vec_ld(48, (__vector unsigned long long*) p); + VEC_PERM(vdata3, vdata3, vdata3, vperm_const); vconst2 = vec_ld(offset, vcrc_const); GROUP_ENDING_NOP; @@ -254,24 +290,28 @@ va4 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata4, (__vector unsigned long long)vconst1); vdata4 = vec_ld(64, (__vector unsigned long long*) p); + VEC_PERM(vdata4, vdata4, vdata4, vperm_const); GROUP_ENDING_NOP; v5 = vec_xor(v5, va5); va5 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata5, (__vector unsigned long long)vconst1); vdata5 = vec_ld(80, (__vector unsigned long long*) p); + VEC_PERM(vdata5, vdata5, vdata5, vperm_const); GROUP_ENDING_NOP; v6 = vec_xor(v6, va6); va6 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata6, (__vector unsigned long long)vconst1); vdata6 = vec_ld(96, (__vector unsigned long long*) p); + VEC_PERM(vdata6, vdata6, vdata6, vperm_const); GROUP_ENDING_NOP; v7 = vec_xor(v7, va7); va7 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata7, (__vector unsigned long long)vconst1); vdata7 = vec_ld(112, (__vector unsigned long long*) p); + VEC_PERM(vdata7, vdata7, vdata7, vperm_const); p = (char *)p + 128; } @@ -355,20 +395,28 @@ /* xor with the last 1024 bits. */ va0 = vec_ld(0, (__vector unsigned long long*) p); + VEC_PERM(va0, va0, va0, vperm_const); va1 = vec_ld(16, (__vector unsigned long long*) p); + VEC_PERM(va1, va1, va1, vperm_const); va2 = vec_ld(32, (__vector unsigned long long*) p); + VEC_PERM(va2, va2, va2, vperm_const); va3 = vec_ld(48, (__vector unsigned long long*) p); + VEC_PERM(va3, va3, va3, vperm_const); va4 = vec_ld(64, (__vector unsigned long long*) p); + VEC_PERM(va4, va4, va4, vperm_const); va5 = vec_ld(80, (__vector unsigned long long*) p); + VEC_PERM(va5, va5, va5, vperm_const); va6 = vec_ld(96, (__vector unsigned long long*) p); + VEC_PERM(va6, va6, va6, vperm_const); va7 = vec_ld(112, (__vector unsigned long long*) p); + VEC_PERM(va7, va7, va7, vperm_const); p = (char *)p + 128; @@ -437,6 +485,7 @@ /* Now reduce the tail (0-112 bytes). */ for (i = 0; i < length; i+=16) { vdata0 = vec_ld(i,(__vector unsigned long long*)p); + VEC_PERM(vdata0, vdata0, vdata0, vperm_const); va0 = vec_ld(offset + i,vcrc_short_const); va0 = (__vector unsigned long long)__builtin_crypto_vpmsumw( (__vector unsigned int)vdata0, (__vector unsigned int)va0); @@ -502,6 +551,9 @@ /* shift result into top 64 bits of */ v0 = (__vector unsigned long long)vec_sld((__vector unsigned char)v0, (__vector unsigned char)vzero, 4); - +#ifdef __BIG_ENDIAN__ + return v0[0]; +#else return v0[1]; +#endif } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/crc32_ppc_constants.h new/libnxz-0.65/lib/crc32_ppc_constants.h --- old/libnxz-0.64+git4.2f1ae54/lib/crc32_ppc_constants.h 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/crc32_ppc_constants.h 2026-04-25 20:28:42.000000000 +0200 @@ -1,7 +1,7 @@ /* * * THIS FILE IS GENERATED WITH -./crc32_constants -r -x 0x04C11DB7 +./crc32_constants -r -x 0x04C11DB7 * This is from https://github.com/antonblanchard/crc32-vpmsum/ * DO NOT MODIFY IT MANUALLY! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/nx_crc.c new/libnxz-0.65/lib/nx_crc.c --- old/libnxz-0.64+git4.2f1ae54/lib/nx_crc.c 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/nx_crc.c 2026-04-25 20:28:42.000000000 +0200 @@ -45,8 +45,6 @@ typedef size_t z_size_t; #undef NOBYFOUR -#define ZEXPORT -#define ZEXTERN extern #define ZSWAP32(q) bswap_32(q) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/nx_deflate.c new/libnxz-0.65/lib/nx_deflate.c --- old/libnxz-0.64+git4.2f1ae54/lib/nx_deflate.c 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/nx_deflate.c 2026-04-25 20:28:42.000000000 +0200 @@ -512,6 +512,7 @@ s->used_in = s->used_out = 0; s->cur_in = s->cur_out = 0; + s->history_len = 0; s->tebc = 0; s->is_final = 0; @@ -623,8 +624,13 @@ else wrap = HEADER_ZLIB; prt_info(" windowBits %d wrap %d \n", windowBits, wrap); - if (method != Z_DEFLATED || (strategy != Z_FIXED && strategy != Z_DEFAULT_STRATEGY)) { - prt_err("unsupported zlib method or strategy\n"); + if (method != Z_DEFLATED) { + prt_err("unsupported zlib method. Supported zlib methods: Z_DEFLATED.\n"); + return Z_STREAM_ERROR; + } + if (strategy != Z_FIXED && strategy != Z_DEFAULT_STRATEGY) { + prt_err("unsupported zlib strategy." + " Supported zlib strategies: Z_FIXED, Z_DEFAULT_STRATEGY.\n"); return Z_STREAM_ERROR; } @@ -1328,12 +1334,12 @@ /* When page faults are too many oom_killer * should kill this process. */ rc = LIBNX_ERR_PAGEFLT; - prt_err("Cannot make progress; "); - prt_err("too many page faults!\n"); + prt_err("Cannot make progress; too many page" + " faults cc= %d\n", cc); goto err_exit; } else { - prt_warn("ERR_NX_AT_FAULT: Retry again\n"); + prt_warn("ERR_NX_AT_FAULT: Retry\n"); goto restart; } } @@ -1643,8 +1649,7 @@ return Z_STREAM_ERROR; /* check for sw deflate first */ - if (has_nx_state(strm) && s->switchable - && (0 == use_nx_deflate(strm, flush))) { + if ((has_nx_state(strm)) && s->switchable && (0 == use_nx_deflate(strm,flush) || 0 == s->level)){ /* Use software zlib, switch the sw and hw state */ nx_switch_to_sw(strm); @@ -1691,7 +1696,8 @@ /* User must not provide more input after the first FINISH: */ if (s->status == NX_BFINAL_ST && s->avail_in != 0) { - prt_info("s->status is NX_BFINAL_ST but s->avail_out is not 0\n"); + prt_info("s->status = NX_BFINAL_ST, s->avail_in = %d" + " Non zero s->avail_in value.\n", s->avail_in); return Z_BUF_ERROR; } @@ -1900,6 +1906,34 @@ return Z_STREAM_ERROR; } +int nx_deflateParams(z_streamp strm, int level, int strategy) +{ + int rc = Z_OK; + nx_streamp s; + + + s = (nx_streamp) strm->state; + + if (level == Z_DEFAULT_COMPRESSION) level = 6; + + if (level < 0 || level > 9) + return Z_STREAM_ERROR; + + if (strategy < Z_DEFAULT_STRATEGY || strategy > Z_FIXED) + return Z_STREAM_ERROR; + + if (strategy == Z_FILTERED || strategy == Z_RLE || strategy == Z_HUFFMAN_ONLY) + strategy = Z_DEFAULT_STRATEGY; + + if (level !=0 && s->level != level) + s->level = level; + + s->strategy = strategy; + + return rc; +} + + /* from zlib.h deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or deflateInit2(), and after deflateSetHeader(), if @@ -2247,6 +2281,11 @@ void *sw_state = NULL; nx_streamp s; + prt_api_entry("strm=%p, level=%d, method=%d, windowBits=%d, " + "memLevel=%d, strategy=%d, version=%s, stream_size=%d", + strm, level, method, windowBits, memLevel, strategy, version, stream_size); + print_zstream_info(strm); + /* statistic */ zlib_stats_inc(&zlib_stats.deflateInit); @@ -2310,12 +2349,17 @@ /* TODO: need to free sme and etc.? */ return Z_MEM_ERROR; } - } else if (nx_config.mode.deflate == GZIP_NX) { - rc = nx_deflateInit2_(strm, level, method, windowBits, memLevel, - strategy, version, stream_size); - } else { - rc = sw_deflateInit2_(strm, level, method, windowBits, memLevel, - strategy, version, stream_size); + + }else if(nx_config.mode.deflate == GZIP_NX){ + rc = nx_deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size); + }else{ + rc = sw_deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size); + if (rc != Z_OK) + return rc; + if (strm->state && (0 == has_nx_state(strm))){ + s = (nx_streamp) strm->state; + s->switchable = 1; + } } return rc; @@ -2325,6 +2369,9 @@ { int rc; + prt_api_entry("strm=%p", strm); + print_zstream_info(strm); + if (nx_config.mode.deflate == GZIP_AUTO) { struct stream_map_entry *sme; @@ -2421,6 +2468,9 @@ */ int deflateResetKeep(z_streamp strm) { + prt_api_entry("strm=%p", strm); + print_zstream_info(strm); + if (has_nx_state(strm)) return nx_deflateResetKeep(strm); else @@ -2431,6 +2481,9 @@ { int rc; + prt_api_entry("strm=%p", strm); + print_zstream_info(strm); + /* statistic */ zlib_stats_inc(&zlib_stats.deflateEnd); @@ -2476,6 +2529,9 @@ uint64_t t1=0, t2, t_diff; unsigned int avail_in=0, avail_out=0; + prt_api_entry("strm=%p, flush=%d", strm, flush); + print_zstream_info(strm); + /* statistic */ if (nx_gzip_gather_statistics()) { avail_in = strm->avail_in; @@ -2526,6 +2582,9 @@ { unsigned long rc; + prt_api_entry("strm=%p, sourceLen=%lu", strm, sourceLen); + print_zstream_info(strm); + if (strm == NULL) { return NX_MAX(nx_deflateBound(NULL, sourceLen), sw_deflateBound(NULL, sourceLen)); @@ -2540,10 +2599,35 @@ return rc; } +int deflateParams(z_streamp strm, int level, int strategy) +{ + unsigned long rc; + nx_streamp s; + + prt_api_entry("strm=%p, level=%d, strategy=%d", strm, level, strategy); + print_zstream_info(strm); + + if (strm == Z_NULL) return Z_STREAM_ERROR; + + s = (nx_streamp) strm->state; + if (s == Z_NULL) return Z_STREAM_ERROR; + + if (0 == has_nx_state(strm)){ + rc = sw_deflateParams(strm, level, strategy); + }else{ + rc = nx_deflateParams(strm, level, strategy); + } + + return rc; +} + int deflateSetHeader(z_streamp strm, gz_headerp head) { int rc; + prt_api_entry("strm=%p", strm); + print_zstream_info(strm); + if (0 == has_nx_state(strm)){ rc = sw_deflateSetHeader(strm, head); }else{ @@ -2556,10 +2640,19 @@ int deflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength) { int rc; + nx_streamp s; + + prt_api_entry("strm=%p, dictionary=%p, dictLength=%u", + strm, dictionary, dictLength); + print_zstream_info(strm); + + s = (nx_streamp) strm->state; if (0 == has_nx_state(strm)){ rc = sw_deflateSetDictionary(strm, dictionary, dictLength); }else{ + if (s == Z_NULL) return Z_STREAM_ERROR; + s->switchable = 0; rc = nx_deflateSetDictionary(strm, dictionary, dictLength); } @@ -2570,6 +2663,9 @@ { int rc; + prt_api_entry("dest=%p, source=%p", dest, source); + print_zstream_info(source); + if (0 == has_nx_state(source)){ rc = sw_deflateCopy(dest, source); }else{ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/nx_gzlib.c new/libnxz-0.65/lib/nx_gzlib.c --- old/libnxz-0.64+git4.2f1ae54/lib/nx_gzlib.c 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/nx_gzlib.c 2026-04-25 20:28:42.000000000 +0200 @@ -142,7 +142,7 @@ state = malloc(sizeof(struct gz_state)); if (state == NULL) - return NULL; + return Z_NULL; memset(state, 0, sizeof(struct gz_state)); if (path == NULL){ @@ -192,7 +192,7 @@ if (err == Z_OK) { state->buf = malloc(BUF_LEN); if (state->buf == NULL) { - err=Z_NULL; + err=Z_MEM_ERROR; } } } @@ -200,7 +200,7 @@ free(state); if (err == Z_STREAM_ERROR) errno = EINVAL; - return NULL; + return Z_NULL; } file = (gzFile) state; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/nx_inflate.c new/libnxz-0.65/lib/nx_inflate.c --- old/libnxz-0.64+git4.2f1ae54/lib/nx_inflate.c 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/nx_inflate.c 2026-04-25 20:28:42.000000000 +0200 @@ -284,9 +284,8 @@ if (s == NULL) return Z_STREAM_ERROR; /* check for sw deflate first*/ - if (has_nx_state(strm) && s->switchable - && (0 == use_nx_inflate(strm, flush))) { - /* Use software zlib, switch the sw and hw state */ + if (has_nx_state(strm) && s->switchable && (0 == use_nx_inflate(strm,flush) || 0 == s->level)){ + /*Use software zlib, switch the sw and hw state*/ s = (nx_streamp) strm->state; s->switchable = 0; /* decided to use sw zlib and not switchable */ strm->state = s->sw_stream; /* use sw internal state */ @@ -322,6 +321,9 @@ copy_stream_in(s, s->zstrm); copy_stream_out(s, s->zstrm); + /* update flush status */ + s->flush = flush; + /* Account for progress */ in = s->avail_in; out = s->avail_out; @@ -1188,16 +1190,17 @@ Avoid executing this code when avail_in is 0. That means either the end of the stream or the end of the current request. There is nothing to copy anyway. - Likewise when flush is either Z_FINISH or Z_SYNC_FLUSH. In these - cases, inflate is expected to provide an output and copying data to - fifo_in would just add unnecessary delays. + Cache the input in fifo_in only when flush value is Z_NO_FLUSH. + All other flush modes i.e., Z_SYNC_FLUSH, Z_PARTIAL_FLUSH, Z_FINISH + and Z_FULL_FLUSH require immediate output and therefore must be + submitted to NX and not fifo_in. The following code is not just an optimization, it is also required by NX because it may refuse to start processing a stream if the input is not large enough. */ if (s->avail_in > 0 && (s->avail_in + s->used_in < nx_config.cache_threshold) && s->avail_out > 0 - && flush != Z_FINISH && flush != Z_SYNC_FLUSH) { + && flush == Z_NO_FLUSH) { /* We haven't accumulated enough data. Cache any input data provided and wait for the application to send more in order to reduce the amount of requests sent to the accelerator. */ @@ -1363,7 +1366,7 @@ " faults cc= %d\n", cc); } else { - prt_warn("ERR_NX_AT_FAULT: more retry\n"); + prt_warn("ERR_NX_AT_FAULT: Retry\n"); fc = nx_reset_dde(s); goto init_dde; } @@ -1990,6 +1993,8 @@ void *sw_state = NULL; nx_streamp s; + prt_api_entry("strm=%p, version=%s, stream_size=%d", strm, version, stream_size); + print_zstream_info(strm); /* statistic */ zlib_stats_inc(&zlib_stats.inflateInit); @@ -2057,6 +2062,9 @@ { int rc; + prt_api_entry("strm=%p", strm); + print_zstream_info(strm); + if (nx_config.mode.inflate == GZIP_AUTO) { struct stream_map_entry *sme; @@ -2151,6 +2159,9 @@ */ int inflateResetKeep(z_streamp strm) { + prt_api_entry("strm=%p", strm); + print_zstream_info(strm); + if (has_nx_state(strm)) return nx_inflateResetKeep(strm); else @@ -2161,6 +2172,9 @@ { int rc; + prt_api_entry("strm=%p, windowBits=%d", strm, windowBits); + print_zstream_info(strm); + if (nx_config.mode.inflate == GZIP_AUTO) { struct stream_map_entry *sme; @@ -2222,6 +2236,8 @@ { int rc; + prt_api_entry("strm=%p", strm); + print_zstream_info(strm); /* statistic */ zlib_stats_inc(&zlib_stats.inflateEnd); @@ -2266,6 +2282,9 @@ uint64_t t1=0, t2, t_diff; unsigned int avail_in=0, avail_out=0; + prt_api_entry("strm=%p, flush=%d", strm, flush); + print_zstream_info(strm); + if (strm == NULL || strm->state == NULL) return Z_STREAM_ERROR; /* statistic */ @@ -2316,6 +2335,10 @@ { int rc; + prt_api_entry("strm=%p, dictionary=%p, dictLength=%u", + strm, dictionary, dictLength); + print_zstream_info(strm); + if (0 == has_nx_state(strm)){ rc = sw_inflateSetDictionary(strm, dictionary, dictLength); }else{ @@ -2329,6 +2352,9 @@ { int rc; + prt_api_entry("dest=%p, source=%p", dest, source); + print_zstream_info(source); + if (0 == has_nx_state(source)){ rc = sw_inflateCopy(dest, source); }else{ @@ -2342,6 +2368,9 @@ { int rc; + prt_api_entry("strm=%p, head=%p", strm, head); + print_zstream_info(strm); + if (0 == has_nx_state(strm)){ rc = sw_inflateGetHeader(strm, head); }else{ @@ -2355,6 +2384,9 @@ { int rc; + prt_api_entry("strm=%p", strm); + print_zstream_info(strm); + if (0 == has_nx_state(strm)) rc = sw_inflateSyncPoint(strm); else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/nx_zlib.c new/libnxz-0.65/lib/nx_zlib.c --- old/libnxz-0.64+git4.2f1ae54/lib/nx_zlib.c 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/nx_zlib.c 2026-04-25 20:28:42.000000000 +0200 @@ -731,9 +731,12 @@ } int nx_read_credits(int *total, int *used) { - if (nx_read_sysfs_entry(SYSFS_VAS_CAPS "nr_total_credits", total) || - nx_read_sysfs_entry(SYSFS_VAS_CAPS "nr_used_credits", used)) { - prt_info("Failed to read number of credits from sysfs.\n"); + if (nx_read_sysfs_entry(SYSFS_VAS_CAPS "nr_total_credits", total)) { + prt_err("Failed to read number of total credits from sysfs.\n"); + return -1; + } + if (nx_read_sysfs_entry(SYSFS_VAS_CAPS "nr_used_credits", used)) { + prt_err("Failed to read number of used credits from sysfs.\n"); return -1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/nx_zlib.h new/libnxz-0.65/lib/nx_zlib.h --- old/libnxz-0.64+git4.2f1ae54/lib/nx_zlib.h 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/nx_zlib.h 2026-04-25 20:28:42.000000000 +0200 @@ -524,6 +524,17 @@ (long)(s)->len_in, (long)(s)->len_out, (s)->flush); \ } while (0) +/* Print z_stream state information for API tracing - compile-time conditional for zero overhead */ +#ifdef NX_API_TRACE +#define print_zstream_info(strm) \ +do { if (strm) prt_info(\ +"== %s:%d z_stream: avail_in %u total_in %lu avail_out %u total_out %lu\n", \ +__func__, __LINE__, \ +(strm)->avail_in, (strm)->total_in, (strm)->avail_out, (strm)->total_out);\ +} while (0) +#else +#define print_zstream_info(strm) +#endif /* inflate states */ typedef enum { @@ -661,6 +672,7 @@ extern int nx_deflate(z_streamp strm, int flush); extern int nx_deflateEnd(z_streamp strm); extern unsigned long nx_deflateBound(z_streamp strm, unsigned long sourceLen); +extern int nx_deflateParams(z_streamp strm, int level, int strategy); extern int nx_deflateSetDictionary(z_streamp strm, const unsigned char *dictionary, uint dictLength); extern int nx_deflateReset(z_streamp strm); @@ -712,6 +724,7 @@ extern int sw_deflateResetKeep(z_streamp strm); extern int sw_deflateSetHeader(z_streamp strm, gz_headerp head); extern uLong sw_deflateBound(z_streamp strm, uLong sourceLen); +extern int sw_deflateParams(z_streamp strm, int level, int strategy); extern int sw_deflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength); extern int sw_deflateCopy(z_streamp dest, z_streamp source); extern int sw_uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/lib/sw_zlib.c new/libnxz-0.65/lib/sw_zlib.c --- old/libnxz-0.64+git4.2f1ae54/lib/sw_zlib.c 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/lib/sw_zlib.c 2026-04-25 20:28:42.000000000 +0200 @@ -109,6 +109,13 @@ return (* p_deflateBound)(strm, sourceLen); } +static int (* p_deflateParams)(z_streamp strm, int level, int strategy); +int sw_deflateParams(z_streamp strm, int level, int strategy) +{ + check_sym(p_deflateParams, Z_STREAM_ERROR); + return (* p_deflateParams)(strm, level, strategy); +} + static int (* p_deflateReset)(z_streamp strm); int sw_deflateReset(z_streamp strm) { @@ -297,6 +304,7 @@ register_sym(deflateReset); register_sym(deflateResetKeep); register_sym(deflateBound); + register_sym(deflateParams); register_sym(deflateSetHeader); register_sym(deflate); register_sym(deflateEnd); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/libnxz.h new/libnxz-0.65/libnxz.h --- old/libnxz-0.64+git4.2f1ae54/libnxz.h 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/libnxz.h 2026-04-25 20:28:42.000000000 +0200 @@ -70,6 +70,7 @@ extern int nx_deflate(void *strm, int flush); extern int nx_deflateEnd(void *strm); extern ulong nx_deflateBound(void *strm, ulong sourceLen); +extern int nx_deflateParams(z_streamp strm, int level, int strategy); extern int nx_deflateSetHeader(void *strm, void *head); extern int nx_deflateCopy(void *dest, void *source); extern int nx_deflateReset(void *strm); @@ -125,6 +126,7 @@ extern int deflateEnd(void *strm); extern int deflate(void *strm, int flush); extern ulong deflateBound(void *strm, ulong sourceLen); +extern int deflateParams(void *strm, int level, int strategy); extern int deflateSetHeader(void *strm, void *head); extern int deflateSetDictionary(void *strm, const unsigned char *dictionary, uint dictLength); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/test/Makefile.am new/libnxz-0.65/test/Makefile.am --- old/libnxz-0.64+git4.2f1ae54/test/Makefile.am 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/test/Makefile.am 2026-04-25 20:28:42.000000000 +0200 @@ -15,7 +15,8 @@ test_reset2 \ test_inflatesyncpoint \ test_multithread_stress \ - test_pid_reuse + test_pid_reuse \ + test_jdk_deinflate selector_tests = test_stress test_deflate test_inflate test_dict test_gz other_tests = test_zeroinput @@ -31,10 +32,12 @@ check_SCRIPTS = $(test_scripts) test_adler32_SOURCES = test_adler32.c +test_adler32_CFLAGS = -DSTDC test_buf_error_SOURCES = test_buf_error.c test_utils.c test_crc32_SOURCES = test_crc32.c +test_crc32_CFLAGS = -DSTDC test_deflate_SOURCES = test_deflate.c \ test_utils.c \ @@ -72,6 +75,8 @@ test_gz_SOURCES = test_gz.c test_utils.c +test_jdk_deinflate_SOURCES = test_jdk_deinflate.c + ABIDW_FLAGS = --no-corpus-path --drop-undefined-syms --drop-private-types \ --no-comp-dir-path --no-show-locs --type-id-style hash diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/test/Makefile.in new/libnxz-0.65/test/Makefile.in --- old/libnxz-0.64+git4.2f1ae54/test/Makefile.in 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/test/Makefile.in 2026-04-25 20:28:42.000000000 +0200 @@ -111,11 +111,12 @@ test_crc32$(EXEEXT) test_reset$(EXEEXT) \ test_resetKeep$(EXEEXT) test_reset2$(EXEEXT) \ test_inflatesyncpoint$(EXEEXT) \ - test_multithread_stress$(EXEEXT) test_pid_reuse$(EXEEXT) + test_multithread_stress$(EXEEXT) test_pid_reuse$(EXEEXT) \ + test_jdk_deinflate$(EXEEXT) am__EXEEXT_2 = test_stress$(EXEEXT) test_deflate$(EXEEXT) \ test_inflate$(EXEEXT) test_dict$(EXEEXT) test_gz$(EXEEXT) am__EXEEXT_3 = test_zeroinput$(EXEEXT) -am_test_adler32_OBJECTS = test_adler32.$(OBJEXT) +am_test_adler32_OBJECTS = test_adler32-test_adler32.$(OBJEXT) test_adler32_OBJECTS = $(am_test_adler32_OBJECTS) test_adler32_LDADD = $(LDADD) am__DEPENDENCIES_1 = @@ -124,15 +125,21 @@ am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = +test_adler32_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_adler32_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_test_buf_error_OBJECTS = test_buf_error.$(OBJEXT) \ test_utils.$(OBJEXT) test_buf_error_OBJECTS = $(am_test_buf_error_OBJECTS) test_buf_error_LDADD = $(LDADD) test_buf_error_DEPENDENCIES = ../lib/libnxz.la $(am__DEPENDENCIES_1) -am_test_crc32_OBJECTS = test_crc32.$(OBJEXT) +am_test_crc32_OBJECTS = test_crc32-test_crc32.$(OBJEXT) test_crc32_OBJECTS = $(am_test_crc32_OBJECTS) test_crc32_LDADD = $(LDADD) test_crc32_DEPENDENCIES = ../lib/libnxz.la $(am__DEPENDENCIES_1) +test_crc32_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_crc32_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am__dirstamp = $(am__leading_dot)dirstamp am_test_deflate_OBJECTS = test_deflate.$(OBJEXT) test_utils.$(OBJEXT) \ deflate/0.$(OBJEXT) deflate/compress.$(OBJEXT) \ @@ -160,6 +167,11 @@ test_inflatesyncpoint_LDADD = $(LDADD) test_inflatesyncpoint_DEPENDENCIES = ../lib/libnxz.la \ $(am__DEPENDENCIES_1) +am_test_jdk_deinflate_OBJECTS = test_jdk_deinflate.$(OBJEXT) +test_jdk_deinflate_OBJECTS = $(am_test_jdk_deinflate_OBJECTS) +test_jdk_deinflate_LDADD = $(LDADD) +test_jdk_deinflate_DEPENDENCIES = ../lib/libnxz.la \ + $(am__DEPENDENCIES_1) am_test_multithread_stress_OBJECTS = \ test_multithread_stress.$(OBJEXT) test_utils.$(OBJEXT) test_multithread_stress_OBJECTS = \ @@ -211,11 +223,13 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/test_adler32.Po \ - ./$(DEPDIR)/test_buf_error.Po ./$(DEPDIR)/test_crc32.Po \ +am__depfiles_remade = ./$(DEPDIR)/test_adler32-test_adler32.Po \ + ./$(DEPDIR)/test_buf_error.Po \ + ./$(DEPDIR)/test_crc32-test_crc32.Po \ ./$(DEPDIR)/test_deflate.Po ./$(DEPDIR)/test_dict.Po \ ./$(DEPDIR)/test_gz.Po ./$(DEPDIR)/test_inflate.Po \ ./$(DEPDIR)/test_inflatesyncpoint.Po \ + ./$(DEPDIR)/test_jdk_deinflate.Po \ ./$(DEPDIR)/test_multithread_stress.Po \ ./$(DEPDIR)/test_pid_reuse.Po ./$(DEPDIR)/test_reset.Po \ ./$(DEPDIR)/test_reset2-test_reset.Po \ @@ -251,6 +265,7 @@ $(test_crc32_SOURCES) $(test_deflate_SOURCES) \ $(test_dict_SOURCES) $(test_gz_SOURCES) \ $(test_inflate_SOURCES) $(test_inflatesyncpoint_SOURCES) \ + $(test_jdk_deinflate_SOURCES) \ $(test_multithread_stress_SOURCES) $(test_pid_reuse_SOURCES) \ $(test_reset_SOURCES) $(test_reset2_SOURCES) \ $(test_resetKeep_SOURCES) $(test_stress_SOURCES) \ @@ -259,6 +274,7 @@ $(test_crc32_SOURCES) $(test_deflate_SOURCES) \ $(test_dict_SOURCES) $(test_gz_SOURCES) \ $(test_inflate_SOURCES) $(test_inflatesyncpoint_SOURCES) \ + $(test_jdk_deinflate_SOURCES) \ $(test_multithread_stress_SOURCES) $(test_pid_reuse_SOURCES) \ $(test_reset_SOURCES) $(test_reset2_SOURCES) \ $(test_resetKeep_SOURCES) $(test_stress_SOURCES) \ @@ -707,14 +723,17 @@ test_reset2 \ test_inflatesyncpoint \ test_multithread_stress \ - test_pid_reuse + test_pid_reuse \ + test_jdk_deinflate selector_tests = test_stress test_deflate test_inflate test_dict test_gz other_tests = test_zeroinput check_SCRIPTS = $(test_scripts) test_adler32_SOURCES = test_adler32.c +test_adler32_CFLAGS = -DSTDC test_buf_error_SOURCES = test_buf_error.c test_utils.c test_crc32_SOURCES = test_crc32.c +test_crc32_CFLAGS = -DSTDC test_deflate_SOURCES = test_deflate.c \ test_utils.c \ deflate/0.c \ @@ -742,6 +761,7 @@ test_zeroinput_SOURCES = test_zeroinput.c test_utils.c test_dict_SOURCES = test_dict.c test_utils.c test_gz_SOURCES = test_gz.c test_utils.c +test_jdk_deinflate_SOURCES = test_jdk_deinflate.c ABIDW_FLAGS = --no-corpus-path --drop-undefined-syms --drop-private-types \ --no-comp-dir-path --no-show-locs --type-id-style hash @@ -790,7 +810,7 @@ test_adler32$(EXEEXT): $(test_adler32_OBJECTS) $(test_adler32_DEPENDENCIES) $(EXTRA_test_adler32_DEPENDENCIES) @rm -f test_adler32$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_adler32_OBJECTS) $(test_adler32_LDADD) $(LIBS) + $(AM_V_CCLD)$(test_adler32_LINK) $(test_adler32_OBJECTS) $(test_adler32_LDADD) $(LIBS) test_buf_error$(EXEEXT): $(test_buf_error_OBJECTS) $(test_buf_error_DEPENDENCIES) $(EXTRA_test_buf_error_DEPENDENCIES) @rm -f test_buf_error$(EXEEXT) @@ -798,7 +818,7 @@ test_crc32$(EXEEXT): $(test_crc32_OBJECTS) $(test_crc32_DEPENDENCIES) $(EXTRA_test_crc32_DEPENDENCIES) @rm -f test_crc32$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_crc32_OBJECTS) $(test_crc32_LDADD) $(LIBS) + $(AM_V_CCLD)$(test_crc32_LINK) $(test_crc32_OBJECTS) $(test_crc32_LDADD) $(LIBS) deflate/$(am__dirstamp): @$(MKDIR_P) deflate @: > deflate/$(am__dirstamp) @@ -846,6 +866,10 @@ @rm -f test_inflatesyncpoint$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_inflatesyncpoint_OBJECTS) $(test_inflatesyncpoint_LDADD) $(LIBS) +test_jdk_deinflate$(EXEEXT): $(test_jdk_deinflate_OBJECTS) $(test_jdk_deinflate_DEPENDENCIES) $(EXTRA_test_jdk_deinflate_DEPENDENCIES) + @rm -f test_jdk_deinflate$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_jdk_deinflate_OBJECTS) $(test_jdk_deinflate_LDADD) $(LIBS) + test_multithread_stress$(EXEEXT): $(test_multithread_stress_OBJECTS) $(test_multithread_stress_DEPENDENCIES) $(EXTRA_test_multithread_stress_DEPENDENCIES) @rm -f test_multithread_stress$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_multithread_stress_OBJECTS) $(test_multithread_stress_LDADD) $(LIBS) @@ -882,14 +906,15 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_adler32.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_adler32-test_adler32.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_buf_error.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_crc32.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_crc32-test_crc32.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_deflate.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dict.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gz.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_inflate.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_inflatesyncpoint.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_jdk_deinflate.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_multithread_stress.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pid_reuse.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_reset.Po@am__quote@ # am--include-marker @@ -938,6 +963,34 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +test_adler32-test_adler32.o: test_adler32.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_adler32_CFLAGS) $(CFLAGS) -MT test_adler32-test_adler32.o -MD -MP -MF $(DEPDIR)/test_adler32-test_adler32.Tpo -c -o test_adler32-test_adler32.o `test -f 'test_adler32.c' || echo '$(srcdir)/'`test_adler32.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_adler32-test_adler32.Tpo $(DEPDIR)/test_adler32-test_adler32.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_adler32.c' object='test_adler32-test_adler32.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_adler32_CFLAGS) $(CFLAGS) -c -o test_adler32-test_adler32.o `test -f 'test_adler32.c' || echo '$(srcdir)/'`test_adler32.c + +test_adler32-test_adler32.obj: test_adler32.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_adler32_CFLAGS) $(CFLAGS) -MT test_adler32-test_adler32.obj -MD -MP -MF $(DEPDIR)/test_adler32-test_adler32.Tpo -c -o test_adler32-test_adler32.obj `if test -f 'test_adler32.c'; then $(CYGPATH_W) 'test_adler32.c'; else $(CYGPATH_W) '$(srcdir)/test_adler32.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_adler32-test_adler32.Tpo $(DEPDIR)/test_adler32-test_adler32.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_adler32.c' object='test_adler32-test_adler32.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_adler32_CFLAGS) $(CFLAGS) -c -o test_adler32-test_adler32.obj `if test -f 'test_adler32.c'; then $(CYGPATH_W) 'test_adler32.c'; else $(CYGPATH_W) '$(srcdir)/test_adler32.c'; fi` + +test_crc32-test_crc32.o: test_crc32.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crc32_CFLAGS) $(CFLAGS) -MT test_crc32-test_crc32.o -MD -MP -MF $(DEPDIR)/test_crc32-test_crc32.Tpo -c -o test_crc32-test_crc32.o `test -f 'test_crc32.c' || echo '$(srcdir)/'`test_crc32.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crc32-test_crc32.Tpo $(DEPDIR)/test_crc32-test_crc32.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_crc32.c' object='test_crc32-test_crc32.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crc32_CFLAGS) $(CFLAGS) -c -o test_crc32-test_crc32.o `test -f 'test_crc32.c' || echo '$(srcdir)/'`test_crc32.c + +test_crc32-test_crc32.obj: test_crc32.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crc32_CFLAGS) $(CFLAGS) -MT test_crc32-test_crc32.obj -MD -MP -MF $(DEPDIR)/test_crc32-test_crc32.Tpo -c -o test_crc32-test_crc32.obj `if test -f 'test_crc32.c'; then $(CYGPATH_W) 'test_crc32.c'; else $(CYGPATH_W) '$(srcdir)/test_crc32.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crc32-test_crc32.Tpo $(DEPDIR)/test_crc32-test_crc32.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_crc32.c' object='test_crc32-test_crc32.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crc32_CFLAGS) $(CFLAGS) -c -o test_crc32-test_crc32.obj `if test -f 'test_crc32.c'; then $(CYGPATH_W) 'test_crc32.c'; else $(CYGPATH_W) '$(srcdir)/test_crc32.c'; fi` + test_reset2-test_reset.o: test_reset.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_reset2_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_reset2-test_reset.o -MD -MP -MF $(DEPDIR)/test_reset2-test_reset.Tpo -c -o test_reset2-test_reset.o `test -f 'test_reset.c' || echo '$(srcdir)/'`test_reset.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_reset2-test_reset.Tpo $(DEPDIR)/test_reset2-test_reset.Po @@ -1303,6 +1356,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +test_jdk_deinflate.log: test_jdk_deinflate$(EXEEXT) + @p='test_jdk_deinflate$(EXEEXT)'; \ + b='test_jdk_deinflate'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) test_abi.log: test_abi @p='test_abi'; \ b='test_abi'; \ @@ -1580,14 +1640,15 @@ mostlyclean-am distclean: distclean-recursive - -rm -f ./$(DEPDIR)/test_adler32.Po + -rm -f ./$(DEPDIR)/test_adler32-test_adler32.Po -rm -f ./$(DEPDIR)/test_buf_error.Po - -rm -f ./$(DEPDIR)/test_crc32.Po + -rm -f ./$(DEPDIR)/test_crc32-test_crc32.Po -rm -f ./$(DEPDIR)/test_deflate.Po -rm -f ./$(DEPDIR)/test_dict.Po -rm -f ./$(DEPDIR)/test_gz.Po -rm -f ./$(DEPDIR)/test_inflate.Po -rm -f ./$(DEPDIR)/test_inflatesyncpoint.Po + -rm -f ./$(DEPDIR)/test_jdk_deinflate.Po -rm -f ./$(DEPDIR)/test_multithread_stress.Po -rm -f ./$(DEPDIR)/test_pid_reuse.Po -rm -f ./$(DEPDIR)/test_reset.Po @@ -1650,14 +1711,15 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive - -rm -f ./$(DEPDIR)/test_adler32.Po + -rm -f ./$(DEPDIR)/test_adler32-test_adler32.Po -rm -f ./$(DEPDIR)/test_buf_error.Po - -rm -f ./$(DEPDIR)/test_crc32.Po + -rm -f ./$(DEPDIR)/test_crc32-test_crc32.Po -rm -f ./$(DEPDIR)/test_deflate.Po -rm -f ./$(DEPDIR)/test_dict.Po -rm -f ./$(DEPDIR)/test_gz.Po -rm -f ./$(DEPDIR)/test_inflate.Po -rm -f ./$(DEPDIR)/test_inflatesyncpoint.Po + -rm -f ./$(DEPDIR)/test_jdk_deinflate.Po -rm -f ./$(DEPDIR)/test_multithread_stress.Po -rm -f ./$(DEPDIR)/test_pid_reuse.Po -rm -f ./$(DEPDIR)/test_reset.Po diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/test/test_abi new/libnxz-0.65/test/test_abi --- old/libnxz-0.64+git4.2f1ae54/test/test_abi 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/test/test_abi 2026-04-25 20:28:42.000000000 +0200 @@ -53,4 +53,4 @@ abidiff --suppressions "${zlib_supp}" --no-added-syms ${zlib_abi} ${libnxz} echo "Checking changes on libnxz's ABI..." -abidiff ${libnxz_abi} ${libnxz} +abidiff --no-added-syms ${libnxz_abi} ${libnxz} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/test/test_crc32.c new/libnxz-0.65/test/test_crc32.c --- old/libnxz-0.64+git4.2f1ae54/test/test_crc32.c 2025-07-03 21:27:30.000000000 +0200 +++ new/libnxz-0.65/test/test_crc32.c 2026-04-25 20:28:42.000000000 +0200 @@ -110,6 +110,7 @@ {__LINE__, 0x0, (Byte *) "e$98KNzqaV)Y:2X?]77].{gKRD4G5{mHZk,Z)SpU%L3FSgv!Wb8MLAFdi{+fp)c,@8m6v)yXg@]HBDFk?.4&}g5_udE*JHCiH=aL", 100, 0xe7c71db9}, {__LINE__, 0x0, (Byte *) "r*Fd}ef+5RJQ;+W=4jTR9)R*p!B;]Ed7tkrLi;88U7g@3v!5pk2X6D)vt,.@N8c]@yyEcKi[[email protected]@C6%Mv*3Nw}Y,58_aH)", 100, 0xeaa52777}, {__LINE__, 0x0, (Byte *) "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 100, 0xcd472048}, + {__LINE__, 0x0, (Byte *) "I#>l&}XD^0|ff2aID$.(N`a[qIZEym'X_d)-b&#p`?{@*s%F;k+%r?t(Q:4wGsdrFPC'YoEcPG-j6Bca<YQ%0Gr;+CWU2}KyAg9JEjNmV~(kFz#$2tn?l@?qN!~pS7B;t.9[v}H3Nlq:5B_`k%=@_Y?(Rn;aC<kN:bej|#?podn9S0R}LRu%MNCtVBF27YoC/>QrFyA/3IeUT*wjsc<{D92U.|uZKHEhfL9W1+DqlbPo]V6pH.G(?OUc!l&ZV&?hwk0{Lr),ZJ}7tsr=[d-L{Z5U^q1`F~F^OFt.J5HB-f$DYZKF='#_+*t6z(t:7]}D![ERhD[{tTnmZP9HxF)6P$HWqrom;3()vX(*~sI?&LL_833t-:m0x787z)+bC:qRPcF~)}cu%O&hO4=h_=}'J[U|5LyO-2y0qRZi>M3v#0gSNPLq5J%3tZ'`[G_.E;H8@z6[x*bTGiPDiNod[Cy$<X?q?KUlCU;j:6m$_,BTQ]tljs!vgC:>?$=WsQ0wy_VE~FjEjI9.H:C%dg%0x>WiZ@#iu.F`&C:BZEfM_v'>hozf.>UmgnjYJYF,UV|:_^Y~!JgYrdr8pt(d=9,fpQ<`wTeQ/MBMUv5]cM67'8'B_cT,,#%r1/Ddd(YMqtm*G&=#CS4=kZ86=3=FozA;Mdi%8r!7;iCBMQ{rQ^a^V|!U&|B3R*c[jfhipeNv6yTcHsnn}n4AU)T~q8L3&~AM/lX*ZcM9Y<^.;=/:N;Q~w<Zf8(sYjhh'BF|u$,$R./[?+I|'SV,B|#5A){}&i{PO5D^{bx,$x+5-L}dC>0PjtylTTw}^@oU^H/w8}nHG/$S+CihNlkGtHE2Hfw.BnnZglI*IWaQ$jJ#7Bnt3&EWDO=WI)y8C%L~09:uXnNw[e(@'Sv'l|zf3;TM-'j_6OiH!HEwhv-AZw_6*tb|$QNo'+s5c}!6SH&hsZ{Y7;_lj{;q,x%K}37tLxozno x;3%#?FZMlk[va4?Tn0w8mL|jnEeEyK", 1000, 0x4da44349}, {__LINE__, 0x7a30360d, (Byte *) "abacus", 6, 0xf8655a84}, {__LINE__, 0x6fd767ee, (Byte *) "backlog", 7, 0x1ed834b1}, {__LINE__, 0xefeb7589, (Byte *) "campfire", 8, 0x686cfca}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnxz-0.64+git4.2f1ae54/test/test_jdk_deinflate.c new/libnxz-0.65/test/test_jdk_deinflate.c --- old/libnxz-0.64+git4.2f1ae54/test/test_jdk_deinflate.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libnxz-0.65/test/test_jdk_deinflate.c 2026-04-25 20:28:42.000000000 +0200 @@ -0,0 +1,105 @@ +/* Test that deflateReset properly clears history_len + * Targets assertion at lib/nx_deflate.c:845: assert(s->cur_in >= s->history_len) + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <zlib.h> +#include "test.h" + +#define CHUNK_SIZE 65536 + +int main() { + z_stream d_strm, i_strm; + unsigned char in[CHUNK_SIZE]; + unsigned char compressed[CHUNK_SIZE * 2]; + unsigned char decompressed[CHUNK_SIZE]; + int ret; + + for (int i = 0; i < CHUNK_SIZE; i++) { + in[i] = (unsigned char)(i % 256); + } + + /* Initialize with level 6 to use history */ + memset(&d_strm, 0, sizeof(d_strm)); + ret = deflateInit2(&d_strm, 6, Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY); + if (ret != Z_OK) { + fprintf(stderr, "deflateInit2 failed: %d\n", ret); + return TEST_ERROR; + } + + /* First compression to build history */ + d_strm.avail_in = CHUNK_SIZE; + d_strm.next_in = in; + d_strm.avail_out = sizeof(compressed); + d_strm.next_out = compressed; + + ret = deflate(&d_strm, Z_FINISH); + if (ret != Z_STREAM_END) { + fprintf(stderr, "First deflate failed: %d\n", ret); + deflateEnd(&d_strm); + return TEST_ERROR; + } + + /* Reset - must clear history_len to avoid assertion */ + ret = deflateReset(&d_strm); + if (ret != Z_OK) { + fprintf(stderr, "deflateReset failed: %d\n", ret); + deflateEnd(&d_strm); + return TEST_ERROR; + } + + /* Second compression - triggers assertion if history_len not cleared */ + d_strm.avail_in = CHUNK_SIZE; + d_strm.next_in = in; + d_strm.avail_out = sizeof(compressed); + d_strm.next_out = compressed; + + ret = deflate(&d_strm, Z_FINISH); + if (ret != Z_STREAM_END) { + fprintf(stderr, "Second deflate failed: %d\n", ret); + deflateEnd(&d_strm); + return TEST_ERROR; + } + + unsigned long compressed_size = d_strm.total_out; + deflateEnd(&d_strm); + + /* Inflate to verify correctness */ + memset(&i_strm, 0, sizeof(i_strm)); + ret = inflateInit(&i_strm); + if (ret != Z_OK) { + fprintf(stderr, "inflateInit failed: %d\n", ret); + return TEST_ERROR; + } + + i_strm.avail_in = compressed_size; + i_strm.next_in = compressed; + i_strm.avail_out = sizeof(decompressed); + i_strm.next_out = decompressed; + + ret = inflate(&i_strm, Z_FINISH); + if (ret != Z_STREAM_END) { + fprintf(stderr, "inflate failed: %d\n", ret); + inflateEnd(&i_strm); + return TEST_ERROR; + } + + if (i_strm.total_out != CHUNK_SIZE) { + fprintf(stderr, "Size mismatch: expected %d, got %lu\n", + CHUNK_SIZE, i_strm.total_out); + inflateEnd(&i_strm); + return TEST_ERROR; + } + + if (memcmp(in, decompressed, CHUNK_SIZE) != 0) { + fprintf(stderr, "Data mismatch after decompression\n"); + inflateEnd(&i_strm); + return TEST_ERROR; + } + + inflateEnd(&i_strm); + printf("%s passed\n", __FILE__); + return TEST_OK; +}
