From d01847b0e586f0047659803cfd6dc9f44ef0d855 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 20 Mar 2012 22:01:23 -0500 Subject: [PATCH] Bugfix: delimit whitespaces on write I believe I had a mental lapse on this one. The previous code was acting like a read operation in certain cases when dealing with whitespace. When doing a write if a white space exists treat don't ignore it; instead, wrap it in quotes so that object names can contain spaces. For example " " is a valid object name which is a object whose name is a single space. --- level_1/fl_fss/c/fss_basic.c | 22 +++++----------------- level_1/fl_fss/c/fss_extended.c | 8 +++++--- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index b6dd2dc..a4cc3f3 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -277,10 +277,12 @@ extern "C"{ f_string_length start_position = f_string_initialize; f_string_length pre_allocate_size = f_string_length_initialize; - fl_macro_fss_skip_past_all_whitespace(buffer, (*input)) + fl_macro_fss_skip_past_delimit_placeholders(buffer, (*input)) - if (input->start >= buffer.used) { - return f_no_data; + if (input->start > input->stop) { + return f_no_data_on_stop; + } else if (input->start >= buffer.used) { + return f_no_data_on_eos; } start_position = input->start; @@ -353,20 +355,6 @@ extern "C"{ input->start++; continue; } else if (isspace(buffer.string[input->start])) { - f_string_length first_space = input->start; - - input->start++; - - while (input->start <= input->stop && input->start < buffer.used && isspace(buffer.string[input->start])) { - input->start++; - } // while - - if (input->start > input->stop || input->start >= buffer.used) { - object->string[first_space] = f_fss_basic_open; - object->used = object_position.stop + 1; - break; - } - // restart the loop searching for f_fss_delimit_double_quote. input->start = start_position; object_position.stop = object_position.start; diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index 27fd439..25f345d 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -409,10 +409,12 @@ extern "C"{ f_string_length start_position = f_string_initialize; f_string_length pre_allocate_size = f_string_length_initialize; - fl_macro_fss_skip_past_all_whitespace(buffer, (*input)) + fl_macro_fss_skip_past_delimit_placeholders(buffer, (*input)) - if (input->start >= buffer.used) { - return f_no_data; + if (input->start > input->stop) { + return f_no_data_on_stop; + } else if (input->start >= buffer.used) { + return f_no_data_on_eos; } start_position = input->start; -- 1.8.3.1