From 4cdf678711305bb24326bde3f2a195133944ad66 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 30 May 2023 23:31:13 -0500 Subject: [PATCH] Bugfix: Quotes in FSS read functions are not being properly handled and fix backtick handling. At some point in time the intended behavior changed from using the literal quote character to an enumeration representing the quote character on FSS read calls. This transition is incomplete and broken. Finish the transition, passing the enumeration representation rather than the literal character. Remove an unnecessary initialization on the quote because the private function being called also initializes the variable. Relocate the f_uint8s_increase() call to be after changing the error status to ensure that the quotes array is properly incremented. Update the documentation comments to better clarify this behavior in regards to the enumeration. There are several FSS read functions that are not handling backticks properly. The backticks should now be fully and properly processed on read. --- level_0/f_fss/c/fss/common.h | 110 +++++++++++++++------------- level_0/f_fss/c/fss/quote.h | 8 +- level_1/fl_fss/c/fss/basic.h | 2 +- level_1/fl_fss/c/fss/extended.c | 26 +++---- level_1/fl_fss/c/fss/extended.h | 4 +- level_1/fl_fss/c/private-fss.c | 22 ++++-- level_1/fl_fss/c/private-fss.h | 2 +- level_2/fll_fss/c/fss/basic.h | 2 +- level_2/fll_fss/c/fss/extended.h | 4 +- level_3/fss_basic_read/c/private-print.c | 36 ++++++++- level_3/fss_extended_read/c/private-print.c | 72 ++++++++++++++++-- level_3/fss_extended_read/c/private-read.c | 36 ++++++++- level_3/fss_payload_read/c/private-print.c | 72 ++++++++++++++++-- level_3/fss_payload_read/c/private-read.c | 36 ++++++++- 14 files changed, 317 insertions(+), 115 deletions(-) diff --git a/level_0/f_fss/c/fss/common.h b/level_0/f_fss/c/fss/common.h index 8417a75..329383d 100644 --- a/level_0/f_fss/c/fss/common.h +++ b/level_0/f_fss/c/fss/common.h @@ -20,44 +20,47 @@ extern "C" { * FSS-specific types. */ #ifndef _di_f_fss_types_t_ - #define F_fss_brace_close_s F_string_ascii_brace_close_s - #define F_fss_brace_open_s F_string_ascii_brace_open_s - #define F_fss_colon_s F_string_ascii_colon_s - #define F_fss_minus_s F_string_ascii_minus_s - #define F_fss_f_s F_string_ascii_f_s - #define F_fss_pound_s F_string_ascii_pound_s - #define F_fss_quote_double_s F_string_ascii_quote_double_s - #define F_fss_quote_single_s F_string_ascii_quote_single_s - #define F_fss_s_s F_string_ascii_s_s - #define F_fss_slash_s F_string_ascii_slash_backward_s - #define F_fss_space_s F_string_ascii_space_s - #define F_fss_underscore_s F_string_ascii_underscore_s - - #define F_fss_brace_close_s_length F_string_ascii_brace_close_s_length - #define F_fss_brace_open_s_length F_string_ascii_brace_open_s_length - #define F_fss_colon_s_length F_string_ascii_colon_s_length - #define F_fss_minus_s_length F_string_ascii_minus_s_length - #define F_fss_f_s_length F_string_ascii_f_s_length - #define F_fss_pound_s_length F_string_ascii_pound_s_length - #define F_fss_quote_double_s_length F_string_ascii_quote_double_s_length - #define F_fss_quote_single_s_length F_string_ascii_quote_single_s_length - #define F_fss_s_s_length F_string_ascii_s_s_length - #define F_fss_slash_s_length F_string_ascii_slash_backward_s_length - #define F_fss_space_s_length F_string_ascii_space_s_length - #define F_fss_underscore_s_length F_string_ascii_underscore_s_length - - #define f_fss_brace_close_s f_string_ascii_brace_close_s - #define f_fss_brace_open_s f_string_ascii_brace_open_s - #define f_fss_colon_s f_string_ascii_colon_s - #define f_fss_minus_s f_string_ascii_minus_s - #define f_fss_f_s f_string_ascii_f_s - #define f_fss_pound_s f_string_ascii_pound_s - #define f_fss_quote_double_s f_string_ascii_quote_double_s - #define f_fss_quote_single_s f_string_ascii_quote_single_s - #define f_fss_s_s f_string_ascii_s_s - #define f_fss_slash_s f_string_ascii_slash_backward_s - #define f_fss_space_s f_string_ascii_space_s - #define f_fss_underscore_s f_string_ascii_underscore_s + #define F_fss_brace_close_s F_string_ascii_brace_close_s + #define F_fss_brace_open_s F_string_ascii_brace_open_s + #define F_fss_colon_s F_string_ascii_colon_s + #define F_fss_minus_s F_string_ascii_minus_s + #define F_fss_f_s F_string_ascii_f_s + #define F_fss_pound_s F_string_ascii_pound_s + #define F_fss_quote_backtick_s F_string_ascii_grave_s + #define F_fss_quote_double_s F_string_ascii_quote_double_s + #define F_fss_quote_single_s F_string_ascii_quote_single_s + #define F_fss_s_s F_string_ascii_s_s + #define F_fss_slash_s F_string_ascii_slash_backward_s + #define F_fss_space_s F_string_ascii_space_s + #define F_fss_underscore_s F_string_ascii_underscore_s + + #define F_fss_brace_close_s_length F_string_ascii_brace_close_s_length + #define F_fss_brace_open_s_length F_string_ascii_brace_open_s_length + #define F_fss_colon_s_length F_string_ascii_colon_s_length + #define F_fss_minus_s_length F_string_ascii_minus_s_length + #define F_fss_f_s_length F_string_ascii_f_s_length + #define F_fss_pound_s_length F_string_ascii_pound_s_length + #define F_fss_quote_backtick_s_length F_string_ascii_grave_s_length + #define F_fss_quote_double_s_length F_string_ascii_quote_double_s_length + #define F_fss_quote_single_s_length F_string_ascii_quote_single_s_length + #define F_fss_s_s_length F_string_ascii_s_s_length + #define F_fss_slash_s_length F_string_ascii_slash_backward_s_length + #define F_fss_space_s_length F_string_ascii_space_s_length + #define F_fss_underscore_s_length F_string_ascii_underscore_s_length + + #define f_fss_brace_close_s f_string_ascii_brace_close_s + #define f_fss_brace_open_s f_string_ascii_brace_open_s + #define f_fss_colon_s f_string_ascii_colon_s + #define f_fss_minus_s f_string_ascii_minus_s + #define f_fss_f_s f_string_ascii_f_s + #define f_fss_pound_s f_string_ascii_pound_s + #define f_fss_quote_backtick_s f_string_ascii_grave_s + #define f_fss_quote_double_s f_string_ascii_quote_double_s + #define f_fss_quote_single_s f_string_ascii_quote_single_s + #define f_fss_s_s f_string_ascii_s_s + #define f_fss_slash_s f_string_ascii_slash_backward_s + #define f_fss_space_s f_string_ascii_space_s + #define f_fss_underscore_s f_string_ascii_underscore_s #define f_fss_comment_s f_fss_pound_s #define f_fss_eol_s f_string_eol_s @@ -97,20 +100,23 @@ extern "C" { * FSS-specific delimiters. */ #ifndef _di_f_fss_delimiters_ - #define F_fss_delimit_placeholder_s F_string_placeholder_s - #define F_fss_delimit_quote_single_s F_fss_quote_single_s - #define F_fss_delimit_quote_double_s F_fss_quote_double_s - #define F_fss_delimit_slash_s F_fss_slash_s - - #define F_fss_delimit_placeholder_s_length F_string_placeholder_s_length - #define F_fss_delimit_quote_single_s_length F_fss_quote_single_s_length - #define F_fss_delimit_quote_double_s_length F_fss_quote_double_s_length - #define F_fss_delimit_slash_s_length F_fss_slash_s_length - - #define f_fss_delimit_placeholder_s f_string_placeholder_s - #define f_fss_delimit_quote_single_s f_fss_quote_single_s - #define f_fss_delimit_quote_double_s f_fss_quote_double_s - #define f_fss_delimit_slash_s f_fss_slash_s + #define F_fss_delimit_placeholder_s F_string_placeholder_s + #define F_fss_delimit_quote_backtick_s F_fss_quote_backtick_s + #define F_fss_delimit_quote_double_s F_fss_quote_double_s + #define F_fss_delimit_quote_single_s F_fss_quote_single_s + #define F_fss_delimit_slash_s F_fss_slash_s + + #define F_fss_delimit_placeholder_s_length F_string_placeholder_s_length + #define F_fss_delimit_quote_backtick_s_length F_fss_quote_backtick_s_length + #define F_fss_delimit_quote_double_s_length F_fss_quote_double_s_length + #define F_fss_delimit_quote_single_s_length F_fss_quote_single_s_length + #define F_fss_delimit_slash_s_length F_fss_slash_s_length + + #define f_fss_delimit_placeholder_s f_string_placeholder_s + #define f_fss_delimit_quote_backtick_s f_fss_quote_backtick_s + #define f_fss_delimit_quote_double_s f_fss_quote_double_s + #define f_fss_delimit_quote_single_s f_fss_quote_single_s + #define f_fss_delimit_slash_s f_fss_slash_s #endif //_di_f_fss_delimiters_ /** diff --git a/level_0/f_fss/c/fss/quote.h b/level_0/f_fss/c/fss/quote.h index a8123f1..eff8d92 100644 --- a/level_0/f_fss/c/fss/quote.h +++ b/level_0/f_fss/c/fss/quote.h @@ -20,15 +20,17 @@ extern "C" { * Types for FSS quote. * * f_fss_quote_type_*: - * - none: Not a quote. - * - single: Quote type is a single quote. - * - double: Quote type is a double quote. + * - none: Not a quote. + * - single: Quote type is a single quote. + * - double: Quote type is a double quote. + * - backtick: Quote type is a backtick. */ #ifndef _di_f_fss_quote_type_ enum { f_fss_quote_type_none_e = 0, f_fss_quote_type_single_e, f_fss_quote_type_double_e, + f_fss_quote_type_backtick_e, }; #endif // _di_f_fss_quote_type_ diff --git a/level_1/fl_fss/c/fss/basic.h b/level_1/fl_fss/c/fss/basic.h index 123c61f..c0e14a5 100644 --- a/level_1/fl_fss/c/fss/basic.h +++ b/level_1/fl_fss/c/fss/basic.h @@ -158,7 +158,7 @@ extern "C" { * @param found * A location where a valid object was found. * @param quote - * This will store whether or not this object is quote and what quote is in use. + * This will store the quote type representing the character to use (from the f_fss_quote_type_*_e). * Set pointer address to 0 to not use. * @param delimits * A delimits array representing where delimits exist within the buffer. diff --git a/level_1/fl_fss/c/fss/extended.c b/level_1/fl_fss/c/fss/extended.c index 81193e7..3b71ea1 100644 --- a/level_1/fl_fss/c/fss/extended.c +++ b/level_1/fl_fss/c/fss/extended.c @@ -39,22 +39,20 @@ extern "C" { f_string_range_t content_partial = f_string_range_t_initialize; - quote = f_fss_quote_type_none_e; - status = private_fl_fss_basic_read(buffer, F_false, state, range, &content_partial, "e, delimits); if (status == F_fss_found_object || F_status_set_fine(status) == F_fss_found_object_content_not) { status_allocate = f_string_ranges_increase(state.step_small, found); - if (F_status_is_error_not(status_allocate) && quotes) { - status_allocate = f_uint8s_increase(state.step_small, quotes); - } - // The private function sets the error bit on unterminated quoted Object. if (status == F_status_set_error(F_fss_found_object_content_not)) { status = F_fss_found_object_content_not; } + if (F_status_is_error_not(status_allocate) && quotes) { + status_allocate = f_uint8s_increase(state.step_small, quotes); + } + if (F_status_is_error(status_allocate)) { delimits->used = delimits_used; @@ -68,17 +66,7 @@ extern "C" { found->array[found->used++] = content_partial; if (quotes) { - if (quote == f_fss_quote_type_double_e) { - quotes->array[quotes->used] = f_string_ascii_quote_double_s.string[0]; - } - else if (quote == f_fss_quote_type_single_e) { - quotes->array[quotes->used] = f_string_ascii_quote_single_s.string[0]; - } - else { - quotes->array[quotes->used] = 0; - } - - quotes->used = found->used; + quotes->array[quotes->used++] = quote; } content_found = 1; @@ -116,6 +104,10 @@ extern "C" { else if (F_status_is_error(status)) { delimits->used = delimits_used; + if (quotes) { + quotes->used = quotes_used; + } + return status; } } // while diff --git a/level_1/fl_fss/c/fss/extended.h b/level_1/fl_fss/c/fss/extended.h index c407fbc..f8edcba 100644 --- a/level_1/fl_fss/c/fss/extended.h +++ b/level_1/fl_fss/c/fss/extended.h @@ -53,7 +53,7 @@ extern "C" { * @param found * A set of all locations where a valid content was found. * @param quotes - * An array of quotes designating whether or not content is quoted and what quote is in use. + * This will store the quote types representing the character to use (from the f_fss_quote_type_*_e). * Set pointer address to 0 to not use. * @param delimits * A delimits array representing where delimits exist within the buffer. @@ -185,7 +185,7 @@ extern "C" { * @param found * A location where a valid object was found. * @param quoted - * This will store whether or not this object is quoted and what quote is in use. + * This will store the quote type representing the character to use (from the f_fss_quote_type_*_e). * Set pointer address to 0 to not use. * @param delimits * A delimits array representing where delimits exist within the buffer. diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index c2dd489..a117e49 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -253,7 +253,7 @@ extern "C" { return F_none_stop; } - if (buffer.string[range->start] == f_fss_delimit_quote_single_s.string[0] || buffer.string[range->start] == f_fss_delimit_quote_double_s.string[0] || (object_as && buffer.string[range->start] == f_fss_comment_s.string[0])) { + if (buffer.string[range->start] == f_fss_quote_single_s.string[0] || buffer.string[range->start] == f_fss_quote_double_s.string[0] || buffer.string[range->start] == f_fss_quote_backtick_s.string[0] || (object_as && buffer.string[range->start] == f_fss_comment_s.string[0])) { // Only the first slash before a quote needs to be escaped (or not) as once there is a slash before a quote, this cannot ever be a quote object. // This simplifies the number of slashes needed. @@ -266,7 +266,7 @@ extern "C" { if (F_status_is_error(status)) return status; } } - else if (buffer.string[range->start] == f_fss_delimit_quote_single_s.string[0] || buffer.string[range->start] == f_fss_delimit_quote_double_s.string[0]) { + else if (buffer.string[range->start] == f_fss_quote_single_s.string[0] || buffer.string[range->start] == f_fss_delimit_quote_double_s.string[0] || buffer.string[range->start] == f_fss_quote_backtick_s.string[0]) { quote_found = buffer.string[range->start]; status = f_utf_buffer_increment(buffer, range, 1); @@ -366,11 +366,14 @@ extern "C" { if (status == F_true) { if (quote) { - if (quote_found == f_fss_delimit_quote_single_s.string[0]) { + if (quote_found == f_fss_quote_double_s.string[0]) { + *quote = f_fss_quote_type_double_e; + } + else if (quote_found == f_fss_quote_single_s.string[0]) { *quote = f_fss_quote_type_single_e; } - else if (quote_found == f_fss_delimit_quote_double_s.string[0]) { - *quote = f_fss_quote_type_double_e; + else if (quote_found == f_fss_quote_backtick_s.string[0]) { + *quote = f_fss_quote_type_backtick_e; } else { *quote = f_fss_quote_type_none_e; @@ -526,11 +529,14 @@ extern "C" { if (status == F_true) { if (quote) { - if (quote_found == f_fss_delimit_quote_single_s.string[0]) { + if (quote_found == f_fss_quote_double_s.string[0]) { + *quote = f_fss_quote_type_double_e; + } + else if (quote_found == f_fss_quote_single_s.string[0]) { *quote = f_fss_quote_type_single_e; } - else if (quote_found == f_fss_delimit_quote_double_s.string[0]) { - *quote = f_fss_quote_type_double_e; + else if (quote_found == f_fss_quote_backtick_s.string[0]) { + *quote = f_fss_quote_type_backtick_e; } else { *quote = f_fss_quote_type_none_e; diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index d44128f..4ab48eb 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -112,7 +112,7 @@ extern "C" { * @param found * A set of all locations where a valid object was found. * @param quote - * This will store whether or not this object is quote and what quote is in use. + * This will store the quote type representing the character to use (from the f_fss_quote_type_*_e). * Set pointer address to 0 to not use. * @param delimits * An array of delimits detected during processing. diff --git a/level_2/fll_fss/c/fss/basic.h b/level_2/fll_fss/c/fss/basic.h index d404343..7cd7bc9 100644 --- a/level_2/fll_fss/c/fss/basic.h +++ b/level_2/fll_fss/c/fss/basic.h @@ -48,7 +48,7 @@ extern "C" { * @param contents * This will be populated with all valid contents found. * @param objects_quoted - * (optional) An array mapped to each object in objects representing the quote discovered, if any. + * (optional) An array mapped to each object in objects representing the quote type discovered (from the f_fss_quote_type_*_e), if any. * Set the pointer address to 0 to disable. * @param objects_delimits * An array of delimits for objects detected during processing. diff --git a/level_2/fll_fss/c/fss/extended.h b/level_2/fll_fss/c/fss/extended.h index 6dcf939..33ca876 100644 --- a/level_2/fll_fss/c/fss/extended.h +++ b/level_2/fll_fss/c/fss/extended.h @@ -47,10 +47,10 @@ extern "C" { * @param contents * This will be populated with all valid contents found. * @param objects_quoted - * (optional) An array mapped to each object in objects representing the quote discovered, if any. + * (optional) An array mapped to each object in objects representing the quote type discovered (from the f_fss_quote_type_*_e), if any. * Set the pointer address to 0 to disable. * @param contents_quoted - * (optional) An array mapped to each content in contents representing the quote discovered, if any. + * (optional) An array mapped to each content in objects representing the quote type discovered (from the f_fss_quote_type_*_e), if any. * Set the pointer address to 0 to disable. * @param objects_delimits * An array of delimits for objects detected during processing. diff --git a/level_3/fss_basic_read/c/private-print.c b/level_3/fss_basic_read/c/private-print.c index 56cac0d..f8c8a60 100644 --- a/level_3/fss_basic_read/c/private-print.c +++ b/level_3/fss_basic_read/c/private-print.c @@ -20,13 +20,27 @@ extern "C" { if (data->option & fss_basic_read_data_option_trim_d) { if (data->option & fss_basic_read_data_option_original_d) { if (data->quotes.array[at]) { - f_print_dynamic_raw(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } fl_print_trim_dynamic_partial(data->buffer, data->objects.array[at], main->output.to.stream); if (data->quotes.array[at]) { - f_print_dynamic_raw(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } } else { @@ -36,13 +50,27 @@ extern "C" { else { if (data->option & fss_basic_read_data_option_original_d) { if (data->quotes.array[at]) { - f_print_dynamic_raw(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } f_print_dynamic_partial(data->buffer, data->objects.array[at], main->output.to.stream); if (data->quotes.array[at]) { - f_print_dynamic_raw(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } } else { diff --git a/level_3/fss_extended_read/c/private-print.c b/level_3/fss_extended_read/c/private-print.c index f318c56..f94030d 100644 --- a/level_3/fss_extended_read/c/private-print.c +++ b/level_3/fss_extended_read/c/private-print.c @@ -20,24 +20,52 @@ extern "C" { if (data->option & fss_extended_read_data_option_object_d) { if (data->option & fss_extended_read_data_option_trim_d) { if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_object.array[at]) { - f_print_dynamic_raw(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_object.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_object.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream); if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_object.array[at]) { - f_print_dynamic_raw(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_object.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_object.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } } else { if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_object.array[at]) { - f_print_dynamic_raw(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_object.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_object.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream); if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_object.array[at]) { - f_print_dynamic_raw(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_object.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_object.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } } @@ -54,13 +82,27 @@ extern "C" { content_printed = F_true; if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_content.array[at].array[data->select]) { - f_print_dynamic_raw(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_content.array[at].array[data->select] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[data->select], delimits_content, main->output.to.stream); if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_content.array[at].array[data->select]) { - f_print_dynamic_raw(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_content.array[at].array[data->select] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } } } @@ -74,13 +116,27 @@ extern "C" { content_printed = F_true; if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_content.array[at].array[i]) { - f_print_dynamic_raw(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_content.array[at].array[i] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[i], delimits_content, main->output.to.stream); if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_content.array[at].array[i]) { - f_print_dynamic_raw(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_content.array[at].array[i] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } if (i + 1 < data->contents.array[at].used && data->contents.array[at].array[i + 1].start <= data->contents.array[at].array[i + 1].stop) { diff --git a/level_3/fss_extended_read/c/private-read.c b/level_3/fss_extended_read/c/private-read.c index f304972..fc17785 100644 --- a/level_3/fss_extended_read/c/private-read.c +++ b/level_3/fss_extended_read/c/private-read.c @@ -406,13 +406,27 @@ extern "C" { } else { if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_object.array[at]) { - f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_character_safely( + data->quotes_object.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s.string[0] + : data->quotes_object.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s.string[0] + : f_fss_quote_backtick_s.string[0], + main->output.to.stream + ); } fss_extended_read_print_at(main, i, *delimits_object, *delimits_content, data); if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_object.array[at]) { - f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_character_safely( + data->quotes_object.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s.string[0] + : data->quotes_object.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s.string[0] + : f_fss_quote_backtick_s.string[0], + main->output.to.stream + ); } } } @@ -426,13 +440,27 @@ extern "C" { } else { if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_content.array[at].array[i]) { - f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_character_safely( + data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e + ? f_fss_quote_single_s.string[0] + : data->quotes_content.array[at].array[i] == f_fss_quote_type_double_e + ? f_fss_quote_double_s.string[0] + : f_fss_quote_backtick_s.string[0], + main->output.to.stream + ); } fss_extended_read_print_at(main, i, *delimits_object, *delimits_content, data); if ((data->option & fss_extended_read_data_option_original_d) && data->quotes_content.array[at].array[i]) { - f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_character_safely( + data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e + ? f_fss_quote_single_s.string[0] + : data->quotes_content.array[at].array[i] == f_fss_quote_type_double_e + ? f_fss_quote_double_s.string[0] + : f_fss_quote_backtick_s.string[0], + main->output.to.stream + ); } } diff --git a/level_3/fss_payload_read/c/private-print.c b/level_3/fss_payload_read/c/private-print.c index db7a459..c528770 100644 --- a/level_3/fss_payload_read/c/private-print.c +++ b/level_3/fss_payload_read/c/private-print.c @@ -68,24 +68,52 @@ extern "C" { if (data->option & fss_payload_read_data_option_object_d) { if (data->option & fss_payload_read_data_option_trim_d) { if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_object_header.array[at]) { - f_print_dynamic_raw(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_object_header.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_object_header.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } fl_print_trim_except_dynamic_partial(data->buffer, data->objects_header.array[at], delimits_object, main->output.to.stream); if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_object_header.array[at]) { - f_print_dynamic_raw(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_object_header.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_object_header.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } } else { if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_object_header.array[at]) { - f_print_dynamic_raw(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_object_header.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_object_header.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } f_print_except_dynamic_partial(data->buffer, data->objects_header.array[at], delimits_object, main->output.to.stream); if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_object_header.array[at]) { - f_print_dynamic_raw(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_object_header.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_object_header.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } } @@ -102,13 +130,27 @@ extern "C" { content_printed = F_true; if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_content_header.array[at].array[data->select]) { - f_print_dynamic_raw(data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } f_print_except_dynamic_partial(data->buffer, data->contents_header.array[at].array[data->select], delimits_content, main->output.to.stream); if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_content_header.array[at].array[data->select]) { - f_print_dynamic_raw(data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_content_header.array[at].array[data->select] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } } } @@ -122,13 +164,27 @@ extern "C" { content_printed = F_true; if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_content_header.array[at].array[i]) { - f_print_dynamic_raw(data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_content_header.array[at].array[i] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } f_print_except_dynamic_partial(data->buffer, data->contents_header.array[at].array[i], delimits_content, main->output.to.stream); if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_content_header.array[at].array[i]) { - f_print_dynamic_raw(data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s : f_fss_quote_double_s, main->output.to.stream); + f_print_dynamic_raw( + data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e + ? f_fss_quote_single_s + : data->quotes_content_header.array[at].array[i] == f_fss_quote_type_double_e + ? f_fss_quote_double_s + : f_fss_quote_backtick_s, + main->output.to.stream + ); } if (i + 1 < data->contents_header.array[at].used && data->contents_header.array[at].array[i + 1].start <= data->contents_header.array[at].array[i + 1].stop) { diff --git a/level_3/fss_payload_read/c/private-read.c b/level_3/fss_payload_read/c/private-read.c index d930469..099f1ce 100644 --- a/level_3/fss_payload_read/c/private-read.c +++ b/level_3/fss_payload_read/c/private-read.c @@ -609,13 +609,27 @@ extern "C" { } else { if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_object_header.array[at]) { - f_print_character_safely(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_character_safely( + data->quotes_object_header.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s.string[0] + : data->quotes_object_header.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s.string[0] + : f_fss_quote_backtick_s.string[0], + main->output.to.stream + ); } fss_payload_read_print_at_extended(main, i, *delimits_object, *delimits_content, data); if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_object_header.array[at]) { - f_print_character_safely(data->quotes_object_header.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_character_safely( + data->quotes_object_header.array[at] == f_fss_quote_type_single_e + ? f_fss_quote_single_s.string[0] + : data->quotes_object_header.array[at] == f_fss_quote_type_double_e + ? f_fss_quote_double_s.string[0] + : f_fss_quote_backtick_s.string[0], + main->output.to.stream + ); } } } @@ -629,13 +643,27 @@ extern "C" { } else { if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_content_header.array[at].array[i]) { - f_print_character_safely(data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_character_safely( + data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e + ? f_fss_quote_single_s.string[0] + : data->quotes_content_header.array[at].array[i] == f_fss_quote_type_double_e + ? f_fss_quote_double_s.string[0] + : f_fss_quote_backtick_s.string[0], + main->output.to.stream + ); } fss_payload_read_print_at_extended(main, i, *delimits_object, *delimits_content, data); if ((data->option & fss_payload_read_data_option_original_d) && data->quotes_content_header.array[at].array[i]) { - f_print_character_safely(data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s.string[0] : f_fss_quote_double_s.string[0], main->output.to.stream); + f_print_character_safely( + data->quotes_content_header.array[at].array[i] == f_fss_quote_type_single_e + ? f_fss_quote_single_s.string[0] + : data->quotes_content_header.array[at].array[i] == f_fss_quote_type_double_e + ? f_fss_quote_double_s.string[0] + : f_fss_quote_backtick_s.string[0], + main->output.to.stream + ); } } -- 1.8.3.1