Skip to content

Commit

Permalink
Fix compilation on Windows (#2072)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanNardi authored Aug 14, 2023
1 parent cfbb7a4 commit 5867f43
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 7 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
2 changes: 1 addition & 1 deletion src/lib/third_party/include/MurmurHash3.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _MURMURHASH3_H_
#define _MURMURHASH3_H_

#include <stdint.h>
#include "ndpi_includes.h"

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

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

Expand Down
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
3 changes: 3 additions & 0 deletions windows/nDPI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<ClCompile Include="..\src\lib\ndpi_community_id.c" />
<ClCompile Include="..\src\lib\ndpi_geoip.c" />
<ClCompile Include="..\src\lib\ndpi_main.c" />
<ClCompile Include="..\src\lib\ndpi_filter.c" />
<ClCompile Include="..\src\lib\ndpi_memory.c" />
<ClCompile Include="..\src\lib\ndpi_serializer.c" />
<ClCompile Include="..\src\lib\ndpi_utils.c" />
Expand Down Expand Up @@ -331,6 +332,8 @@
<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\lib\third_party\src\hll\hll.c" />
<ClCompile Include="src\getopt.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
Expand Down
7 changes: 7 additions & 0 deletions windows/nDPI.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<ClCompile Include="..\src\lib\ndpi_community_id.c" />
<ClCompile Include="..\src\lib\ndpi_geoip.c" />
<ClCompile Include="..\src\lib\ndpi_main.c" />
<ClCompile Include="..\src\lib\ndpi_filter.c" />
<ClCompile Include="..\src\lib\ndpi_memory.c" />
<ClCompile Include="..\src\lib\ndpi_serializer.c" />
<ClCompile Include="..\src\lib\ndpi_utils.c" />
Expand Down Expand Up @@ -202,6 +203,12 @@
<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\third_party\src\hll\hll.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 5867f43

Please sign in to comment.