From 98cc5c4b69c5380887ed2ec36828b0dbf738f7ca Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 8 May 2020 20:23:46 -0500 Subject: [PATCH] Update: switch back to lengths from inclusive ranges Using start and stop ranges ended up being cumbersome. Using length is simpler and a start range can be used by just adding to the source string before calling. --- level_1/fl_string/c/private-string.c | 92 +++++++-------- level_1/fl_string/c/private-string.h | 30 ++--- level_1/fl_string/c/string.c | 128 ++++++++++----------- level_1/fl_string/c/string.h | 84 ++++++-------- level_1/fl_utf/c/private-utf.c | 92 +++++++-------- level_1/fl_utf/c/private-utf.h | 32 ++---- level_1/fl_utf/c/utf.c | 128 ++++++++++----------- level_1/fl_utf/c/utf.h | 20 ++-- level_2/fll_execute/c/private-execute.c | 8 +- level_2/fll_program/c/program.c | 8 +- level_3/fake/c/private-fake.c | 2 +- .../c/private-fss_basic_list_read.c | 4 +- level_3/fss_basic_read/c/private-fss_basic_read.c | 4 +- .../c/private-fss_extended_list_read.c | 4 +- .../c/private-fss_extended_read.c | 4 +- 15 files changed, 291 insertions(+), 349 deletions(-) diff --git a/level_1/fl_string/c/private-string.c b/level_1/fl_string/c/private-string.c index 11e053b..d1bcad0 100644 --- a/level_1/fl_string/c/private-string.c +++ b/level_1/fl_string/c/private-string.c @@ -6,22 +6,19 @@ extern "C" { #endif #if !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) - f_return_status private_fl_string_append(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { - // The start and stop point are inclusive locations, and therefore start - stop is actually 1 too few locations. - f_string_length source_length = (stop - start) + 1; - - if (destination->used + source_length > f_string_max_size) return f_status_set_error(f_string_too_large); + f_return_status private_fl_string_append(const f_string source, const f_string_length length, f_string_dynamic *destination) { + if (destination->used + length > f_string_max_size) return f_status_set_error(f_string_too_large); f_status status = f_none; - const f_string_length total = destination->used + source_length; + const f_string_length total = destination->used + length; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); if (f_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source + start, source_length); + memcpy(destination->string + destination->used, source, length); destination->used = total; return f_none; @@ -29,31 +26,28 @@ extern "C" { #endif // !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) #if !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) - f_return_status private_fl_string_append_nulless(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { - // The start and stop point are inclusive locations, and therefore start - stop is actually 1 too few locations. - f_string_length source_length = (stop - start) + 1; - - if (destination->used + source_length > f_string_max_size) return f_status_set_error(f_string_too_large); + f_return_status private_fl_string_append_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) { + if (destination->used + length > f_string_max_size) return f_status_set_error(f_string_too_large); f_status status = f_none; f_string_length first = 0; - for (f_string_length i = 0; i <= source_length; i++) { - if (i == source_length) { + for (f_string_length i = 0; i <= length; i++) { + if (i == length) { if (i > first) { - f_string_length length = i - first; + f_string_length size = i - first; - if (destination->used + length > f_string_max_size) return f_status_set_error(f_string_too_large); + if (destination->used + size > f_string_max_size) return f_status_set_error(f_string_too_large); - f_string_length total = destination->used + length; + f_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); if (f_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source + start + first, length); + memcpy(destination->string + destination->used, source + first, size); destination->used = total; } @@ -63,23 +57,23 @@ extern "C" { if (source[i] == f_string_eos) { if (i > 0) { if (i > first) { - f_string_length length = i - first; + f_string_length size = i - first; - if (destination->used + length > f_string_max_size) return f_status_set_error(f_string_too_large); + if (destination->used + size > f_string_max_size) return f_status_set_error(f_string_too_large); - f_string_length total = destination->used + length; + f_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); if (f_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source + start + first, length); + memcpy(destination->string + destination->used, source + first, size); destination->used = total; } } - while (i + 1 < source_length && source[i + 1] == f_string_eos) { + while (i + 1 < length && source[i + 1] == f_string_eos) { i++; } // while @@ -254,15 +248,12 @@ extern "C" { #endif // !defined(_di_fl_string_compare_trim_) || !defined(_di_fl_string_dynamic_compare_trim_) || !defined(_di_fl_string_dynamic_partial_compare_trim_) #if !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) - f_return_status private_fl_string_prepend(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { - // The start and stop point are inclusive locations, and therefore start - stop is actually 1 too few locations. - f_string_length source_length = (stop - start) + 1; - - if (destination->used + source_length > f_string_max_size) return f_status_set_error(f_string_too_large); + f_return_status private_fl_string_prepend(const f_string source, const f_string_length length, f_string_dynamic *destination) { + if (destination->used + length > f_string_max_size) return f_status_set_error(f_string_too_large); f_status status = f_none; - const f_string_length total = destination->used + source_length; + const f_string_length total = destination->used + length; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); @@ -270,11 +261,11 @@ extern "C" { } if (destination->used > 0) { - memmove(destination->string + source_length, destination->string, destination->used); - memcpy(destination->string, source + start, source_length); + memmove(destination->string + length, destination->string, destination->used); + memcpy(destination->string, source, length); } else { - memcpy(destination->string, source + start, source_length); + memcpy(destination->string, source, length); } destination->used = total; @@ -283,36 +274,33 @@ extern "C" { #endif // !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) #if !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) - f_return_status private_fl_string_prepend_nulless(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { - // The start and stop point are inclusive locations, and therefore start - stop is actually 1 too few locations. - f_string_length source_length = (stop - start) + 1; - - if (destination->used + source_length > f_string_max_size) return f_status_set_error(f_string_too_large); + f_return_status private_fl_string_prepend_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) { + if (destination->used + length > f_string_max_size) return f_status_set_error(f_string_too_large); f_status status = f_none; f_string_length first = 0; f_string_length offset = 0; - for (f_string_length i = 0; i <= source_length; i++) { - if (i == source_length) { + for (f_string_length i = 0; i <= length; i++) { + if (i == length) { if (i > first) { - f_string_length length = i - first; + f_string_length size = i - first; - if (destination->used + length > f_string_max_size) return f_status_set_error(f_string_too_large); + if (destination->used + size > f_string_max_size) return f_status_set_error(f_string_too_large); - f_string_length total = destination->used + length; + f_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); if (f_status_is_error(status)) return status; } - memmove(destination->string + offset + length, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, length); + memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); + memcpy(destination->string + offset, source + first, size); destination->used = total; - offset += length; + offset += size; } break; @@ -321,11 +309,11 @@ extern "C" { if (source[i] == f_string_eos) { if (i > 0) { if (i > first) { - f_string_length length = i - first; + f_string_length size = i - first; - if (destination->used + length > f_string_max_size) return f_status_set_error(f_string_too_large); + if (destination->used + size > f_string_max_size) return f_status_set_error(f_string_too_large); - f_string_length total = destination->used + length; + f_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); @@ -333,15 +321,15 @@ extern "C" { if (f_status_is_error(status)) return status; } - memmove(destination->string + offset + length, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, length); + memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); + memcpy(destination->string + offset, source + first, size); destination->used = total; - offset += length; + offset += size; } } - while (i + 1 < source_length && source[i + 1] == f_string_eos) { + while (i + 1 < length && source[i + 1] == f_string_eos) { i++; } // while diff --git a/level_1/fl_string/c/private-string.h b/level_1/fl_string/c/private-string.h index 1c7ee77..2d80ddf 100644 --- a/level_1/fl_string/c/private-string.h +++ b/level_1/fl_string/c/private-string.h @@ -24,8 +24,8 @@ extern "C" { * * @param source * The source string to append. - * @param start - * Inclusive start point of string to append. + * @param length + * Length of source to append. * @param stop * Inclusive stop point of string to append. * @param destination @@ -44,7 +44,7 @@ extern "C" { * @see fl_string_dynamic_mash() */ #if !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) - extern f_return_status private_fl_string_append(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) f_gcc_attribute_visibility_internal; + extern f_return_status private_fl_string_append(const f_string source, const f_string_length length, f_string_dynamic *destination) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) /** @@ -54,10 +54,8 @@ extern "C" { * * @param source * The source string to append. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of string to append. + * @param length + * Length of source to append. * @param destination * The destination string the source and glue are appended onto. * @@ -74,7 +72,7 @@ extern "C" { * @see fl_string_dynamic_mash_nulless() */ #if !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) - extern f_return_status private_fl_string_append_nulless(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) f_gcc_attribute_visibility_internal; + extern f_return_status private_fl_string_append_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fl_string_append_nulless_) || !defined(_di_fl_string_dynamic_append_nulless_) || !defined(_di_fl_string_mash_nulless_) || !defined(_di_fl_string_dynamic_mash_nulless_) /** @@ -146,10 +144,8 @@ extern "C" { * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of string to append. + * @param length + * Length of source to append. * @param destination * The destination string the source and glue are prepended onto. * @@ -164,7 +160,7 @@ extern "C" { * @see fl_string_dynamic_prepend() */ #if !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_append_mish_) || !defined(_di_fl_string_dynamic_mish_) - extern f_return_status private_fl_string_prepend(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) f_gcc_attribute_visibility_internal; + extern f_return_status private_fl_string_prepend(const f_string source, const f_string_length length, f_string_dynamic *destination) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fl_string_prepend_) || !defined(_di_fl_string_dynamic_prepend_) || !defined(_di_fl_string_append_mish_) || !defined(_di_fl_string_dynamic_mish_) /** @@ -174,10 +170,8 @@ extern "C" { * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of string to append. + * @param length + * Length of source to append. * @param destination * The destination string the source and glue are prepended onto. * @@ -192,7 +186,7 @@ extern "C" { * @see fl_string_dynamic_prepend_nulless() */ #if !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) || !defined(_di_fl_string_append_mish_) || !defined(_di_fl_string_dynamic_mish_) - extern f_return_status private_fl_string_prepend_nulless(const f_string source, f_string_length start, const f_string_length stop, f_string_dynamic *destination) f_gcc_attribute_visibility_internal; + extern f_return_status private_fl_string_prepend_nulless(const f_string source, f_string_length length, f_string_dynamic *destination) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fl_string_prepend_nulless_) || !defined(_di_fl_string_dynamic_prepend_nulless_) || !defined(_di_fl_string_append_mish_) || !defined(_di_fl_string_dynamic_mish_) /** diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 84dd1ac..41d8861 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -6,26 +6,26 @@ extern "C" { #endif #ifndef _di_fl_string_append_ - f_return_status fl_string_append(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_append(const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - return private_fl_string_append(source, start, stop, destination); + return private_fl_string_append(source, length, destination); } #endif // _di_fl_string_append_ #ifndef _di_fl_string_append_nulless_ - f_return_status fl_string_append_nulless(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_append_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - return private_fl_string_append_nulless(source, start, stop, destination); + return private_fl_string_append_nulless(source, length, destination); } #endif // _di_fl_string_append_nulless_ @@ -61,7 +61,7 @@ extern "C" { if (source.used == 0) return f_no_data; - return private_fl_string_append(source.string, 0, source.used - 1, destination); + return private_fl_string_append(source.string, source.used, destination); } #endif // _di_fl_string_dynamic_append_ @@ -73,7 +73,7 @@ extern "C" { if (source.used == 0) return f_no_data; - return private_fl_string_append_nulless(source.string, 0, source.used - 1, destination); + return private_fl_string_append_nulless(source.string, source.used, destination); } #endif // _di_fl_string_dynamic_append_nulless_ @@ -86,12 +86,12 @@ extern "C" { if (source.used == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_append(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_append(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_append(source.string, 0, source.used - 1, destination); + return private_fl_string_append(source.string, source.used, destination); } #endif // _di_fl_string_dynamic_mash_ @@ -104,12 +104,12 @@ extern "C" { if (source.used == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_append_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_append_nulless(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_append_nulless(source.string, 0, source.used - 1, destination); + return private_fl_string_append_nulless(source.string, source.used, destination); } #endif // _di_fl_string_dynamic_mash_nulless_ @@ -122,12 +122,12 @@ extern "C" { if (source.used == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_prepend(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_prepend(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_prepend(source.string, 0, source.used - 1, destination); + return private_fl_string_prepend(source.string, source.used, destination); } #endif // _di_fl_string_dynamic_mish_ @@ -140,12 +140,12 @@ extern "C" { if (source.used == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_prepend_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_prepend_nulless(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_prepend_nulless(source.string, 0, source.used - 1, destination); + return private_fl_string_prepend_nulless(source.string, source.used, destination); } #endif // _di_fl_string_dynamic_mish_nulless_ @@ -159,7 +159,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_string_append(source.string, range.start, range.stop, destination); + return private_fl_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_partial_append_ @@ -173,7 +173,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_string_append_nulless(source.string, range.start, range.stop, destination); + return private_fl_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_append_nulless_ @@ -210,12 +210,12 @@ extern "C" { if (range.start > range.stop) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_append(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_append(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_append(source.string, range.start, range.stop, destination); + return private_fl_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_partial_mash_ @@ -230,12 +230,12 @@ extern "C" { if (range.start > range.stop) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_append_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_append_nulless(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_append_nulless(source.string, range.start, range.stop, destination); + return private_fl_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_partial_mash_nulless_ @@ -250,12 +250,12 @@ extern "C" { if (range.start > range.stop) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_prepend(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_prepend(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_prepend(source.string, range.start, range.stop, destination); + return private_fl_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_partial_mish_ @@ -270,12 +270,12 @@ extern "C" { if (range.start > range.stop) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_prepend_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_prepend_nulless(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_prepend_nulless(source.string, range.start, range.stop, destination); + return private_fl_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_partial_mish_nulless_ @@ -289,7 +289,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_string_prepend(source.string, range.start, range.stop, destination); + return private_fl_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_partial_prepend_ @@ -303,7 +303,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_string_prepend_nulless(source.string, range.start, range.stop, destination); + return private_fl_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_partial_prepend_nulless @@ -315,7 +315,7 @@ extern "C" { if (source.used == 0) return f_no_data; - return private_fl_string_prepend(source.string, 0, source.used - 1, destination); + return private_fl_string_prepend(source.string, source.used, destination); } #endif // _di_fl_string_dynamic_prepend_ @@ -327,7 +327,7 @@ extern "C" { if (source.used == 0) return f_no_data; - return private_fl_string_prepend_nulless(source.string, 0, source.used - 1, destination); + return private_fl_string_prepend_nulless(source.string, source.used, destination); } #endif // _di_fl_string_dynamic_prepend_nulless_ @@ -342,7 +342,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_string_append(source.string, range.start, range.stop, destination); + return private_fl_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_rip_ @@ -357,7 +357,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_string_append_nulless(source.string, range.start, range.stop, destination); + return private_fl_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_string_dynamic_rip_nulless_ @@ -671,138 +671,138 @@ extern "C" { #endif // _di_fl_string_dynamic_terminate_ #ifndef _di_fl_string_mash_ - f_return_status fl_string_mash(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_mash(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_append(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_append(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_append(source, start, stop, destination); + return private_fl_string_append(source, length, destination); } #endif // _di_fl_string_mash_ #ifndef _di_fl_string_mash_nulless_ - f_return_status fl_string_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_append_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_append_nulless(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_append_nulless(source, start, stop, destination); + return private_fl_string_append_nulless(source, length, destination); } #endif // _di_fl_string_mash_nulless_ #ifndef _di_fl_string_mish_ - f_return_status fl_string_mish(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_mish(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_prepend(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_prepend(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_prepend(source, start, stop, destination); + return private_fl_string_prepend(source, length, destination); } #endif // _di_fl_string_mish_ #ifndef _di_fl_string_mish_nulless_ - f_return_status fl_string_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_string_prepend_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_string_prepend_nulless(glue, glue_length, destination); if (f_status_is_error(status)) return status; } - return private_fl_string_prepend_nulless(source, start, stop, destination); + return private_fl_string_prepend_nulless(source, length, destination); } #endif // _di_fl_string_mish_nulless_ #ifndef _di_fl_string_prepend_ - f_return_status fl_string_prepend(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_prepend(const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - return private_fl_string_prepend(source, start, stop, destination); + return private_fl_string_prepend(source, length, destination); } #endif // _di_fl_string_prepend_ #ifndef _di_fl_string_prepend_nulless_ - f_return_status fl_string_prepend_nulless(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_prepend_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - return private_fl_string_prepend_nulless(source, start, stop, destination); + return private_fl_string_prepend_nulless(source, length, destination); } #endif // _di_fl_string_prepend_nulless_ #ifndef _di_fl_string_rip_ - f_return_status fl_string_rip(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_rip(const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - f_string_length begin = start; - f_string_length end = stop; + f_string_length begin = 0; + f_string_length end = length - 1; f_status status = private_fl_string_rip_find_range(source, &begin, &end); if (f_status_is_error(status)) return status; if (status == f_no_data) return status; - return private_fl_string_append(source, begin, end, destination); + return private_fl_string_append(source + begin, (end - begin) + 1, destination); } #endif // _di_fl_string_rip_ #ifndef _di_fl_string_rip_nulless_ - f_return_status fl_string_rip_nulless(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination) { + f_return_status fl_string_rip_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - f_string_length begin = start; - f_string_length end = stop; + f_string_length begin = 0; + f_string_length end = length - 1; f_status status = private_fl_string_rip_find_range(source, &begin, &end); if (f_status_is_error(status)) return status; if (status == f_no_data) return status; - return private_fl_string_append_nulless(source, begin, end, destination); + return private_fl_string_append_nulless(source + begin, (end - begin) + 1, destination); } #endif // _di_fl_string_rip_nulless_ diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index 4f2ad97..4b73725 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -39,10 +39,8 @@ extern "C" { * * @param source * The source string to append. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of string to append. + * @param length + * The length of source to append. * @param destination * The destination string the source is appended onto. * @@ -57,7 +55,7 @@ extern "C" { * @see fl_string_append_nulless() */ #ifndef _di_fl_string_append_ - extern f_return_status fl_string_append(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_append(const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_append_ /** @@ -67,10 +65,8 @@ extern "C" { * * @param source * The source string to append. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of string to append. + * @param length + * The length of source to append. * @param destination * The destination string the source is appended onto. * @@ -85,7 +81,7 @@ extern "C" { * @see fl_string_append() */ #ifndef _di_fl_string_append_nulless_ - extern f_return_status fl_string_append_nulless(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_append_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_append_nulless_ /** @@ -944,10 +940,8 @@ extern "C" { * The number of bytes the glue takes up. * @param source * The source string to append. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source and glue are appended onto. * @@ -962,7 +956,7 @@ extern "C" { * @see fl_string_mash_nulless() */ #ifndef _di_fl_string_mash_ - extern f_return_status fl_string_mash(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_mash(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_mash_ /** @@ -978,10 +972,8 @@ extern "C" { * The number of bytes the glue takes up. * @param source * The source string to append. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source and glue are appended onto. * @@ -996,7 +988,7 @@ extern "C" { * @see fl_string_mash() */ #ifndef _di_fl_string_mash_nulless_ - extern f_return_status fl_string_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_mash_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_mash_nulless_ /** @@ -1010,10 +1002,8 @@ extern "C" { * The number of bytes the glue takes up. * @param source * The source string to append. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source and glue are appended onto. * @@ -1028,7 +1018,7 @@ extern "C" { * @see fl_string_mish_nulless() */ #ifndef _di_fl_string_mish_ - extern f_return_status fl_string_mish(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_mish(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_mish_ /** @@ -1044,10 +1034,8 @@ extern "C" { * The number of bytes the glue takes up. * @param source * The source string to append. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source and glue are appended onto. * @@ -1062,7 +1050,7 @@ extern "C" { * @see fl_string_mish() */ #ifndef _di_fl_string_mish_nulless_ - extern f_return_status fl_string_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_mish_nulless(const f_string glue, const f_string_length glue_length, const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_mish_nulless_ /** @@ -1072,10 +1060,8 @@ extern "C" { * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source is prepended onto. * @@ -1090,7 +1076,7 @@ extern "C" { * @see fl_string_prepend_nulless() */ #ifndef _di_fl_string_prepend_ - extern f_return_status fl_string_prepend(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_prepend(const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_prepend_ /** @@ -1102,10 +1088,8 @@ extern "C" { * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to prepend. - * @param stop - * Inclusive stop point of string to prepend. + * @param length + * The length of source to append. * @param destination * The destination string the source is prepended onto. * @@ -1120,21 +1104,19 @@ extern "C" { * @see fl_string_dynamic_prepend() */ #ifndef _di_fl_string_prepend_nulless_ - extern f_return_status fl_string_prepend_nulless(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_prepend_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_prepend_nulless_ /** * Allocate a new string from the provided range in the string. * * Ignores leading and trailing whitespace. - * As a result, resulting size may be smaller than requested range. + * As a result, resulting size may be smaller than requested length. * * @param source * The string to rip from. - * @param start - * An inclusive start location within string. - * @param stop - * An inclusive stop location within string. + * @param length + * The length of source to append. * @param destination * The new string, which will be allocated or reallocated as necessary. * @@ -1148,23 +1130,21 @@ extern "C" { * @see fl_string_rip_nulless() */ #ifndef _di_fl_string_rip_ - extern f_return_status fl_string_rip(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_rip(const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_rip_ /** * Allocate a new string from the provided range in the string. * * Ignores leading and trailing whitespace. - * As a result, resulting size may be smaller than requested range. + * As a result, resulting size may be smaller than requested length. * * Skips over NULL characters from source when ripping. * * @param source * The string to rip from. - * @param start - * An inclusive start location within string. - * @param stop - * An inclusive stop location within string. + * @param length + * The length of source to append. * @param destination * The new string, which will be allocated or reallocated as necessary. * @@ -1178,7 +1158,7 @@ extern "C" { * @see fl_string_rip() */ #ifndef _di_fl_string_rip_nulless_ - extern f_return_status fl_string_rip_nulless(const f_string source, const f_string_length start, const f_string_length stop, f_string_dynamic *destination); + extern f_return_status fl_string_rip_nulless(const f_string source, const f_string_length length, f_string_dynamic *destination); #endif // _di_fl_string_rip_nulless_ /** diff --git a/level_1/fl_utf/c/private-utf.c b/level_1/fl_utf/c/private-utf.c index 12046f9..5759171 100644 --- a/level_1/fl_utf/c/private-utf.c +++ b/level_1/fl_utf/c/private-utf.c @@ -6,22 +6,19 @@ extern "C" { #endif #if !defined(_di_fl_utf_string_append_) || !defined(_di_fl_utf_string_dynamic_append_) || !defined(_di_fl_utf_string_append_mash_) || !defined(_di_fl_utf_string_dynamic_mash_) - f_return_status private_fl_utf_string_append(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { - // The start and stop point are inclusive locations, and therefore start - stop is actually 1 too few locations. - f_utf_string_length source_length = (stop - start) + 1; - - if (destination->used + source_length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); + f_return_status private_fl_utf_string_append(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { + if (destination->used + length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); f_status status = f_none; - const f_utf_string_length total = destination->used + source_length; + const f_utf_string_length total = destination->used + length; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); if (f_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source + start, source_length); + memcpy(destination->string + destination->used, source, length); destination->used = total; return f_none; @@ -29,31 +26,28 @@ extern "C" { #endif // !defined(_di_fl_utf_string_append_) || !defined(_di_fl_utf_string_dynamic_append_) || !defined(_di_fl_utf_string_append_mash_) || !defined(_di_fl_utf_string_dynamic_mash_) #if !defined(_di_fl_utf_string_append_nulless_) || !defined(_di_fl_utf_string_dynamic_append_nulless_) || !defined(_di_fl_utf_string_mash_nulless_) || !defined(_di_fl_utf_string_dynamic_mash_nulless_) - f_return_status private_fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { - // The start and stop point are inclusive locations, and therefore start - stop is actually 1 too few locations. - f_utf_string_length source_length = (stop - start) + 1; - - if (destination->used + source_length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); + f_return_status private_fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { + if (destination->used + length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); f_status status = f_none; f_utf_string_length first = 0; - for (f_utf_string_length i = 0; i <= source_length; i++) { - if (i == source_length) { + for (f_utf_string_length i = 0; i <= length; i++) { + if (i == length) { if (i > first) { - f_utf_string_length length = i - first; + f_utf_string_length size = i - first; - if (destination->used + length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); + if (destination->used + size > f_utf_string_max_size) return f_status_set_error(f_string_too_large); - f_utf_string_length total = destination->used + length; + f_utf_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); if (f_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source + start + first, length); + memcpy(destination->string + destination->used, source + first, size); destination->used = total; } @@ -63,23 +57,23 @@ extern "C" { if (source[i] == f_utf_character_eos) { if (i > 0) { if (i > first) { - f_utf_string_length length = i - first; + f_utf_string_length size = i - first; - if (destination->used + length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); + if (destination->used + size > f_utf_string_max_size) return f_status_set_error(f_string_too_large); - f_utf_string_length total = destination->used + length; + f_utf_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); if (f_status_is_error(status)) return status; } - memcpy(destination->string + destination->used, source + start + first, length); + memcpy(destination->string + destination->used, source + first, size); destination->used = total; } } - while (i + 1 < source_length && source[i + 1] == f_utf_character_eos) { + while (i + 1 < length && source[i + 1] == f_utf_character_eos) { i++; } // while @@ -240,15 +234,12 @@ extern "C" { #endif // !defined(_di_fl_utf_string_compare_trim_) || !defined(_di_fl_utf_string_dynamic_compare_trim_) || !defined(_di_fl_utf_string_dynamic_partial_compare_trim_) #if !defined(_di_fl_utf_string_prepend_) || !defined(_di_fl_utf_string_dynamic_prepend_) - f_return_status private_fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { - // The start and stop point are inclusive locations, and therefore start - stop is actually 1 too few locations. - f_utf_string_length source_length = (stop - start) + 1; - - if (destination->used + source_length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); + f_return_status private_fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { + if (destination->used + length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); f_status status = f_none; - const f_utf_string_length total = destination->used + source_length; + const f_utf_string_length total = destination->used + length; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); @@ -256,11 +247,11 @@ extern "C" { } if (destination->used > 0) { - memmove(destination->string + source_length, destination->string, destination->used); - memcpy(destination->string, source + start, source_length); + memmove(destination->string + length, destination->string, destination->used); + memcpy(destination->string, source, length); } else { - memcpy(destination->string, source + start, source_length); + memcpy(destination->string, source, length); } destination->used = total; @@ -269,36 +260,33 @@ extern "C" { #endif // !defined(_di_fl_utf_string_prepend_) || !defined(_di_fl_utf_string_dynamic_prepend_) #if !defined(_di_fl_utf_string_prepend_nulless_) || !defined(_di_fl_utf_string_dynamic_prepend_nulless_) - f_return_status private_fl_utf_string_prepend_nulless(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { - // The start and stop point are inclusive locations, and therefore start - stop is actually 1 too few locations. - f_utf_string_length source_length = (stop - start) + 1; - - if (destination->used + source_length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); + f_return_status private_fl_utf_string_prepend_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { + if (destination->used + length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); f_status status = f_none; f_utf_string_length first = 0; f_utf_string_length offset = 0; - for (f_utf_string_length i = 0; i <= source_length; i++) { - if (i == source_length) { + for (f_utf_string_length i = 0; i <= length; i++) { + if (i == length) { if (i > first) { - f_utf_string_length length = i - first; + f_utf_string_length size = i - first; - if (destination->used + length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); + if (destination->used + size > f_utf_string_max_size) return f_status_set_error(f_string_too_large); - f_utf_string_length total = destination->used + length; + f_utf_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); if (f_status_is_error(status)) return status; } - memmove(destination->string + offset + length, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, length); + memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); + memcpy(destination->string + offset, source + first, size); destination->used = total; - offset += length; + offset += size; } break; @@ -307,11 +295,11 @@ extern "C" { if (source[i] == f_utf_character_eos) { if (i > 0) { if (i > first) { - f_utf_string_length length = i - first; + f_utf_string_length size = i - first; - if (destination->used + length > f_utf_string_max_size) return f_status_set_error(f_string_too_large); + if (destination->used + size > f_utf_string_max_size) return f_status_set_error(f_string_too_large); - f_utf_string_length total = destination->used + length; + f_utf_string_length total = destination->used + size; if (total > destination->size) { f_macro_string_dynamic_resize(status, (*destination), total); @@ -319,15 +307,15 @@ extern "C" { if (f_status_is_error(status)) return status; } - memmove(destination->string + offset + length, destination->string + offset, destination->used - offset); - memcpy(destination->string + offset, source + first, length); + memmove(destination->string + offset + size, destination->string + offset, destination->used - offset); + memcpy(destination->string + offset, source + first, size); destination->used = total; - offset += length; + offset += size; } } - while (i + 1 < source_length && source[i + 1] == f_utf_character_eos) { + while (i + 1 < length && source[i + 1] == f_utf_character_eos) { i++; } // while diff --git a/level_1/fl_utf/c/private-utf.h b/level_1/fl_utf/c/private-utf.h index a2417f0..fec7055 100644 --- a/level_1/fl_utf/c/private-utf.h +++ b/level_1/fl_utf/c/private-utf.h @@ -24,10 +24,8 @@ extern "C" { * * @param source * The source string to append. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of string to append. + * @param length + * Length of source to append. * @param destination * The destination string the source and glue are appended onto. * @@ -44,7 +42,7 @@ extern "C" { * @see fl_utf_string_dynamic_mash() */ #if !defined(_di_fl_utf_string_append_) || !defined(_di_fl_utf_string_dynamic_append_) || !defined(_di_fl_utf_string_append_mash_) || !defined(_di_fl_utf_string_dynamic_mash_) - extern f_return_status private_fl_utf_string_append(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) f_gcc_attribute_visibility_internal; + extern f_return_status private_fl_utf_string_append(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fl_utf_string_append_) || !defined(_di_fl_utf_string_dynamic_append_) || !defined(_di_fl_utf_string_append_mash_) || !defined(_di_fl_utf_string_dynamic_mash_) /** @@ -54,10 +52,8 @@ extern "C" { * * @param source * The source string to append. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of string to append. + * @param length + * Length of source to append. * @param destination * The destination string the source and glue are appended onto. * @@ -74,7 +70,7 @@ extern "C" { * @see fl_utf_string_dynamic_mash_nulless() */ #if !defined(_di_fl_utf_string_append_nulless_) || !defined(_di_fl_utf_string_dynamic_append_nulless_) || !defined(_di_fl_utf_string_mash_nulless_) || !defined(_di_fl_utf_string_dynamic_mash_nulless_) - extern f_return_status private_fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) f_gcc_attribute_visibility_internal; + extern f_return_status private_fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fl_utf_string_append_nulless_) || !defined(_di_fl_utf_string_dynamic_append_nulless_) || !defined(_di_fl_utf_string_mash_nulless_) || !defined(_di_fl_utf_string_dynamic_mash_nulless_) /** @@ -146,10 +142,8 @@ extern "C" { * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of string to append. + * @param length + * Length of source to append. * @param destination * The destination string the source and glue are prepended onto. * @@ -164,7 +158,7 @@ extern "C" { * @see fl_utf_string_dynamic_prepend() */ #if !defined(_di_fl_utf_string_prepend_) || !defined(_di_fl_utf_string_dynamic_prepend_) || !defined(_di_fl_utf_string_append_mish_) || !defined(_di_fl_utf_string_dynamic_mish_) - extern f_return_status private_fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) f_gcc_attribute_visibility_internal; + extern f_return_status private_fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fl_utf_string_prepend_) || !defined(_di_fl_utf_string_dynamic_prepend_) || !defined(_di_fl_utf_string_append_mish_) || !defined(_di_fl_utf_string_dynamic_mish_) /** @@ -174,10 +168,8 @@ extern "C" { * * @param source * The source string to prepend. - * @param start - * Inclusive start point of string to append. - * @param stop - * Inclusive stop point of string to append. + * @param length + * Length of source to append. * @param destination * The destination string the source and glue are prepended onto. * @@ -192,7 +184,7 @@ extern "C" { * @see fl_utf_string_dynamic_prepend_nulless() */ #if !defined(_di_fl_utf_string_prepend_nulless_) || !defined(_di_fl_utf_string_dynamic_prepend_nulless_) || !defined(_di_fl_utf_string_append_mish_) || !defined(_di_fl_utf_string_dynamic_mish_) - extern f_return_status private_fl_utf_string_prepend_nulless(const f_utf_string source, f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) f_gcc_attribute_visibility_internal; + extern f_return_status private_fl_utf_string_prepend_nulless(const f_utf_string source, f_utf_string_length length, f_utf_string_dynamic *destination) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fl_utf_string_prepend_nulless_) || !defined(_di_fl_utf_string_dynamic_prepend_nulless_) || !defined(_di_fl_utf_string_append_mish_) || !defined(_di_fl_utf_string_dynamic_mish_) /** diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index 470ae07..ad61149 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -6,26 +6,26 @@ extern "C" { #endif #ifndef _di_fl_utf_string_append_ - f_return_status fl_utf_string_append(const f_utf_string source, const f_string_length start, const f_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_append(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - return private_fl_utf_string_append(source, start, stop, destination); + return private_fl_utf_string_append(source, length, destination); } #endif // _di_fl_utf_string_append_ #ifndef _di_fl_utf_string_append_nulless_ - f_return_status fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - return private_fl_utf_string_append_nulless(source, start, stop, destination); + return private_fl_utf_string_append_nulless(source, length, destination); } #endif // _di_fl_utf_string_append_nulless_ @@ -59,7 +59,7 @@ extern "C" { if (source.used == 0) return f_no_data; - return private_fl_utf_string_append(source.string, 0, source.used - 1, destination); + return private_fl_utf_string_append(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_append_ @@ -71,7 +71,7 @@ extern "C" { if (source.used == 0) return f_no_data; - return private_fl_utf_string_append_nulless(source.string, 0, source.used - 1, destination); + return private_fl_utf_string_append_nulless(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_append_nulless_ @@ -84,14 +84,14 @@ extern "C" { if (source.used == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_append(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_append(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_append(source.string, 0, source.used - 1, destination); + return private_fl_utf_string_append(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_mash_ @@ -104,14 +104,14 @@ extern "C" { if (source.used == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_append_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_append_nulless(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_append_nulless(source.string, 0, source.used - 1, destination); + return private_fl_utf_string_append_nulless(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_mash_nulless_ @@ -124,14 +124,14 @@ extern "C" { if (source.used == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_prepend(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_prepend(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_prepend(source.string, 0, source.used - 1, destination); + return private_fl_utf_string_prepend(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_mish_ @@ -144,14 +144,14 @@ extern "C" { if (source.used == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_prepend_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_prepend_nulless(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_prepend_nulless(source.string, 0, source.used - 1, destination); + return private_fl_utf_string_prepend_nulless(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_mish_nulless_ @@ -177,7 +177,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_utf_string_append(source.string, range.start, range.stop, destination); + return private_fl_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_partial_append_ @@ -191,7 +191,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_utf_string_append_nulless(source.string, range.start, range.stop, destination); + return private_fl_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_partial_append_nulless_ @@ -228,14 +228,14 @@ extern "C" { if (range.start > range.stop) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_append(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_append(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_append(source.string, range.start, range.stop, destination); + return private_fl_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_partial_mash_ @@ -250,14 +250,14 @@ extern "C" { if (range.start > range.stop) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_append_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_append_nulless(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_append_nulless(source.string, range.start, range.stop, destination); + return private_fl_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_partial_mash_nulless_ @@ -272,14 +272,14 @@ extern "C" { if (range.start > range.stop) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_prepend(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_prepend(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_prepend(source.string, range.start, range.stop, destination); + return private_fl_utf_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_partial_mish_ @@ -294,14 +294,14 @@ extern "C" { if (range.start > range.stop) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_prepend_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_prepend_nulless(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_prepend_nulless(source.string, range.start, range.stop, destination); + return private_fl_utf_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_partial_mish_nulless_ @@ -315,7 +315,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_utf_string_prepend(source.string, range.start, range.stop, destination); + return private_fl_utf_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_partial_prepend_ @@ -329,7 +329,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_utf_string_prepend_nulless(source.string, range.start, range.stop, destination); + return private_fl_utf_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_partial_prepend_nulless_ @@ -341,7 +341,7 @@ extern "C" { if (source.used == 0) return f_no_data; - return private_fl_utf_string_prepend(source.string, 0, source.used - 1, destination); + return private_fl_utf_string_prepend(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_prepend_ @@ -353,7 +353,7 @@ extern "C" { if (source.used == 0) return f_no_data; - return private_fl_utf_string_prepend_nulless(source.string, 0, source.used - 1, destination); + return private_fl_utf_string_prepend_nulless(source.string, source.used, destination); } #endif // _di_fl_utf_string_dynamic_prepend_nulless_ @@ -368,7 +368,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_utf_string_append(source.string, range.start, range.stop, destination); + return private_fl_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_rip_ @@ -383,7 +383,7 @@ extern "C" { if (source.used == 0) return f_no_data; if (range.start > range.stop) return f_no_data; - return private_fl_utf_string_append_nulless(source.string, range.start, range.stop, destination); + return private_fl_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } #endif // _di_fl_utf_string_dynamic_rip_nulless_ @@ -627,146 +627,146 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_terminate_ #ifndef _di_fl_utf_string_mash_ - f_return_status fl_utf_string_mash(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_mash(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_append(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_append(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_append(source, start, stop, destination); + return private_fl_utf_string_append(source, length, destination); } #endif // _di_fl_utf_string_mash_ #ifndef _di_fl_utf_string_mash_nulless_ - f_return_status fl_utf_string_mash_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_mash_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_append_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_append_nulless(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_append_nulless(source, start, stop, destination); + return private_fl_utf_string_append_nulless(source, length, destination); } #endif // _di_fl_utf_string_mash_nulless_ #ifndef _di_fl_utf_string_mish_ - f_return_status fl_utf_string_mish(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_mish(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_prepend(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_prepend(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_prepend(source, start, stop, destination); + return private_fl_utf_string_prepend(source, length, destination); } #endif // _di_fl_utf_string_mish_ #ifndef _di_fl_utf_string_mish_nulless_ - f_return_status fl_utf_string_mish_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_mish_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; if (glue_length > 0 && destination->used > 0) { - f_status status = private_fl_utf_string_prepend_nulless(glue, 0, glue_length - 1, destination); + f_status status = private_fl_utf_string_prepend_nulless(glue, glue_length, destination); if (f_status_is_error(status)) { return status; } } - return private_fl_utf_string_prepend_nulless(source, start, stop, destination); + return private_fl_utf_string_prepend_nulless(source, length, destination); } #endif // _di_fl_utf_string_mish_nulless_ #ifndef _di_fl_utf_string_prepend_ - f_return_status fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - return private_fl_utf_string_prepend(source, start, stop, destination); + return private_fl_utf_string_prepend(source, length, destination); } #endif // _di_fl_utf_string_prepend_ #ifndef _di_fl_utf_string_prepend_nulless_ - f_return_status fl_utf_string_prepend_nulless(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_prepend_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - return private_fl_utf_string_prepend_nulless(source, start, stop, destination); + return private_fl_utf_string_prepend_nulless(source, length, destination); } #endif // _di_fl_utf_string_prepend_nulless_ #ifndef _di_fl_utf_string_rip_ - f_return_status fl_utf_string_rip(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_rip(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - f_utf_string_length begin = start; - f_utf_string_length end = stop; + f_utf_string_length begin = 0; + f_utf_string_length end = length - 1; f_status status = private_fl_utf_string_rip_find_range(source, &begin, &end); if (f_status_is_error(status)) return status; if (status == f_no_data) return status; - return private_fl_utf_string_append(source, begin, end, destination); + return private_fl_utf_string_append(source + begin, (end - begin) + 1, destination); } #endif // _di_fl_utf_string_rip_ #ifndef _di_fl_utf_string_rip_nulless_ - f_return_status fl_utf_string_rip_nulless(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination) { + f_return_status fl_utf_string_rip_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination) { #ifndef _di_level_1_parameter_checking_ if (destination == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ - if (start > stop) return f_no_data; + if (length == 0) return f_no_data; - f_utf_string_length begin = start; - f_utf_string_length end = stop; + f_utf_string_length begin = 0; + f_utf_string_length end = length - 1; f_status status = private_fl_utf_string_rip_find_range(source, &begin, &end); if (f_status_is_error(status)) return status; if (status == f_no_data) return status; - return private_fl_utf_string_append_nulless(source, begin, end, destination); + return private_fl_utf_string_append_nulless(source + begin, (end - begin) + 1, destination); } #endif // _di_fl_utf_string_rip_nulless_ diff --git a/level_1/fl_utf/c/utf.h b/level_1/fl_utf/c/utf.h index 23064cf..5e99cb0 100644 --- a/level_1/fl_utf/c/utf.h +++ b/level_1/fl_utf/c/utf.h @@ -57,7 +57,7 @@ extern "C" { * @see fl_utf_string_append_nulless() */ #ifndef _di_fl_utf_string_append_ - extern f_return_status fl_utf_string_append(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_append(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_append_ /** @@ -85,7 +85,7 @@ extern "C" { * @see fl_utf_string_append() */ #ifndef _di_fl_utf_string_append_nulless_ - extern f_return_status fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_append_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_append_nulless_ /** @@ -986,7 +986,7 @@ extern "C" { * @see fl_utf_string_mash_nulless() */ #ifndef _di_fl_utf_string_mash_ - extern f_return_status fl_utf_string_mash(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_mash(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_mash_ /** @@ -1020,7 +1020,7 @@ extern "C" { * @see fl_utf_string_mash() */ #ifndef _di_fl_utf_string_mash_nulless_ - extern f_return_status fl_utf_string_mash_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_mash_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_mash_nulless_ /** @@ -1052,7 +1052,7 @@ extern "C" { * @see fl_utf_string_mish_nulless() */ #ifndef _di_fl_utf_string_mish_ - extern f_return_status fl_utf_string_mish(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_mish(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_mish_ /** @@ -1086,7 +1086,7 @@ extern "C" { * @see fl_utf_string_mish() */ #ifndef _di_fl_utf_string_mish_nulless_ - extern f_return_status fl_utf_string_mish_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_mish_nulless(const f_utf_string glue, const f_utf_string_length glue_length, const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_mish_nulless_ /** @@ -1114,7 +1114,7 @@ extern "C" { * @see fl_utf_string_prepend_nulless() */ #ifndef _di_fl_utf_string_prepend_ - extern f_return_status fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_prepend(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_prepend_ /** @@ -1144,7 +1144,7 @@ extern "C" { * @see fl_utf_string_prepend() */ #ifndef _di_fl_utf_string_prepend_nulless_ - extern f_return_status fl_utf_string_prepend_nulless(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_prepend_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_prepend_nulless_ /** @@ -1172,7 +1172,7 @@ extern "C" { * @see fl_utf_string_rip_nulless() */ #ifndef _di_fl_utf_string_rip_ - extern f_return_status fl_utf_string_rip(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_rip(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_rip_ /** @@ -1202,7 +1202,7 @@ extern "C" { * @see fl_utf_string_append() */ #ifndef _di_fl_utf_string_rip_nulless_ - extern f_return_status fl_utf_string_rip_nulless(const f_utf_string source, const f_utf_string_length start, const f_utf_string_length stop, f_utf_string_dynamic *destination); + extern f_return_status fl_utf_string_rip_nulless(const f_utf_string source, const f_utf_string_length length, f_utf_string_dynamic *destination); #endif // _di_fl_utf_string_rip_nulless_ /** diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 7f71d29..e1314ca 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -23,7 +23,7 @@ extern "C" { f_string_dynamic argument = f_string_dynamic_initialize; - status = fl_string_append(source, 0, length - 1, &argument); + status = fl_string_append(source, length, &argument); if (f_status_is_error(status)) { f_macro_string_dynamic_delete_simple(argument); return status; @@ -63,14 +63,14 @@ extern "C" { f_string_dynamic argument = f_string_dynamic_initialize; if (prefix_length > 0) { - status = fl_string_append(prefix, 0, prefix_length - 1, &argument); + status = fl_string_append(prefix, prefix_length, &argument); if (f_status_is_error(status)) { f_macro_string_dynamic_delete_simple(argument); return status; } } - status = fl_string_append(name, 0, name_length - 1, &argument); + status = fl_string_append(name, name_length, &argument); if (f_status_is_error(status)) { f_macro_string_dynamic_delete_simple(argument); return status; @@ -89,7 +89,7 @@ extern "C" { f_macro_string_dynamic_clear(argument); - status = fl_string_append(value, 0, value_length - 1, &argument); + status = fl_string_append(value, value_length, &argument); if (f_status_is_error(status)) { f_macro_string_dynamic_delete_simple(argument); return status; diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index e309927..d3b9410 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -168,7 +168,7 @@ extern "C" { if (length > 0) { f_string_dynamic ripped = f_string_dynamic_initialize; - status = fl_string_append(argv[additional.array[i]], 0, length - 1, &ripped); + status = fl_string_append(argv[additional.array[i]], length, &ripped); if (f_status_is_error(status)) return status; @@ -213,7 +213,7 @@ extern "C" { length = strnlen(argv[additional.array[i]], f_console_max_size); if (length > 0) { - status = fl_string_mash(glue, glue_length, argv[additional.array[i]], 0, length - 1, destination); + status = fl_string_mash(glue, glue_length, argv[additional.array[i]], length, destination); if (f_status_is_error(status)) return f_status_set_error(f_string_too_large); } @@ -244,7 +244,7 @@ extern "C" { if (length > 0) { f_string_dynamic ripped = f_string_dynamic_initialize; - status = fl_string_rip(argv[additional.array[i]], 0, length - 1, &ripped); + status = fl_string_rip(argv[additional.array[i]], length, &ripped); if (f_status_is_error(status)) return status; @@ -290,7 +290,7 @@ extern "C" { length = strnlen(argv[additional.array[i]], f_console_max_size); if (length > 0) { - status = fl_string_rip(argv[additional.array[i]], 0, length - 1, &ripped); + status = fl_string_rip(argv[additional.array[i]], length, &ripped); if (f_status_is_error(status)) { f_macro_string_dynamic_delete_simple(ripped); diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 1c81d78..126e798 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -455,7 +455,7 @@ extern "C" { f_string_length length = strnlen(arguments.argv[location], f_console_max_size); if (length > 0) { - status = fl_string_append(arguments.argv[location], 0, length - 1, parameter_values[i]); + status = fl_string_append(arguments.argv[location], length, parameter_values[i]); if (f_status_is_error(status)) { if (status == f_status_set_error(f_string_too_large)) { diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index f41da5d..c5e9a03 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -162,10 +162,10 @@ extern "C" { depths->array[i].index_name = data.parameters[fss_basic_list_read_parameter_name].additional.array[position_name]; if (data.parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { - status = fl_string_rip(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); + status = fl_string_rip(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } else { - status = fl_string_append(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); + status = fl_string_append(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } if (f_status_is_error(status)) { diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.c b/level_3/fss_basic_read/c/private-fss_basic_read.c index 445d1ea..b163a0a 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.c +++ b/level_3/fss_basic_read/c/private-fss_basic_read.c @@ -162,10 +162,10 @@ extern "C" { depths->array[i].index_name = data.parameters[fss_basic_read_parameter_name].additional.array[position_name]; if (data.parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { - status = fl_string_rip(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); + status = fl_string_rip(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } else { - status = fl_string_append(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); + status = fl_string_append(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } if (f_status_is_error(status)) { diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index 9e106b4..d8d86f9 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -162,10 +162,10 @@ extern "C" { depths->array[i].index_name = data.parameters[fss_extended_list_read_parameter_name].additional.array[position_name]; if (data.parameters[fss_extended_list_read_parameter_trim].result == f_console_result_found) { - status = fl_string_rip(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); + status = fl_string_rip(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } else { - status = fl_string_append(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); + status = fl_string_append(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } if (f_status_is_error(status)) { diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.c b/level_3/fss_extended_read/c/private-fss_extended_read.c index b8e233f..2dca09c 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.c +++ b/level_3/fss_extended_read/c/private-fss_extended_read.c @@ -162,10 +162,10 @@ extern "C" { depths->array[i].index_name = data.parameters[fss_extended_read_parameter_name].additional.array[position_name]; if (data.parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { - status = fl_string_rip(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); + status = fl_string_rip(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } else { - status = fl_string_append(arguments.argv[depths->array[i].index_name], 0, strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); + status = fl_string_append(arguments.argv[depths->array[i].index_name], strlen(arguments.argv[depths->array[i].index_name]), &depths->array[i].value_name); } if (f_status_is_error(status)) { -- 1.8.3.1