aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorErik Rigtorp <erik@rigtorp.se>2021-09-15 21:05:22 +0200
committerErik Rigtorp <erik@rigtorp.se>2021-09-15 19:09:30 +0000
commit4ebd927ccd248e52d950d868adb17e059b4c215d (patch)
treee48d1bc8d025aa48ea1869192f683dc1937ba526 /wiretap
parentbd33320521b5c887e51ebcfa7cf2a63cdf0f08f9 (diff)
Support LZ4 versions earlier than 1.8.0
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/file_wrappers.c10
1 files changed, 10 insertions, 0 deletions
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;