From: Kevin Day Date: Sat, 19 Feb 2022 04:59:24 +0000 (-0600) Subject: Cleanup: Use signed type and cast to unsigned. X-Git-Tag: 0.5.8~25 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=efdc9f6726d94e2805f3fb6a580f62f3b1bcc813;p=fll Cleanup: Use signed type and cast to unsigned. This situation is exposed by a warning from the CLang compiler. The warning makes sense, so the code is changed to a signed type and then cast. The negative value should never make it to the assignment if the preceding if condition properly catches it as intended. --- diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index e7e52db..03cb8e1 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -685,7 +685,7 @@ extern "C" { f_status_t controller_rule_action_read_rerun_number(const controller_global_t global, const f_string_t name, controller_cache_t * const cache, f_array_length_t * const index, f_number_unsigned_t * const number) { f_status_t status = F_none; - f_number_unsigned_t parsed = 0; + f_number_signed_t parsed = 0; if (*index + 1 == cache->content_action.used) { status = F_status_set_error(F_valid_not); @@ -744,7 +744,7 @@ extern "C" { return status; } - *number = parsed; + *number = (f_number_unsigned_t) parsed; return F_none; }