From 4ebd927ccd248e52d950d868adb17e059b4c215d Mon Sep 17 00:00:00 2001 From: Erik Rigtorp Date: Wed, 15 Sep 2021 21:05:22 +0200 Subject: [PATCH] Support LZ4 versions earlier than 1.8.0 --- wiretap/file_wrappers.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c index 6ec35eb1c8..e7aaa5a66a 100644 --- a/wiretap/file_wrappers.c +++ b/wiretap/file_wrappers.c @@ -886,7 +886,17 @@ gz_head(FILE_T state) && state->in.buf[0] == 0x04 && state->in.buf[1] == 0x22 && state->in.buf[2] == 0x4d && state->in.buf[3] == 0x18) { #ifdef USE_LZ4 +#if LZ4_VERSION_NUMBER >= 10800 LZ4F_resetDecompressionContext(state->lz4_dctx); +#else + LZ4F_freeDecompressionContext(state->lz4_dctx); + const LZ4F_errorCode_t ret = LZ4F_createDecompressionContext(&state->lz4_dctx, LZ4F_VERSION); + if (LZ4F_isError(ret)) { + state->err = WTAP_ERR_INTERNAL; + state->err_info = LZ4F_getErrorName(ret); + return -1; + } +#endif state->compression = LZ4; state->is_compressed = TRUE; return 0;