aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_domain_classify.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2023-09-05 18:08:16 +0200
committerLuca Deri <deri@ntop.org>2023-09-05 18:08:16 +0200
commitad9ed4f95480d6cd093ee259d520cf802fec7ed2 (patch)
tree0bebb2e8957098d8248073debf8d16394a68aceb /src/lib/ndpi_domain_classify.c
parent978df906b38c26a359b2d91089e70e133cc7502e (diff)
Minor warning fixes
Diffstat (limited to 'src/lib/ndpi_domain_classify.c')
-rw-r--r--src/lib/ndpi_domain_classify.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/ndpi_domain_classify.c b/src/lib/ndpi_domain_classify.c
index 2b2e5b6f6..0c9979922 100644
--- a/src/lib/ndpi_domain_classify.c
+++ b/src/lib/ndpi_domain_classify.c
@@ -128,7 +128,8 @@ u_int32_t ndpi_domain_classify_add_domains(ndpi_domain_classify *s,
while((line = fgets(buf, sizeof(buf), fd)) != NULL) {
u_int len;
-
+ u_int64_t hash;
+
if((line[0] == '#') || (line[0] == '\0'))
continue;
else {
@@ -140,8 +141,9 @@ u_int32_t ndpi_domain_classify_add_domains(ndpi_domain_classify *s,
line[len] = '\0';
}
- if(ndpi_bitmap64_set(s->classes[i].domains,
- ndpi_quick_hash64(line, strlen(line))))
+ hash = ndpi_quick_hash64(line, strlen(line));
+
+ if(ndpi_bitmap64_set(s->classes[i].domains, hash))
num_added++;
}
@@ -170,7 +172,6 @@ bool ndpi_domain_classify_contains(ndpi_domain_classify *s,
u_int8_t *class_id /* out */,
char *domain) {
u_int32_t i, len;
- u_int64_t hash;
char *dot, *elem;
if(!domain) return(false);
@@ -198,7 +199,7 @@ bool ndpi_domain_classify_contains(ndpi_domain_classify *s,
elem = domain;
while(elem != NULL) {
- hash = ndpi_quick_hash64(elem, strlen(elem));
+ u_int64_t hash = ndpi_quick_hash64(elem, strlen(elem));
for(i=0; i<MAX_NUM_NDPI_DOMAIN_CLASSIFICATIONS; i++) {
if(s->classes[i].class_id != 0) {