Commit Graph

374 Commits

Author SHA1 Message Date
Yann Collet
708e2cbb60 simplified early exit when single solution 2017-10-19 16:39:40 -07:00
Yann Collet
a4314829db fused getLongerMatch and getWiderMatch 2017-10-09 01:50:28 -07:00
Yann Collet
97c18f5f0e re-inserted last byte test in widerMatch 2017-10-09 01:44:05 -07:00
Yann Collet
bdca63ed69 early out is not better 2017-10-09 00:36:47 -07:00
Yann Collet
1ee17e4eb8 optional fuse 2017-10-09 00:31:12 -07:00
Yann Collet
b9459faeb2 improved search of rep-1 patterns 2017-10-08 23:55:42 -07:00
Yann Collet
f1fa91d6fc insertAndFindBestMatch defers to insertAndGetWiderMatch 2017-10-08 23:40:21 -07:00
Yann Collet
87968517f9 fixed decoding block checksum in lz4frame 2017-10-04 15:24:08 -07:00
Yann Collet
f6b31bf0d0 fix #404
static analyzer `cppcheck` complains about a shift-by-32 on a 32 bits value,
which is an undefined behavior.
However, the flagged code path is never triggered in 32-bits mode,
(actually, it's not even generated if DCE kicks in),
the shift-by-32 is necessarily performed on a 64-bits value.

While it doesn't change anything regarding lz4 code generation, for both 32 and 64 bits mode,
(can be checked by md5sum on the generated binary),
the shift has been rewritten in a way which should please this static analyzer,
since it now pretends to shift by 16 on 32-bits cpu (note : it doesn't matter since the code will not even be generated in this case).

Note : this is a blind fix, the new code has not been tested with cppcheck, because cppcheck only works on Windows.
Other static analyzer, such as scan-build, do not trigger this false positive.
2017-09-30 10:35:55 -07:00
Yann Collet
ceb868f442 minor lz4frame code refactor
try to improve code readability.
minor optimization on condition to preserve history.
2017-09-23 15:06:24 -07:00
W. Felix Handte
77f7245ea7 Fix Segfault When Copying Dict
dctx must have been initialized before we can copy the dictionary in.
2017-09-22 13:20:49 -07:00
Yann Collet
a30cba08f4 fixed a bunch of -Wcomma warnings
reported by @rvandermeulen (#398)
2017-09-10 14:32:38 -07:00
Yann Collet
b500c5282e fix #397 : decompression failed when using a combination of extDict + low memory address
Reported and fixed by @jscheid

Note : we are missing a test case to include it in the CI
2017-09-07 12:48:24 -07:00
Yann Collet
00418f7611 bench : made decompression speed evaluation same time as compression
minor : slightly modified an example do avoid disabling a gcc warning through #pragma
2017-09-07 12:12:36 -07:00
Yann Collet
ee5332438b minor Makefile fixes 2017-09-06 17:41:44 -07:00
Yann Collet
1ad9a36cfb updated lib/README
clarifications, improved wording
2017-09-06 11:22:45 -07:00
Yann Collet
3d260f3522 complementary information for #394 2017-08-30 16:09:10 -07:00
Yann Collet
e3c71584ff clarified documentation of streaming decompression functions
(synchronous bufferless mode)
answering questions by @jtbandes (#394)
2017-08-30 15:42:04 -07:00
Yann Collet
f212a10ae0 fixed FS-independent file order in /lib
identified by @bmwiedemann
2017-08-29 15:31:56 -07:00
Yann Collet
c4d6884cd8 build: source files sorted in a FS independent manner
to be more compatible with reproducible builds.
patch inspired by @bmwiedemann
2017-08-26 12:22:51 -07:00
Nick Terrell
252ce14fd2 Don't use C++11 deprecation attribute with clang
Clang doesn't accept a C++11 attribute following `LZ4LIB_API`.
Use the GNU attribute instead.
2017-08-24 14:06:34 -07:00
tcpan
f423d016cf FIX: added prefix to FORCE_INLINE to prevent redefinition error during compilation when used with other libraries that define FORCE_INLINE 2017-08-24 10:14:20 -04:00
Yann Collet
c10863b98e fix : asan error in dctx, due to increased maximum frame header size, reported by Craig Young 2017-08-17 10:55:30 -07:00
Yann Collet
a1f3a27e9b Merge branch 'dev' into installVars and fixed conflicts 2017-08-15 16:57:00 -07:00
Yann Collet
af9d72b7f6 Merge pull request #383 from lz4/blockChecksum
Block checksum
2017-08-15 16:50:04 -07:00
Yann Collet
8593ba8831 Merge pull request #380 from lz4/dictID
Frame Dictionary API
2017-08-15 14:12:04 -07:00
Yann Collet
aea7d521ae better respect GNU standard Makefile conventions
supports lowercase directory variables
add an "Installation" section in README.md
added an INSTALL file
2017-08-14 15:13:23 -07:00
Yann Collet
77f99d2922 restored block checksum capability at lz4frame API level 2017-08-11 17:46:52 -07:00
Yann Collet
757497ae3d implemented lz4frame decompression API 2017-08-10 16:53:57 -07:00
Yann Collet
4531637ecd support dictionary compression with independent blocks 2017-08-10 12:12:53 -07:00
Yann Collet
8d597d62d5 fixed gcc prototype warning 2017-08-10 10:28:52 -07:00
Yann Collet
d8aafe2c52 dictionary compression correctly uses compression level
Not obvious : copying the state was copying cdict's compression level
2017-08-10 00:48:19 -07:00
Yann Collet
ca2fb166ab fixed C++ conversion warnings 2017-08-09 18:22:26 -07:00
Yann Collet
bf8daa2fd5 fixed uninitialization error in lz4frame 2017-08-09 18:00:48 -07:00
Yann Collet
31f2cdf4d2 implemented dictionary compression in lz4frame
note : only compression API is implemented and tested
still to do : decompression API
2017-08-09 16:51:19 -07:00
Yann Collet
a82dadfbae added dictID inside LZ4F_frameInfo_t
Compressor can set dictID on LZ4F_compressBegin()
Decompressor can retrieve it using LZ4F_getFrameInfo()
2017-08-08 17:43:11 -07:00
Alex Deymo
76ef6d0ab0 Allow to predefine FORCE_INLINE macro.
FORCE_INLINE macro is defined based on the compiler used. When using
gcc, it will include "__attribute__((always_inline))" forcing gcc to
always inline all the functions marked as FORCE_INLINE. However, this
can cause a performance degradation of about 15%.

This patch allows to set the FORCE_INLINE macro from the compiler
command line to either "static" or "static inline" giving allowing it
to inline functions as needed when performing optimizations.
2017-08-07 10:34:33 +02:00
Ido Rosen
8aeaf6bb3a Fix typos preventing installation of static lib. 2017-08-01 00:48:58 -04:00
Yann Collet
6ad3a983db fix #369
The bug would make the bt search read one byte in an invalid memory region,
and make a branch decision based on its value.
Impact was small (missed compression opportunity).
It only happens in -BD mode, with extDict-prefix overlapping matches.

The bt match search is supposed to work also in extDict mode.
In which case, the match ptr can point into Dict.
When the match was overlapping Dict<->Prefix,
match[matchLength] would end up outside of Dict, in an invalid memory area.
The correction ensures that in such a case,
match[matchLength] ends up at intended location, inside prefix.
2017-06-26 11:29:05 -07:00
Chocobo1
a4ec7fa7b7 Fix gcc7 Wimplicit-fallthrough warnings
For the default Wimplicit-fallthrough=3 level,
the comment should start with "fall*"
2017-06-19 13:57:35 +08:00
Yann Collet
89b9f026c9 made level 10 a bit faster
at the expense of a little bit of compression ratio.

Now speed is intermediate on calgary corpus :
25 - 12 - 8 - 3
2017-06-13 17:25:29 -07:00
Yann Collet
bfc1806605 clarified lz4frame api comment (#350) 2017-06-13 12:35:00 -07:00
Yann Collet
139a387d17 updated NEWS 2017-06-12 10:54:59 -07:00
Yann Collet
e60cbb5cac added test for LZ4F_resetDecompressionContext() 2017-05-10 16:28:36 -07:00
Yann Collet
a902127613 bumped version number to 1.8.0
due to addition of prototype
LZ4F_resetDecompressionContext()
2017-05-10 13:27:18 -07:00
Yann Collet
b8575f2d2b updated Makefile
to automatically build manual files with
make all
2017-05-10 13:26:04 -07:00
Yann Collet
fe932c4527 expose LZ4F_resetDecompressionContext() 2017-05-10 12:25:05 -07:00
Yann Collet
1efa48831e minor readability changes 2017-05-02 12:01:13 -07:00
Yann Collet
a8dd86d93e changed macro HEAPMODE into LZ4_HEAPMODE
This macro is susceptible to be triggered from user side
typically through compiler flag (-DLZ4_HEAPMODE=1).
In which case, it makes sense to prefix the macro
since we want to reduce potential side-effect on namespace.
2017-05-01 22:32:21 -07:00
Alexey Tourbin
6cf1f7d758 lz4hc.c: clamp compression levels > 12
I noticed that, while 'lz4 -12' works fine, 'lz4 -13' does not compress
at all.

$ cat </etc/passwd |wc -c
2565
$ lz4 -12 </etc/passwd |wc -c
1456
$ lz4 -13 </etc/passwd |wc -c
2584

Perhaps the best way to fix this is to clamp the compression level
in the LZ4HC_compress_generic routine.
2017-04-29 16:33:15 +03:00