From c85b011d4582d7a465232fa07e407fd2653444a9 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 2 Aug 2022 19:10:10 -0500 Subject: [PATCH] Update: Always ensure content size is 0 when content is not found. --- level_2/fll_fss/c/fss/basic.c | 10 ++++++++++ level_2/fll_fss/c/fss/basic_list.c | 10 ++++++++++ level_2/fll_fss/c/fss/extended.c | 9 +++++++++ level_2/fll_fss/c/fss/extended_list.c | 10 ++++++++++ level_2/fll_fss/c/fss/payload.c | 11 ++++++++++- 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/level_2/fll_fss/c/fss/basic.c b/level_2/fll_fss/c/fss/basic.c index ef2a7f5..8b9b495 100644 --- a/level_2/fll_fss/c/fss/basic.c +++ b/level_2/fll_fss/c/fss/basic.c @@ -88,6 +88,7 @@ extern "C" { break; } + } while (status == F_fss_found_object_not); if (status == F_none_eos || status == F_none_stop) { @@ -120,6 +121,11 @@ extern "C" { // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. if (range->start >= range->stop || range->start >= buffer.used) { if (status == F_fss_found_object || status == F_fss_found_content || status == F_fss_found_content_not || status == F_fss_found_object_content_not) { + + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; @@ -133,6 +139,10 @@ extern "C" { return F_none_stop; } + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; diff --git a/level_2/fll_fss/c/fss/basic_list.c b/level_2/fll_fss/c/fss/basic_list.c index 05871f0..f899d49 100644 --- a/level_2/fll_fss/c/fss/basic_list.c +++ b/level_2/fll_fss/c/fss/basic_list.c @@ -74,6 +74,7 @@ extern "C" { break; } + } while (status == F_fss_found_object_not); if (status == F_none_eos || status == F_none_stop) { @@ -103,6 +104,11 @@ extern "C" { // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. if (status == F_fss_found_object || status == F_fss_found_content || status == F_fss_found_content_not || status == F_fss_found_object_content_not) { + + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; } @@ -112,6 +118,10 @@ extern "C" { return F_none_stop; } + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; diff --git a/level_2/fll_fss/c/fss/extended.c b/level_2/fll_fss/c/fss/extended.c index dd34548..309f614 100644 --- a/level_2/fll_fss/c/fss/extended.c +++ b/level_2/fll_fss/c/fss/extended.c @@ -148,6 +148,11 @@ extern "C" { // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. if (status == F_fss_found_object || status == F_fss_found_content || status == F_fss_found_content_not || status == F_fss_found_object_content_not || status == F_end_not_group) { + + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; @@ -171,6 +176,10 @@ extern "C" { return F_none_stop; } + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; diff --git a/level_2/fll_fss/c/fss/extended_list.c b/level_2/fll_fss/c/fss/extended_list.c index cd810f6..74aaabb 100644 --- a/level_2/fll_fss/c/fss/extended_list.c +++ b/level_2/fll_fss/c/fss/extended_list.c @@ -73,6 +73,7 @@ extern "C" { break; } + } while (status == F_fss_found_object_not); if (status == F_none_eos || status == F_none_stop) { @@ -102,6 +103,11 @@ extern "C" { // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. if (status == F_fss_found_object || status == F_fss_found_content || status == F_fss_found_content_not || status == F_fss_found_object_content_not) { + + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; } @@ -111,6 +117,10 @@ extern "C" { return F_none_stop; } + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; diff --git a/level_2/fll_fss/c/fss/payload.c b/level_2/fll_fss/c/fss/payload.c index 6b058ab..868bfc7 100644 --- a/level_2/fll_fss/c/fss/payload.c +++ b/level_2/fll_fss/c/fss/payload.c @@ -113,7 +113,7 @@ extern "C" { status2 = f_string_ranges_increase(state.step_small, &contents->array[contents->used]); if (F_status_is_error(status2)) return status2; - ++contents->used; + contents->array[contents->used++].used = 0; return F_none; } @@ -152,6 +152,11 @@ extern "C" { // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. if (status == F_fss_found_object || status == F_fss_found_content || status == F_fss_found_content_not || status == F_fss_found_object_content_not) { + + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; } @@ -162,6 +167,10 @@ extern "C" { return F_status_set_error(F_none_stop); } + if (status == F_fss_found_object_content_not) { + contents->array[contents->used].used = 0; + } + ++objects->used; ++contents->used; -- 1.8.3.1