From 72e679438f9ead31e671e0738b7730f846ebde70 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 20 Apr 2015 12:23:33 +0100 Subject: Updated LZ4F_freeDecompressionContext(), to provide stage hint as result --- lib/lz4frame.c | 4 +++- lib/lz4frame.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/lz4frame.c b/lib/lz4frame.c index eb38390..a70dbaf 100644 --- a/lib/lz4frame.c +++ b/lib/lz4frame.c @@ -772,14 +772,16 @@ LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_decompressionContext_t* LZ LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_decompressionContext_t LZ4F_decompressionContext) { + LZ4F_errorCode_t result = LZ4F_OK_NoError; LZ4F_dctx_internal_t* dctxPtr = (LZ4F_dctx_internal_t*)LZ4F_decompressionContext; if (dctxPtr != NULL) /* can accept NULL input, like free() */ { + result = (LZ4F_errorCode_t)dctxPtr->dStage; FREEMEM(dctxPtr->tmpIn); FREEMEM(dctxPtr->tmpOutBuffer); FREEMEM(dctxPtr); } - return LZ4F_OK_NoError; + return result; } diff --git a/lib/lz4frame.h b/lib/lz4frame.h index 85ebce3..b5ba2fb 100644 --- a/lib/lz4frame.h +++ b/lib/lz4frame.h @@ -245,6 +245,8 @@ LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_decompressionContext_t dctx) * The function will provide a pointer to a fully allocated and initialized LZ4F_decompressionContext_t object. * The result is an errorCode, which can be tested using LZ4F_isError(). * dctx memory can be released using LZ4F_freeDecompressionContext(); + * The result of LZ4F_freeDecompressionContext() is indicative of the current state of decompressionContext when being released. + * That is, it should be == 0 if decompression has been completed fully and correctly. */ -- cgit v0.12