A bit of stale code is exposed by running the compiler with -Wall.
Example:
fake clean build -d -Wall
fake clean build -d -Wall -m clang
Using char (generally) is fine because the numbers match.
However, there tends to be specific cases and behaviors that might result in char being not treated as expected.
Explicitly cast to an (unsigned int) to play it safe.
The fwrite_unlocked() response checks were previously mass refactored to use a size check on the response.
Mistakes in this resulted in the the not operation "!" being left there resulting in a bad if condition check.
Clang warnings about not having parenthesis when using "&&" and "||".
I would argue that this is simply an ignorance or incompetence in the programmers.
The programmers should be expected to understand basic parts of a language, such as order of operations.
Rather than fight this battle, I am just adding parenthesis.
return F_none;
}
- if (character > 0x40 && character < 0x43 || character > 0x60 && character < 0x63) {
+ if ((character > 0x40 && character < 0x43) || (character > 0x60 && character < 0x63)) {
*number = 9 + (0xf & character);
return F_none;
return F_none;
}
- if (character > 0x40 && character < 0x47 || character > 0x60 && character < 0x67) {
+ if ((character > 0x40 && character < 0x47) || (character > 0x60 && character < 0x67)) {
*number = 9 + (0xf & character);
return F_none;
// 1 = add, 2 = replace, 3 = subtract.
uint8_t how = 0;
- // 0 = none, 0x1 = leading zero.
- uint8_t option = 0;
-
f_array_length_t i = 0;
- f_array_length_t j = 0;
if (code.string[0] == f_string_ascii_plus_s.string[0]) {
how = 1;
#ifndef _di_f_file_role_change_
f_status_t f_file_role_change(const f_string_static_t path, const uid_t uid, const gid_t gid, const bool dereference) {
- if (uid == -1 && gid == -1 || !path.used) {
+ if ((uid == -1 && gid == -1) || !path.used) {
return F_data_not;
}
#ifndef _di_f_file_role_change_at_
f_status_t f_file_role_change_at(const int at_id, const f_string_static_t path, const uid_t uid, const gid_t gid, const int flag) {
- if (uid == -1 && gid == -1 || !path.used) {
+ if ((uid == -1 && gid == -1) || !path.used) {
return F_data_not;
}
}
}
else {
- if (fwrite_unlocked(f_print_sequence_set_control_s[character].string, 1, f_print_sequence_set_control_s[character].used, output) == f_print_sequence_set_control_s[character].used) {
+ if (fwrite_unlocked(f_print_sequence_set_control_s[(unsigned int) character].string, 1, f_print_sequence_set_control_s[(unsigned int) character].used, output) == f_print_sequence_set_control_s[(unsigned int) character].used) {
return F_none;
}
}
* The appropriate status.
*/
static inline f_status_t private_inline_f_print_to_error(void) {
+
if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block);
if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == EDESTADDRREQ) return F_status_set_error(F_socket_not);
}
}
else {
- if (write(id, f_print_sequence_set_control_s[character].string, f_print_sequence_set_control_s[character].used) != -1) {
+ if (write(id, f_print_sequence_set_control_s[(unsigned int) character].string, f_print_sequence_set_control_s[(unsigned int) character].used) != -1) {
return F_none;
}
}
f_array_length_t start = offset;
f_array_length_t total = 0;
- f_status_t status = F_none;
f_string_static_t safe = f_string_empty_s;
uint8_t width = 0;
f_array_length_t start = offset;
f_array_length_t total = 0;
- f_status_t status = F_none;
f_string_static_t safe = f_string_empty_s;
uint8_t width = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
- f_status_t status = F_none;
f_string_static_t safe = f_string_empty_s;
uint8_t width = 0;
f_array_length_t start = i;
f_array_length_t total = 0;
- f_status_t status = F_none;
f_string_static_t safe = f_string_empty_s;
uint8_t width = 0;
#if !defined(_di_f_print_to_dynamic_raw_safely_) || !defined(_di_f_print_to_dynamic_partial_raw_safely_) || !defined(_di_f_print_to_raw_safely_)
f_status_t private_f_print_to_raw_safely(const f_string_t string, const f_array_length_t length, const int id) {
- f_status_t status = F_none;
-
register f_array_length_t i = 0;
f_array_length_t start = 0;
f_array_length_t total = 0;
#if !defined(_di_f_print_to_dynamic_safely_) || !defined(_di_f_print_to_dynamic_partial_safely_) || !defined(_di_f_print_to_safely_)
f_status_t private_f_print_to_safely(const f_string_t string, const f_array_length_t length, const int id) {
- f_status_t status = F_none;
-
register f_array_length_t i = 0;
f_array_length_t start = 0;
f_array_length_t total = 0;
return f_string_empty_s;
}
- return f_print_sequence_set_control_s[character];
+ return f_print_sequence_set_control_s[(unsigned int) character];
}
#endif // !defined(_di_f_print_character_safely_get_) || !defined(_di_f_print_dynamic_partial_safely_) || !defined(_di_f_print_dynamic_safely_) || !defined(_di_f_print_except_dynamic_partial_safely_) || !defined(_di_f_print_except_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_partial_safely_) || !defined(_di_f_print_except_in_safely_) || !defined(_di_f_print_except_safely_) || !defined(_di_f_print_safely_) || !defined(_di_f_print_safely_terminated_) || !defined(_di_f_print_to_dynamic_partial_safely_) || !defined(_di_f_print_to_dynamic_safely_) || !defined(_di_f_print_to_except_dynamic_partial_safely_) || !defined(_di_f_print_to_except_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_partial_safely_) || !defined(_di_f_print_to_except_in_safely_) || !defined(_di_f_print_to_except_safely_) || !defined(_di_f_print_to_safely_)
f_array_length_t total = 0;
f_array_length_t count = 0;
- f_status_t status = F_none;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
f_array_length_t total = 0;
f_array_length_t count = 0;
- f_status_t status = F_none;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
f_array_length_t total = 0;
f_array_length_t count = 0;
- f_status_t status = F_none;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
f_array_length_t total = 0;
f_array_length_t count = 0;
- f_status_t status = F_none;
f_string_static_t safe = f_string_static_t_initialize;
uint8_t width = 0;
#if !defined(_di_f_print_raw_safely_) || !defined(_di_f_print_raw_safely_dynamic_) || !defined(_di_f_print_raw_safely_dynamic_partial_)
f_status_t private_f_print_raw_safely(const f_string_t string, const f_array_length_t length, FILE * const output) {
- f_status_t status = F_none;
-
register f_array_length_t i = 0;
f_array_length_t start = 0;
f_array_length_t total = 0;
#if !defined(_di_f_print_safely_) || !defined(_di_f_print_safely_dynamic_) || !defined(_di_f_print_safely_dynamic_partial_)
f_status_t private_f_print_safely(const f_string_t string, const f_array_length_t length, FILE * const output) {
- f_status_t status = F_none;
-
register f_array_length_t i = 0;
f_array_length_t start = 0;
f_array_length_t total = 0;
return f_string_empty_s;
}
- return f_print_sequence_set_control_s[character[0]];
+ return f_print_sequence_set_control_s[(unsigned int) character[0]];
}
#endif // !defined(_di_f_print_character_safely_get_) || !defined(_di_f_print_dynamic_partial_safely_) || !defined(_di_f_print_dynamic_safely_) || !defined(_di_f_print_except_dynamic_partial_safely_) || !defined(_di_f_print_except_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_partial_safely_) || !defined(_di_f_print_except_in_safely_) || !defined(_di_f_print_except_safely_) || !defined(_di_f_print_safely_) || !defined(_di_f_print_safely_terminated_) || !defined(_di_f_print_to_dynamic_partial_safely_) || !defined(_di_f_print_to_dynamic_safely_) || !defined(_di_f_print_to_except_dynamic_partial_safely_) || !defined(_di_f_print_to_except_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_partial_safely_) || !defined(_di_f_print_to_except_in_safely_) || !defined(_di_f_print_to_except_safely_) || !defined(_di_f_print_to_safely_)
struct dirent **entity = 0;
- f_array_length_t size = 0;
f_status_t status = F_none;
DIR *parent = opendir(path.string);
f_string_static_t name_directory = f_string_static_t_initialize;
f_string_dynamics_t *names = 0;
- f_array_length_t total = 0;
struct stat file_stat;
int mode = 0;
size_t i = 0;
}
}
else {
- const f_array_lengths_t except_at = f_array_lengths_t_initialize;
- const f_string_ranges_t except_in = f_string_ranges_t_initialize;
-
if (partial.start > partial.stop) {
*status = F_data_not;
}
}
else {
- const f_array_lengths_t except_at = f_array_lengths_t_initialize;
- const f_string_ranges_t except_in = va_arg(apl, f_string_ranges_t);
-
if (partial.start > partial.stop) {
*status = F_data_not;
i += macro_f_utf_byte_width(string[i]);
} // while
- f_string_t s = 0;
-
while (i < length) {
while (at < except_at.used && except_at.array[at] < i) {
i += macro_f_utf_byte_width(string[i]);
} // while
- f_string_t s = 0;
-
while (i < length) {
while (at < except_at.used && except_at.array[at] < i) {
status = f_utf_is_whitespace(string + j, (length - j) + 1);
- if (F_status_is_error(status) || status == F_false && string[i]) break;
+ if (F_status_is_error(status) || (status == F_false && string[i])) break;
} // while
if (j == length) break;
f_status_t status = F_none;
- f_string_t s = 0;
-
// Skip past leading whitespace.
while (i < length) {
status = f_utf_is_whitespace(string + j, (length - j) + 1);
- if (F_status_is_error(status) || status == F_false && string[i]) break;
+ if (F_status_is_error(status) || (status == F_false && string[i])) break;
} // while
if (j == length || status == F_true) break;
}
if (i + macro_f_utf_byte_width(string[i]) >= length) {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
}
}
else {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
}
}
if (status == F_false || i + macro_f_utf_byte_width(string[i]) >= length) {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
f_status_t status = F_none;
- f_string_t s = 0;
-
// Skip past leading whitespace.
while (i < length) {
status = f_utf_is_whitespace(string + j, (length - j) + 1);
- if (F_status_is_error(status) || status == F_false && string[i]) break;
+ if (F_status_is_error(status) || (status == F_false && string[i])) break;
} // while
if (j == length || status == F_true || !string[i]) break;
}
if (i + macro_f_utf_byte_width(string[i]) >= length) {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
}
}
else {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
}
}
if (status == F_false || i + macro_f_utf_byte_width(string[i]) >= length) {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
i += macro_f_utf_byte_width(string[i]);
} // while
- f_string_t s = 0;
-
while (i < length) {
status = f_utf_is_whitespace(string + i, (length - i) + 1);
i += macro_f_utf_byte_width(string[i]);
} // while
- f_string_t s = 0;
-
while (i < length) {
status = f_utf_is_whitespace(string + i, (length - i) + 1);
status = f_utf_is_whitespace(string + j, (length - j) + 1);
- if (F_status_is_error(status) || status == F_false && string[i]) break;
+ if (F_status_is_error(status) || (status == F_false && string[i])) break;
} // while
if (j == length) break;
f_status_t status = F_none;
- f_string_t s = 0;
-
// Skip past leading whitespace.
while (i < length) {
status = f_utf_is_whitespace(string + j, (length - j) + 1);
- if (F_status_is_error(status) || status == F_false && string[i]) break;
+ if (F_status_is_error(status) || (status == F_false && string[i])) break;
} // while
if (j == length || status == F_true) break;
while (i < j) {
if (i + macro_f_utf_byte_width(string[i]) >= length) {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
}
}
else {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
}
}
if (status == F_false || i + macro_f_utf_byte_width(string[i]) >= length) {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
f_status_t status = F_none;
- f_string_t s = 0;
-
// Skip past leading whitespace.
while (i < length) {
status = f_utf_is_whitespace(string + j, (length - j) + 1);
- if (F_status_is_error(status) || status == F_false && string[i]) break;
+ if (F_status_is_error(status) || (status == F_false && string[i])) break;
} // while
if (j == length || status == F_true || !string[i]) break;
while (i < j) {
if (i + macro_f_utf_byte_width(string[i]) >= length) {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
}
}
else {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
}
}
if (status == F_false || i + macro_f_utf_byte_width(string[i]) >= length) {
- if (!fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
+ if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, stream) < f_print_sequence_unknown_s.used) {
return F_status_set_error(F_output);
}
f_array_length_t i1 = offset1;
f_array_length_t i2 = offset2;
- f_string_static_t debug1;
- debug1.string = string1 + offset1;
- debug1.used = (stop1 - offset1) + 1;
-
- f_string_static_t debug2;
- debug2.string = string2 + offset2;
- debug2.used = (stop2 - offset2) + 1;
-
uint8_t width = 0;
f_array_length_t width_max = 0;
f_status_t status = F_none;
private_fll_execute_path_arguments_fixate(program.used ? program : arguments.array[0], arguments, last_slash, !program.used, program_name, fixed_arguments);
// Determine full path when the environment is to be cleared or full path is explicitly requested.
- if (parameter && parameter->environment || parameter && (parameter->option & FL_execute_parameter_option_path_d)) {
+ if ((parameter && parameter->environment) || (parameter && (parameter->option & FL_execute_parameter_option_path_d))) {
f_string_dynamic_t path = f_string_dynamic_t_initialize;
f_string_dynamics_t paths = f_string_dynamics_t_initialize;
f_string_dynamic_t *found = 0;
#endif // _di_level_2_parameter_checking_
f_status_t status = F_none;
- f_status_t status2 = F_none;
f_array_length_t initial_used = 0;
bool found_data = F_false;
return F_interrupt_not;
}
- fll_program_data_t *main = (fll_program_data_t *) state_ptr->custom;
+ fll_program_data_t *data = (fll_program_data_t *) state_ptr->custom;
- main->signal_received = fll_program_standard_signal_received(main);
+ data->signal_received = fll_program_standard_signal_received(data);
- if (main->signal_received == F_signal_abort || main->signal_received == F_signal_broken_pipe || main->signal_received == F_signal_hangup || main->signal_received == F_signal_interrupt || main->signal_received == F_signal_quit || main->signal_received == F_signal_termination) {
+ if (data->signal_received == F_signal_abort || data->signal_received == F_signal_broken_pipe || data->signal_received == F_signal_hangup || data->signal_received == F_signal_interrupt || data->signal_received == F_signal_quit || data->signal_received == F_signal_termination) {
return F_status_set_error(F_interrupt);
}