From 263edc39b89d386705b6944e10bb909468fabe09 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 25 Jul 2023 23:18:47 -0500 Subject: [PATCH] Update: Minor fixes and consistency changes. Fix some small things that I noticed while I was migrating the byte_dump program. --- level_3/control/c/common.c | 2 +- level_3/control/c/common.h | 2 +- level_3/control/c/control.c | 2 +- level_3/controller/c/common.c | 2 +- level_3/controller/c/common.h | 2 +- level_3/controller/c/controller.c | 2 +- level_3/fake/c/main/common.c | 2 +- level_3/fake/c/main/make/print/error.c | 15 +++++++++++ level_3/fake/c/main/print/error.c | 12 ++++----- level_3/fake/c/main/signal.c | 6 ++--- level_3/firewall/c/common.c | 2 +- level_3/firewall/c/common.h | 2 +- level_3/firewall/c/firewall.c | 2 +- level_3/fss_embedded_list_read/c/common.c | 2 +- level_3/fss_embedded_list_read/c/common.h | 2 +- .../c/fss_embedded_list_read.c | 2 +- level_3/fss_identify/c/main/common.c | 2 +- level_3/fss_identify/c/main/common/enumeration.h | 2 +- level_3/fss_identify/c/main/print/data.c | 4 +-- level_3/fss_identify/c/main/print/error.c | 7 +++-- level_3/fss_identify/c/main/signal.c | 6 ++--- level_3/fss_read/c/main/common.c | 4 +-- level_3/fss_read/c/main/signal.c | 6 ++--- level_3/fss_write/c/main/common.c | 2 +- level_3/fss_write/c/main/signal.c | 6 ++--- level_3/iki_read/c/main/common.c | 2 +- level_3/iki_read/c/main/signal.c | 6 ++--- level_3/iki_write/c/main/common.c | 2 +- level_3/iki_write/c/main/signal.c | 6 ++--- level_3/status_code/c/main/common.c | 2 +- level_3/status_code/c/main/signal.c | 6 ++--- level_3/utf8/c/main/common.c | 3 ++- level_3/utf8/c/main/print/data.c | 30 +++++++++++----------- level_3/utf8/c/main/print/error.c | 12 ++++++--- level_3/utf8/c/main/signal.c | 6 ++--- 35 files changed, 90 insertions(+), 83 deletions(-) diff --git a/level_3/control/c/common.c b/level_3/control/c/common.c index bedb7c2..a08cbf2 100644 --- a/level_3/control/c/common.c +++ b/level_3/control/c/common.c @@ -190,7 +190,7 @@ extern "C" { setting->state.step_small = control_write_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->parameters.array[control_parameter_line_first_no_e].result & f_console_result_found_e) { setting->flag -= setting->flag & control_main_flag_print_first_e; } diff --git a/level_3/control/c/common.h b/level_3/control/c/common.h index 9f62841..d3f1cd0 100644 --- a/level_3/control/c/common.h +++ b/level_3/control/c/common.h @@ -201,8 +201,8 @@ extern "C" { * - copyright: Print copyright. * - file_from: Using a specified source file. * - file_to: Using a specified destination file. - * - help: Print help. * - header: Enable printing of headers. + * - help: Print help. * - print_first: When set, print new line to message output on program begin after loading settings. * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index c5bf299..3774ccb 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -30,7 +30,7 @@ extern "C" { choices.array = choices_array; choices.used = 3; - const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; + static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c index bd90f0c..1d6f326 100644 --- a/level_3/controller/c/common.c +++ b/level_3/controller/c/common.c @@ -622,7 +622,7 @@ extern "C" { main->setting.state.step_small = controller_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[controller_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & controller_main_flag_print_first_e; } diff --git a/level_3/controller/c/common.h b/level_3/controller/c/common.h index 5a1b495..3bed915 100644 --- a/level_3/controller/c/common.h +++ b/level_3/controller/c/common.h @@ -459,8 +459,8 @@ extern "C" { * - copyright: Print copyright. * - file_from: Using a specified source file. * - file_to: Using a specified destination file. - * - help: Print help. * - header: Enable printing of headers. + * - help: Print help. * - print_first: When set, print new line to message output on program begin after loading settings. * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 854bc36..b23727a 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -35,7 +35,7 @@ extern "C" { choices.array = choices_array; choices.used = 3; - const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; + static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); diff --git a/level_3/fake/c/main/common.c b/level_3/fake/c/main/common.c index e793313..3e830c9 100644 --- a/level_3/fake/c/main/common.c +++ b/level_3/fake/c/main/common.c @@ -25,7 +25,7 @@ extern "C" { main->setting.state.step_small = step_original; } - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[fake_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fake_main_flag_print_first_e; } diff --git a/level_3/fake/c/main/make/print/error.c b/level_3/fake/c/main/make/print/error.c index c51be3a..af083a1 100644 --- a/level_3/fake/c/main/make/print/error.c +++ b/level_3/fake/c/main/make/print/error.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_fake_make_print_error_argument_invalid_section_ f_status_t fake_make_print_error_argument_invalid_section(fl_print_t * const print, const f_string_static_t name) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_print_context_wrapped_variable(print, "The argument ", name, " is not a valid section name"); @@ -18,6 +19,7 @@ extern "C" { #ifndef _di_fake_make_print_error_compiler_not_specified_ f_status_t fake_make_print_error_compiler_not_specified(fl_print_t * const print, const f_string_static_t action) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_print_context_wrapped_variable(print, "No compiler has been specified, cannot perform ", action, " section operation"); @@ -29,6 +31,7 @@ extern "C" { #ifndef _di_fake_make_print_error_content_not_directory_ f_status_t fake_make_print_error_content_not_directory(fl_print_t * const print, const f_string_t content, const f_string_static_t file) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); @@ -46,6 +49,7 @@ extern "C" { #ifndef _di_fake_make_print_error_define_name_empty_ f_status_t fake_make_print_error_define_name_empty(fl_print_t * const print) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_print_context_simple(print, "Define name must not be an empty string"); @@ -57,6 +61,7 @@ extern "C" { #ifndef _di_fake_make_print_error_define_invalid_character_ f_status_t fake_make_print_error_define_invalid_character(fl_print_t * const print, const f_string_static_t name) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_print_context_wrapped_variable(print, "Invalid characters in the define name ", name, ", only alpha-numeric ASCII characters and underscore (without a leading digit) are allowed"); @@ -68,6 +73,7 @@ extern "C" { #ifndef _di_fake_make_print_error_fakefile_section_missing_ f_status_t fake_make_print_error_fakefile_section_missing(fl_print_t * const print, const f_string_static_t fakefile, const f_string_static_t section) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); @@ -87,6 +93,7 @@ extern "C" { #ifndef _di_fake_make_print_error_file_name_empty_ f_status_t fake_make_print_error_file_name_empty(fl_print_t * const print) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_print_context_simple(print, "File name argument must not be an empty string"); @@ -98,6 +105,7 @@ extern "C" { #ifndef _di_fake_make_print_error_file_type_ f_status_t fake_make_print_error_file_type(fl_print_t * const print, const f_string_static_t type, const f_string_static_t file) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); @@ -115,6 +123,7 @@ extern "C" { #ifndef _di_fake_make_print_error_indexer_not_specified_ f_status_t fake_make_print_error_indexer_not_specified(fl_print_t * const print, const f_string_static_t action) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_print_context_wrapped_variable(print, "No indexer has been specified, cannot perform ", action, " section operation"); @@ -126,6 +135,7 @@ extern "C" { #ifndef _di_fake_make_print_error_after_condition_ f_status_t fake_make_print_error_after_condition(fl_print_t * const print, const f_string_t message) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); @@ -147,6 +157,7 @@ extern "C" { #ifndef _di_fake_make_print_error_after_condition_may_only_ f_status_t fake_make_print_error_after_condition_may_only(fl_print_t * const print) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_make_print_error_after_condition(print, "May only be used immediately after"); @@ -158,6 +169,7 @@ extern "C" { #ifndef _di_fake_make_print_error_after_condition_must_not_ f_status_t fake_make_print_error_after_condition_must_not(fl_print_t * const print) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_make_print_error_after_condition(print, "Must not be used immediately after"); @@ -169,6 +181,7 @@ extern "C" { #ifndef _di_fake_make_print_error_after_condition_no_preceding_ f_status_t fake_make_print_error_after_condition_no_preceding(fl_print_t * const print) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_make_print_error_after_condition(print, "Has no preceding"); @@ -180,6 +193,7 @@ extern "C" { #ifndef _di_fake_make_print_error_operation_incomplete_ f_status_t fake_make_print_error_operation_incomplete(fl_print_t * const print, const uint8_t operation) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); @@ -210,6 +224,7 @@ extern "C" { #ifndef _di_fake_make_print_error_operation_recursion_ f_status_t fake_make_print_error_operation_recursion(fl_print_t * const print, const f_string_static_t buffer, const f_string_range_t range) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); diff --git a/level_3/fake/c/main/print/error.c b/level_3/fake/c/main/print/error.c index e9f5a24..ee39978 100644 --- a/level_3/fake/c/main/print/error.c +++ b/level_3/fake/c/main/print/error.c @@ -342,7 +342,7 @@ extern "C" { #ifndef _di_fake_print_error_fss_ f_status_t fake_print_error_fss(fl_print_t * const print, const f_string_t function, const f_string_static_t path_file, const f_string_range_t range, const bool fallback) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_main_t * const main = (fake_main_t *) print->custom; @@ -452,7 +452,7 @@ extern "C" { #ifndef _di_fake_print_error_operation_failed_ f_status_t fake_print_error_operation_failed(fl_print_t * const print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_main_t * const main = (fake_main_t *) print->custom; @@ -529,7 +529,7 @@ extern "C" { #ifndef _di_fake_print_error_operation_path_outside_ f_status_t fake_print_error_operation_path_outside(fl_print_t * const print, const f_string_t function, const f_string_static_t path) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_verbose_e) return F_output_not; fake_main_t * const main = (fake_main_t *) print->custom; @@ -548,7 +548,7 @@ extern "C" { #ifndef _di_fake_print_error_operation_path_stack_max_ f_status_t fake_print_error_operation_path_stack_max(fl_print_t * const print, const f_string_t function, const f_string_static_t path) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_main_t * const main = (fake_main_t *) print->custom; @@ -580,7 +580,7 @@ extern "C" { #ifndef _di_fake_print_error_operation_stack_max_ f_status_t fake_print_error_operation_stack_max(fl_print_t * const print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_number_unsigned_t stack_max) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_main_t * const main = (fake_main_t *) print->custom; @@ -613,7 +613,7 @@ extern "C" { #ifndef _di_fake_print_error_operation_unknown_ f_status_t fake_print_error_operation_unknown(fl_print_t * const print, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fake_main_t * const main = (fake_main_t *) print->custom; diff --git a/level_3/fake/c/main/signal.c b/level_3/fake/c/main/signal.c index 1d774c3..cfff1e8 100644 --- a/level_3/fake/c/main/signal.c +++ b/level_3/fake/c/main/signal.c @@ -7,8 +7,7 @@ extern "C" { #if !defined(_di_fake_signal_check_) && defined(_di_thread_support_) f_status_t fake_signal_check(fake_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (!((++main->program.signal_check) % fake_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { @@ -29,8 +28,7 @@ extern "C" { #if !defined(_di_fake_signal_check_) && !defined(_di_thread_support_) f_status_t fake_signal_check(fake_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/firewall/c/common.c b/level_3/firewall/c/common.c index 2b2694d..088b29d 100644 --- a/level_3/firewall/c/common.c +++ b/level_3/firewall/c/common.c @@ -121,7 +121,7 @@ extern "C" { main->setting.state.status = f_console_parameter_process(state, arguments, &main->program.parameters, &main->setting.state, 0); - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[firewall_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & firewall_main_flag_print_first_e; } diff --git a/level_3/firewall/c/common.h b/level_3/firewall/c/common.h index 550113b..3ba3a3a 100644 --- a/level_3/firewall/c/common.h +++ b/level_3/firewall/c/common.h @@ -414,8 +414,8 @@ extern "C" { * - none: No flags set. * - file_from: Using a specified source file. * - file_to: Using a specified destination file. - * - help: Print help. * - header: Enable printing of headers. + * - help: Print help. * - print_first: When set, print new line to message output on program begin after loading settings. * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 2b1552f..94ad055 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -35,7 +35,7 @@ extern "C" { choices.array = choices_array; choices.used = 3; - const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; + static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); diff --git a/level_3/fss_embedded_list_read/c/common.c b/level_3/fss_embedded_list_read/c/common.c index 48bd9c4..0cf42a1 100644 --- a/level_3/fss_embedded_list_read/c/common.c +++ b/level_3/fss_embedded_list_read/c/common.c @@ -79,7 +79,7 @@ extern "C" { main->setting.state.step_small = fss_embedded_list_read_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[fss_embedded_list_read_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_embedded_list_read_main_flag_print_first_e; } diff --git a/level_3/fss_embedded_list_read/c/common.h b/level_3/fss_embedded_list_read/c/common.h index 4ac3f94..4758a57 100644 --- a/level_3/fss_embedded_list_read/c/common.h +++ b/level_3/fss_embedded_list_read/c/common.h @@ -293,8 +293,8 @@ extern "C" { * - copyright: Print copyright. * - file_from: Using a specified source file. * - file_to: Using a specified destination file. - * - help: Print help. * - header: Enable printing of headers. + * - help: Print help. * - print_first: When set, print new line to message output on program begin after loading settings. * - print_last: When set, print new line to message output on program end. * - separate: Enable printing of separators. diff --git a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c index b01be29..0e38380 100644 --- a/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c +++ b/level_3/fss_embedded_list_read/c/fss_embedded_list_read.c @@ -30,7 +30,7 @@ extern "C" { choices.array = choices_array; choices.used = 3; - const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; + static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); diff --git a/level_3/fss_identify/c/main/common.c b/level_3/fss_identify/c/main/common.c index 543c936..c989648 100644 --- a/level_3/fss_identify/c/main/common.c +++ b/level_3/fss_identify/c/main/common.c @@ -15,7 +15,7 @@ extern "C" { main->setting.state.step_small = fss_identify_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[fss_identify_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_identify_main_flag_print_first_e; } diff --git a/level_3/fss_identify/c/main/common/enumeration.h b/level_3/fss_identify/c/main/common/enumeration.h index cfd9ed4..e246821 100644 --- a/level_3/fss_identify/c/main/common/enumeration.h +++ b/level_3/fss_identify/c/main/common/enumeration.h @@ -25,8 +25,8 @@ extern "C" { * - copyright: Print copyright. * - file_from: Using a specified source file. * - file_to: Using a specified destination file. (Not used at this time.) - * - help: Print help. * - header: Enable printing of headers. + * - help: Print help. * - line: Print only the identifier at a given line. * - name: Select using this full or partial type name or code. * - object: Use the object (The "FSS" part of "FSS-0000"). diff --git a/level_3/fss_identify/c/main/print/data.c b/level_3/fss_identify/c/main/print/data.c index 5b5fab2..ce09d5b 100644 --- a/level_3/fss_identify/c/main/print/data.c +++ b/level_3/fss_identify/c/main/print/data.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fss_identify_print_data_id_ f_status_t fss_identify_print_data_id(fl_print_t * const print, const f_fll_id_t id) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); fss_identify_main_t * const main = (fss_identify_main_t *) print->custom; @@ -36,7 +36,7 @@ extern "C" { #ifndef _di_fss_identify_print_data_total_ f_status_t fss_identify_print_data_total(fl_print_t * const print) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); fss_identify_main_t * const main = (fss_identify_main_t *) print->custom; diff --git a/level_3/fss_identify/c/main/print/error.c b/level_3/fss_identify/c/main/print/error.c index 4695f36..d3b6a2a 100644 --- a/level_3/fss_identify/c/main/print/error.c +++ b/level_3/fss_identify/c/main/print/error.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_fss_identify_print_error_ f_status_t fss_identify_print_error(fl_print_t * const print, const f_string_t function) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fll_error_print(print, F_status_set_fine(((fss_identify_main_t *) print->custom)->setting.state.status), function, fll_error_file_flag_fallback_e); @@ -19,7 +19,7 @@ extern "C" { #ifndef _di_fss_identify_print_error_file_ f_status_t fss_identify_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fss_identify_main_t * const main = (fss_identify_main_t *) print->custom; @@ -33,6 +33,7 @@ extern "C" { #ifndef _di_fss_identify_print_error_no_from_ f_status_t fss_identify_print_error_no_from(fl_print_t * const print) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fll_print_format("%[%QNo sources are specified, please pipe data or designate a file.%]%r", print->to, print->set->error, print->prefix, print->set->error, f_string_eol_s); @@ -44,6 +45,7 @@ extern "C" { #ifndef _di_fss_identify_print_error_parameter_file_name_empty_ f_status_t fss_identify_print_error_parameter_file_name_empty(fl_print_t * const print, const f_number_unsigned_t index) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); @@ -63,6 +65,7 @@ extern "C" { #ifndef _di_fss_identify_print_error_parameter_file_name_invalid_ f_status_t fss_identify_print_error_parameter_file_name_invalid(fl_print_t * const print, const f_number_unsigned_t index, const f_string_static_t name) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); diff --git a/level_3/fss_identify/c/main/signal.c b/level_3/fss_identify/c/main/signal.c index 34774ee..2faad5c 100644 --- a/level_3/fss_identify/c/main/signal.c +++ b/level_3/fss_identify/c/main/signal.c @@ -7,8 +7,7 @@ extern "C" { #if !defined(_di_fss_identify_signal_check_) && defined(_di_thread_support_) f_status_t fss_identify_signal_check(fss_identify_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (!((++main->program.signal_check) % fss_identify_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { @@ -29,8 +28,7 @@ extern "C" { #if !defined(_di_fss_identify_signal_check_) && !defined(_di_thread_support_) f_status_t fss_identify_signal_check(fss_identify_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/fss_read/c/main/common.c b/level_3/fss_read/c/main/common.c index a945069..75d88ba 100644 --- a/level_3/fss_read/c/main/common.c +++ b/level_3/fss_read/c/main/common.c @@ -53,7 +53,7 @@ extern "C" { main->setting.state.step_small = fss_read_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (parameters->array[fss_read_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_read_main_flag_print_first_e; } @@ -87,7 +87,7 @@ extern "C" { choices.array = choices_array; choices.used = 3; - const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; + static const uint8_t modes[3] = { f_color_mode_not_e, f_color_mode_light_e, f_color_mode_dark_e }; main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program); diff --git a/level_3/fss_read/c/main/signal.c b/level_3/fss_read/c/main/signal.c index c4fa721..fa651f9 100644 --- a/level_3/fss_read/c/main/signal.c +++ b/level_3/fss_read/c/main/signal.c @@ -7,8 +7,7 @@ extern "C" { #if !defined(_di_fss_read_signal_check_) && defined(_di_thread_support_) f_status_t fss_read_signal_check(fss_read_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (!((++main->program.signal_check) % fss_read_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { @@ -29,8 +28,7 @@ extern "C" { #if !defined(_di_fss_read_signal_check_) && !defined(_di_thread_support_) f_status_t fss_read_signal_check(fss_read_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/fss_write/c/main/common.c b/level_3/fss_write/c/main/common.c index dfcce31..afed4a6 100644 --- a/level_3/fss_write/c/main/common.c +++ b/level_3/fss_write/c/main/common.c @@ -15,7 +15,7 @@ extern "C" { main->setting.state.step_small = fss_write_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[fss_write_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & fss_write_main_flag_print_first_e; } diff --git a/level_3/fss_write/c/main/signal.c b/level_3/fss_write/c/main/signal.c index f04c28f..6e17e58 100644 --- a/level_3/fss_write/c/main/signal.c +++ b/level_3/fss_write/c/main/signal.c @@ -7,8 +7,7 @@ extern "C" { #if !defined(_di_fss_write_signal_check_) && defined(_di_thread_support_) f_status_t fss_write_signal_check(fss_write_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (!((++main->program.signal_check) % fss_write_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { @@ -29,8 +28,7 @@ extern "C" { #if !defined(_di_fss_write_signal_check_) && !defined(_di_thread_support_) f_status_t fss_write_signal_check(fss_write_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/iki_read/c/main/common.c b/level_3/iki_read/c/main/common.c index e3c5f31..0505667 100644 --- a/level_3/iki_read/c/main/common.c +++ b/level_3/iki_read/c/main/common.c @@ -15,7 +15,7 @@ extern "C" { main->setting.state.step_small = iki_read_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[iki_read_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & iki_read_main_flag_print_first_e; } diff --git a/level_3/iki_read/c/main/signal.c b/level_3/iki_read/c/main/signal.c index f5b2bb3..4fe029a 100644 --- a/level_3/iki_read/c/main/signal.c +++ b/level_3/iki_read/c/main/signal.c @@ -7,8 +7,7 @@ extern "C" { #if !defined(_di_iki_read_signal_check_) && defined(_di_thread_support_) f_status_t iki_read_signal_check(iki_read_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (!((++main->program.signal_check) % iki_read_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { @@ -29,8 +28,7 @@ extern "C" { #if !defined(_di_iki_read_signal_check_) && !defined(_di_thread_support_) f_status_t iki_read_signal_check(iki_read_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/iki_write/c/main/common.c b/level_3/iki_write/c/main/common.c index eb5ec9b..75fd984 100644 --- a/level_3/iki_write/c/main/common.c +++ b/level_3/iki_write/c/main/common.c @@ -15,7 +15,7 @@ extern "C" { main->setting.state.step_small = iki_write_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[iki_write_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & iki_write_main_flag_print_first_e; } diff --git a/level_3/iki_write/c/main/signal.c b/level_3/iki_write/c/main/signal.c index 1c91ca4..39cb1ee 100644 --- a/level_3/iki_write/c/main/signal.c +++ b/level_3/iki_write/c/main/signal.c @@ -7,8 +7,7 @@ extern "C" { #if !defined(_di_iki_write_signal_check_) && defined(_di_thread_support_) f_status_t iki_write_signal_check(iki_write_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (!((++main->program.signal_check) % iki_write_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { @@ -29,8 +28,7 @@ extern "C" { #if !defined(_di_iki_write_signal_check_) && !defined(_di_thread_support_) f_status_t iki_write_signal_check(iki_write_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/status_code/c/main/common.c b/level_3/status_code/c/main/common.c index e3fae1a..4f18971 100644 --- a/level_3/status_code/c/main/common.c +++ b/level_3/status_code/c/main/common.c @@ -15,7 +15,7 @@ extern "C" { main->setting.state.step_small = status_code_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[status_code_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & status_code_main_flag_print_first_e; } diff --git a/level_3/status_code/c/main/signal.c b/level_3/status_code/c/main/signal.c index 3a15462..63d5e66 100644 --- a/level_3/status_code/c/main/signal.c +++ b/level_3/status_code/c/main/signal.c @@ -7,8 +7,7 @@ extern "C" { #if !defined(_di_status_code_signal_check_) && defined(_di_thread_support_) f_status_t status_code_signal_check(status_code_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (!((++main->program.signal_check) % status_code_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { @@ -29,8 +28,7 @@ extern "C" { #if !defined(_di_status_code_signal_check_) && !defined(_di_thread_support_) f_status_t status_code_signal_check(status_code_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); diff --git a/level_3/utf8/c/main/common.c b/level_3/utf8/c/main/common.c index e09863f..565b468 100644 --- a/level_3/utf8/c/main/common.c +++ b/level_3/utf8/c/main/common.c @@ -15,7 +15,7 @@ extern "C" { main->setting.state.step_small = utf8_allocation_small_d; - // Identify and pocess first/last parameters. + // Identify and process first/last parameters. if (main->program.parameters.array[utf8_parameter_line_first_no_e].result & f_console_result_found_e) { main->setting.flag -= main->setting.flag & utf8_main_flag_print_first_e; } @@ -91,6 +91,7 @@ extern "C" { uint16_t choices_array[2] = { utf8_parameter_from_bytesequence_e, utf8_parameter_from_codepoint_e }; choices.array = choices_array; choices.used = 2; + choice = 0; main->setting.state.status = f_console_parameter_prioritize_right(main->program.parameters, choices, &choice); diff --git a/level_3/utf8/c/main/print/data.c b/level_3/utf8/c/main/print/data.c index 0cd577d..2bba316 100644 --- a/level_3/utf8/c/main/print/data.c +++ b/level_3/utf8/c/main/print/data.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_utf8_print_data_bytesequence_ f_status_t utf8_print_data_bytesequence(fl_print_t * const print, const f_string_static_t sequence) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -20,7 +20,7 @@ extern "C" { #ifndef _di_utf8_print_data_character_invalid_ f_status_t utf8_print_data_character_invalid(fl_print_t * const print, const f_string_static_t invalid) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -53,7 +53,7 @@ extern "C" { #ifndef _di_utf8_print_data_codepoint_ f_status_t utf8_print_data_codepoint(fl_print_t * const print, const uint32_t codepoint) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -74,7 +74,7 @@ extern "C" { #ifndef _di_utf8_print_data_combining_or_width_ f_status_t utf8_print_data_combining_or_width(fl_print_t * const print, const f_string_static_t sequence) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -112,7 +112,7 @@ extern "C" { #ifndef _di_utf8_print_data_combining_or_width_invalid_ f_status_t utf8_print_data_combining_or_width_invalid(fl_print_t * const print) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -127,7 +127,7 @@ extern "C" { #ifndef _di_utf8_print_data_raw_bytesequence_ f_status_t utf8_print_data_raw_bytesequence(fl_print_t * const print, const f_utf_char_t raw, const uint8_t width) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -172,7 +172,7 @@ extern "C" { #ifndef _di_utf8_print_data_raw_codepoint_ f_status_t utf8_print_data_raw_codepoint(fl_print_t * const print, const f_string_static_t raw) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -187,7 +187,7 @@ extern "C" { #ifndef _di_utf8_print_data_raw_combining_or_width_ f_status_t utf8_print_data_raw_combining_or_width(fl_print_t * const print, const uint8_t width) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -230,7 +230,7 @@ extern "C" { #ifndef _di_utf8_print_data_section_header_file_ f_status_t utf8_print_data_section_header_file(fl_print_t * const print, const f_string_static_t name, const f_number_unsigned_t index) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -263,7 +263,7 @@ extern "C" { #ifndef _di_utf8_print_data_section_header_parameter_ f_status_t utf8_print_data_section_header_parameter(fl_print_t * const print, const f_number_unsigned_t index) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -295,7 +295,7 @@ extern "C" { #ifndef _di_utf8_print_data_section_header_pipe_ f_status_t utf8_print_data_section_header_pipe(fl_print_t * const print) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -313,7 +313,7 @@ extern "C" { #ifndef _di_utf8_print_data_width_ f_status_t utf8_print_data_width(fl_print_t * const print, const f_string_static_t sequence) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_status_t status = f_utf_is_wide(sequence.string, sequence.used); @@ -323,7 +323,7 @@ extern "C" { if (status == F_true) { fl_print_format("%r%r%r", print->to, main->setting.prepend, utf8_string_width_2_s, main->setting.append); - return F_output_not; + return F_none; } if (status == F_false) { @@ -332,13 +332,13 @@ extern "C" { if (status == F_true) { fl_print_format("%r%r%r", print->to, main->setting.prepend, utf8_string_width_1_s, main->setting.append); - return F_output_not; + return F_none; } if (status == F_false) { fl_print_format("%r%r%r", print->to, main->setting.prepend, utf8_string_width_0_s, main->setting.append); - return F_output_not; + return F_none; } } diff --git a/level_3/utf8/c/main/print/error.c b/level_3/utf8/c/main/print/error.c index f9b73fb..7907e5d 100644 --- a/level_3/utf8/c/main/print/error.c +++ b/level_3/utf8/c/main/print/error.c @@ -7,7 +7,7 @@ extern "C" { #ifndef _di_utf8_print_error_ f_status_t utf8_print_error(fl_print_t * const print, const f_string_t function) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fll_error_print(print, F_status_set_fine(((utf8_main_t *) print->custom)->setting.state.status), function, fll_error_file_flag_fallback_e); @@ -19,7 +19,7 @@ extern "C" { #ifndef _di_utf8_print_error_decode_ f_status_t utf8_print_error_decode(fl_print_t * const print, const f_string_static_t invalid) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -60,7 +60,7 @@ extern "C" { #ifndef _di_utf8_print_error_encode_ f_status_t utf8_print_error_encode(fl_print_t * const print, const uint32_t codepoint) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -86,7 +86,7 @@ extern "C" { #ifndef _di_utf8_print_error_file_ f_status_t utf8_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) { - if (!print->custom) return F_status_set_error(F_output_not); + if (!print || !print->custom) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; utf8_main_t * const main = (utf8_main_t *) print->custom; @@ -100,6 +100,7 @@ extern "C" { #ifndef _di_utf8_print_error_no_from_ f_status_t utf8_print_error_no_from(fl_print_t * const print) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fll_print_format("%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", print->to, print->set->error, print->prefix, print->set->error, f_string_eol_s); @@ -111,6 +112,7 @@ extern "C" { #ifndef _di_utf8_print_error_parameter_file_name_empty_ f_status_t utf8_print_error_parameter_file_name_empty(fl_print_t * const print, const f_number_unsigned_t index) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); @@ -128,6 +130,7 @@ extern "C" { #ifndef _di_utf8_print_error_parameter_file_not_found_ f_status_t utf8_print_error_parameter_file_not_found(fl_print_t * const print, const bool from, const f_string_static_t name) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; f_file_stream_lock(print->to); @@ -145,6 +148,7 @@ extern "C" { #ifndef _di_utf8_print_error_parameter_file_to_too_many_ f_status_t utf8_print_error_parameter_file_to_too_many(fl_print_t * const print) { + if (!print) return F_status_set_error(F_output_not); if (print->verbosity < f_console_verbosity_error_e) return F_output_not; fll_print_format("%[%QToo many '%r' files specified, there may only be one '%r' file.%]%r", print->to, print->set->error, print->prefix, utf8_string_to_s, utf8_string_to_s, print->set->error, f_string_eol_s); diff --git a/level_3/utf8/c/main/signal.c b/level_3/utf8/c/main/signal.c index d71cab1..99b0cb3 100644 --- a/level_3/utf8/c/main/signal.c +++ b/level_3/utf8/c/main/signal.c @@ -7,8 +7,7 @@ extern "C" { #if !defined(_di_utf8_signal_check_) && defined(_di_thread_support_) f_status_t utf8_signal_check(utf8_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (!((++main->program.signal_check) % utf8_signal_check_d)) { if (fll_program_standard_signal_received(&main->program)) { @@ -29,8 +28,7 @@ extern "C" { #if !defined(_di_utf8_signal_check_) && !defined(_di_thread_support_) f_status_t utf8_signal_check(utf8_main_t * const main) { - if (!main) return F_false; - if (main->program.signal.id == -1) return F_false; + if (!main || main->program.signal.id == -1) return F_false; if (main->program.signal_received) { fll_program_print_signal_received(&main->program.warning, main->program.signal_received); -- 1.8.3.1