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.
* @param found
* A location where a valid object was found.
* @param quote
- * This will store the quote character to use (if value is 0, then there is not quote).
+ * 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.
f_string_range_t content_partial = f_string_range_t_initialize;
- quote = 0;
-
private_fl_fss_basic_read(buffer, F_false, range, &content_partial, "e, delimits, state);
if (state->status == F_fss_found_object || F_status_set_fine(state->status) == F_fss_found_object_content_not) {
status = f_string_ranges_increase(state->step_small, found);
- if (F_status_is_error_not(status) && quotes) {
- status = f_uint8s_increase(state->step_small, quotes);
- }
-
// The private function sets the error bit on unterminated quoted Object.
if (state->status == F_status_set_error(F_fss_found_object_content_not)) {
state->status = F_fss_found_object_content_not;
}
+ if (F_status_is_error_not(status) && quotes) {
+ status = f_uint8s_increase(state->step_small, quotes);
+ }
+
if (F_status_is_error(status)) {
delimits->used = delimits_used;
state->status = status;
found->array[found->used++] = content_partial;
if (quotes) {
- if (quote == f_fss_quote_type_double_e) {
- quotes->array[quotes->used] = f_fss_quote_double_s.string[0];
- }
- else if (quote == f_fss_quote_type_single_e) {
- quotes->array[quotes->used] = f_fss_quote_single_s.string[0];
- }
- else if (quote == f_fss_quote_type_backtick_e) {
- quotes->array[quotes->used] = f_fss_quote_backtick_s.string[0];
- }
- else {
- quotes->array[quotes->used] = 0;
- }
-
- quotes->used = found->used;
+ quotes->array[quotes->used++] = quote;
}
content_found = 1;
else if (F_status_is_error(state->status)) {
delimits->used = delimits_used;
+ if (quotes) {
+ quotes->used = quotes_used;
+ }
+
return;
}
} // while
* @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 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.
* @param found
* A location where a valid object was found.
* @param quote
- * This will store the quote character to use (if value is 0, then there is not quote).
+ * 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.
f_char_t quote_found = 0;
if (quote) {
- *quote = 0;
+ *quote = f_fss_quote_type_none_e;
}
// Identify where the object begins.
if (state->status == F_true) {
if (quote) {
- if (quote_found == f_fss_quote_single_s.string[0] || quote_found == f_fss_quote_double_s.string[0] || quote_found == f_fss_quote_backtick_s.string[0]) {
- *quote = quote_found;
+ 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_quote_backtick_s.string[0]) {
+ *quote = f_fss_quote_type_backtick_e;
}
else {
- *quote = 0;
+ *quote = f_fss_quote_type_none_e;
}
}
if (state->status == F_true) {
if (quote) {
- if (quote_found == f_fss_quote_single_s.string[0] || quote_found == f_fss_quote_double_s.string[0] || quote_found == f_fss_quote_backtick_s.string[0]) {
- *quote = quote_found;
+ 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_quote_backtick_s.string[0]) {
+ *quote = f_fss_quote_type_backtick_e;
}
else {
*quote = f_fss_quote_type_none_e;
* @param found
* A set of all locations where a valid object was found.
* @param quote
- * This will store the quote character to use (if value is 0, then there is not quote).
+ * 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.