]> Kevux Git Server - fll/commitdiff
Bugfix: Status codes F_complete_not_utf_stop and F_complete_not_utf_eos are not handl...
authorKevin Day <thekevinday@gmail.com>
Wed, 5 May 2021 05:04:00 +0000 (00:04 -0500)
committerKevin Day <thekevinday@gmail.com>
Wed, 5 May 2021 05:09:51 +0000 (00:09 -0500)
The previous commit: "Bugfix: UTF-8 characters are not being fully printed" exposed that these error codes are being improperly handled.

level_2/fll_error/c/private-error.c
level_3/fake/c/private-make.c
level_3/fake/c/private-print.c

index 4ca4dd4d93dbc7ee23094322eee13d50d2178702..c5f45b9367daa9ac8147e12165d506a938eeb667 100644 (file)
@@ -99,14 +99,22 @@ extern "C" {
       return F_false;
     }
 
-    if (status == F_complete_not_utf) {
+    if (status == F_complete_not_utf || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) {
       if (print.verbosity != f_console_verbosity_quiet) {
         fprintf(print.to.stream, "%c", f_string_eol_s[0]);
-        fprintf(print.to.stream, "%s%sInvalid (incomplete) UTF-8 character", print.context.before->string, print.prefix);
+        fprintf(print.to.stream, "%s%sInvalid (incomplete) UTF-8 character found ", print.context.before->string, print.prefix);
 
         private_fll_error_print_function(print, function);
 
-        fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]);
+        if (status == F_complete_not_utf_eos) {
+          fprintf(print.to.stream, " at end of string.%s%c", print.context.after->string, f_string_eol_s[0]);
+        }
+        else if (status == F_complete_not_utf_stop) {
+          fprintf(print.to.stream, " at stop point of string.%s%c", print.context.after->string, f_string_eol_s[0]);
+        }
+        else {
+          fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]);
+        }
       }
 
       return F_false;
index b8a3f00b48d62bca594265f83257fd43f6e5a30c..b648dde7cb99e2f04059d863844d36f1bbe38ca1 100644 (file)
@@ -210,7 +210,7 @@ extern "C" {
       *status = fll_fss_basic_list_read(data_make->buffer, &range, &list_objects, &list_contents, &delimits, 0, &comments);
 
       if (F_status_is_error(*status)) {
-        fake_print_error_fss(main, *status, "fll_fss_basic_list_read", main.file_data_build_fakefile.string, range, F_true);
+        fake_print_error_fss(main, F_status_set_fine(*status), "fll_fss_basic_list_read", main.file_data_build_fakefile.string, range, F_true);
       }
       else {
         *status = fl_fss_apply_delimit(delimits, &data_make->buffer);
index 8b976df337f5e6c9e0b8331e4ed7ad4653346ef5..8e77e91f309efbf1abb965bc9cc636fa1258da90 100644 (file)
@@ -247,10 +247,32 @@ extern "C" {
       return F_false;
     }
 
-    if (status == F_status_set_error(F_complete_not_utf_stop)) {
+    if (status == F_complete_not_utf || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) {
       if (main.error.verbosity != f_console_verbosity_quiet) {
         fprintf(main.error.to.stream, "%c", f_string_eol_s[0]);
-        f_color_print(main.error.to.stream, main.context.set.error, "%serror occurred on invalid UTF-8 character at end of string (at ", fll_error_print_error);
+        f_color_print(main.error.to.stream, main.context.set.error, "%serror occurred on invalid UTF-8 character", fll_error_print_error);
+
+        if (status == F_complete_not_utf_eos) {
+          f_color_print(main.error.to.stream, main.context.set.error, " at end of string");
+        }
+        else if (status == F_complete_not_utf_stop) {
+          f_color_print(main.error.to.stream, main.context.set.error, " at stop point of string");
+        }
+
+        f_color_print(main.error.to.stream, main.context.set.error, " (at ");
+        f_color_print(main.error.to.stream, main.context.set.notable, "%d", range.start);
+        f_color_print(main.error.to.stream, main.context.set.error, " of setting file '");
+        f_color_print(main.error.to.stream, main.context.set.notable, "%s", path_file);
+        f_color_print(main.error.to.stream, main.context.set.error, "').%c", f_string_eol_s[0]);
+      }
+
+      return F_false;
+    }
+
+    if (status == F_complete_not_utf_stop) {
+      if (main.error.verbosity != f_console_verbosity_quiet) {
+        fprintf(main.error.to.stream, "%c", f_string_eol_s[0]);
+        f_color_print(main.error.to.stream, main.context.set.error, "%serror occurred on invalid UTF-8 character at stop point of string (at ", fll_error_print_error);
         f_color_print(main.error.to.stream, main.context.set.notable, "%d", range.start);
         f_color_print(main.error.to.stream, main.context.set.error, " of setting file '");
         f_color_print(main.error.to.stream, main.context.set.notable, "%s", path_file);