From: Kevin Day Date: Tue, 5 May 2020 03:25:47 +0000 (-0500) Subject: Cleanup: replace variable name 'input' with 'location', add location parameter check X-Git-Tag: 0.5.0~290 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=b4a63e9183d35d077fd7a67c7948c7768b211026;p=fll Cleanup: replace variable name 'input' with 'location', add location parameter check Using the word 'location' makes more semantic sense than 'input', especially given that the variable type is called a location. --- diff --git a/level_2/fll_fss/c/fss_basic.c b/level_2/fll_fss/c/fss_basic.c index d97de5c..1f99ec3 100644 --- a/level_2/fll_fss/c/fss_basic.c +++ b/level_2/fll_fss/c/fss_basic.c @@ -5,9 +5,10 @@ extern "C" { #endif #ifndef _di_fll_fss_basic_read_ - f_return_status fll_fss_basic_read(f_string_dynamic *buffer, f_string_location *input, f_fss_objects *objects, f_fss_contents *contents) { + f_return_status fll_fss_basic_read(f_string_dynamic *buffer, f_string_location *location, f_fss_objects *objects, f_fss_contents *contents) { #ifndef _di_level_2_parameter_checking_ if (buffer == 0) return f_status_set_error(f_invalid_parameter); + if (location == 0) return f_status_set_error(f_invalid_parameter); if (objects == 0) return f_status_set_error(f_invalid_parameter); if (contents == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_2_parameter_checking_ @@ -32,13 +33,13 @@ extern "C" { } do { - status = fl_fss_basic_object_read(buffer, input, &objects->array[objects->used]); + status = fl_fss_basic_object_read(buffer, location, &objects->array[objects->used]); if (f_status_is_error(status)) { return status; } - if (input->start >= input->stop || input->start >= buffer->used) { + if (location->start >= location->stop || location->start >= buffer->used) { if (status == fl_fss_found_object || status == fl_fss_found_object_no_content) { objects->used++; @@ -58,14 +59,14 @@ extern "C" { } if (found_data) { - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_none_on_eos; } return f_none_on_stop; } else { - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_no_data_on_eos; } @@ -75,7 +76,7 @@ extern "C" { if (status == fl_fss_found_object) { found_data = f_true; - status = fl_fss_basic_content_read(buffer, input, &contents->array[contents->used]); + status = fl_fss_basic_content_read(buffer, location, &contents->array[contents->used]); if (f_status_is_error(status)) { return status; @@ -119,14 +120,14 @@ extern "C" { else if (status != fl_fss_found_object && status != fl_fss_found_content && status != fl_fss_found_no_content && status != fl_fss_found_object_no_content) { return status; } - // When content is found, the input->start is incremented, if content is found at input->stop, then input->start will be > input.stop. - else if (input->start >= input->stop || input->start >= buffer->used) { + // When content is found, the location->start is incremented, if content is found at location->stop, then location->start will be > location.stop. + else if (location->start >= location->stop || location->start >= buffer->used) { if (status == fl_fss_found_object || status == fl_fss_found_content || status == fl_fss_found_no_content || status == fl_fss_found_object_no_content) { objects->used++; contents->used++; } - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_none_on_eos; } @@ -135,7 +136,7 @@ extern "C" { objects->used++; contents->used++; - } while (input->start < f_string_max_size); + } while (location->start < f_string_max_size); return f_status_is_error(f_number_overflow); } diff --git a/level_2/fll_fss/c/fss_basic.h b/level_2/fll_fss/c/fss_basic.h index a92881f..18fe0ca 100644 --- a/level_2/fll_fss/c/fss_basic.h +++ b/level_2/fll_fss/c/fss_basic.h @@ -54,7 +54,7 @@ extern "C" { * f_number_overflow (with error bit) if the maximimum buffer size is reached. */ #ifndef _di_fll_fss_basic_read_ - extern f_return_status fll_fss_basic_read(f_string_dynamic *buffer, f_string_location *input, f_fss_objects *objects, f_fss_contents *contents); + extern f_return_status fll_fss_basic_read(f_string_dynamic *buffer, f_string_location *location, f_fss_objects *objects, f_fss_contents *contents); #endif // _di_fll_fss_basic_read_ /** diff --git a/level_2/fll_fss/c/fss_basic_list.c b/level_2/fll_fss/c/fss_basic_list.c index dbabc18..9c22ed3 100644 --- a/level_2/fll_fss/c/fss_basic_list.c +++ b/level_2/fll_fss/c/fss_basic_list.c @@ -5,9 +5,10 @@ extern "C" { #endif #ifndef _di_fll_fss_basic_list_read_ - f_return_status fll_fss_basic_list_read(f_string_dynamic *buffer, f_string_location *input, f_fss_objects *objects, f_fss_contents *contents) { + f_return_status fll_fss_basic_list_read(f_string_dynamic *buffer, f_string_location *location, f_fss_objects *objects, f_fss_contents *contents) { #ifndef _di_level_2_parameter_checking_ if (buffer == 0) return f_status_set_error(f_invalid_parameter); + if (location == 0) return f_status_set_error(f_invalid_parameter); if (objects == 0) return f_status_set_error(f_invalid_parameter); if (contents == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_2_parameter_checking_ @@ -32,13 +33,13 @@ extern "C" { } do { - status = fl_fss_basic_list_object_read(buffer, input, &objects->array[objects->used]); + status = fl_fss_basic_list_object_read(buffer, location, &objects->array[objects->used]); if (f_status_is_error(status)) { return status; } - if (input->start >= input->stop || input->start >= buffer->used) { + if (location->start >= location->stop || location->start >= buffer->used) { if (status == fl_fss_found_object || status == fl_fss_found_object_no_content) { objects->used++; @@ -58,14 +59,14 @@ extern "C" { } if (found_data) { - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_none_on_eos; } return f_none_on_stop; } else { - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_no_data_on_eos; } @@ -75,7 +76,7 @@ extern "C" { if (status == fl_fss_found_object) { found_data = f_true; - status = fl_fss_basic_list_content_read(buffer, input, &contents->array[contents->used]); + status = fl_fss_basic_list_content_read(buffer, location, &contents->array[contents->used]); if (f_status_is_error(status)) { return status; @@ -119,14 +120,14 @@ extern "C" { else if (status != fl_fss_found_object && status != fl_fss_found_content && status != fl_fss_found_no_content && status != fl_fss_found_object_no_content) { return status; } - // When content is found, the input->start is incremented, if content is found at input->stop, then input->start will be > input.stop. - else if (input->start >= input->stop || input->start >= buffer->used) { + // When content is found, the location->start is incremented, if content is found at location->stop, then location->start will be > location.stop. + else if (location->start >= location->stop || location->start >= buffer->used) { if (status == fl_fss_found_object || status == fl_fss_found_content || status == fl_fss_found_no_content || status == fl_fss_found_object_no_content) { objects->used++; contents->used++; } - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_none_on_eos; } @@ -135,7 +136,7 @@ extern "C" { objects->used++; contents->used++; - } while (input->start < f_string_max_size); + } while (location->start < f_string_max_size); return f_status_is_error(f_number_overflow); } diff --git a/level_2/fll_fss/c/fss_basic_list.h b/level_2/fll_fss/c/fss_basic_list.h index 500944e..f43eedd 100644 --- a/level_2/fll_fss/c/fss_basic_list.h +++ b/level_2/fll_fss/c/fss_basic_list.h @@ -53,7 +53,7 @@ extern "C" { * f_number_overflow (with error bit) if the maximimum buffer size is reached. */ #ifndef _di_fll_fss_basic_list_read_ - extern f_return_status fll_fss_basic_list_read(f_string_dynamic *buffer, f_string_location *input, f_fss_objects *objects, f_fss_contents *contents); + extern f_return_status fll_fss_basic_list_read(f_string_dynamic *buffer, f_string_location *location, f_fss_objects *objects, f_fss_contents *contents); #endif // _di_fll_fss_basic_list_read_ /** diff --git a/level_2/fll_fss/c/fss_extended.c b/level_2/fll_fss/c/fss_extended.c index 0397c03..a792572 100644 --- a/level_2/fll_fss/c/fss_extended.c +++ b/level_2/fll_fss/c/fss_extended.c @@ -5,9 +5,10 @@ extern "C" { #endif #ifndef _di_fll_fss_extended_read_ - f_return_status fll_fss_extended_read(f_string_dynamic *buffer, f_string_location *input, f_fss_objects *objects, f_fss_contents *contents) { + f_return_status fll_fss_extended_read(f_string_dynamic *buffer, f_string_location *location, f_fss_objects *objects, f_fss_contents *contents) { #ifndef _di_level_2_parameter_checking_ if (buffer == 0) return f_status_set_error(f_invalid_parameter); + if (location == 0) return f_status_set_error(f_invalid_parameter); if (objects == 0) return f_status_set_error(f_invalid_parameter); if (contents == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_2_parameter_checking_ @@ -32,13 +33,13 @@ extern "C" { } do { - status = fl_fss_extended_object_read(buffer, input, &objects->array[objects->used]); + status = fl_fss_extended_object_read(buffer, location, &objects->array[objects->used]); if (f_status_is_error(status)) { return status; } - if (input->start >= input->stop || input->start >= buffer->used) { + if (location->start >= location->stop || location->start >= buffer->used) { if (status == fl_fss_found_object || status == fl_fss_found_object_no_content) { objects->used++; @@ -58,14 +59,14 @@ extern "C" { } if (found_data) { - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_none_on_eos; } return f_none_on_stop; } else { - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_no_data_on_eos; } @@ -75,7 +76,7 @@ extern "C" { if (status == fl_fss_found_object) { found_data = f_true; - status = fl_fss_extended_content_read(buffer, input, &contents->array[contents->used]); + status = fl_fss_extended_content_read(buffer, location, &contents->array[contents->used]); if (f_status_is_error(status)) { return status; @@ -119,14 +120,14 @@ extern "C" { else if (status != fl_fss_found_object && status != fl_fss_found_content && status != fl_fss_found_no_content && status != fl_fss_found_object_no_content) { return status; } - // When content is found, the input->start is incremented, if content is found at input->stop, then input->start will be > input.stop. - else if (input->start >= input->stop || input->start >= buffer->used) { + // When content is found, the location->start is incremented, if content is found at location->stop, then location->start will be > location.stop. + else if (location->start >= location->stop || location->start >= buffer->used) { if (status == fl_fss_found_object || status == fl_fss_found_content || status == fl_fss_found_no_content || status == fl_fss_found_object_no_content) { objects->used++; contents->used++; } - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_none_on_eos; } @@ -135,7 +136,7 @@ extern "C" { objects->used++; contents->used++; - } while (input->start < f_string_max_size); + } while (location->start < f_string_max_size); return f_status_is_error(f_number_overflow); } diff --git a/level_2/fll_fss/c/fss_extended.h b/level_2/fll_fss/c/fss_extended.h index e3d43d6..940f14a 100644 --- a/level_2/fll_fss/c/fss_extended.h +++ b/level_2/fll_fss/c/fss_extended.h @@ -53,7 +53,7 @@ extern "C" { * f_number_overflow (with error bit) if the maximimum buffer size is reached. */ #ifndef _di_fll_fss_extended_read_ - extern f_return_status fll_fss_extended_read(f_string_dynamic *buffer, f_string_location *input, f_fss_objects *objects, f_fss_contents *contents); + extern f_return_status fll_fss_extended_read(f_string_dynamic *buffer, f_string_location *location, f_fss_objects *objects, f_fss_contents *contents); #endif // _di_fll_fss_extended_read_ /** diff --git a/level_2/fll_fss/c/fss_extended_list.c b/level_2/fll_fss/c/fss_extended_list.c index f612976..7278918 100644 --- a/level_2/fll_fss/c/fss_extended_list.c +++ b/level_2/fll_fss/c/fss_extended_list.c @@ -5,9 +5,10 @@ extern "C" { #endif #ifndef _di_fll_fss_extended_list_read_ - f_return_status fll_fss_extended_list_read(f_string_dynamic *buffer, f_string_location *input, f_fss_nest *nest) { + f_return_status fll_fss_extended_list_read(f_string_dynamic *buffer, f_string_location *location, f_fss_nest *nest) { #ifndef _di_level_3_parameter_checking_ if (buffer == 0) return f_status_set_error(f_invalid_parameter); + if (location == 0) return f_status_set_error(f_invalid_parameter); if (nest == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_3_parameter_checking_ @@ -32,27 +33,27 @@ extern "C" { } } - status = fl_fss_extended_list_object_read(buffer, input, &nest->depth[0].array[nest->depth[0].used].object); + status = fl_fss_extended_list_object_read(buffer, location, &nest->depth[0].array[nest->depth[0].used].object); if (f_status_is_error(status)) { return status; } - if (input->start >= input->stop || input->start >= buffer->used) { + if (location->start >= location->stop || location->start >= buffer->used) { if (status == fl_fss_found_object || status == fl_fss_found_object_no_content) { // extended list requires content closure, so this could be an error. return fl_fss_found_object_no_content; } if (found_data) { - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_none_on_eos; } return f_none_on_stop; } else { - if (input->start >= buffer->used) { + if (location->start >= buffer->used) { return f_no_data_on_eos; } @@ -62,7 +63,7 @@ extern "C" { if (status == fl_fss_found_object) { found_data = f_true; - status = fl_fss_extended_list_content_read(buffer, input, nest); + status = fl_fss_extended_list_content_read(buffer, location, nest); break; } @@ -96,15 +97,15 @@ extern "C" { else if (status != fl_fss_found_object && status != fl_fss_found_content && status != fl_fss_found_no_content && status != fl_fss_found_object_no_content) { return status; } - // When content is found, the input->start is incremented, if content is found at input->stop, then input->start will be > input.stop. - else if (input->start >= input->stop || input->start >= buffer->used) { - if (input->start >= buffer->used) { + // When content is found, the location->start is incremented, if content is found at location->stop, then location->start will be > location.stop. + else if (location->start >= location->stop || location->start >= buffer->used) { + if (location->start >= buffer->used) { return f_none_on_eos; } return f_none_on_stop; } - } while (input->start < f_string_max_size); + } while (location->start < f_string_max_size); return f_status_is_error(f_number_overflow); } diff --git a/level_2/fll_fss/c/fss_extended_list.h b/level_2/fll_fss/c/fss_extended_list.h index 05f0ab7..46c7239 100644 --- a/level_2/fll_fss/c/fss_extended_list.h +++ b/level_2/fll_fss/c/fss_extended_list.h @@ -58,7 +58,7 @@ extern "C" { * f_number_overflow (with error bit) if the maximimum buffer size is reached. */ #ifndef _di_fll_fss_extended_list_read_ - extern f_return_status fll_fss_extended_list_read(f_string_dynamic *buffer, f_string_location *input, f_fss_nest *nest); + extern f_return_status fll_fss_extended_list_read(f_string_dynamic *buffer, f_string_location *location, f_fss_nest *nest); #endif // _di_fll_fss_extended_list_read_ /**