Prototype, not intended for a PR as is.
- LZ4F_preferences_t : reserved array replaced by explicit scalar fields
(nbWorkers, reserved1, reserved0), and LZ4F_compressOptions_t likewise
(stableSrc, reserved2, reserved1, reserved0), as LZ4F_decompressOptions_t.
Same sizes and offsets (ABI unchanged). A future field takes the place of a
reserved one, without changing positional initializers.
One-time source change : the former positional form { ..., { 0, 0, 0 } }
no longer compiles in C++ (warnings in C) ; examples/frameCompress.c updated.
LZ4F_INIT_PREFERENCES : { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, 0u, 0u, 0u }.
- LZ4F_srcStableUntilFlush (2) is stronger than LZ4F_srcStable (1) : in addition
to the last 64 KB of input (which remain, including after LZ4F_flush()),
all of src remains until LZ4F_flush() / LZ4F_compressEnd() returns
(with autoFlush : until the invocation returns). Docs only : the code already
relied on this (history read in place after a flush, single-threaded path).
- tests/frameMT.c : validateFlushContract : one buffer, 2 invocations separated by
a flush, everything but the last 64 KB scrambled after the flush with content
resembling upcoming data ; nbWorkers 0 and 2, levels 1 and 9, with and without
autoFlush. Scrambling the last 64 KB too is detected (contentChecksum_invalid).
Streaming test : LZ4F_srcStableUntilFlush slices come from a working copy,
scrambled the same way after each flush.
Output unchanged (same digests). Validated : full tests MT / no-MT, ASAN+UBSAN, TSAN,
make test, wine, examples (C, C++), cxxtest, CLI == dev CLI.
The macOS CI job builds the examples with
CFLAGS="-O3 -Werror -Wconversion -Wno-sign-conversion" make test
and clang's -Wconversion implies -Wimplicit-int-float-conversion. In each of
these ratio expressions the numerator is cast explicitly but the denominator is
left to convert implicitly, so newer clang rejects them:
frameCompress.c:446:40: error: implicit conversion from
'const unsigned long long' to 'double' may lose precision
[-Werror,-Wimplicit-int-float-conversion]
446 | (double)ret.size_out / ret.size_in * 100);
| ~ ~~~~^~~~~~~
Cast the denominators too, matching how fileCompress.c:193 already writes the
same computation. The conversion happened anyway via the usual arithmetic
conversions, so the printed values are unchanged.
frameCompress.c is only the first failure; make stops there, and
bench_functions.c has ten more instances of the same pattern behind it.
When size of the given file is less than 1024 (DICTIONARY_BYTES), dict[] may contain garbage.
Therefore, test_decompress() fails with garbage dictionary.
This change set fixes the failure of test for dictionaryRandomAccess with TESTFILE_SMALL.
The text at the top of each source file was already specifying 2.0-or-later,
but this wasn't clearly reflected in the full-text license in COPYING,
which was the old 2.0 license, which can be interpreted as 2.0-only.
Note that the license of `liblz4`, the library in `lib/` directory,
is unchanged, and remains the more permissive `BSD 2-clause`.
new method `uncompressed_update` allows to insert blocks without
compression into the lz4 stream.
The usage is documented in the frameCompress example
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Aim: To adapt C++
Compilation errors:
simple_buffer.c:47:9: error: cannot initialize a variable of type 'char *' with an rvalue of type 'void *'
char* compressed_data = malloc((size_t)max_dst_size);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
simple_buffer.c:76:15: error: cannot initialize a variable of type 'char *const' with an rvalue of type 'void *'
char* const regen_buffer = malloc(src_size);
^ ~~~~~~~~~~~~~~~~
2 errors generated.