From: Kevin Day Date: Tue, 24 Jan 2023 02:58:12 +0000 (-0600) Subject: Bugfix: FSS Write programs don't correctly handle multi-Content per Object situations. X-Git-Tag: 0.6.4~86 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=f8f7d506a2753bab20d6ecd5a9907e5fdb9bb1b6;p=fll Bugfix: FSS Write programs don't correctly handle multi-Content per Object situations. The FSS Extended should support one or more Content per Object. All others support the same number of Objects as Content (not referring to nested Content). The error and error message when this is and is not correctly being handled. The correct detection needs to count based on sub locations rather than locations. Remove now pointless and misleading checks. --- diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index 959bde2..854cab1 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -192,15 +192,7 @@ extern "C" { if (F_status_is_error_not(status)) { if (main->parameters.array[fss_basic_list_write_parameter_object_e].locations.used || main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used) { if (main->parameters.array[fss_basic_list_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_basic_list_write_parameter_object_e].locations.used != main->parameters.array[fss_basic_list_write_parameter_object_e].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used != main->parameters.array[fss_basic_list_write_parameter_content_e].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_list_write_parameter_object_e].locations.used != main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used && main->parameters.array[fss_basic_list_write_parameter_partial_e].result == f_console_result_none_e) { + if (main->parameters.array[fss_basic_list_write_parameter_object_e].locations_sub.used != main->parameters.array[fss_basic_list_write_parameter_content_e].locations_sub.used && main->parameters.array[fss_basic_list_write_parameter_partial_e].result == f_console_result_none_e) { fss_basic_list_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); } @@ -259,11 +251,7 @@ extern "C" { } } else if (main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used != main->parameters.array[fss_basic_list_write_parameter_content_e].values.used) { - fss_basic_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_basic_list_write_parameter_partial_e].locations.used) { + if (!main->parameters.array[fss_basic_list_write_parameter_partial_e].locations.used) { fss_basic_list_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); } diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index 0407ed7..ea614c8 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -190,15 +190,7 @@ extern "C" { if (F_status_is_error_not(status)) { if (main->parameters.array[fss_basic_write_parameter_object_e].locations.used || main->parameters.array[fss_basic_write_parameter_content_e].locations.used) { if (main->parameters.array[fss_basic_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_basic_write_parameter_object_e].locations.used != main->parameters.array[fss_basic_write_parameter_object_e].values.used) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_write_parameter_content_e].locations.used != main->parameters.array[fss_basic_write_parameter_content_e].values.used) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_basic_write_parameter_object_e].locations.used != main->parameters.array[fss_basic_write_parameter_content_e].locations.used && main->parameters.array[fss_basic_write_parameter_partial_e].result == f_console_result_none_e) { + if (main->parameters.array[fss_basic_write_parameter_object_e].locations_sub.used != main->parameters.array[fss_basic_write_parameter_content_e].locations_sub.used && main->parameters.array[fss_basic_write_parameter_partial_e].result == f_console_result_none_e) { fss_basic_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); } @@ -257,11 +249,7 @@ extern "C" { } } else if (main->parameters.array[fss_basic_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_basic_write_parameter_content_e].locations.used != main->parameters.array[fss_basic_write_parameter_content_e].values.used) { - fss_basic_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_basic_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_basic_write_parameter_partial_e].locations.used) { + if (!main->parameters.array[fss_basic_write_parameter_partial_e].locations.used) { fss_basic_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); } diff --git a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c index bd7900a..32e8f2a 100644 --- a/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c +++ b/level_3/fss_embedded_list_write/c/fss_embedded_list_write.c @@ -193,15 +193,7 @@ extern "C" { if (F_status_is_error_not(status)) { if (main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.used || main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used) { if (main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.used != main->parameters.array[fss_embedded_list_write_parameter_object_e].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used != main->parameters.array[fss_embedded_list_write_parameter_content_e].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_embedded_list_write_parameter_object_e].locations.used != main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used && main->parameters.array[fss_embedded_list_write_parameter_partial_e].result == f_console_result_none_e) { + if (main->parameters.array[fss_embedded_list_write_parameter_object_e].locations_sub.used != main->parameters.array[fss_embedded_list_write_parameter_content_e].locations_sub.used && main->parameters.array[fss_embedded_list_write_parameter_partial_e].result == f_console_result_none_e) { fss_embedded_list_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); } @@ -260,11 +252,7 @@ extern "C" { } } else if (main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used != main->parameters.array[fss_embedded_list_write_parameter_content_e].values.used) { - fss_embedded_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_embedded_list_write_parameter_partial_e].locations.used) { + if (!main->parameters.array[fss_embedded_list_write_parameter_partial_e].locations.used) { fss_embedded_list_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); } diff --git a/level_3/fss_extended_list_write/c/fss_extended_list_write.c b/level_3/fss_extended_list_write/c/fss_extended_list_write.c index 319e22a..d74a4eb 100644 --- a/level_3/fss_extended_list_write/c/fss_extended_list_write.c +++ b/level_3/fss_extended_list_write/c/fss_extended_list_write.c @@ -193,15 +193,7 @@ extern "C" { if (F_status_is_error_not(status)) { if (main->parameters.array[fss_extended_list_write_parameter_object_e].locations.used || main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used) { if (main->parameters.array[fss_extended_list_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_extended_list_write_parameter_object_e].locations.used != main->parameters.array[fss_extended_list_write_parameter_object_e].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used != main->parameters.array[fss_extended_list_write_parameter_content_e].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_extended_list_write_parameter_object_e].locations.used != main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used && main->parameters.array[fss_extended_list_write_parameter_partial_e].result == f_console_result_none_e) { + if (main->parameters.array[fss_extended_list_write_parameter_object_e].locations_sub.used != main->parameters.array[fss_extended_list_write_parameter_content_e].locations_sub.used && main->parameters.array[fss_extended_list_write_parameter_partial_e].result == f_console_result_none_e) { fss_extended_list_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); } @@ -259,11 +251,7 @@ extern "C" { } } else if (main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used != main->parameters.array[fss_extended_list_write_parameter_content_e].values.used) { - fss_extended_list_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_extended_list_write_parameter_partial_e].locations.used) { + if (!main->parameters.array[fss_extended_list_write_parameter_partial_e].locations.used) { fss_extended_list_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); } diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 826a6e9..ec25604 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -190,16 +190,8 @@ extern "C" { if (F_status_is_error_not(status)) { if (main->parameters.array[fss_extended_write_parameter_object_e].locations.used || main->parameters.array[fss_extended_write_parameter_content_e].locations.used) { if (main->parameters.array[fss_extended_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_extended_write_parameter_object_e].locations.used != main->parameters.array[fss_extended_write_parameter_object_e].values.used) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_extended_write_parameter_content_e].locations.used != main->parameters.array[fss_extended_write_parameter_content_e].values.used) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_extended_write_parameter_content_e].locations.used && main->parameters.array[fss_extended_write_parameter_partial_e].result == f_console_result_none_e) { - fss_extended_write_error_parameter_at_least_once(main); + if (main->parameters.array[fss_extended_write_parameter_object_e].locations_sub.used > main->parameters.array[fss_extended_write_parameter_content_e].locations_sub.used && main->parameters.array[fss_extended_write_parameter_partial_e].result == f_console_result_none_e) { + fss_extended_write_error_parameter_same_times_at_least_print(main); status = F_status_set_error(F_parameter); } else if (main->parameters.array[fss_extended_write_parameter_content_e].locations.used && main->parameters.array[fss_extended_write_parameter_partial_e].locations.used) { @@ -270,12 +262,8 @@ extern "C" { } } else if (main->parameters.array[fss_extended_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_extended_write_parameter_content_e].locations.used != main->parameters.array[fss_extended_write_parameter_content_e].values.used) { - fss_extended_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_extended_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_extended_write_parameter_partial_e].locations.used) { - fss_extended_write_error_parameter_at_least_once(main); + if (!main->parameters.array[fss_extended_write_parameter_partial_e].locations.used) { + fss_extended_write_error_parameter_same_times_at_least_print(main); status = F_status_set_error(F_parameter); } } diff --git a/level_3/fss_extended_write/c/private-write.c b/level_3/fss_extended_write/c/private-write.c index a33d943..e96c26b 100644 --- a/level_3/fss_extended_write/c/private-write.c +++ b/level_3/fss_extended_write/c/private-write.c @@ -6,8 +6,8 @@ extern "C" { #endif -#ifndef _di_fss_extended_write_error_parameter_at_least_once_print_ - void fss_extended_write_error_parameter_at_least_once(fll_program_data_t * const main) { +#ifndef _di_fss_extended_write_error_parameter_same_times_at_least_print_ + void fss_extended_write_error_parameter_same_times_at_least_print(fll_program_data_t * const main) { if (main->error.verbosity == f_console_verbosity_quiet_e) { return; @@ -16,16 +16,16 @@ extern "C" { flockfile(main->error.to.stream); fl_print_format("%r%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context); - fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); - fl_print_format("%[' parameter and the '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable); - fl_print_format("%[' parameter the same number of times when not specifying the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[' parameter at least the same number of times as the '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable); + fl_print_format("%[' parameter when not specifying the '%]", main->error.to.stream, main->error.context, main->error.context); fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable); fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s); funlockfile(main->error.to.stream); } -#endif // _di_fss_extended_write_error_parameter_at_least_once_print_ +#endif // _di_fss_extended_write_error_parameter_same_times_at_least_print_ #ifndef _di_fss_extended_write_error_parameter_value_missing_print_ void fss_extended_write_error_parameter_value_missing_print(fll_program_data_t * const main, const f_string_static_t symbol, const f_string_static_t parameter) { diff --git a/level_3/fss_extended_write/c/private-write.h b/level_3/fss_extended_write/c/private-write.h index 7200164..b2d711b 100644 --- a/level_3/fss_extended_write/c/private-write.h +++ b/level_3/fss_extended_write/c/private-write.h @@ -13,7 +13,7 @@ extern "C" { #endif /** - * Print an message about the object and content parameters not being specified the correct number of times. + * Print an error message about the object and content parameters not being specified at least the same number of times when partial is not requested. * * @param main * The main program data. @@ -22,9 +22,9 @@ extern "C" { * F_none on success. * F_failure (with error bit) for any other failure. */ -#ifndef _di_fss_extended_write_error_parameter_at_least_once_print_ - void fss_extended_write_error_parameter_at_least_once(fll_program_data_t * const main) F_attribute_visibility_internal_d; -#endif // _di_fss_extended_write_error_parameter_at_least_once_print_ +#ifndef _di_fss_extended_write_error_parameter_same_times_at_least_print_ + void fss_extended_write_error_parameter_same_times_at_least_print(fll_program_data_t * const main) F_attribute_visibility_internal_d; +#endif // _di_fss_extended_write_error_parameter_same_times_at_least_print_ /** * Print an message about a parameter missing a value. diff --git a/level_3/fss_payload_write/c/fss_payload_write.c b/level_3/fss_payload_write/c/fss_payload_write.c index dde0e44..e4ec494 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.c +++ b/level_3/fss_payload_write/c/fss_payload_write.c @@ -201,15 +201,7 @@ extern "C" { if (F_status_is_error_not(status)) { if (main->parameters.array[fss_payload_write_parameter_object_e].locations.used || main->parameters.array[fss_payload_write_parameter_content_e].locations.used) { if (main->parameters.array[fss_payload_write_parameter_object_e].locations.used) { - if (main->parameters.array[fss_payload_write_parameter_object_e].locations.used != main->parameters.array[fss_payload_write_parameter_object_e].values.used) { - fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_payload_write_long_object_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_payload_write_parameter_content_e].locations.used != main->parameters.array[fss_payload_write_parameter_content_e].values.used) { - fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_payload_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (main->parameters.array[fss_payload_write_parameter_object_e].locations.used != main->parameters.array[fss_payload_write_parameter_content_e].locations.used && main->parameters.array[fss_payload_write_parameter_partial_e].result == f_console_result_none_e) { + if (main->parameters.array[fss_payload_write_parameter_object_e].locations_sub.used != main->parameters.array[fss_payload_write_parameter_content_e].locations_sub.used && main->parameters.array[fss_payload_write_parameter_partial_e].result == f_console_result_none_e) { fss_payload_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); } @@ -290,11 +282,7 @@ extern "C" { } } else if (main->parameters.array[fss_payload_write_parameter_content_e].locations.used) { - if (main->parameters.array[fss_payload_write_parameter_content_e].locations.used != main->parameters.array[fss_payload_write_parameter_content_e].values.used) { - fss_payload_write_error_parameter_value_missing_print(main, f_console_symbol_long_enable_s, fss_payload_write_long_content_s); - status = F_status_set_error(F_parameter); - } - else if (!main->parameters.array[fss_payload_write_parameter_partial_e].locations.used) { + if (!main->parameters.array[fss_payload_write_parameter_partial_e].locations.used) { fss_payload_write_error_parameter_same_times_print(main); status = F_status_set_error(F_parameter); }