summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2020-10-01 17:48:22 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2020-10-01 17:48:22 (GMT)
commit03f006a7eabf476a6424821753337fefc6984dae (patch)
tree03c709cb3c62c32d8c14ae01f66ca9373e8e09a9 /lib
parent1e31f1d25cda257b11d62e8700ed650dca1bbe54 (diff)
downloadlz4-03f006a7eabf476a6424821753337fefc6984dae.zip
lz4-03f006a7eabf476a6424821753337fefc6984dae.tar.gz
lz4-03f006a7eabf476a6424821753337fefc6984dae.tar.bz2
make scan-build accept assert()
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4frame.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index 2c62d78..bfdef5d 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -1284,18 +1284,20 @@ LZ4F_errorCode_t LZ4F_getFrameInfo(LZ4F_dctx* dctx,
/* LZ4F_updateDict() :
- * only used for LZ4F_blockLinked mode */
+ * only used for LZ4F_blockLinked mode
+ * Condition : dstPtr != NULL
+ */
static void LZ4F_updateDict(LZ4F_dctx* dctx,
const BYTE* dstPtr, size_t dstSize, const BYTE* dstBufferStart,
unsigned withinTmp)
{
- /* hint to static analyzer : dstPtr can't be NULL at this stage */
- assert(dstPtr != NULL); if (dstPtr==NULL) return;
+ assert(dstPtr != NULL);
if (dctx->dictSize==0) {
- dctx->dict = (const BYTE*)dstPtr; /* priority to dictionary continuity */
+ dctx->dict = (const BYTE*)dstPtr; /* priority to prefix mode */
}
+ assert(dctx->dict != NULL);
- if (dctx->dict + dctx->dictSize == dstPtr) { /* dictionary continuity, directly within dstBuffer */
+ if (dctx->dict + dctx->dictSize == dstPtr) { /* prefix mode, everything within dstBuffer */
dctx->dictSize += dstSize;
return;
}
@@ -1309,7 +1311,8 @@ static void LZ4F_updateDict(LZ4F_dctx* dctx,
assert(dstSize < 64 KB); /* if dstSize >= 64 KB, dictionary would be set into dstBuffer directly */
- /* dstBuffer does not contain whole useful history (64 KB), so it must be saved within tmpOut */
+ /* dstBuffer does not contain whole useful history (64 KB), so it must be saved within tmpOutBuffer */
+ assert(dctx->tmpOutBuffer != NULL);
if (withinTmp && (dctx->dict == dctx->tmpOutBuffer)) { /* continue history within tmpOutBuffer */
/* withinTmp expectation : content of [dstPtr,dstSize] is same as [dict+dictSize,dstSize], so we just extend it */