aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2018-04-11 14:37:21 +0200
committerAnders Broman <a.broman58@gmail.com>2018-04-11 23:05:57 +0000
commit0c30760c95eb14b8cc79c7ed54c9a066388c1588 (patch)
treeba96208ee1ec94be79f68886250c4350198a4b8a /epan/dissectors
parent205505d9c82237676dfbae29cc53dd851713e702 (diff)
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 <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-kafka.c9
1 files 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 <lz4.h>
#if LZ4_VERSION_NUMBER >= 10301
#include <lz4frame.h>
+#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: