[Kafka] The inclusion of LZ4 broke building on Ubuntu 14.04, since it has lz4-r114.

But the lz4 frame API was introduced in [r123](https://github.com/lz4/lz4/blob/r123/lz4frame.h).
Put the code behind a lz4 version check.

Change-Id: If8a7e5f7f2e7c9beac89eec334368a5b95a1bc3f
Reviewed-on: https://code.wireshark.org/review/21684
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
AndersBroman 2017-05-16 13:10:48 +02:00 committed by Pascal Quantin
parent 467031cdd8
commit 511b9dda82
1 changed files with 7 additions and 4 deletions

View File

@ -34,7 +34,10 @@
#include <snappy-c.h>
#endif
#ifdef HAVE_LZ4
#include <lz4.h>
#if LZ4_VERSION_NUMBER >= 10301
#include <lz4frame.h>
#endif /* LZ4_VERSION_NUMBER >= 10301 */
#endif
#include "packet-tcp.h"
@ -354,7 +357,7 @@ dissect_kafka_message_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
/* HELPERS */
#ifdef HAVE_LZ4
#if defined HAVE_LZ4 && LZ4_VERSION_NUMBER >= 10301
/* 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 {
@ -467,7 +470,7 @@ static guint XXH32(const void* input, size_t len, guint seed)
else
return XXH32_endian(input, len, seed, XXH_bigEndian);
}
#endif
#endif /* HAVE_LZ4 && LZ4_VERSION_NUMBER >= 10301 */
static const char *
kafka_error_to_str(kafka_error_t error)
@ -828,7 +831,7 @@ dissect_kafka_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int s
break;
#endif
case KAFKA_MESSAGE_CODEC_LZ4:
#ifdef HAVE_LZ4
#if defined HAVE_LZ4 && LZ4_VERSION_NUMBER >= 10301
raw = kafka_get_bytes(subtree, tvb, pinfo, offset);
offset += 4;
if (raw) {
@ -918,7 +921,7 @@ dissect_kafka_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int s
offset += compressed_size;
}
break;
#endif
#endif /* HAVE_LZ4 && LZ4_VERSION_NUMBER >= 10301 */
case KAFKA_MESSAGE_CODEC_NONE:
default: