Skip to content

Commit

Permalink
fix code scanning alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Sep 30, 2024
1 parent 3de0c89 commit bba05a2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/naemon/macros.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = &macro_keys[mid];
value = strcmp(name, key->name);
Expand Down
4 changes: 2 additions & 2 deletions src/naemon/sretention.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/naemon/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit bba05a2

Please sign in to comment.