]> Kevux Git Server - fll/commitdiff
Bugfix: Incorrect handling of "at" positions in FSS Embedded List Read.
authorKevin Day <Kevin@kevux.org>
Sat, 23 Nov 2024 06:27:55 +0000 (00:27 -0600)
committerKevin Day <Kevin@kevux.org>
Sat, 23 Nov 2024 06:27:55 +0000 (00:27 -0600)
The "at" position needs to be counted during all iterations.

level_3/fss_read/c/embedded_list/process.c

index fe88ca33a333b213b8c5efa14ffdc1f90ceedd60..e6f91f3aa9e32501dcb586b86126f9f932370ebe 100644 (file)
@@ -139,27 +139,25 @@ extern "C" {
         }
       } // for
 
-      if (F_status_is_error_not(main->setting.state.status)) {
-        f_number_unsigned_t j = 0;
+      {
+        f_number_unsigned_t at = 0;
         fss_read_depth_t * const the = &main->setting.depths.array[0];
 
         for (i = 0; i < main->setting.nest.depth[the->depth].used; ++i) {
 
-          if (main->setting.depths.used > 1) {
-
-            // The name and at conditions are only to be matched if not at the last depth.
-            if (the->index_name) {
-              if (f_compare_dynamic_partial_trim_string(the->value_name.string, main->setting.buffer, the->value_name.used, main->setting.nest.depth[the->depth].array[i].object) != F_equal_to) continue;
-            }
+          if (the->index_name) {
+            if (f_compare_dynamic_partial_trim_string(the->value_name.string, main->setting.buffer, the->value_name.used, main->setting.nest.depth[the->depth].array[i].object) != F_equal_to) continue;
+          }
 
-            if (the->index_at) {
-              if (j != the->value_at) {
-                if (++j > the->value_at) break;
+          if (the->index_at) {
+            if (at++ != the->value_at) {
+              if (at > the->value_at) break;
 
-                continue;
-              }
+              continue;
             }
+          }
 
+          if (main->setting.depths.used > 1) {
             fss_read_embedded_list_process_determine_depth_nest_recurse(main, i, 1);
             if (F_status_is_error(main->setting.state.status)) break;
           }
@@ -236,28 +234,26 @@ extern "C" {
     if (!main || !next || next >= main->setting.depths.used) return;
 
     f_number_unsigned_t i = 0;
-    f_number_unsigned_t j = 0;
+    f_number_unsigned_t at = 0;
     fss_read_depth_t * const the = &main->setting.depths.array[next];
 
     for (; F_status_is_error_not(main->setting.state.status) && i < main->setting.nest.depth[the->depth].used; ++i) {
 
       if (main->setting.nest.depth[the->depth].array[i].parent != parent) continue;
 
-      if (next + 1 < main->setting.depths.used) {
-
-        // The name and at conditions are only to be matched if not at the last depth.
-        if (the->index_name) {
-          if (f_compare_dynamic_partial_trim_string(the->value_name.string, main->setting.buffer, the->value_name.used, main->setting.nest.depth[the->depth].array[i].object) != F_equal_to) continue;
-        }
+      if (the->index_name) {
+        if (f_compare_dynamic_partial_trim_string(the->value_name.string, main->setting.buffer, the->value_name.used, main->setting.nest.depth[the->depth].array[i].object) != F_equal_to) continue;
+      }
 
-        if (the->index_at) {
-          if (j != the->value_at) {
-            if (++j > the->value_at) break;
+      if (the->index_at) {
+        if (at++ != the->value_at) {
+          if (at > the->value_at) break;
 
-            continue;
-          }
+          continue;
         }
+      }
 
+      if (next + 1 < main->setting.depths.used) {
         fss_read_embedded_list_process_determine_depth_nest_recurse(main, i, next + 1);
       }
       else {