From 79858cf386916fd25ccd3578797de53b16f5c446 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 29 Jan 2023 15:44:53 -0600 Subject: [PATCH] Bugfix: The -S/--sources parameter is not being correctly used. The parameter is not being properly validated. The parameter is then not being appended to the appropriate strings. The default value is being appended to the appropriate strings. --- level_3/fake/c/private-build-load.c | 2 +- level_3/fake/c/private-fake.c | 15 +++++++++++---- level_3/fake/c/private-skeleton.c | 5 +---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index ca4b742..31db704 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -932,7 +932,7 @@ extern "C" { fake_path_part_script_s, // path_program_script fake_path_part_shared_s, // path_program_shared fake_path_part_static_s, // path_program_static - fake_default_path_sources_s, // path_sources + f_string_empty_s, // path_sources f_string_empty_s, // path_sources_object f_string_empty_s, // preserve_path_headers f_string_empty_s, // process_post diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 46076ab..bb858cc 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -361,28 +361,32 @@ extern "C" { const uint8_t parameters_id[] = { fake_parameter_path_build_e, fake_parameter_path_data_e, + fake_parameter_path_sources_e, fake_parameter_path_work_e, }; const f_string_static_t parameters_name[] = { fake_long_path_build_s, fake_long_path_data_s, + fake_long_path_sources_s, fake_long_path_work_s, }; const f_string_static_t parameter_defaults[] = { fake_default_path_build_s, fake_default_path_data_s, + fake_default_path_sources_s, fake_default_path_work_s, }; f_string_dynamic_t * const parameters_value[] = { &data->path_build, &data->path_data, + &data->path_sources, &data->path_work, }; - for (uint8_t i = 0; i < 3; ++i) { + for (uint8_t i = 0; i < 4; ++i) { if (data->main->parameters.array[parameters_id[i]].result == f_console_result_found_e) { fake_print_error_parameter_missing_value(data, parameters_name[i]); @@ -557,12 +561,14 @@ extern "C" { const f_string_static_t names[] = { fake_long_path_build_s, fake_long_path_data_s, + fake_long_path_sources_s, fake_long_path_work_s, }; const f_string_dynamic_t values[] = { data->path_build, data->path_data, + data->path_sources, data->path_work, }; @@ -570,8 +576,11 @@ extern "C" { F_false, data->main->process_pipe ? F_false : F_true, F_false, + F_false, }; + struct stat directory_stat; + f_status_t status = F_none; // Check only expected operations (fake_operation_clean_e and fake_operation_skeleton_e should not call this function). @@ -609,9 +618,7 @@ extern "C" { } } - struct stat directory_stat; - - for (uint8_t i = 0; i < 3; ++i) { + for (uint8_t i = 0; i < 4; ++i) { if (requireds[i] != F_none && values[i].used) { memset(&directory_stat, 0, sizeof(struct stat)); diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index 0e827ba..f7479ba 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -300,7 +300,7 @@ extern "C" { #ifndef _di_fake_skeleton_path_source_length_ void fake_skeleton_path_source_length(fake_data_t * const data, const f_string_static_t *partial, f_string_static_t * const source) { - source->used = data->path_sources.used + fake_default_path_sources_s.used + partial->used; + source->used = data->path_sources.used + partial->used; } #endif // _di_fake_skeleton_path_source_length_ @@ -312,9 +312,6 @@ extern "C" { memcpy(source->string, data->path_sources.string, sizeof(f_char_t) * data->path_sources.used); source->used += data->path_sources.used; - memcpy(source->string, fake_default_path_sources_s.string, sizeof(f_char_t) * fake_default_path_sources_s.used); - source->used += fake_default_path_sources_s.used; - memcpy(source->string + source->used, partial->string, sizeof(f_char_t) * partial->used); source->used += partial->used; -- 1.8.3.1