aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2024-11-13 09:55:40 +0100
committerToni Uhlig <matzeton@googlemail.com>2024-11-14 10:21:35 +0100
commit9105b393e1df76c9d4d11e3a75cd160a724493bd (patch)
tree738a902d279117ea45640582d9858b5e480cee8b /examples
parent9efdecf4efa352a6046c88a945cf9ff8db1b37b9 (diff)
Fixed some SonarCloud issues
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/c-analysed/c-analysed.c16
-rw-r--r--examples/c-captured/c-captured.c6
2 files changed, 12 insertions, 10 deletions
diff --git a/examples/c-analysed/c-analysed.c b/examples/c-analysed/c-analysed.c
index 36a99441d..2f1759823 100644
--- a/examples/c-analysed/c-analysed.c
+++ b/examples/c-analysed/c-analysed.c
@@ -594,7 +594,8 @@ static int analysed_map_to_stat(char const * const token_str,
struct global_map const * const map,
size_t map_length)
{
- size_t i, null_i = map_length;
+ size_t i;
+ size_t null_i = map_length;
for (i = 0; i < map_length; ++i)
{
@@ -621,7 +622,7 @@ static int analysed_map_to_stat(char const * const token_str,
return 1;
}
-static int analysed_map_value_to_stat(struct nDPIsrvd_socket * const sock,
+static int analysed_map_value_to_stat(struct nDPIsrvd_socket const * const sock,
struct nDPIsrvd_json_token const * const token,
struct global_map const * const map,
size_t map_length)
@@ -638,7 +639,7 @@ static int analysed_map_value_to_stat(struct nDPIsrvd_socket * const sock,
return analysed_map_to_stat(value_str, value_length, map, map_length);
}
-static void analysed_unmap_flow_from_stat(struct flow_user_data * const flow_user_data)
+static void analysed_unmap_flow_from_stat(struct flow_user_data const * const flow_user_data)
{
if (flow_user_data->is_ip4 != 0)
{
@@ -774,7 +775,7 @@ static ssize_t analysed_map_index(char const * const json_key,
return unknown_key;
}
-static int analysed_map_flow_u8(struct nDPIsrvd_socket * const sock,
+static int analysed_map_flow_u8(struct nDPIsrvd_socket const * const sock,
struct nDPIsrvd_json_token const * const token,
struct global_map const * const map,
size_t map_length,
@@ -802,7 +803,7 @@ static int analysed_map_flow_u8(struct nDPIsrvd_socket * const sock,
return 0;
}
-static void process_flow_stats(struct nDPIsrvd_socket * const sock, struct nDPIsrvd_flow * const flow)
+static void process_flow_stats(struct nDPIsrvd_socket const * const sock, struct nDPIsrvd_flow * const flow)
{
struct flow_user_data * flow_user_data;
struct nDPIsrvd_json_token const * const flow_event_name = TOKEN_GET_SZ(sock, "flow_event_name");
@@ -1120,7 +1121,7 @@ static void process_flow_stats(struct nDPIsrvd_socket * const sock, struct nDPIs
}
}
-static void process_global_stats(struct nDPIsrvd_socket * const sock)
+static void process_global_stats(struct nDPIsrvd_socket const * const sock)
{
struct nDPIsrvd_json_token const * const flow_event = TOKEN_GET_SZ(sock, "flow_event_name");
struct nDPIsrvd_json_token const * const packet_event = TOKEN_GET_SZ(sock, "packet_event_name");
@@ -1975,7 +1976,8 @@ static int mainloop(int epollfd, struct nDPIsrvd_socket * const sock)
int main(int argc, char ** argv)
{
- int retval = 1, epollfd = -1;
+ int retval = 1;
+ int epollfd = -1;
init_logging("nDPIsrvd-analysed");
diff --git a/examples/c-captured/c-captured.c b/examples/c-captured/c-captured.c
index 0729d3f19..630d22256 100644
--- a/examples/c-captured/c-captured.c
+++ b/examples/c-captured/c-captured.c
@@ -197,7 +197,7 @@ static void decode_base64(pcap_dumper_t * const pd,
static void packet_data_copy(void * dst, const void * src)
{
struct packet_data * const pd_dst = (struct packet_data *)dst;
- struct packet_data const * const pd_src = (struct packet_data *)src;
+ struct packet_data const * const pd_src = (struct packet_data const *)src;
*pd_dst = *pd_src;
if (pd_src->base64_packet != NULL && pd_src->base64_packet_size > 0)
{
@@ -224,7 +224,7 @@ static void packet_data_dtor(void * elt)
static void flow_packet_data_copy(void * dst, const void * src)
{
struct flow_packet_data * const pd_dst = (struct flow_packet_data *)dst;
- struct flow_packet_data const * const pd_src = (struct flow_packet_data *)src;
+ struct flow_packet_data const * const pd_src = (struct flow_packet_data const *)src;
*pd_dst = *pd_src;
if (pd_src->base64_packet != NULL && pd_src->base64_packet_size > 0)
{
@@ -1175,7 +1175,7 @@ static int parse_options(int argc, char ** argv)
break;
case 'R':
{
- char * value = (optarg[0] == '~' ? optarg + 1 : optarg);
+ char const * const value = (optarg[0] == '~' ? optarg + 1 : optarg);
nDPIsrvd_ull risk;
if (perror_ull(str_value_to_ull(value, &risk), "process_risky") != CONVERSION_OK)
{