]> Kevux Git Server - fll/commitdiff
Bugfix: Incorrect information is printed on certain errors.
authorKevin Day <thekevinday@gmail.com>
Sun, 10 Jul 2022 05:45:05 +0000 (00:45 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 10 Jul 2022 05:45:05 +0000 (00:45 -0500)
Remove unused line variable.

The f_fss_count_lines() function appends to the calculated length variable.
The number is not being reset.
This results in each iteration adding to the previous:
  Line number 1, count = 1.
  Line number 2, count = 3.
  Line number 3, count = 6.
  etc...

Reset the line number on each pass of the loop to get the correct line number.

An error message is printing "1" when it should be printing "2".

The "%Q" should be used instead of "%s" for the static string.

Replace "parameter" with "Content" to be consistent with other error messages.

level_3/controller/c/entry/private-entry.c
level_3/controller/c/entry/private-entry_print.c

index 5906e14cf794a7ef6a8ccc47dd44e9620dd66948..a440cc9d4f6f4599419c68b9e1bba7bdad020665 100644 (file)
@@ -1895,13 +1895,14 @@ extern "C" {
     cache->delimits.used = 0;
 
     f_array_length_t i = 0;
-    f_array_length_t line = 0;
 
     controller_entry_t *entry = is_entry ? &global.setting->entry : &global.setting->exit;
     f_state_t state = f_state_t_initialize;
 
     for (; i < cache->object_actions.used; ++i) {
 
+      cache->action.line_action = 0;
+
       status = f_fss_count_lines(state, cache->buffer_file, cache->object_actions.array[i].start, &cache->action.line_action);
 
       if (F_status_is_error(status)) {
@@ -1910,7 +1911,7 @@ extern "C" {
         break;
       }
 
-      line = ++cache->action.line_action;
+      ++cache->action.line_action;
       cache->action.name_action.used = 0;
 
       status = fl_string_dynamic_partial_rip_nulless(cache->buffer_file, cache->object_actions.array[i], &cache->action.name_action);
@@ -2039,7 +2040,7 @@ extern "C" {
       }
       else if (fl_string_dynamic_compare(controller_define_s, cache->action.name_action) == F_equal_to) {
         if (cache->content_actions.array[i].used != 2) {
-          controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 1);
+          controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 2);
 
           continue;
         }
@@ -2073,7 +2074,7 @@ extern "C" {
       }
       else if (fl_string_dynamic_compare(controller_parameter_s, cache->action.name_action) == F_equal_to) {
         if (cache->content_actions.array[i].used != 2) {
-          controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 1);
+          controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 2);
 
           continue;
         }
index 461fbaac5c985ecb737cf302841393e120057fdc..4b606b4ddc4008f32271b0c306b3b2f4dc44b857 100644 (file)
@@ -167,11 +167,11 @@ extern "C" {
 
     controller_lock_print(global.main->error.to, global.thread);
 
-    fl_print_format("%r%[%QThe %s item setting '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
+    fl_print_format("%r%[%QThe %Q item setting '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
     fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, cache.action.name_action, global.main->error.notable);
     fl_print_format("%[' requires exactly %]", global.main->error.to.stream, global.main->error.context, global.main->error.context);
     fl_print_format("%[%un%]", global.main->error.to.stream, global.main->error.notable, total, global.main->error.notable);
-    fl_print_format("%[' %r.%]%r", global.main->error.to.stream, global.main->error.context, total > 1 ? controller_parameters_s : controller_parameter_s, global.main->error.context, f_string_eol_s);
+    fl_print_format("%[ Content.%]%r", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s);
 
     controller_entry_print_error_cache(is_entry, global.main->error, cache.action);