From 02ce07114549cbe952eb8fdcaabe4c97b1cc310f Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 27 May 2023 21:07:42 -0500 Subject: [PATCH] Security: F_data_not is not being handled leading to invalid read or write. At some point I changed the behavior to return F_data_not when the main string (usually buffer) has used set to 0. I failed to update the FSS processing functions to handle this. The documentation comments are also not up to date in this regard and is now updated. --- level_1/fl_fss/c/fss/basic.c | 2 + level_1/fl_fss/c/fss/basic.h | 140 ++++++++++++++--------------- level_1/fl_fss/c/fss/basic_list.c | 4 + level_1/fl_fss/c/fss/basic_list.h | 156 +++++++++++++++++---------------- level_1/fl_fss/c/fss/embedded_list.c | 4 + level_1/fl_fss/c/fss/embedded_list.h | 156 +++++++++++++++++---------------- level_1/fl_fss/c/fss/extended.c | 1 + level_1/fl_fss/c/fss/extended.h | 160 +++++++++++++++++----------------- level_1/fl_fss/c/fss/extended_list.c | 4 + level_1/fl_fss/c/fss/extended_list.h | 154 ++++++++++++++++---------------- level_1/fl_fss/c/private-fss.h | 2 + level_2/fll_fss/c/fss/basic.c | 13 ++- level_2/fll_fss/c/fss/basic.h | 2 + level_2/fll_fss/c/fss/basic_list.c | 13 ++- level_2/fll_fss/c/fss/basic_list.h | 22 ++--- level_2/fll_fss/c/fss/embedded_list.c | 20 ++--- level_2/fll_fss/c/fss/embedded_list.h | 2 + level_2/fll_fss/c/fss/extended.c | 13 ++- level_2/fll_fss/c/fss/extended.h | 2 + level_2/fll_fss/c/fss/extended_list.c | 13 ++- level_2/fll_fss/c/fss/extended_list.h | 2 + level_2/fll_fss/c/fss/payload.c | 17 ++-- level_2/fll_fss/c/fss/payload.h | 2 + 23 files changed, 467 insertions(+), 437 deletions(-) diff --git a/level_1/fl_fss/c/fss/basic.c b/level_1/fl_fss/c/fss/basic.c index a50962a..e52e1c1 100644 --- a/level_1/fl_fss/c/fss/basic.c +++ b/level_1/fl_fss/c/fss/basic.c @@ -19,6 +19,7 @@ extern "C" { f_fss_skip_past_space(buffer, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eol) { ++range->start; @@ -85,6 +86,7 @@ extern "C" { f_fss_skip_past_delimit(content, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (range->start > range->stop || range->start >= content.used) { diff --git a/level_1/fl_fss/c/fss/basic.h b/level_1/fl_fss/c/fss/basic.h index 9bdbb62..f1a45ab 100644 --- a/level_1/fl_fss/c/fss/basic.h +++ b/level_1/fl_fss/c/fss/basic.h @@ -55,23 +55,24 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_content on success and content was found (start location is at end of content). - * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). - * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). - * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_string_ranges_increase(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_content on success and content was found (start location is at end of content). + * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_string_ranges_increase(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_fss_skip_past_delimit() * @see f_fss_skip_past_space() @@ -111,20 +112,21 @@ extern "C" { * When state.interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_none_stop on success after reaching the range stop. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_none_stop on success after reaching the range stop. + * F_data_not if content is empty (content.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. - * F_parameter (with error bit) if a parameter is invalid. + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. + * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). * * @see f_fss_skip_past_delimit() * @see f_string_dynamic_increase() @@ -163,29 +165,30 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_object on success and object was found (start location is at end of object). - * F_fss_found_object_content_not on success but object ended at the line so there can be no content. - * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). - * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). - * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_array_lengths_increase(). - * Errors (with error bit) from: f_array_lengths_increase_by(). - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_is_zero_width(). - * Errors (with error bit) from: f_fss_seek_to_eol(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_object on success and object was found (start location is at end of object). + * F_fss_found_object_content_not on success but object ended at the line so there can be no content. + * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_array_lengths_increase(). + * Errors (with error bit) from: f_array_lengths_increase_by(). + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_is_zero_width(). + * Errors (with error bit) from: f_fss_seek_to_eol(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_array_lengths_increase() * @see f_array_lengths_increase_by() @@ -235,22 +238,23 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_none_stop on success after reaching the range stop. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_none_stop on success after reaching the range stop. + * F_data_not if object is empty (object.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). * * @see f_fss_is_space() * @see f_fss_skip_past_delimit() diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index 17d720d..558d626 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -22,6 +22,7 @@ extern "C" { f_fss_skip_past_delimit(buffer, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (range->start >= buffer.used || range->start > range->stop) { delimits->used = delimits_used; @@ -303,6 +304,7 @@ extern "C" { f_fss_skip_past_delimit(content, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_stop || state->status == F_none_eos) { if (complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e || complete == f_fss_complete_end_e) { @@ -553,6 +555,7 @@ extern "C" { f_fss_skip_past_space(buffer, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eol) { @@ -856,6 +859,7 @@ extern "C" { f_fss_skip_past_delimit(object, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_stop || state->status == F_none_eos) { if (complete == f_fss_complete_partial_e || complete == f_fss_complete_partial_trim_e || complete == f_fss_complete_full_e || complete == f_fss_complete_full_trim_e) { diff --git a/level_1/fl_fss/c/fss/basic_list.h b/level_1/fl_fss/c/fss/basic_list.h index c396bb7..0b2d75b 100644 --- a/level_1/fl_fss/c/fss/basic_list.h +++ b/level_1/fl_fss/c/fss/basic_list.h @@ -60,26 +60,27 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_content on success and content was found (start location is at end of content). - * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). - * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). - * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_array_lengths_increase(). - * Errors (with error bit) from: f_array_lengths_increase_by(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_seek_to_eol(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_string_ranges_increase(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_content on success and content was found (start location is at end of content). + * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_array_lengths_increase(). + * Errors (with error bit) from: f_array_lengths_increase_by(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_seek_to_eol(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_string_ranges_increase(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_array_lengths_increase() * @see f_array_lengths_increase_by() @@ -127,24 +128,25 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eol on success after reaching the end of the line. - * F_none_eos on success after reaching the end of the buffer. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_none_stop on success after reaching stopping point. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_string_dynamic_append(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_none on success. + * F_none_eol on success after reaching the end of the line. + * F_none_eos on success after reaching the end of the buffer. + * F_data_not if content is empty (content.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * F_none_stop on success after reaching stopping point. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_string_dynamic_append(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_fss_is_graph() * @see f_fss_skip_past_delimit() @@ -184,27 +186,28 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_object on success and object was found (start location is at end of object). - * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). - * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). - * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_array_lengths_increase_by(). - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_is_zero_width(). - * Errors (with error bit) from: f_fss_seek_to_eol(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_object on success and object was found (start location is at end of object). + * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_array_lengths_increase_by(). + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_is_zero_width(). + * Errors (with error bit) from: f_fss_seek_to_eol(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_array_lengths_increase_by() * @see f_fss_is_graph() @@ -250,23 +253,24 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_none_stop on success after reaching stopping point. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_data_not if object is empty (object.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * F_none_stop on success after reaching stopping point. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_fss_is_graph() * @see f_fss_is_space() diff --git a/level_1/fl_fss/c/fss/embedded_list.c b/level_1/fl_fss/c/fss/embedded_list.c index 817e8ad..6dfb271 100644 --- a/level_1/fl_fss/c/fss/embedded_list.c +++ b/level_1/fl_fss/c/fss/embedded_list.c @@ -19,6 +19,7 @@ extern "C" { f_fss_skip_past_delimit(buffer, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eos || state->status == F_none_stop) return; state->status = f_fss_nest_increase(state->step_small, found); @@ -805,6 +806,7 @@ extern "C" { f_fss_skip_past_delimit(content, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eos) { state->status = F_data_not_eos; @@ -1100,6 +1102,7 @@ extern "C" { f_fss_skip_past_space(buffer, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eol) { @@ -1439,6 +1442,7 @@ extern "C" { f_fss_skip_past_delimit(object, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eos) { state->status = F_data_not_eos; diff --git a/level_1/fl_fss/c/fss/embedded_list.h b/level_1/fl_fss/c/fss/embedded_list.h index 0b6a5c6..380a5b9 100644 --- a/level_1/fl_fss/c/fss/embedded_list.h +++ b/level_1/fl_fss/c/fss/embedded_list.h @@ -64,27 +64,28 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_content on success and content was found (start location is at end of content). - * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). - * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). - * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_array_lengths_increase(). - * Errors (with error bit) from: f_array_lengths_increase_by(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_nest_increase(). - * Errors (with error bit) from: f_fss_seek_to_eol(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_string_ranges_increase(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_content on success and content was found (start location is at end of content). + * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_array_lengths_increase(). + * Errors (with error bit) from: f_array_lengths_increase_by(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_nest_increase(). + * Errors (with error bit) from: f_fss_seek_to_eol(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_string_ranges_increase(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_array_lengths_increase() * @see f_array_lengths_increase_by() @@ -138,23 +139,24 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_none_stop on success after reaching stopping point. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_string_dynamic_append(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_data_not if content is empty (content.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * F_none_stop on success after reaching stopping point. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_string_dynamic_append(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_fss_is_graph() * @see f_fss_skip_past_delimit() @@ -194,27 +196,28 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_object on success and object was found (start location is at end of object). - * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). - * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). - * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_array_lengths_increase_by(). - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_is_zero_width(). - * Errors (with error bit) from: f_fss_seek_to_eol(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_object on success and object was found (start location is at end of object). + * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_array_lengths_increase_by(). + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_is_zero_width(). + * Errors (with error bit) from: f_fss_seek_to_eol(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_array_lengths_increase_by() * @see f_fss_is_graph() @@ -260,23 +263,24 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_none_stop on success after reaching stopping point. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_data_not if object is empty (object.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * F_none_stop on success after reaching stopping point. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_fss_is_graph() * @see f_fss_is_space() diff --git a/level_1/fl_fss/c/fss/extended.c b/level_1/fl_fss/c/fss/extended.c index 9d4924c..c8dd351 100644 --- a/level_1/fl_fss/c/fss/extended.c +++ b/level_1/fl_fss/c/fss/extended.c @@ -19,6 +19,7 @@ extern "C" { f_fss_skip_past_space(buffer, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eol) { ++range->start; diff --git a/level_1/fl_fss/c/fss/extended.h b/level_1/fl_fss/c/fss/extended.h index b70667f..d974c48 100644 --- a/level_1/fl_fss/c/fss/extended.h +++ b/level_1/fl_fss/c/fss/extended.h @@ -58,27 +58,28 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_content on success and content was found (start location is at end of content). - * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). - * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). - * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_array_lengths_increase(). - * Errors (with error bit) from: f_array_lengths_increase_by(). - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_is_zero_width(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_content on success and content was found (start location is at end of content). + * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_array_lengths_increase(). + * Errors (with error bit) from: f_array_lengths_increase_by(). + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_is_zero_width(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_array_lengths_increase() * @see f_array_lengths_increase_by() @@ -129,23 +130,24 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_none_stop on success after reaching the range stop. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_none_stop on success after reaching the range stop. + * F_data_not if content is empty (content.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_fss_is_space() * @see f_fss_skip_past_delimit() @@ -190,30 +192,31 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_object on success and object was found (start location is at end of object). - * F_fss_found_object_content_not on success but object ended at the line so there can be no content. - * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). - * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). - * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_array_lengths_increase(). - * Errors (with error bit) from: f_array_lengths_increase_by(). - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_is_zero_width(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_string_ranges_increase(). - * Errors (with error bit) from: f_uint8s_increase(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_object on success and object was found (start location is at end of object). + * F_fss_found_object_content_not on success but object ended at the line so there can be no content. + * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_array_lengths_increase(). + * Errors (with error bit) from: f_array_lengths_increase_by(). + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_is_zero_width(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_string_ranges_increase(). + * Errors (with error bit) from: f_uint8s_increase(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_array_lengths_increase() * @see f_array_lengths_increase_by() @@ -265,22 +268,23 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_none_stop on success after reaching the range stop. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_none_stop on success after reaching the range stop. + * F_data_not if object is empty (object.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). * * @see f_fss_is_space() * @see f_fss_skip_past_delimit() diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index f02e7b9..df35735 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -22,6 +22,7 @@ extern "C" { f_fss_skip_past_delimit(buffer, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (range->start >= buffer.used || range->start > range->stop) { delimits->used = delimits_used; @@ -237,6 +238,7 @@ extern "C" { f_fss_skip_past_delimit(content, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eos) { state->status = F_data_not_eos; @@ -540,6 +542,7 @@ extern "C" { f_fss_skip_past_space(buffer, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eol) { @@ -878,6 +881,7 @@ extern "C" { f_fss_skip_past_delimit(object, range, state); if (F_status_is_error(state->status)) return; + if (state->status == F_data_not) return; if (state->status == F_none_eos) { state->status = F_data_not_eos; diff --git a/level_1/fl_fss/c/fss/extended_list.h b/level_1/fl_fss/c/fss/extended_list.h index 914da76..b860a94 100644 --- a/level_1/fl_fss/c/fss/extended_list.h +++ b/level_1/fl_fss/c/fss/extended_list.h @@ -62,26 +62,27 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_content on success and content was found (start location is at end of content). - * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). - * F_none_eos on success after reaching the end of the buffer (a valid content is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid content is not yet confirmed). - * F_data_not_eos no content found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no content found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_array_lengths_increase(). - * Errors (with error bit) from: f_array_lengths_increase_by(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_seek_to_eol(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_string_ranges_increase(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_content on success and content was found (start location is at end of content). + * F_fss_found_content_not on success and no content was found (start location is after character designating this is not a content). + * F_none_eos on success after reaching the end of the buffer (a valid content is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid content is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no content found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no content found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_array_lengths_increase(). + * Errors (with error bit) from: f_array_lengths_increase_by(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_seek_to_eol(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_string_ranges_increase(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_array_lengths_increase() * @see f_array_lengths_increase_by() @@ -134,23 +135,24 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_none_stop on success after reaching stopping point. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_string_dynamic_append(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_data_not if content is empty (content.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * F_none_stop on success after reaching stopping point. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_string_dynamic_append(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_fss_is_graph() * @see f_fss_skip_past_delimit() @@ -190,27 +192,28 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_fss_found_object on success and object was found (start location is at end of object). - * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). - * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). - * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). - * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). - * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). - * F_end_not_group_eos if EOS was reached before the a group termination was reached. - * F_end_not_group_stop if stop point was reached before the a group termination was reached. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_array_lengths_increase_by(). - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_is_zero_width(). - * Errors (with error bit) from: f_fss_seek_to_eol(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_fss_skip_past_space(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_fss_found_object on success and object was found (start location is at end of object). + * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). + * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). + * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). + * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). + * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). + * F_end_not_group_eos if EOS was reached before the a group termination was reached. + * F_end_not_group_stop if stop point was reached before the a group termination was reached. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_array_lengths_increase_by(). + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_is_zero_width(). + * Errors (with error bit) from: f_fss_seek_to_eol(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_array_lengths_increase_by() * @see f_fss_is_graph() @@ -256,23 +259,24 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_data_not_stop no data to write due start location being greater than stop location. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_none_stop on success after reaching stopping point. - * - * F_interrupt (with error bit) if stopping due to an interrupt. - * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_fss_is_graph(). - * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_skip_past_delimit(). - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: f_string_dynamic_increase_by(). - * Errors (with error bit) from: f_utf_buffer_increment(). + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_data_not if object is empty (object.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location. + * F_none_stop on success after reaching stopping point. + * + * F_interrupt (with error bit) if stopping due to an interrupt. + * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_fss_is_graph(). + * Errors (with error bit) from: f_fss_is_space(). + * Errors (with error bit) from: f_fss_skip_past_delimit(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: f_string_dynamic_increase_by(). + * Errors (with error bit) from: f_utf_buffer_increment(). * * @see f_fss_is_graph() * @see f_fss_is_space() diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index 8b7a679..b880dc7 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -123,6 +123,7 @@ extern "C" { * F_fss_found_object_not on success and no object was found (start location is after character designating this is not an object). * F_none_eos on success after reaching the end of the buffer (a valid object is not yet confirmed). * F_none_stop on success after reaching stopping point (a valid object is not yet confirmed). + * F_data_not if buffer is empty (buffer.used is 0). * F_data_not_eos no objects found after reaching the end of the buffer (essentially only comments are found). * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_end_not_group_eos if EOS was reached before the a group termination was reached. @@ -194,6 +195,7 @@ extern "C" { * F_none on success. * F_none_eos on success after reaching the end of the buffer. * F_none_stop on success after reaching the range stop. + * F_data_not if object is empty (object.used is 0). * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * diff --git a/level_2/fll_fss/c/fss/basic.c b/level_2/fll_fss/c/fss/basic.c index e98b54c..bbb8325 100644 --- a/level_2/fll_fss/c/fss/basic.c +++ b/level_2/fll_fss/c/fss/basic.c @@ -66,6 +66,8 @@ extern "C" { return; } + if (state->status == F_data_not) return; + if (found_data) { state->status = (range->start >= buffer.used) ? F_none_eos : F_none_stop; @@ -114,16 +116,11 @@ extern "C" { return; } - if (state->status == F_data_not_eos || state->status == F_data_not_stop) { + if (state->status == F_data_not || state->status == F_data_not_eos || state->status == F_data_not_stop) { // If at least some valid object was found, then return F_none equivelents. if (objects->used > initial_used) { - if (state->status == F_data_not_eos) { - state->status = F_none_eos; - } - else if (state->status == F_data_not_stop) { - state->status = F_none_stop; - } + state->status = (state->status == F_data_not_eos) ? F_none_eos : F_none_stop; } return; @@ -187,7 +184,7 @@ extern "C" { fl_fss_basic_object_write(object, quote, f_fss_complete_full_e, &range, destination, state); - if (F_status_is_error(state->status) || state->status == F_data_not_stop || state->status == F_data_not_eos) { + if (F_status_is_error(state->status) || state->status == F_data_not || state->status == F_data_not_stop || state->status == F_data_not_eos) { return; } diff --git a/level_2/fll_fss/c/fss/basic.h b/level_2/fll_fss/c/fss/basic.h index 8d9c927..49b82fc 100644 --- a/level_2/fll_fss/c/fss/basic.h +++ b/level_2/fll_fss/c/fss/basic.h @@ -61,6 +61,7 @@ extern "C" { * F_none on success. * F_none_eos on success after reaching the end of the buffer. * F_none_stop on success after reaching stopping point. + * F_data_not if buffer is empty (buffer.used is 0). * F_data_not_eol if there is no data to write and EOL was reached. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. @@ -110,6 +111,7 @@ extern "C" { * F_none on success. * F_none_eos on success after reaching the end of the buffer. * F_none_stop on success after reaching stopping point. + * F_data_not if object or contents are empty (either object.used or contents.used is 0). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. * diff --git a/level_2/fll_fss/c/fss/basic_list.c b/level_2/fll_fss/c/fss/basic_list.c index f3ae43d..b210143 100644 --- a/level_2/fll_fss/c/fss/basic_list.c +++ b/level_2/fll_fss/c/fss/basic_list.c @@ -52,6 +52,8 @@ extern "C" { return; } + if (state->status == F_data_not) return; + if (found_data) { state->status = (range->start >= buffer.used) ? F_none_eos : F_none_stop; } @@ -96,16 +98,11 @@ extern "C" { return; } - if (state->status == F_data_not_eos || state->status == F_data_not_stop) { + if (state->status == F_data_not || state->status == F_data_not_eos || state->status == F_data_not_stop) { // If at least some valid object was found, then return F_none equivalents. if (objects->used > initial_used) { - if (state->status == F_data_not_eos) { - state->status = F_none_eos; - } - else if (state->status == F_data_not_stop) { - state->status = F_none_stop; - } + state->status = (state->status == F_data_not_eos) ? F_none_eos : F_none_stop; } return; @@ -156,7 +153,7 @@ extern "C" { fl_fss_basic_list_object_write(object, f_fss_complete_full_e, &range, destination, state); - if (F_status_is_error(state->status) || state->status == F_data_not_stop || state->status == F_data_not_eos) { + if (F_status_is_error(state->status) || state->status == F_data_not || state->status == F_data_not_stop || state->status == F_data_not_eos) { return; } diff --git a/level_2/fll_fss/c/fss/basic_list.h b/level_2/fll_fss/c/fss/basic_list.h index e07594f..1cecc29 100644 --- a/level_2/fll_fss/c/fss/basic_list.h +++ b/level_2/fll_fss/c/fss/basic_list.h @@ -61,6 +61,7 @@ extern "C" { * F_none on success. * F_none_eos on success after reaching the end of the buffer. * F_none_stop on success after reaching stopping point. + * F_data_not if buffer is empty (buffer.used is 0). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. * @@ -105,18 +106,19 @@ extern "C" { * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. * - * @return - * F_none on success. - * F_none_eos on success after reaching the end of the buffer. - * F_none_stop on success after reaching stopping point. - * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_data_not_stop no data to write due start location being greater than stop location + * This alters state.status: + * F_none on success. + * F_none_eos on success after reaching the end of the buffer. + * F_none_stop on success after reaching stopping point. + * F_data_not if object or contents are empty (either object.used or contents.used is 0). + * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * F_data_not_stop no data to write due start location being greater than stop location * - * F_parameter (with error bit) if a parameter is invalid. + * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_string_dynamic_increase(). - * Errors (with error bit) from: fl_fss_basic_list_content_write(). - * Errors (with error bit) from: fl_fss_basic_list_object_write(). + * Errors (with error bit) from: f_string_dynamic_increase(). + * Errors (with error bit) from: fl_fss_basic_list_content_write(). + * Errors (with error bit) from: fl_fss_basic_list_object_write(). * * @see f_string_dynamic_increase() * @see fl_fss_basic_list_content_write() diff --git a/level_2/fll_fss/c/fss/embedded_list.c b/level_2/fll_fss/c/fss/embedded_list.c index 61cdc81..71d5a70 100644 --- a/level_2/fll_fss/c/fss/embedded_list.c +++ b/level_2/fll_fss/c/fss/embedded_list.c @@ -47,6 +47,8 @@ extern "C" { return; } + if (state->status == F_data_not) return; + if (found_data) { state->status = (range->start >= buffer.used) ? F_none_eos : F_none_stop; @@ -76,16 +78,11 @@ extern "C" { if (state->status == F_none_eos || state->status == F_none_stop) return; - if (state->status == F_data_not_eos || state->status == F_data_not_stop) { + if (state->status == F_data_not || state->status == F_data_not_eos || state->status == F_data_not_stop) { // If at least some valid object was found, then return F_none equivalents. if (nest->depth[0].used > initial_used) { - if (state->status == F_data_not_eos) { - state->status = F_none_eos; - } - else if (state->status == F_data_not_stop) { - state->status = F_none_stop; - } + state->status = (state->status == F_data_not_eos) ? F_none_eos : F_none_stop; } return; @@ -95,12 +92,7 @@ extern "C" { // If at least some valid object was found, then return F_none equivalents. if (nest->depth[0].used > initial_used) { - if (state->status == F_data_not_eos) { - state->status = F_none_eos; - } - else if (state->status == F_data_not_stop) { - state->status = F_none_stop; - } + state->status = (state->status == F_data_not_eos) ? F_none_eos : F_data_not_stop; } return; @@ -134,7 +126,7 @@ extern "C" { fl_fss_embedded_list_object_write(object, f_fss_complete_full_e, &range, destination, state); - if (F_status_is_error(state->status) || state->status == F_data_not_stop || state->status == F_data_not_eos) { + if (F_status_is_error(state->status) || state->status == F_data_not || state->status == F_data_not_stop || state->status == F_data_not_eos) { return; } diff --git a/level_2/fll_fss/c/fss/embedded_list.h b/level_2/fll_fss/c/fss/embedded_list.h index 41aa3df..5f8f6f0 100644 --- a/level_2/fll_fss/c/fss/embedded_list.h +++ b/level_2/fll_fss/c/fss/embedded_list.h @@ -59,6 +59,7 @@ extern "C" { * F_none on success (both valid object and valid content found with start location is at end of content). * F_none_eos on success after reaching the end of the buffer (both valid object and valid content found with start location is at end of buffer). * F_none_stop on success after reaching stopping point (both valid object and valid content found with start location is at stop point). + * F_data_not if buffer is empty (buffer.used is 0). * F_data_not_eol if there is no data to write and EOL was reached. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. @@ -114,6 +115,7 @@ extern "C" { * F_none on success. * F_none_eos on success after reaching the end of the buffer. * F_none_stop on success after reaching stopping point. + * F_data_not if object or contents are empty (either object.used or contents.used is 0). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. * diff --git a/level_2/fll_fss/c/fss/extended.c b/level_2/fll_fss/c/fss/extended.c index f4c9ada..7533be7 100644 --- a/level_2/fll_fss/c/fss/extended.c +++ b/level_2/fll_fss/c/fss/extended.c @@ -78,6 +78,8 @@ extern "C" { return; } + if (state->status == F_data_not) return; + if (found_data) { state->status = (range->start >= buffer.used) ? F_none_eos : F_none_stop; } @@ -131,16 +133,11 @@ extern "C" { return; } - if (state->status == F_data_not_eos || state->status == F_data_not_stop || state->status == F_end_not_group_eos || state->status == F_end_not_group_stop) { + if (state->status == F_data_not || state->status == F_data_not_eos || state->status == F_data_not_stop || state->status == F_end_not_group_eos || state->status == F_end_not_group_stop) { // If at least some valid object was found, then return F_none equivelents. if (objects->used > initial_used) { - if (state->status == F_data_not_eos) { - state->status = F_none_eos; - } - else if (state->status == F_data_not_stop) { - state->status = F_none_stop; - } + state->status = (state->status == F_data_not_eos) ? F_none_eos : F_none_stop; } return; @@ -213,7 +210,7 @@ extern "C" { fl_fss_extended_object_write(object, quote, f_fss_complete_full_e, &range, destination, state); - if (F_status_is_error(state->status) || state->status == F_data_not_stop || state->status == F_data_not_eos) { + if (F_status_is_error(state->status) || state->status == F_data_not || state->status == F_data_not_stop || state->status == F_data_not_eos) { return; } diff --git a/level_2/fll_fss/c/fss/extended.h b/level_2/fll_fss/c/fss/extended.h index b64095f..b704afb 100644 --- a/level_2/fll_fss/c/fss/extended.h +++ b/level_2/fll_fss/c/fss/extended.h @@ -64,6 +64,7 @@ extern "C" { * F_none on success. * F_none_stop on success after reaching stopping point. * F_none_eos on success after reaching the end of the buffer. + * F_data_not if buffer is empty (buffer.used is 0). * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_eol if there is no data to write and EOL was reached. @@ -113,6 +114,7 @@ extern "C" { * F_none on success. * F_none_eos on success after reaching the end of the buffer. * F_none_stop on success after reaching stopping point. + * F_data_not if object or contents are empty (either object.used or contents.used is 0). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. * diff --git a/level_2/fll_fss/c/fss/extended_list.c b/level_2/fll_fss/c/fss/extended_list.c index 2a5fe5c..07f8979 100644 --- a/level_2/fll_fss/c/fss/extended_list.c +++ b/level_2/fll_fss/c/fss/extended_list.c @@ -51,6 +51,8 @@ extern "C" { return; } + if (state->status == F_data_not) return; + if (found_data) { state->status = (range->start >= buffer.used) ? F_none_eos : F_none_stop; } @@ -94,16 +96,11 @@ extern "C" { return; } - if (state->status == F_data_not_eos || state->status == F_data_not_stop) { + if (state->status == F_data_not || state->status == F_data_not_eos || state->status == F_data_not_stop) { // If at least some valid object was found, then return F_none equivalents. if (objects->used > initial_used) { - if (state->status == F_data_not_eos) { - state->status = F_none_eos; - } - else if (state->status == F_data_not_stop) { - state->status = F_none_stop; - } + state->status = state->status == F_data_not_eos ? F_none_eos : F_none_stop; } return; @@ -154,7 +151,7 @@ extern "C" { fl_fss_extended_list_object_write(object, f_fss_complete_full_e, &range, destination, state); - if (F_status_is_error(state->status) || state->status == F_data_not_stop || state->status == F_data_not_eos) { + if (F_status_is_error(state->status) || state->status == F_data_not || state->status == F_data_not_stop || state->status == F_data_not_eos) { return; } diff --git a/level_2/fll_fss/c/fss/extended_list.h b/level_2/fll_fss/c/fss/extended_list.h index 1804050..0c3767c 100644 --- a/level_2/fll_fss/c/fss/extended_list.h +++ b/level_2/fll_fss/c/fss/extended_list.h @@ -63,6 +63,7 @@ extern "C" { * F_none on success (both valid object and valid content found with start location is at end of content). * F_none_eos on success after reaching the end of the buffer (both valid object and valid content found with start location is at end of buffer). * F_none_stop on success after reaching stopping point (both valid object and valid content found with start location is at stop point). + * F_data_not if buffer is empty (buffer.used is 0). * F_data_not_eol if there is no data to write and EOL was reached. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. @@ -118,6 +119,7 @@ extern "C" { * F_none on success. * F_none_eos on success after reaching the end of the buffer. * F_none_stop on success after reaching stopping point. + * F_data_not if object or contents are empty (either object.used or contents.used is 0). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. * diff --git a/level_2/fll_fss/c/fss/payload.c b/level_2/fll_fss/c/fss/payload.c index 4f10d8c..2b88862 100644 --- a/level_2/fll_fss/c/fss/payload.c +++ b/level_2/fll_fss/c/fss/payload.c @@ -60,6 +60,12 @@ extern "C" { } // Returning without a "payload" is an error. + if (state->status == F_data_not) { + state->status = F_status_set_error(F_data_not); + + return; + } + if (found_data) { state->status = F_status_set_error((range->start >= buffer.used) ? F_none_eos : F_none_stop); } @@ -155,18 +161,13 @@ extern "C" { return; } - if (state->status == F_data_not_eos || state->status == F_data_not_stop) { + if (state->status == F_data_not || state->status == F_data_not_eos || state->status == F_data_not_stop) { // If at least some valid object was found, then return F_none equivalents. if (objects->used > initial_used) { // Returning without a "payload" is an error. - if (state->status == F_data_not_eos) { - state->status = F_status_set_error(F_none_eos); - } - else if (state->status == F_data_not_stop) { - state->status = F_status_set_error(F_none_stop); - } + state->status = (state->status == F_data_not_eos) ? F_status_set_error(F_none_eos) : F_status_set_error(F_none_stop); } else { state->status = F_status_set_error(state->status); @@ -227,7 +228,7 @@ extern "C" { fl_fss_basic_list_object_write(object, trim ? f_fss_complete_full_trim_e : f_fss_complete_full_e, &range, destination, state); - if (F_status_is_error(state->status) || state->status == F_data_not_stop || state->status == F_data_not_eos) { + if (F_status_is_error(state->status) || state->status == F_data_not || state->status == F_data_not_stop || state->status == F_data_not_eos) { return; } diff --git a/level_2/fll_fss/c/fss/payload.h b/level_2/fll_fss/c/fss/payload.h index 48b59d4..c5d51e3 100644 --- a/level_2/fll_fss/c/fss/payload.h +++ b/level_2/fll_fss/c/fss/payload.h @@ -67,6 +67,7 @@ extern "C" { * F_none on success. * F_none_eos on success after reaching the end of the buffer. * F_none_stop on success after reaching stopping point. + * F_data_not if buffer is empty (buffer.used is 0). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. * @@ -136,6 +137,7 @@ extern "C" { * F_none on success. * F_none_eos on success after reaching the end of the buffer. * F_none_stop on success after reaching stopping point. + * F_data_not if object or contents are empty (either object.used or contents.used is 0). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. * -- 1.8.3.1