The print formatting for status should be %llu in the event that the entire status (error bits, etc..) is printed.
There were some cases where the file is not being closed.
There were some cases where the program is missing the return statement.
}
fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.notable, context.reset, "%d", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") occurred for file '");
fl_color_print(f_type_error, context.notable, context.reset, "%s", file_name);
fl_color_print_line(f_type_error, context.error, context.reset, "'.");
if (fallback && verbosity != fake_verbosity_quiet) {
fprintf(f_type_error, "%c", f_string_eol[0]);
fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.notable, context.reset, "%d", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") in function ");
fl_color_print(f_type_error, context.notable, context.reset, "%s", function);
fl_color_print_line(f_type_error, context.error, context.reset, "().");
if (fake_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != fake_verbosity_quiet) {
fprintf(f_type_error, "%c", f_string_eol[0]);
fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.notable, context.reset, "%d", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s", function);
fl_color_print(f_type_error, context.error, context.reset, "() for section '");
if (fake_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != fake_verbosity_quiet) {
fprintf(f_type_error, "%c", f_string_eol[0]);
fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.notable, context.reset, "%d", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s", function);
fl_color_print(f_type_error, context.error, context.reset, "() for section '");
#ifndef _di_fake_print_error_file_
bool fake_print_error_file(const fl_color_context context, const uint8_t verbosity, const f_status status, const f_string function, const f_string name, const f_string operation, const bool is_file, const bool fallback) {
- f_string file_or_directory = 0;
-
- if (is_file) file_or_directory = "file";
- else file_or_directory = "directory";
+ const f_string file_or_directory = is_file ? "file" : "directory";
if (status == F_file_found_not) {
if (verbosity != fake_verbosity_quiet) {
if (fake_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != fake_verbosity_quiet) {
fprintf(f_type_error, "%c", f_string_eol[0]);
fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.notable, context.reset, "%d", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") occurred while trying to %s %s '", operation, file_or_directory);
fl_color_print(f_type_error, context.notable, context.reset, "%s", name);
fl_color_print_line(f_type_error, context.error, context.reset, "'.");
if (fake_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != fake_verbosity_quiet) {
fprintf(f_type_error, "%c", f_string_eol[0]);
fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.notable, context.reset, "%d", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") in function ");
fl_color_print(f_type_error, context.notable, context.reset, "%s", function);
fl_color_print_line(f_type_error, context.error, context.reset, "().");
if (fake_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != fake_verbosity_quiet) {
fprintf(f_type_error, "%c", f_string_eol[0]);
fl_color_print(f_type_error, context.error, context.reset, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.notable, context.reset, "%d", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") occurred while trying to %s '", operation);
fl_color_print(f_type_error, context.notable, context.reset, "%s", source);
/**
* Print file/directory error messages.
*
+ * @todo the fll_file_error_print() needs to be reviewed and possibly changed.
+ *
* @param context
* The color context.
* @param verbosity
* @param name
* The name of the file or directory.
* @param operation
- * The operation that failes, such as 'create' or 'access'.
+ * The operation that fails, such as 'create' or 'access'.
* @param is_file
* Set to TRUE if this is a file and FALSE if this is a directory.
* @param fallback
file.id = f_type_descriptor_input;
status = f_file_read(file, &data->buffer);
-
if (F_status_is_error(status)) {
fss_basic_list_read_print_file_error(data->context, "f_file_read", "-", F_status_set_fine(status));
}
status = fss_basic_list_read_main_process_file(arguments, data, "-", depths);
-
if (F_status_is_error(status)) {
macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
if (F_status_is_error(status)) {
fss_basic_list_read_print_file_error(data->context, "f_file_open", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+
macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
return status;
if (data->quantity.total == 0) {
status = f_file_size_by_id(file.id, &data->quantity.total);
-
if (F_status_is_error(status)) {
fss_basic_list_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+
+ f_file_close(&file.id);
+
macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
+ return status;
}
// Skip past empty files.
}
status = fss_basic_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[counter]], depths);
-
if (F_status_is_error(status)) {
macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
if (fll_file_error_print(f_type_error, context, function_name, file_name, status) == F_false) {
fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.notable, context.reset, "%u", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") has occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s()", function_name);
fl_color_print_line(f_type_error, context.error, context.reset, ".");
}
else {
fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.notable, context.reset, "%u", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") has occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s()", function_name);
fl_color_print(f_type_error, context.error, context.reset, "' for the parameter '");
}
status = fss_basic_read_main_process_file(arguments, data, "-", depths);
-
if (F_status_is_error(status)) {
macro_fss_basic_read_depths_delete_simple(depths);
fss_basic_read_delete_data(data);
if (F_status_is_error(status)) {
fss_basic_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+
+ f_file_close(&file.id);
+
macro_fss_basic_read_depths_delete_simple(depths);
fss_basic_read_delete_data(data);
+ return status;
}
// Skip past empty files.
}
status = fss_basic_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[counter]], depths);
-
if (F_status_is_error(status)) {
macro_fss_basic_read_depths_delete_simple(depths);
fss_basic_read_delete_data(data);
if (fll_file_error_print(f_type_error, context, function_name, file_name, status) == F_false) {
fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.notable, context.reset, "%u", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") has occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s()", function_name);
fl_color_print_line(f_type_error, context.error, context.reset, ".");
}
else {
fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.notable, context.reset, "%u", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") has occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s()", function_name);
fl_color_print(f_type_error, context.error, context.reset, "' for the parameter '");
file.id = f_type_descriptor_input;
status = f_file_read(file, &data->buffer);
-
if (F_status_is_error(status)) {
fss_extended_list_read_print_file_error(data->context, "f_file_read", "-", F_status_set_fine(status));
}
status = fss_extended_list_read_main_process_file(arguments, data, "-", depths);
-
if (F_status_is_error(status)) {
macro_fss_extended_list_read_depths_delete_simple(depths);
fss_extended_list_read_delete_data(data);
if (data->quantity.total == 0) {
status = f_file_size_by_id(file.id, &data->quantity.total);
-
if (F_status_is_error(status)) {
fss_extended_list_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+
+ f_file_close(&file.id);
+
macro_fss_extended_list_read_depths_delete_simple(depths);
fss_extended_list_read_delete_data(data);
+ return status;
}
// Skip past empty files.
if (fll_file_error_print(f_type_error, context, function_name, file_name, status) == F_false) {
fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.notable, context.reset, "%u", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") has occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s()", function_name);
fl_color_print_line(f_type_error, context.error, context.reset, ".");
}
else {
fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.notable, context.reset, "%u", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") has occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s()", function_name);
fl_color_print(f_type_error, context.error, context.reset, "' for the parameter '");
file.id = f_type_descriptor_input;
status = f_file_read(file, &data->buffer);
-
if (F_status_is_error(status)) {
fss_extended_read_print_file_error(data->context, "f_file_read", "-", F_status_set_fine(status));
}
status = fss_extended_read_main_process_file(arguments, data, "-", depths);
-
if (F_status_is_error(status)) {
macro_fss_extended_read_depths_delete_simple(depths);
fss_extended_read_delete_data(data);
if (F_status_is_error(status)) {
fss_extended_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+
+ f_file_close(&file.id);
+
macro_fss_extended_read_depths_delete_simple(depths);
fss_extended_read_delete_data(data);
+ return status;
}
// Skip past empty files.
}
status = fss_extended_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[counter]], depths);
-
if (F_status_is_error(status)) {
macro_fss_extended_read_depths_delete_simple(depths);
fss_extended_read_delete_data(data);
if (fll_file_error_print(f_type_error, context, function_name, file_name, status) == F_false) {
fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.notable, context.reset, "%u", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") has occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s()", function_name);
fl_color_print_line(f_type_error, context.error, context.reset, ".");
}
else {
fl_color_print(f_type_error, context.error, context.reset, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.notable, context.reset, "%u", status);
+ fl_color_print(f_type_error, context.notable, context.reset, "%llu", status);
fl_color_print(f_type_error, context.error, context.reset, ") has occurred while calling ");
fl_color_print(f_type_error, context.notable, context.reset, "%s()", function_name);
fl_color_print(f_type_error, context.error, context.reset, "' for the parameter '");