diff options
author | W. Felix Handte <w@felixhandte.com> | 2018-02-12 12:10:15 -0500 |
---|---|---|
committer | W. Felix Handte <w@felixhandte.com> | 2018-03-12 14:58:43 -0400 |
commit | 62cb52b3410bdfd696669910de010ab03666edc8 (patch) | |
tree | c55f7d60ff8edbef91982c0f19615ad43d74fb9e /lib/lz4.c | |
parent | 7060bcabf041395d6249a701729d02e28529bf82 (diff) | |
download | lz4-62cb52b3410bdfd696669910de010ab03666edc8.tar.gz |
Initialize Current Offset to 1
Diffstat (limited to 'lib/lz4.c')
-rw-r--r-- | lib/lz4.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -550,7 +550,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( tableType == byPtr); size_t currentOffset = ((tableType == byU32 || tableType == byU16) && - !resetTable) ? cctx->currentOffset : 0; + !resetTable) ? cctx->currentOffset : 1; const BYTE* base = (const BYTE*) source - currentOffset; const BYTE* lowLimit; const BYTE* const lowRefLimit = ip - cctx->dictSize; @@ -593,7 +593,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( if (resetTable) { DEBUGLOG(4, "Resetting table in %p", cctx); MEM_INIT(cctx->hashTable, 0, LZ4_HASHTABLESIZE); - cctx->currentOffset = 0; + cctx->currentOffset = 1; } if (inputSize<LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */ @@ -793,7 +793,7 @@ int LZ4_compress_fast(const char* source, char* dest, int inputSize, int maxOutp int result; #if (LZ4_HEAPMODE) LZ4_stream_t* ctxPtr = ALLOCATOR(1, sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ - ctxPtr->internal_donotuse.currentOffset = 0; + ctxPtr->internal_donotuse.currentOffset = 1; #else LZ4_stream_t ctx; LZ4_stream_t* const ctxPtr = &ctx; @@ -1039,7 +1039,7 @@ void LZ4_resetStream (LZ4_stream_t* LZ4_stream) { DEBUGLOG(5, "LZ4_resetStream %p", LZ4_stream); MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t)); - LZ4_stream->internal_donotuse.currentOffset = 0; + LZ4_stream->internal_donotuse.currentOffset = 1; LZ4_stream->internal_donotuse.tableType = unusedTable; } |