]> Kevux Git Server - fll/commitdiff
Bugfix: FSS Write programs don't correctly handle multi-Content per Object situations.
authorKevin Day <kevin@kevux.org>
Tue, 24 Jan 2023 02:58:12 +0000 (20:58 -0600)
committerKevin Day <kevin@kevux.org>
Tue, 24 Jan 2023 02:58:12 +0000 (20:58 -0600)
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.

level_3/fss_basic_list_write/c/fss_basic_list_write.c
level_3/fss_basic_write/c/fss_basic_write.c
level_3/fss_embedded_list_write/c/fss_embedded_list_write.c
level_3/fss_extended_list_write/c/fss_extended_list_write.c
level_3/fss_extended_write/c/fss_extended_write.c
level_3/fss_extended_write/c/private-write.c
level_3/fss_extended_write/c/private-write.h
level_3/fss_payload_write/c/fss_payload_write.c

index 959bde21826d946fda0a6c8088387579d7f6dd5f..854cab1bb37260c14b37270c2ace6343853c06c3 100644 (file)
@@ -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);
           }
index 0407ed75e7e280f7596df14d80f7b6c9db3e444e..ea614c8f5ee937a4d93ccd99c18df1ad1d2ff16d 100644 (file)
@@ -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);
           }
index bd7900a42b3935c2914cf7122f9bf4b65cc5f16d..32e8f2abeab477e3e6b1cde25de0d4bfd79d7049 100644 (file)
@@ -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);
           }
index 319e22af687a041453ade8f1f131f5bcd4f31d9b..d74a4ebcd79f84d998c6f7395ec1848211bf68cd 100644 (file)
@@ -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);
           }
index 826a6e9d3aa9dde9f4abe63f438125bf74b96499..ec25604d867ceb8f9e29f7c97c9c888011eea679 100644 (file)
@@ -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);
           }
         }
index a33d943a366c2f5c9d7a4d7c5620f8aa5eb6489c..e96c26b95d0ecb3ec022e635da34768e918d604e 100644 (file)
@@ -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) {
index 7200164f087bf8a147ac927ba7d95c51385032be..b2d711b6a6f9965baf66e5fe4d371d2a7b65684e 100644 (file)
@@ -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.
index dde0e44285e1637f762b19c0a06ec1fa2b6cef3d..e4ec49410eb335946ccb760deed4579d37baf8e1 100644 (file)
@@ -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);
           }