From 0c30760c95eb14b8cc79c7ed54c9a066388c1588 Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Wed, 11 Apr 2018 14:37:21 +0200 Subject: [PATCH] kafka: check lz4 version in a single point. This allows a better check of the required version. Change-Id: I6c4aab67c73434aff4ad744caa2d0add9ec6225c Reviewed-on: https://code.wireshark.org/review/26889 Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-kafka.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c index 0f59c9545d..f516284cef 100644 --- a/epan/dissectors/packet-kafka.c +++ b/epan/dissectors/packet-kafka.c @@ -25,6 +25,7 @@ #include #if LZ4_VERSION_NUMBER >= 10301 #include +#define HAVE_LZ4_FRAME #endif /* LZ4_VERSION_NUMBER >= 10301 */ #endif #include "packet-tcp.h" @@ -345,7 +346,7 @@ dissect_kafka_message_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i /* HELPERS */ -#if defined HAVE_LZ4 && LZ4_VERSION_NUMBER >= 10301 +#if defined HAVE_LZ4_FRAME /* Local copy of XXH32() algorithm as found in https://github.com/lz4/lz4/blob/v1.7.5/lib/xxhash.c as some packagers are not providing xxhash.h in liblz4 */ typedef struct { @@ -458,7 +459,7 @@ static guint XXH32(const void* input, size_t len, guint seed) else return XXH32_endian(input, len, seed, XXH_bigEndian); } -#endif /* HAVE_LZ4 && LZ4_VERSION_NUMBER >= 10301 */ +#endif /* HAVE_LZ4_FRAME */ static const char * kafka_error_to_str(kafka_error_t error) @@ -819,7 +820,7 @@ dissect_kafka_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int s break; #endif case KAFKA_MESSAGE_CODEC_LZ4: -#if defined HAVE_LZ4 && LZ4_VERSION_NUMBER >= 10301 +#ifdef HAVE_LZ4_FRAME raw = kafka_get_bytes(subtree, tvb, pinfo, offset); offset += 4; if (raw) { @@ -909,7 +910,7 @@ dissect_kafka_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int s offset += compressed_size; } break; -#endif /* HAVE_LZ4 && LZ4_VERSION_NUMBER >= 10301 */ +#endif /* HAVE_LZ4_FRAME */ case KAFKA_MESSAGE_CODEC_NONE: default: