From c9c577576608f04bc1e43adb19db771a248dab56 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 10 Jul 2022 00:45:05 -0500 Subject: [PATCH] Bugfix: Incorrect information is printed on certain errors. 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 | 9 +++++---- level_3/controller/c/entry/private-entry_print.c | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index 5906e14..a440cc9 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -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; } diff --git a/level_3/controller/c/entry/private-entry_print.c b/level_3/controller/c/entry/private-entry_print.c index 461fbaa..4b606b4 100644 --- a/level_3/controller/c/entry/private-entry_print.c +++ b/level_3/controller/c/entry/private-entry_print.c @@ -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); -- 1.8.3.1