diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-11-13 13:52:42 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-11-13 13:52:42 +0100 |
commit | 82934b7271ad11332cdc291188e6b51e9534c301 (patch) | |
tree | 6f48d177a1a047878c54db75b9945aa0e3242eea /examples | |
parent | 4920b2a4be62b85b6355278fe0d63637bddb624f (diff) |
Fixed clang-tidy warnings.
* fixed/improved c-captured logging
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/c-captured/c-captured.c | 6 | ||||
-rw-r--r-- | examples/c-json-stdout/c-json-stdout.c | 5 | ||||
-rw-r--r-- | examples/c-simple/c-simple.c | 2 |
3 files changed, 5 insertions, 8 deletions
diff --git a/examples/c-captured/c-captured.c b/examples/c-captured/c-captured.c index 338125b6f..9356db8f5 100644 --- a/examples/c-captured/c-captured.c +++ b/examples/c-captured/c-captured.c @@ -952,7 +952,7 @@ static enum nDPIsrvd_callback_return captured_json_callback(struct nDPIsrvd_sock if (flow_user->packets == NULL || flow_user->flow_max_packets == 0 || utarray_len(flow_user->packets) == 0) { - if (logging_mode != 0) + if (capture_mode != 0) { logger(0, "Flow %llu: No packets captured.", flow->id_as_ull); } @@ -1335,8 +1335,8 @@ int main(int argc, char ** argv) return 1; } - logger(0, "Recv buffer size: %u\n", NETWORK_BUFFER_MAX_SIZE); - logger(0, "Connecting to `%s'..\n", serv_optarg); + logger(0, "Recv buffer size: %u", NETWORK_BUFFER_MAX_SIZE); + logger(0, "Connecting to `%s'..", serv_optarg); if (nDPIsrvd_connect(sock) != CONNECT_OK) { diff --git a/examples/c-json-stdout/c-json-stdout.c b/examples/c-json-stdout/c-json-stdout.c index ae082a366..a80369c82 100644 --- a/examples/c-json-stdout/c-json-stdout.c +++ b/examples/c-json-stdout/c-json-stdout.c @@ -90,8 +90,7 @@ int main(void) break; } - if (buf[json_bytes - 2] != '}' || - buf[json_bytes - 1] != '\n') + if (buf[json_bytes - 2] != '}' || buf[json_bytes - 1] != '\n') { fprintf(stderr, "BUG: Invalid JSON string: \"%.*s\"\n", (int)json_bytes, buf); exit(1); @@ -129,8 +128,6 @@ int main(void) memmove(buf, buf + json_bytes, buf_used - json_bytes); buf_used -= json_bytes; - json_bytes = 0; - json_start = 0; } } diff --git a/examples/c-simple/c-simple.c b/examples/c-simple/c-simple.c index 642611f07..29321c963 100644 --- a/examples/c-simple/c-simple.c +++ b/examples/c-simple/c-simple.c @@ -58,7 +58,7 @@ static void nDPIsrvd_write_flow_info_cb(struct nDPIsrvd_socket const * sock, #endif flow->last_seen, flow->idle_time, - (flow->last_seen + flow->idle_time >= thread_data->most_recent_flow_time + (thread_data != NULL && flow->last_seen + flow->idle_time >= thread_data->most_recent_flow_time ? flow->last_seen + flow->idle_time - thread_data->most_recent_flow_time : 0)); } |