diff options
author | Luca Deri <lucaderi@users.noreply.github.com> | 2019-07-13 18:34:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-13 18:34:40 +0200 |
commit | c65025f7b005444b6100f50ca49ef537fcd72c0b (patch) | |
tree | ee3ad9e59b84ad6b2519302e3b3d754d8f499da7 /example/ndpiReader.c | |
parent | ea32d535eb2a52f0146e6bd7054281138d106299 (diff) | |
parent | 92c769f206d407024cec677b838e67e64769249e (diff) |
Merge pull request #737 from themadprofessor/dev
Add compiler warnings and fix them
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r-- | example/ndpiReader.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 665dcc766..41b30729e 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -2852,7 +2852,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 "); @@ -2879,7 +2879,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 "); @@ -3026,7 +3026,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; @@ -3074,11 +3073,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<json_object_array_length(jObj_stat); j++) { + for(; j<json_object_array_length(jObj_stat); j++) { field_stat = json_object_array_get_idx(jObj_stat, j); json_object *jObj_tot_flows_number; @@ -3263,7 +3262,6 @@ static void produceBpfFilter(char *filePath) { const char *filterPktDstHosts[48]; struct stat statbuf; FILE *fp = NULL; - char *fileName; char _filterFilePath[1024]; json_object *jObj_bpfFilter; void *fmap; @@ -3359,7 +3357,6 @@ static void produceBpfFilter(char *filePath) { } - fileName = basename(filePath); snprintf(_filterFilePath, sizeof(_filterFilePath), "%s.bpf", filePath); if((fp = fopen(_filterFilePath,"w")) == NULL) { |