diff options
author | Yann Collet <cyan@fb.com> | 2020-09-17 21:43:02 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2020-09-17 21:43:02 (GMT) |
commit | 10d2e1c69465ac51d210909ca7a447a1397736a1 (patch) | |
tree | f75df86ec7e5805c0340d18c7e9621b57d130b30 /lib/lz4frame.c | |
parent | 43bbb7decc8296078ce191b06b0af494ddad0535 (diff) | |
download | lz4-10d2e1c69465ac51d210909ca7a447a1397736a1.zip lz4-10d2e1c69465ac51d210909ca7a447a1397736a1.tar.gz lz4-10d2e1c69465ac51d210909ca7a447a1397736a1.tar.bz2 |
fixed lz4frame with blocks of size 1
properly track history
Diffstat (limited to 'lib/lz4frame.c')
-rw-r--r-- | lib/lz4frame.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/lz4frame.c b/lib/lz4frame.c index e11f1c8..890fc96 100644 --- a/lib/lz4frame.c +++ b/lib/lz4frame.c @@ -750,6 +750,7 @@ static size_t LZ4F_makeBlock(void* dst, (int)(srcSize), (int)(srcSize-1), level, cdict); if (cSize == 0) { /* compression failed */ + DEBUGLOG(5, "LZ4F_makeBlock: compression failed, creating a raw block (size %u)", (U32)srcSize); cSize = (U32)srcSize; LZ4F_writeLE32(cSizePtr, cSize | LZ4F_BLOCKUNCOMPRESSED_FLAG); memcpy(cSizePtr+BHSize, src, srcSize); @@ -1487,15 +1488,17 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, size_t const nextCBlockSize = blockHeader & 0x7FFFFFFFU; size_t const crcSize = dctx->frameInfo.blockChecksumFlag * BFSize; if (blockHeader==0) { /* frameEnd signal, no more block */ + DEBUGLOG(5, "end of frame"); dctx->dStage = dstage_getSuffix; break; } if (nextCBlockSize > dctx->maxBlockSize) { return err0r(LZ4F_ERROR_maxBlockSize_invalid); } - if (LZ4F_readLE32(selectedIn) & LZ4F_BLOCKUNCOMPRESSED_FLAG) { + if (blockHeader & LZ4F_BLOCKUNCOMPRESSED_FLAG) { /* next block is uncompressed */ dctx->tmpInTarget = nextCBlockSize; + DEBUGLOG(5, "next block is uncompressed (size %u)", (U32)nextCBlockSize); if (dctx->frameInfo.blockChecksumFlag) { (void)XXH32_reset(&dctx->blockChecksum, 0); } |