summaryrefslogtreecommitdiffstats
path: root/lib/lz4.c
diff options
context:
space:
mode:
authorOleg Khabinov <khabinov@fb.com>2018-10-01 22:19:45 (GMT)
committerOleg Khabinov <khabinov@fb.com>2018-10-01 22:19:45 (GMT)
commit28eb88d9885810018cb79421ca7ce0462fd61df2 (patch)
tree5862ec1466bcef0fc80fa23a04f31fecf92f4b5c /lib/lz4.c
parentb18b6e53e16258cbdc4c24a387d9d4338006f827 (diff)
downloadlz4-28eb88d9885810018cb79421ca7ce0462fd61df2.zip
lz4-28eb88d9885810018cb79421ca7ce0462fd61df2.tar.gz
lz4-28eb88d9885810018cb79421ca7ce0462fd61df2.tar.bz2
Some followups and renamings
Diffstat (limited to 'lib/lz4.c')
-rw-r--r--lib/lz4.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index aed2bb2..1521aa2 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -613,7 +613,7 @@ LZ4_FORCE_INLINE void LZ4_prepareTable(
/* If compression failed during the previous step, then the context
* is marked as dirty, therefore, it has to be fully reset.
*/
- if (cctx->dirtyContext) {
+ if (cctx->dirty) {
DEBUGLOG(5, "LZ4_prepareTable: Full reset for %p", cctx);
MEM_INIT(cctx, 0, sizeof(LZ4_stream_t_internal));
return;
@@ -704,10 +704,11 @@ LZ4_FORCE_INLINE int LZ4_compress_generic(
U32 forwardH;
DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, tableType=%u", inputSize, tableType);
- /* Init conditions */
- if (outputLimited == fillOutput && maxOutputSize < 1) goto _failure; /* Impossible to store anything */
- if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) goto _failure; /* Unsupported inputSize, too large (or negative) */
- if ((tableType == byU16) && (inputSize>=LZ4_64Klimit)) goto _failure; /* Size too large (not within 64K limit) */
+ /* If init conditions are not met, we don't have to mark stream
+ * as having dirty context, since no action was taken yet */
+ if (outputLimited == fillOutput && maxOutputSize < 1) return 0; /* Impossible to store anything */
+ if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported inputSize, too large (or negative) */
+ if ((tableType == byU16) && (inputSize>=LZ4_64Klimit)) return 0; /* Size too large (not within 64K limit) */
if (tableType==byPtr) assert(dictDirective==noDict); /* only supported use case with byPtr */
assert(acceleration >= 1);
@@ -1021,7 +1022,7 @@ _last_literals:
_failure:
/* Mark stream as having dirty context, so, it has to be fully reset */
- cctx->dirtyContext = 1;
+ cctx->dirty = 1;
return 0;
}
@@ -1300,7 +1301,7 @@ int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, const char* source, ch
DEBUGLOG(5, "LZ4_compress_fast_continue (inputSize=%i)", inputSize);
- if (streamPtr->dirtyContext) return 0; /* Uninitialized structure detected */
+ if (streamPtr->dirty) return 0; /* Uninitialized structure detected */
LZ4_renormDictT(streamPtr, inputSize); /* avoid index overflow */
if (acceleration < 1) acceleration = ACCELERATION_DEFAULT;