Skip to content

Commit

Permalink
Fix compilation on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanNardi committed Aug 14, 2023
1 parent cfbb7a4 commit 0c2a493
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lib/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/lib/ndpi_analyze.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <float.h> /* FLT_EPSILON */
#include "ndpi_api.h"
#include "ndpi_config.h"
#include "third_party/include/hll.h"

/* ********************************************************************************* */

Expand Down Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ndpi_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/* ******************************************* */

Expand Down
4 changes: 3 additions & 1 deletion src/lib/third_party/include/MurmurHash3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#define _MURMURHASH3_H_

#include <stdint.h>
#include <sys/types.h>
#include <stddef.h>

uint32_t MurmurHash(const void * key, uint32_t len, uint32_t seed);
u_int32_t MurmurHash(const void * key, u_int32_t len, u_int32_t seed);

#endif
1 change: 1 addition & 0 deletions src/lib/third_party/include/hll.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
4 changes: 3 additions & 1 deletion src/lib/third_party/src/hll/hll.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
#include <string.h>

#include <stdio.h>

#include <ndpi_api.h>
#include <ndpi_main.h>
#include "ndpi_typedefs.h"
#include "../include/MurmurHash3.h"
#include "../include/hll.h"

Expand Down
1 change: 1 addition & 0 deletions windows/nDPI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
<ClCompile Include="..\src\lib\third_party\src\ndpi_sha1.c" />
<ClCompile Include="..\src\lib\third_party\src\sha1-fast.c" />
<ClCompile Include="..\src\lib\third_party\src\strptime.c" />
<ClCompile Include="..\src\lib\third_party\src\hll\MurmurHash3.c" />
<ClCompile Include="src\getopt.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
Expand Down
3 changes: 3 additions & 0 deletions windows/nDPI.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@
<ClCompile Include="..\src\lib\third_party\src\strptime.c">
<Filter>third_party</Filter>
</ClCompile>
<ClCompile Include="..\src\lib\third_party\src\hll\MurmurHash3.c" />
<Filter>third_party</Filter>
</ClCompile>
<ClCompile Include="..\src\lib\protocols\tocaboca.c" />
<ClCompile Include="..\src\lib\protocols\raknet.c" />
<ClCompile Include="..\src\lib\protocols\sd_rtn.c" />
Expand Down

0 comments on commit 0c2a493

Please sign in to comment.