]> Kevux Git Server - fll/commitdiff
Bugfix: The FSS object write functions don't handle all newlines.
authorKevin Day <thekevinday@gmail.com>
Sat, 14 May 2022 13:40:31 +0000 (08:40 -0500)
committerKevin Day <thekevinday@gmail.com>
Sat, 14 May 2022 13:40:31 +0000 (08:40 -0500)
There are several cases where the newline character in the object is not being properly treated as an error and returned.

level_1/fl_fss/c/fss/basic_list.c
level_1/fl_fss/c/fss/embedded_list.c
level_1/fl_fss/c/fss/extended_list.c
level_1/fl_fss/c/private-fss.c

index 9c8f2028efbe379671a171d546572b8770e2cacf..a7ad6acd0959c91bf94eb755fd4bf7c16d198cef 100644 (file)
@@ -636,6 +636,12 @@ extern "C" {
         if (F_status_is_error(status)) break;
 
         if (status == F_true) {
+          if (object.string[range->start] == f_fss_eol_s.string[0]) {
+            status = F_status_set_error(F_none_eol);
+
+            break;
+          }
+
           width = macro_f_utf_byte_width(object.string[range->start]);
 
           status = f_string_dynamic_increase_by(width, destination);
index 91b97213cec7cb77f7d897a9dcc087d436d1d4fd..cd99156378e24dc41e14e3ff9efaf96b00b036f0 100644 (file)
@@ -1054,6 +1054,12 @@ extern "C" {
         if (F_status_is_error(status)) break;
 
         if (status == F_true) {
+          if (object.string[range->start] == f_fss_eol_s.string[0]) {
+            status = F_status_set_error(F_none_eol);
+
+            break;
+          }
+
           width = macro_f_utf_byte_width(object.string[range->start]);
 
           status = f_string_dynamic_increase_by(width, destination);
@@ -1140,7 +1146,13 @@ extern "C" {
         status = f_fss_is_space(state, object, *range);
         if (F_status_is_error(status)) break;
 
-        ends_on_space = status == F_true;
+        if (ends_on_space = (status == F_true)) {
+          if (object.string[range->start] == f_fss_eol_s.string[0]) {
+            status = F_status_set_error(F_none_eol);
+
+            break;
+          }
+        }
 
         width = macro_f_utf_byte_width(object.string[range->start]);
 
index 200752eb0804aed6ecd845f38de2938ed31decb2..8da1241740b5ee11608a25346b21d7ce457e31f9 100644 (file)
@@ -601,6 +601,12 @@ extern "C" {
         if (F_status_is_error(status)) break;
 
         if (status == F_true) {
+          if (object.string[range->start] == f_fss_eol_s.string[0]) {
+            status = F_status_set_error(F_none_eol);
+
+            break;
+          }
+
           width = macro_f_utf_byte_width(object.string[range->start]);
 
           status = f_string_dynamic_increase_by(width, destination);
@@ -687,7 +693,13 @@ extern "C" {
         status = f_fss_is_space(state, object, *range);
         if (F_status_is_error(status)) break;
 
-        ends_on_space = status == F_true;
+        if (ends_on_space = (status == F_true)) {
+          if (object.string[range->start] == f_fss_eol_s.string[0]) {
+            status = F_status_set_error(F_none_eol);
+
+            break;
+          }
+        }
 
         width = macro_f_utf_byte_width(object.string[range->start]);
 
index 976bc41594c7e9a0b320dacb4a95b588a753eaaf..81d85e086cc2ef7b8daf284ab8357045c55a29ea 100644 (file)
@@ -856,6 +856,10 @@ extern "C" {
       return F_data_not_stop;
     }
 
+    if (status == F_none_eol) {
+      return F_status_set_error(F_none_eol);
+    }
+
     // Ensure that there is room for the potential start and stop quotes, a potential delimit at start, and the potential object open character.
     status = f_string_dynamic_increase_by(5, destination);
     if (F_status_is_error(status)) return status;
@@ -985,6 +989,12 @@ extern "C" {
           if (F_status_is_error(status)) break;
 
           if (status == F_true) {
+            if (object.string[range->start] == f_fss_eol_s.string[0]) {
+              status = F_status_set_error(F_none_eol);
+
+              break;
+            }
+
             quoted_is = F_true;
 
             status = f_string_dynamic_increase_by(item_total, destination);
@@ -1047,6 +1057,12 @@ extern "C" {
           if (F_status_is_error(status)) break;
 
           if (status == F_true) {
+            if (object.string[range->start] == f_fss_eol_s.string[0]) {
+              status = F_status_set_error(F_none_eol);
+
+              break;
+            }
+
             quoted_is = F_true;
           }
 
@@ -1107,6 +1123,12 @@ extern "C" {
         if (F_status_is_error(status)) break;
 
         if (status == F_true) {
+          if (object.string[range->start] == f_fss_eol_s.string[0]) {
+            status = F_status_set_error(F_none_eol);
+
+            break;
+          }
+
           if (item_first != input_start) {
             status = f_string_dynamic_increase(state.step_large, destination);
             if (F_status_is_error(status)) break;
@@ -1205,7 +1227,14 @@ extern "C" {
             return status;
           }
 
-          if (status == F_false) {
+          if (status == F_true) {
+            if (object.string[i] == f_fss_eol_s.string[0]) {
+              destination->used = used_start;
+
+              return F_status_set_error(F_none_eol);
+            }
+          }
+          else {
             destination->string[used_start + 1] = f_fss_delimit_placeholder_s.string[0];
           }
         }