Skip to content

Commit

Permalink
Fix compilation on Windows
Browse files Browse the repository at this point in the history
For some unknown reasons, `MurmurHash` name doesn't work on Window
  • Loading branch information
IvanNardi committed Aug 14, 2023
1 parent cfbb7a4 commit f389e93
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib/ndpi_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ bool ndpi_filter_add(ndpi_filter *f, u_int32_t value) {
/* ******************************************* */

bool ndpi_filter_add_string(ndpi_filter *f, char *string) {
return(ndpi_filter_add(f, MurmurHash(string, strlen(string), 0xD6DFE7)));
return(ndpi_filter_add(f, MurmurHash3(string, strlen(string), 0xD6DFE7)));
}

/* ******************************************* */
Expand All @@ -76,7 +76,7 @@ bool ndpi_filter_contains(ndpi_filter *f, u_int32_t value) {
/* ******************************************* */

bool ndpi_filter_contains_string(ndpi_filter *f, char *string) {
return(ndpi_filter_contains(f, MurmurHash(string, strlen(string), 0xD6DFE7)));
return(ndpi_filter_contains(f, MurmurHash3(string, strlen(string), 0xD6DFE7)));
}

/* ******************************************* */
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
Expand Up @@ -3,6 +3,6 @@

#include <stdint.h>

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

#endif
2 changes: 1 addition & 1 deletion src/lib/third_party/src/hll/MurmurHash3.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ xo*/

#define ROTL32(x, r) ((x) << (r)) | ((x) >> (32 - (r)))

u_int32_t MurmurHash(const void *key, u_int32_t len, u_int32_t seed) {
u_int32_t MurmurHash3(const void *key, u_int32_t len, u_int32_t seed) {
const u_int8_t *data = (const u_int8_t *)key;
const int32_t nblocks = (int32_t)len / 4;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/third_party/src/hll/hll.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static __inline int _hll_add_hash(struct ndpi_hll *hll, u_int32_t hash) {

/* Return: 0 = nothing changed, 1 = ranking changed */
int hll_add(struct ndpi_hll *hll, const void *buf, size_t size) {
u_int32_t hash = MurmurHash((const char *)buf, (u_int32_t)size, 0x5f61767a);
u_int32_t hash = MurmurHash3((const char *)buf, (u_int32_t)size, 0x5f61767a);

return(_hll_add_hash(hll, hash));
}
Expand Down

0 comments on commit f389e93

Please sign in to comment.