From 8b1c68aed3228ff4e6b0c4e592c45c1426c51ace Mon Sep 17 00:00:00 2001 From: Stuart Reilly Date: Fri, 12 Jul 2019 15:59:11 +0100 Subject: Add compiler warnings and fix them --- example/ndpiReader.c | 11 ++++------- example/ndpi_util.c | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'example') diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 003737212..73dfdf051 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -2781,7 +2781,7 @@ void bpf_filter_pkt_peak_filter(json_object **jObj_bpfFilter, int l; if(port_array[0] != INIT_VAL) - strncat(filter, " and not (src ", sizeof(" and not (src ")); + strncat(filter, " and not (src ", sizeof(filter)/sizeof(char)); else strcpy(filter, "not (src "); @@ -2808,7 +2808,7 @@ void bpf_filter_pkt_peak_filter(json_object **jObj_bpfFilter, int l; if(port_array[0] != INIT_VAL || src_host_array[0] != NULL) - strncat(filter, " and not (dst ", sizeof(" and not (dst ")); + strncat(filter, " and not (dst ", sizeof(filter)/sizeof(char)); else strcpy(filter, "not (dst "); @@ -2955,7 +2955,6 @@ void bpf_filter_port_array_add(int filter_array[], int size, int port) { float getAverage(struct json_object *jObj_stat, char *field){ json_object *field_stat; json_bool res; - float average; float sum = 0; int r; int j = 0; @@ -3003,11 +3002,11 @@ float getStdDeviation(struct json_object *jObj_stat, float average, char *field) json_object *field_stat; json_bool res; float sum = 0; - int j; + int j = 0; int r; if((r = strcmp(field, "top.scanner.stats")) == 0){ - for(j=0; j