skip flush operation in case where op is NULL

This commit is contained in:
Danielle Rozenblit
2022-09-08 13:53:13 -07:00
parent f3ddaaddd6
commit 3d7f9a90df
+4 -3
View File
@@ -2177,10 +2177,11 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
break;
}
case zdss_flush:
{ size_t const toFlushSize = zds->outEnd - zds->outStart;
if (op != NULL) {
size_t const toFlushSize = zds->outEnd - zds->outStart;
size_t const flushedSize = ZSTD_limitCopy(op, (size_t)(oend-op), zds->outBuff + zds->outStart, toFlushSize);
op = op ? op + flushedSize : op;
op += flushedSize;
zds->outStart += flushedSize;
if (flushedSize == toFlushSize) { /* flush completed */
@@ -2193,7 +2194,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
zds->outStart = zds->outEnd = 0;
}
break;
} }
}}
/* cannot complete flush */
someMoreWork = 0;
break;