From 5867f43fae70b1a08b64e8635bf8183ba4d29124 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Mon, 14 Aug 2023 22:51:09 +0200 Subject: [PATCH] Fix compilation on Windows (#2072) --- src/lib/Makefile.in | 2 +- src/lib/ndpi_analyze.c | 3 +-- src/lib/ndpi_filter.c | 2 +- src/lib/third_party/include/MurmurHash3.h | 2 +- src/lib/third_party/include/hll.h | 1 + src/lib/third_party/src/hll/MurmurHash3.c | 2 +- src/lib/third_party/src/hll/hll.c | 4 +++- windows/nDPI.vcxproj | 3 +++ windows/nDPI.vcxproj.filters | 7 +++++++ 9 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 7867f542415..c4e5880b6c3 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -21,7 +21,7 @@ CFLAGS += -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION @NDPI_CF LDFLAGS += @NDPI_LDFLAGS@ LIBS = @ADDITIONAL_LIBS@ @LIBS@ @GPROF_LIBS@ -OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c)) +OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) $(patsubst third_party/src/hll/%.c, third_party/src/hll/%.o, $(wildcard third_party/src/hll/*.c)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c)) HEADERS = $(wildcard ../include/*.h) NDPI_VERSION_MAJOR = @NDPI_MAJOR@ NDPI_LIB_STATIC = libndpi.a diff --git a/src/lib/ndpi_analyze.c b/src/lib/ndpi_analyze.c index ef3d3cb9a3c..e9aa99a31f0 100644 --- a/src/lib/ndpi_analyze.c +++ b/src/lib/ndpi_analyze.c @@ -30,6 +30,7 @@ #include /* FLT_EPSILON */ #include "ndpi_api.h" #include "ndpi_config.h" +#include "third_party/include/hll.h" /* ********************************************************************************* */ @@ -298,8 +299,6 @@ const char* ndpi_data_ratio2str(float ratio) { /* ********************************************************************************* */ /* ********************************************************************************* */ -#include "third_party/src/hll/hll.c" - int ndpi_hll_init(struct ndpi_hll *hll, u_int8_t bits) { return(hll_init(hll, bits)); } diff --git a/src/lib/ndpi_filter.c b/src/lib/ndpi_filter.c index 7917639d09b..5c4ff62bdec 100644 --- a/src/lib/ndpi_filter.c +++ b/src/lib/ndpi_filter.c @@ -34,7 +34,7 @@ #include "ndpi_includes.h" #include "ndpi_encryption.h" -#include "third_party/src/hll/MurmurHash3.c" +#include "third_party/include/MurmurHash3.h" /* ******************************************* */ diff --git a/src/lib/third_party/include/MurmurHash3.h b/src/lib/third_party/include/MurmurHash3.h index 43dc5fd92b9..63841cc6dc9 100644 --- a/src/lib/third_party/include/MurmurHash3.h +++ b/src/lib/third_party/include/MurmurHash3.h @@ -1,7 +1,7 @@ #ifndef _MURMURHASH3_H_ #define _MURMURHASH3_H_ -#include +#include "ndpi_includes.h" uint32_t MurmurHash(const void * key, uint32_t len, uint32_t seed); diff --git a/src/lib/third_party/include/hll.h b/src/lib/third_party/include/hll.h index 4b094a63e9b..68af742e1f3 100644 --- a/src/lib/third_party/include/hll.h +++ b/src/lib/third_party/include/hll.h @@ -25,3 +25,4 @@ extern int hll_init(struct ndpi_hll *hll, u_int8_t bits); extern void hll_destroy(struct ndpi_hll *hll); extern int hll_add(struct ndpi_hll *hll, const void *buf, size_t size); extern double hll_count(const struct ndpi_hll *hll); +extern void hll_reset(struct ndpi_hll *hll); diff --git a/src/lib/third_party/src/hll/MurmurHash3.c b/src/lib/third_party/src/hll/MurmurHash3.c index f8bf0d88151..dbfd15b8578 100644 --- a/src/lib/third_party/src/hll/MurmurHash3.c +++ b/src/lib/third_party/src/hll/MurmurHash3.c @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------- MurmurHash3 was written by Austin Appleby, and is placed in the public domain. The author hereby disclaims copyright to this source code. -xo*/ +*/ #include "MurmurHash3.h" diff --git a/src/lib/third_party/src/hll/hll.c b/src/lib/third_party/src/hll/hll.c index c4ed5988542..653d66aecae 100644 --- a/src/lib/third_party/src/hll/hll.c +++ b/src/lib/third_party/src/hll/hll.c @@ -26,7 +26,9 @@ #include #include - +#include +#include +#include "ndpi_typedefs.h" #include "../include/MurmurHash3.h" #include "../include/hll.h" diff --git a/windows/nDPI.vcxproj b/windows/nDPI.vcxproj index b28587b6d9a..7ebb55b3d67 100644 --- a/windows/nDPI.vcxproj +++ b/windows/nDPI.vcxproj @@ -128,6 +128,7 @@ + @@ -331,6 +332,8 @@ + + true diff --git a/windows/nDPI.vcxproj.filters b/windows/nDPI.vcxproj.filters index 594681a7093..af43e8f1bd8 100644 --- a/windows/nDPI.vcxproj.filters +++ b/windows/nDPI.vcxproj.filters @@ -120,6 +120,7 @@ + @@ -202,6 +203,12 @@ third_party + + third_party + + + third_party +