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.
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);
return status;
}
- *number = parsed;
+ *number = (f_number_unsigned_t) parsed;
return F_none;
}