From 38435fab5314a442e90780eb525f4f637d340386 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Mon, 30 Sep 2024 10:38:01 +0200 Subject: [PATCH] fix code scanning alerts --- src/naemon/macros.c | 2 +- src/naemon/sretention.c | 4 ++-- src/naemon/utils.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/naemon/macros.c b/src/naemon/macros.c index 587a75a48..abcd5ece8 100644 --- a/src/naemon/macros.c +++ b/src/naemon/macros.c @@ -76,7 +76,7 @@ static const struct macro_key_code *find_macro_key(const char *name) struct macro_key_code *key; high = MACRO_X_COUNT; - while (high - low > 0) { + while (high > low) { unsigned int mid = low + ((high - low) / 2); key = ¯o_keys[mid]; value = strcmp(name, key->name); diff --git a/src/naemon/sretention.c b/src/naemon/sretention.c index d99938c7b..3d3d3d697 100644 --- a/src/naemon/sretention.c +++ b/src/naemon/sretention.c @@ -24,7 +24,7 @@ void save_state_information_eventhandler(struct nm_event_execution_properties *e int status; if (evprop->execution_type == EVENT_EXEC_NORMAL) { - schedule_event(retention_update_interval * interval_length, save_state_information_eventhandler, evprop->user_data); + schedule_event((time_t)retention_update_interval * interval_length, save_state_information_eventhandler, evprop->user_data); status = save_state_information(TRUE); @@ -44,7 +44,7 @@ int initialize_retention_data() /* add a retention data save event if needed */ if (retain_state_information == TRUE && retention_update_interval > 0) - schedule_event(retention_update_interval * interval_length, save_state_information_eventhandler, NULL); + schedule_event((time_t)retention_update_interval * interval_length, save_state_information_eventhandler, NULL); return xrddefault_initialize_retention_data(); } diff --git a/src/naemon/utils.c b/src/naemon/utils.c index 1c101f44d..2571fb677 100644 --- a/src/naemon/utils.c +++ b/src/naemon/utils.c @@ -875,11 +875,11 @@ int generate_check_stats(void) /* determine value by weighting this/last buckets... */ /* if this is the current bucket, use its full value + weighted % of last bucket */ if (x == 0) { - bucket_value = (int)(this_bucket_value + floor(last_bucket_value * last_bucket_weight)); + bucket_value = (int)(this_bucket_value + floor((double)last_bucket_value * last_bucket_weight)); } /* otherwise use weighted % of this and last bucket */ else { - bucket_value = (int)(ceil(this_bucket_value * this_bucket_weight) + floor(last_bucket_value * last_bucket_weight)); + bucket_value = (int)(ceil((double)this_bucket_value * this_bucket_weight) + floor((double)last_bucket_value * (double)last_bucket_weight)); } /* 1 minute stats */