summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2018-03-08 19:09:06 (GMT)
committerW. Felix Handte <w@felixhandte.com>2018-03-12 18:59:28 (GMT)
commite34716cc3f54d3fca1cbd797e8af003cd3a63bc8 (patch)
tree521c4df7c9929d415efd33fb1acc1e16984477e3
parent5f8967b98364629310d0013b356070ab445f9e66 (diff)
downloadlz4-e34716cc3f54d3fca1cbd797e8af003cd3a63bc8.zip
lz4-e34716cc3f54d3fca1cbd797e8af003cd3a63bc8.tar.gz
lz4-e34716cc3f54d3fca1cbd797e8af003cd3a63bc8.tar.bz2
Preserve currentOffset==0 When Possible
-rw-r--r--lib/lz4.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 82c0ae3..1ea8ba1 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -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);
}
}