diff options
author | W. Felix Handte <w@felixhandte.com> | 2018-03-08 19:09:06 (GMT) |
---|---|---|
committer | W. Felix Handte <w@felixhandte.com> | 2018-03-12 18:59:28 (GMT) |
commit | e34716cc3f54d3fca1cbd797e8af003cd3a63bc8 (patch) | |
tree | 521c4df7c9929d415efd33fb1acc1e16984477e3 | |
parent | 5f8967b98364629310d0013b356070ab445f9e66 (diff) | |
download | lz4-e34716cc3f54d3fca1cbd797e8af003cd3a63bc8.zip lz4-e34716cc3f54d3fca1cbd797e8af003cd3a63bc8.tar.gz lz4-e34716cc3f54d3fca1cbd797e8af003cd3a63bc8.tar.bz2 |
Preserve currentOffset==0 When Possible
-rw-r--r-- | lib/lz4.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -846,7 +846,9 @@ int LZ4_compress_fast_safeExtState(void* state, const char* source, char* dest, } else { const tableType_t tableType = (sizeof(void*)==8) ? byU32 : byPtr; LZ4_resetTable(ctx, inputSize, tableType, noDict); - ctx->currentOffset += 64 KB; + if (ctx->currentOffset) { + ctx->currentOffset += 64 KB; + } return LZ4_compress_generic(ctx, source, dest, inputSize, 0, notLimited, tableType, noDict, noDictIssue, acceleration); } } else { @@ -861,7 +863,9 @@ int LZ4_compress_fast_safeExtState(void* state, const char* source, char* dest, } else { const tableType_t tableType = (sizeof(void*)==8) ? byU32 : byPtr; LZ4_resetTable(ctx, inputSize, tableType, noDict); - ctx->currentOffset += 64 KB; + if (ctx->currentOffset) { + ctx->currentOffset += 64 KB; + } return LZ4_compress_generic(ctx, source, dest, inputSize, maxOutputSize, limitedOutput, tableType, noDict, noDictIssue, acceleration); } } |