summaryrefslogtreecommitdiff
path: root/lib/lz4.c
AgeCommit message (Collapse)AuthorFilesLines
2020-11-14better visual conformanceYann Collet1-4/+3
only include <intrin.h> on vs2005+ (#947) remove some useless #pragma fix a few minor Visual warnings
2020-11-14restrict BitScanForward() to VS2005+Yann Collet1-1/+1
suggested by @aqrit in #947
2020-11-09changed LZ4_calloc() to a 2-arguments signatureYann Collet1-2/+2
to remain similar to stdlib's calloc(). Updated test to use c++ compiler for stricter signature check.
2020-11-08Merge branch 'dev' into customMemYann Collet1-2/+2
2020-11-08first proposal for LZ4_USER_MEMORY_FUNCTIONSYann Collet1-4/+17
makes it possible to replace at link time malloc, calloc and free by user-provided functions which must be named LZ4_malloc(), LZ4_calloc() and LZ4_free(). answer #937
2020-11-08Merge pull request #944 from lz4/fix874Yann Collet1-1/+1
fix #874
2020-11-08fixed remaining ubsan warningsYann Collet1-1/+1
2020-11-08fix #874Yann Collet1-1/+1
coverity reported a warning regarding a memcpy() overwrite. This is a false positive (the memory area is large enough), but it's true that it's not trivial to determine (encompassing struct), and it's proper anyway to only memcpy() just the right amount of data.
2020-11-07fix minor UBsYann Collet1-1/+3
- check alignment before casting a pointer - saveDict : don't memmove() on NULL dst
2020-11-07Merge pull request #941 from lz4/revertinlineYann Collet1-18/+18
Revert "Replace "static" to "LZ4_FORCE_INLINE" for small functions"
2020-11-07Revert "Replace "static" to "LZ4_FORCE_INLINE" for small functions"Yann Collet1-18/+18
This reverts commit 0e3933edd435c54cc2e21e38f5d4ba7bf644a24e.
2020-11-07fix #935Yann Collet1-2/+3
minor: identical declaration and prototypes of `LZ4HC_compress_optimal()` also : very minor optimization of `LZ4_memcpy_using_offset()`
2020-11-06Merge pull request #936 from lz4/alignTestYann Collet1-12/+19
More alignment tests
2020-11-06re-enable alignment test on all targetsYann Collet1-14/+6
2020-11-06unified alignment testYann Collet1-9/+24
across lz4.c and lz4hc.c
2020-10-07Replace "static" to "LZ4_FORCE_INLINE" for small functionsremittor1-18/+18
The "static" specifier does not guarantee that the function will be inlined.
2020-10-07Replace define LZ4_FORCE_O2_INLINE_GCC_PPC64LE to LZ4_FORCE_INLINEremittor1-18/+18
There is no reason to separate these two definitions!
2020-10-06Fix: The "inline" specifier do not use for LZ4_wildCopy8 and LZ4_wildCopy32remittor1-1/+1
This problem was reproduced on MSVC 2015 (32-bit). Both functions were called using the operator "call".
2020-09-29fix conversion warningYann Collet1-5/+5
2020-09-29fix minor static analyzer warningsYann Collet1-17/+19
detected by scan-build, cppcheck and advanved compilation flags fix #786
2020-09-28Merge pull request #923 from lz4/fix784Yann Collet1-9/+15
fix efficiency of LZ4_compress_HC_destSize()
2020-09-28improved last literals run on LZ4_compress_destSizeYann Collet1-2/+2
applying new more accurate formula from LZ4_compress_HC_destSize() also : fix some minor display issue in tests/frametest
2020-09-27ensure last match not too close to endYann Collet1-6/+11
must respect MFLIMIT distance from oend
2020-09-27Merge pull request #921 from lz4/doubleNullYann Collet1-0/+1
fix compressing into NULL
2020-09-27fix efficiency of LZ4_compress_HC_destSize()Yann Collet1-1/+2
LZ4_compress_HC_destSize() had a tendency to discard its last match when this match overflowed specified dstBuffer limit. The impact is generally moderate, but occasionally huge, typically when this last match is very large (such as compressing a bunch of zeroes). Issue #784 fixed for both Chain and Opt implementations. Added a unit test suggested by @remittor checking this topic.
2020-09-27Fix compilation with TinyCCAnton Kochkov1-2/+2
2020-09-26fix compressing into NULLYann Collet1-0/+1
fails properly bug discovered by oss-fuzz
2020-09-17fixed lz4frame with blocks of size 1Yann Collet1-21/+19
properly track history
2020-09-16added the actual code changeYann Collet1-6/+53
2020-08-27fix #783Yann Collet1-16/+23
LZ4_decompress_safe_partial() now also supports a scenario where nb_bytes_to_generate is <= block_decompressed_size And nb_bytes_to_read is >= block_compressed_size. Previously, the only supported scenario was nb_bytes_to_read == block_compress_size. Pay attention that, if nb_bytes_to_read is > block_compressed_size, then, necessarily, it requires that nb_bytes_to_generate is <= block_decompress_size. If both are larger, it will generate corrupted data.
2020-08-26Merge branch 'dev' into extraInputYann Collet1-55/+57
2020-08-25added documentation about LZ4_FORCE_SW_BITCOUNTYann Collet1-2/+19
Also : added memory-frugal software byte count for big endian 64-bit cpus. Disabled by default.
2020-08-24Merge pull request #898 from aqrit/aqrit-prefixlenYann Collet1-45/+46
rejigger bit counting intrinsics
2020-08-21removed LZ4_compress_fast_force()Yann Collet1-16/+0
which serves no more purpose. The comment implies that the simple presence of this unused function was affecting performance, and that's the reason why it was not removed earlier. This is likely another side effect of instruction alignment. It's obviously unreliable to rely on it in this way, meaning that the impact will be different, positive of negative, with any minor code change, and any minor compiler version change, even parameter change.
2020-08-17silence warningaqrit1-2/+2
MSVC debug mode complains
2020-08-12fix issue #783 (#862)BellaXlp1-1/+1
* fix issue #783
2020-08-11rejigger bit counting intrinsicsaqrit1-45/+46
Fix lz4/lz4#867 Optimize software fallback routines. Delete some faulty (and dead?) MSVC big endian code.
2020-08-10Merge pull request #895 from lz4/hugefastYann Collet1-5/+14
Fix #876
2020-08-10fix #876Yann Collet1-5/+14
by introducing a max limit acceleration value
2020-08-10Fix Enum CastsW. Felix Handte1-5/+5
Fixes `-Wsign-compare` issues.
2020-08-06Remove dirty Field From LZ4_stream_tW. Felix Handte1-10/+0
2020-08-05Remove Extraneous Reset in LZ4_attach_dictionary()W. Felix Handte1-6/+0
Nothing internally sets dirty anymore. The only way to get that is if you use an uninitialized context, in which case your warranty is void anyways.
2020-08-03Call LZ4_memcpy() instead of memcpy()Nick Terrell1-36/+51
`LZ4_memcpy()` uses `__builtin_memcpy()` to ensure that clang/gcc can inline the `memcpy()` calls in freestanding mode. This is necessary for decompressing the Linux Kernel with LZ4. Without an analogous patch decompression ran at 77 MB/s, and with the patch it ran at 884 MB/s.
2020-07-28Merge pull request #860 from adeason/old-style-definitionsYann Collet1-2/+2
Avoid old-style function definitions
2020-07-16Merge pull request #863 from Devernua/reducing_stack_usage_in_t_alignmentYann Collet1-2/+2
Reducing stack usage in _t_alignment checks
2020-07-08avoid computing 0 offsets from null pointersAlexander Gallego1-2/+2
Similar work in the kernel: https://patchwork.kernel.org/patch/11351499/ UBsan (+clang-10) complains about doing pointer arithmetic (adding 0) to a nullpointer. This patch is tested with clang-10+ubsan
2020-05-11Reducing stack usage in _t_alignment checksAleksandr Kukuev1-2/+2
2020-05-07Avoid old-style function definitionsAndrew Deason1-2/+2
Define 0-argument functions like foo(void) instead of foo(), in order to avoid a warning with -Wold-style-definition. This makes it easier to embed lz4.c in projects that compile with -Werror -Wold-style-definition.
2020-01-17Force inline small functions used by LZ4_compress_generic.Bartosz Taudul1-6/+6
2019-12-03fixed lz4hc assert errorYann Collet1-8/+8
when src ptr is in very low memory area (< 64K), the virtual reference to data in dictionary might end up in a very high memory address. Since it's not a "real" memory address, just a virtual one, to calculate distance, it doesn't matter : only distance matters. The assert was to restrictive. Fixed.