From: Kevin Day Date: Sun, 2 May 2021 04:43:24 +0000 (-0500) Subject: Cleanup: Standard code practices refresh. X-Git-Tag: 0.5.4~70 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=71965dbe151275f64ab80abf18a51b4a85eefb72;p=fll Cleanup: Standard code practices refresh. This is a "quick" run through to refresh the syntax and style with the latest practices. This fixes any observed styling change. I noticed some probably errors and added appropriate @fixme comments. --- diff --git a/level_0/f_account/c/account-common.h b/level_0/f_account/c/account-common.h index 88cdf06..b1d073e 100644 --- a/level_0/f_account/c/account-common.h +++ b/level_0/f_account/c/account-common.h @@ -79,9 +79,9 @@ extern "C" { /** * An array of accounts. * - * array: the array of accounts. - * size: total amount of space available. - * used: total number of space used. + * array: The array of accounts. + * size: Total amount of space available. + * used: Total number of space used. */ #ifndef _di_f_accounts_t_ typedef struct { diff --git a/level_0/f_account/c/account.h b/level_0/f_account/c/account.h index 69a5591..d824b7c 100644 --- a/level_0/f_account/c/account.h +++ b/level_0/f_account/c/account.h @@ -44,8 +44,8 @@ extern "C" { * * @return * F_none on success. + * * F_buffer_too_small (with error bit) if the buffer is too small to store the account data. - * F_exist_non if no user by that name exists. * F_file_descriptor_max (with error bit) if max file descriptors was reached. * F_file_open_max (with error bit) too many open files. * F_input_output (with error bit) if an I/O error occurred. @@ -71,8 +71,8 @@ extern "C" { * * @return * F_none on success. + * * F_buffer_too_small (with error bit) if the buffer is too small to store the account data. - * F_exist_non if no user by that name exists. * F_file_descriptor_max (with error bit) if max file descriptors was reached. * F_file_open_max (with error bit) too many open files. * F_input_output (with error bit) if an I/O error occurred. @@ -98,8 +98,8 @@ extern "C" { * * @return * F_none on success. + * * F_buffer_too_small (with error bit) if the buffer is too small to store the account data. - * F_exist_non if no group by that name exists. * F_file_descriptor_max (with error bit) if max file descriptors was reached. * F_file_open_max (with error bit) too many open files. * F_input_output (with error bit) if an I/O error occurred. @@ -125,8 +125,8 @@ extern "C" { * * @return * F_none on success. + * * F_buffer_too_small (with error bit) if the buffer is too small to store the account data. - * F_exist_non if no user by that name exists. * F_file_descriptor_max (with error bit) if max file descriptors was reached. * F_file_open_max (with error bit) too many open files. * F_input_output (with error bit) if an I/O error occurred. @@ -152,8 +152,8 @@ extern "C" { * * @return * F_none on success. + * * F_buffer_too_small (with error bit) if the buffer is too small to store the account data. - * F_exist_non if no user by that name exists. * F_file_descriptor_max (with error bit) if max file descriptors was reached. * F_file_open_max (with error bit) too many open files. * F_input_output (with error bit) if an I/O error occurred. diff --git a/level_0/f_color/c/color.h b/level_0/f_color/c/color.h index 622055c..a9c0286 100644 --- a/level_0/f_color/c/color.h +++ b/level_0/f_color/c/color.h @@ -52,6 +52,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_color_set_ @@ -86,6 +87,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_color_set_to_ @@ -120,6 +122,7 @@ extern "C" { * * @return * F_none on success. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. */ @@ -149,6 +152,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_color_print_ @@ -176,6 +180,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_color_print2_ @@ -194,6 +199,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_print_dynamic(). @@ -214,6 +220,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_print_to_dynamic(). @@ -238,6 +245,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_print_dynamic(). @@ -267,6 +275,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_print_dynamic(). @@ -291,6 +300,7 @@ extern "C" { * * @return * F_none on success. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. */ diff --git a/level_0/f_console/c/console-common.h b/level_0/f_console/c/console-common.h index b0f8bb9..3795c3f 100644 --- a/level_0/f_console/c/console-common.h +++ b/level_0/f_console/c/console-common.h @@ -176,13 +176,13 @@ extern "C" { /** * Provide console type enumerations: * - * - none: parameter not found. - * - found: parameter found. - * - values: parameter found, extra data exists (such as '-f filename', 'filename' would be the extra data). + * - none: Parameter not found. + * - found: Parameter found. + * - values: Parameter found, extra data exists (such as '-f filename', 'filename' would be the extra data). * - * - normal: parameters using minus sign, such as '--help'. - * - inverse: parameters using plus sign, such as '++version'. - * - other: parameters using neither minus nor plus sign, such as 'build'. + * - normal: Parameters using minus sign, such as '--help'. + * - inverse: Parameters using plus sign, such as '++version'. + * - other: Parameters using neither minus nor plus sign, such as 'build'. */ #ifndef _di_f_console_types_t_ typedef uint16_t f_console_id_t; @@ -222,19 +222,19 @@ extern "C" { * The other parameters are for any other parameter that has no prepended characters. * * - symbol_short: The single character string, such as 'h' in '-h'. - * - symbol_long: The multi-character string, such as 'help' in '--help'. + * - symbol_long: The multi-character string, such as 'help' in '--help'. * - symbol_other: The special meaning parameter, such as 'all' in 'make all'. * * - has_values: Designates that a parameter will have a given number of values arguments, such as 'blue' in '--color blue'. - * - type: One of the f_console_type_* codes, defining how this parameter is to be processed. + * - type: One of the f_console_type_* codes, defining how this parameter is to be processed. * * - result: A code representing that the parameter is found and how it is found ('-h' vs '--help'). * - * - location: The last location in argv[] where this parameter is found. - * - location_sub: The last sub-location at location in argv (only used by short parameters, such as -h or +l). - * - locations: All locations within argv where this parameter is found (order is preserved). + * - location: The last location in argv[] where this parameter is found. + * - location_sub: The last sub-location at location in argv (only used by short parameters, such as -h or +l). + * - locations: All locations within argv where this parameter is found (order is preserved). * - locations_sub: All sub-locations within argv where this parameter is found (order is preserved). - * - values: An array of locations representing where in the argv[] the values arguments are found. + * - values: An array of locations representing where in the argv[] the values arguments are found. */ #ifndef _di_f_console_parameter_t_ typedef struct { diff --git a/level_0/f_console/c/console.c b/level_0/f_console/c/console.c index 67745ab..0541f0d 100644 --- a/level_0/f_console/c/console.c +++ b/level_0/f_console/c/console.c @@ -14,6 +14,7 @@ extern "C" { if (!length) { *result = f_console_none; + return F_data_not; } @@ -85,6 +86,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(needs_value); + return status; } @@ -98,7 +100,7 @@ extern "C" { needs_value.array[i] = needs_value.array[i + 1]; } // for - location++; + ++location; continue; } @@ -140,7 +142,7 @@ extern "C" { // The sub_location is used on a per increment basis (such as 'tar -xcf', the '-' would have an increment of 1, therefore x, c, and f would all be three separate parameters). while (sub_location < argument_length) { - for (i = 0; i < parameters.used; i++) { + for (i = 0; i < parameters.used; ++i) { if (parameters.parameter[i].type != console_type) { continue; @@ -166,6 +168,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(needs_value); + return status; } @@ -175,6 +178,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(needs_value); + return status; } @@ -200,6 +204,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(needs_value); + return status; } @@ -207,6 +212,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(needs_value); + return status; } @@ -230,11 +236,12 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(needs_value); + return status; } } - for (values = 0; values < parameters.parameter[i].has_values; values++) { + for (values = 0; values < parameters.parameter[i].has_values; ++values) { needs_value.array[needs_value.used++] = i; } // for } @@ -248,7 +255,7 @@ extern "C" { else { found = F_false; - for (i = 0; i < parameters.used; i++) { + for (i = 0; i < parameters.used; ++i) { if (parameters.parameter[i].type != f_console_type_other) continue; @@ -260,6 +267,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(needs_value); + return status; } @@ -267,6 +275,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(needs_value); + return status; } @@ -283,11 +292,12 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(needs_value); + return status; } } - for (values = 0; values < parameters.parameter[i].has_values; values++) { + for (values = 0; values < parameters.parameter[i].has_values; ++values) { needs_value.array[needs_value.used++] = i; } // for } @@ -311,7 +321,7 @@ extern "C" { } } - location++; + ++location; } // while if (needs_value.used > 0) { @@ -334,16 +344,23 @@ extern "C" { if (!choices.id) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!choices.used) return F_data_not; - if (!parameters.used) return F_data_not; + if (!choices.used) { + return F_data_not; + } + + if (!parameters.used) { + return F_data_not; + } f_array_length_t location = 0; f_array_length_t location_sub = 0; f_console_parameter_id_t priority = 0; - for (f_array_length_t i = 0; i < choices.used; i++) { + for (f_array_length_t i = 0; i < choices.used; ++i) { - if (choices.id[i] > parameters.used) return F_status_set_error(F_parameter); + if (choices.id[i] > parameters.used) { + return F_status_set_error(F_parameter); + } if (parameters.parameter[choices.id[i]].result == f_console_result_found) { if (parameters.parameter[choices.id[i]].location < location) { @@ -376,16 +393,23 @@ extern "C" { if (!choices.id) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!choices.used) return F_data_not; - if (!parameters.used) return F_data_not; + if (!choices.used) { + return F_data_not; + } + + if (!parameters.used) { + return F_data_not; + } f_array_length_t location = 0; f_array_length_t location_sub = 0; f_console_parameter_id_t priority = 0; - for (f_array_length_t i = 0; i < choices.used; i++) { + for (f_array_length_t i = 0; i < choices.used; ++i) { - if (choices.id[i] > parameters.used) return F_status_set_error(F_parameter); + if (choices.id[i] > parameters.used) { + return F_status_set_error(F_parameter); + } if (parameters.parameter[choices.id[i]].result == f_console_result_found) { if (parameters.parameter[choices.id[i]].location > location) { diff --git a/level_0/f_console/c/console.h b/level_0/f_console/c/console.h index 6e9ff8e..6316161 100644 --- a/level_0/f_console/c/console.h +++ b/level_0/f_console/c/console.h @@ -78,6 +78,7 @@ extern "C" { * @return * F_none on success. * F_data_not if "values" parameters were expected but not found. + * * F_array_too_large (with error bit) if a buffer would exceed max length. * F_failure (with error bit) if width is not long enough to convert when processing arguments as UTF-8. * F_parameter (with error bit) if a parameter is invalid. @@ -111,6 +112,7 @@ extern "C" { * @return * F_none on success. * F_data_not if no parameters were found. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_console_parameter_prioritize_left_ @@ -141,6 +143,7 @@ extern "C" { * @return * F_none on success. * F_data_not if no parameters were found. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_console_parameter_prioritize_right_ diff --git a/level_0/f_conversion/c/conversion.c b/level_0/f_conversion/c/conversion.c index 3b7f1fe..96a03b5 100644 --- a/level_0/f_conversion/c/conversion.c +++ b/level_0/f_conversion/c/conversion.c @@ -234,7 +234,7 @@ extern "C" { f_array_length_t total = 0; - for (register f_number_signed_t work = current; work; total++) { + for (register f_number_signed_t work = current; work; ++total) { work /= base; } // for @@ -245,21 +245,24 @@ extern "C" { macro_f_string_dynamic_t_resize(status, (*destination), destination->used + total + 1); } - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } f_number_unsigned_t work = 0; f_number_unsigned_t power = 1; if (negative) { destination->string[destination->used] = f_string_ascii_minus_s[0]; - destination->used++; + ++destination->used; } - for (register uint8_t i = 1; i < total; i++) { + for (register uint8_t i = 1; i < total; ++i) { power *= base; } // for - for (; power; total--) { + for (; power; --total) { + work = current / power; current -= work * power; power /= base; @@ -315,11 +318,11 @@ extern "C" { break; } - destination->used++; + ++destination->used; } // for destination->string[destination->used] = 0; - destination->used++; + ++destination->used; return F_none; } @@ -347,7 +350,7 @@ extern "C" { f_array_length_t total = 0; - for (register f_number_unsigned_t work = number; work; total++) { + for (register f_number_unsigned_t work = number; work; ++total) { work /= base; } // for @@ -358,11 +361,12 @@ extern "C" { f_number_unsigned_t work = 0; f_number_unsigned_t power = 1; - for (register uint8_t i = 1; i < total; i++) { + for (register uint8_t i = 1; i < total; ++i) { power *= base; } // for - for (; power; total--) { + for (; power; --total) { + work = current / power; current -= work * power; power /= base; @@ -418,11 +422,11 @@ extern "C" { break; } - destination->used++; + ++destination->used; } // for destination->string[destination->used] = 0; - destination->used++; + ++destination->used; return F_none; } diff --git a/level_0/f_conversion/c/conversion.h b/level_0/f_conversion/c/conversion.h index f18d71b..a6d71d3 100644 --- a/level_0/f_conversion/c/conversion.h +++ b/level_0/f_conversion/c/conversion.h @@ -109,6 +109,7 @@ extern "C" { * * @return * F_none if character was converted to a binary. + * * F_number (with error bit) if no conversion was made due to non-binary values being found. * F_parameter (with error bit) if a parameter is invalid. */ @@ -127,6 +128,7 @@ extern "C" { * * @return * F_none if character was converted to a decimal. + * * F_number (with error bit) if no conversion was made due to non-decimal values being found. * F_parameter (with error bit) if a parameter is invalid. */ @@ -145,6 +147,7 @@ extern "C" { * * @return * F_none if character was converted to a duodecimal. + * * F_number (with error bit) if no conversion was made due to non-duodecimal values being found. * F_parameter (with error bit) if a parameter is invalid. */ @@ -163,6 +166,7 @@ extern "C" { * * @return * F_none if character was converted to a hexidecimal. + * * F_number (with error bit) if no conversion was made due to non-hexidecimal values being found. * F_parameter (with error bit) if a parameter is invalid. */ @@ -181,6 +185,7 @@ extern "C" { * * @return * F_none if character was converted to a hexidecimal. + * * F_number (with error bit) if no conversion was made due to non-hexidecimal values being found. * F_parameter (with error bit) if a parameter is invalid. */ @@ -204,6 +209,7 @@ extern "C" { * * @return * F_none if the number was converted to a string. + * * F_parameter (with error bit) if a parameter is invalid. * F_memory_not (with error bit) on out of memory. */ @@ -227,6 +233,7 @@ extern "C" { * * @return * F_none if the number was converted to a string. + * * F_parameter (with error bit) if a parameter is invalid. * F_memory_not (with error bit) on out of memory. */ diff --git a/level_0/f_directory/c/directory.c b/level_0/f_directory/c/directory.c index 7c94180..6d659fd 100644 --- a/level_0/f_directory/c/directory.c +++ b/level_0/f_directory/c/directory.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_f_directory_create_ f_status_t f_directory_create(const f_string_t path, const mode_t mode) { + return private_f_directory_create(path, mode); } #endif // _di_f_directory_create_ @@ -23,6 +24,7 @@ extern "C" { #ifndef _di_f_directory_exists_ f_status_t f_directory_exists(const f_string_t path) { + struct stat file_stat; memset(&file_stat, 0, sizeof(struct stat)); @@ -40,7 +42,9 @@ extern "C" { return F_status_set_error(F_file_stat); } - if ((file_stat.st_mode & S_IFMT) == S_IFDIR) return F_true; + if ((file_stat.st_mode & S_IFMT) == S_IFDIR) { + return F_true; + } return F_false; } @@ -48,6 +52,7 @@ extern "C" { #ifndef _di_f_directory_exists_at_ f_status_t f_directory_exists_at(const int at_id, const f_string_t path, const int flag) { + struct stat file_stat; memset(&file_stat, 0, sizeof(struct stat)); @@ -66,7 +71,9 @@ extern "C" { return F_status_set_error(F_file_stat); } - if ((file_stat.st_mode & S_IFMT) == S_IFDIR) return F_true; + if ((file_stat.st_mode & S_IFMT) == S_IFDIR) { + return F_true; + } return F_false; } @@ -74,6 +81,7 @@ extern "C" { #ifndef _di_f_directory_is_ f_status_t f_directory_is(const f_string_t path) { + struct stat file_stat; memset(&file_stat, AT_SYMLINK_NOFOLLOW, sizeof(struct stat)); @@ -91,7 +99,9 @@ extern "C" { return F_status_set_error(F_file_stat); } - if ((file_stat.st_mode & S_IFMT) == S_IFDIR) return F_true; + if ((file_stat.st_mode & S_IFMT) == S_IFDIR) { + return F_true; + } return F_false; } @@ -99,6 +109,7 @@ extern "C" { #ifndef _di_f_directory_is_at_ f_status_t f_directory_is_at(const int at_id, const f_string_t path, const int flag) { + struct stat file_stat; memset(&file_stat, 0, sizeof(struct stat)); @@ -117,7 +128,9 @@ extern "C" { return F_status_set_error(F_file_stat); } - if ((file_stat.st_mode & S_IFMT) == S_IFDIR) return F_true; + if ((file_stat.st_mode & S_IFMT) == S_IFDIR) { + return F_true; + } return F_false; } @@ -141,12 +154,14 @@ extern "C" { else return F_status_set_error(F_failure); } - for (; i < length; i++) { + for (; i < length; ++i) { + size = strnlen(listing[i]->d_name, f_directory_name_max); // There is no reason to include "." and ".." in the directory listing. if (!strncmp(listing[i]->d_name, "..", 3) || !strncmp(listing[i]->d_name, ".", 2)) { f_memory_delete(size, sizeof(char *), (void **) & listing[i]); + continue; } @@ -165,14 +180,19 @@ extern "C" { f_memory_delete(size, sizeof(char *), (void **) & listing[i]); } // for - for (; i < length; i++) { + for (; i < length; ++i) { f_memory_delete(size, sizeof(char *), (void **) & listing[i]); } // for f_memory_delete(1, sizeof(struct dirent *), (void **) & listing); - if (F_status_is_error(status)) return status; - if (!length) return F_data_not; + if (F_status_is_error(status)) { + return status; + } + + if (!length) { + return F_data_not; + } return F_none; } @@ -270,8 +290,11 @@ extern "C" { } } else { + // Not recursively deleting and the path is requested to be preserved, so there is nothing to delete. - if (preserve) return F_none; + if (preserve) { + return F_none; + } result = remove(path); } @@ -317,8 +340,11 @@ extern "C" { } } else { + // Not recursively deleting and the path is requested to be preserved, so there is nothing to delete. - if (preserve) return F_none; + if (preserve) { + return F_none; + } result = remove(path); } @@ -360,7 +386,6 @@ extern "C" { memset(&file_stat, 0, sizeof(struct stat)); if (stat(path, &file_stat) < 0) { - if (errno == ENOENT) { return private_f_directory_create(path, mode); } @@ -377,7 +402,6 @@ extern "C" { } if (utimensat(f_directory_at_current_working, path, 0, 0) < 0) { - if (errno == EACCES) return F_status_set_error(F_access_denied); if (errno == EBADF) return F_status_set_error(F_directory_descriptor); if (errno == EFAULT) return F_status_set_error(F_buffer); diff --git a/level_0/f_directory/c/directory.h b/level_0/f_directory/c/directory.h index e7c6124..ccac433 100644 --- a/level_0/f_directory/c/directory.h +++ b/level_0/f_directory/c/directory.h @@ -53,6 +53,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_link_max (with error bit) max links limit reached or exceeded. @@ -86,6 +87,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. @@ -118,6 +120,7 @@ extern "C" { * F_true if path was found and path is a directory (or a symlink to a directory). * F_false if path was found and path is not a directory. * F_file_found_not if the path was not found. + * * F_access_denied (with error bit) if access to the file was denied. * F_loop (with error bit) on loop error. * F_memory_not (with error bit) if out of memory. @@ -145,6 +148,7 @@ extern "C" { * F_true if path was found and path is a directory (or a symlink to a directory). * F_false if path was found and path is not a directory. * F_file_found_not if the path was not found. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. * F_loop (with error bit) on loop error. @@ -169,6 +173,7 @@ extern "C" { * F_true if path was found and path is a directory. * F_false if path was found and path is not a directory (this includes symlinks). * F_file_found_not if the path was not found. + * * F_access_denied (with error bit) if access to the file was denied. * F_loop (with error bit) on loop error. * F_memory_not (with error bit) if out of memory. @@ -196,6 +201,7 @@ extern "C" { * F_true if path was found and path is a directory. * F_false if path was found and path is not a directory. * F_file_found_not if the path was not found. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. * F_loop (with error bit) on loop error. @@ -230,6 +236,7 @@ extern "C" { * @return * F_none on success. * F_data_not if directory is empty. + * * F_array_too_large (with error bit) if the directory buffer max length would be exceeded. * F_failure (with error bit) if failed to read directory information. * F_memory_not (with error bit) on out of memory. @@ -259,6 +266,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory_found_not (with error bit) if directory was not found. @@ -299,6 +307,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory_found_not (with error bit) if directory was not found. @@ -337,6 +346,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if file is busy. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -379,6 +389,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if file is busy. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -415,6 +426,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -457,6 +469,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. diff --git a/level_0/f_directory/c/directory_type.h b/level_0/f_directory/c/directory_type.h index 64b8302..91ef33f 100644 --- a/level_0/f_directory/c/directory_type.h +++ b/level_0/f_directory/c/directory_type.h @@ -74,8 +74,8 @@ extern "C" { * * The allocation macros apply to the path. * - * status: the status code. - * path: the dynamically allocated path associated with the status code. + * status: The status code. + * path: The dynamically allocated path associated with the status code. */ #ifndef _di_f_directory_status_t_ typedef struct { diff --git a/level_0/f_directory/c/private-directory.c b/level_0/f_directory/c/private-directory.c index 90e3e46..96f7385 100644 --- a/level_0/f_directory/c/private-directory.c +++ b/level_0/f_directory/c/private-directory.c @@ -60,7 +60,11 @@ extern "C" { #if !defined(_di_f_directory_remove_) int private_f_directory_remove_recursively(const char *path, const struct stat *file_stat, int type, struct FTW *entity) { - if (!entity->level) return 0; + + if (!entity->level) { + return 0; + } + return remove(path); } #endif // !defined(_di_f_directory_remove_) diff --git a/level_0/f_directory/c/private-directory.h b/level_0/f_directory/c/private-directory.h index 8f8ce1c..c66d329 100644 --- a/level_0/f_directory/c/private-directory.h +++ b/level_0/f_directory/c/private-directory.h @@ -26,6 +26,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_link_max (with error bit) max links limit reached or exceeded. @@ -62,6 +63,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. diff --git a/level_0/f_environment/c/environment.c b/level_0/f_environment/c/environment.c index 48f45e2..b37e41d 100644 --- a/level_0/f_environment/c/environment.c +++ b/level_0/f_environment/c/environment.c @@ -46,7 +46,9 @@ extern "C" { if (value->used > value->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!name.used) return F_data_not; + if (!name.used) { + return F_data_not; + } if (!name.string[name.used - 1]) { return private_f_environment_get(name.string, value); @@ -74,7 +76,9 @@ extern "C" { if (value.used > value.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!name.used) return F_data_not; + if (!name.used) { + return F_data_not; + } if (!name.string[name.used - 1]) { if (value.used > 0 && !value.string[value.used - 1]) { diff --git a/level_0/f_environment/c/environment.h b/level_0/f_environment/c/environment.h index 32015ca..34b03d3 100644 --- a/level_0/f_environment/c/environment.h +++ b/level_0/f_environment/c/environment.h @@ -57,6 +57,7 @@ extern "C" { * @return * F_true on success and environment variable exists. * F_false on success and environment variable does not exist. + * * F_parameter (with error bit) if a parameter is invalid. * * @see getenv() @@ -82,6 +83,7 @@ extern "C" { * @return * F_none on success. * F_exist_not if name does not exist. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. @@ -110,6 +112,7 @@ extern "C" { * F_none on success. * F_data_not if name.used is 0. * F_exist_not if name does not exist. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. @@ -138,6 +141,7 @@ extern "C" { * * @return * F_none on success. + * * F_valid_not (with error bit) if name is an invalid string. * F_memory_not (with error bit) on out of memory. * F_failure (with error bit) on any other error. @@ -167,6 +171,7 @@ extern "C" { * @return * F_none on success. * F_data_not if name.used is 0. + * * F_valid_not (with error bit) if name is an invalid string. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. @@ -188,6 +193,7 @@ extern "C" { * * @return * F_none on success. + * * F_valid_not (with error bit) if name is an invalid string. * F_memory_not (with error bit) on out of memory. * F_failure (with error bit) on any other error. @@ -208,6 +214,7 @@ extern "C" { * * @return * F_none on success. + * * F_valid_not (with error bit) if name is an invalid string. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_0/f_environment/c/private-environment.h b/level_0/f_environment/c/private-environment.h index 3562e3c..e5ec29e 100644 --- a/level_0/f_environment/c/private-environment.h +++ b/level_0/f_environment/c/private-environment.h @@ -31,6 +31,7 @@ extern "C" { * @return * F_none on success. * F_exist_not if name does not exist. + * * F_memory_not (with error bit) on out of memory. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. * @@ -57,6 +58,7 @@ extern "C" { * * @return * F_none on success. + * * F_valid_not (with error bit) if name is an invalid string. * F_memory_not (with error bit) on out of memory. * F_failure (with error bit) on any other error. @@ -77,6 +79,7 @@ extern "C" { * * @return * F_none on success. + * * F_valid_not (with error bit) if name is an invalid string. * F_memory_not (with error bit) on out of memory. * F_failure (with error bit) on any other error. diff --git a/level_0/f_execute/c/execute-common.h b/level_0/f_execute/c/execute-common.h index f2c1508..c1bb1f4 100644 --- a/level_0/f_execute/c/execute-common.h +++ b/level_0/f_execute/c/execute-common.h @@ -21,8 +21,8 @@ extern "C" { * * @todo move this into a f_scheduler project. * - * policy: the scheduler policy. - * priority: the scheduler priority; + * policy: The scheduler policy. + * priority: The scheduler priority; */ #ifndef _di_f_execute_scheduler_t_ typedef struct { diff --git a/level_0/f_file/c/file-common.h b/level_0/f_file/c/file-common.h index 0f3e3f9..22f8e31 100644 --- a/level_0/f_file/c/file-common.h +++ b/level_0/f_file/c/file-common.h @@ -117,10 +117,10 @@ extern "C" { /** * Commonly used file related properties. * - * stream: File stream. - * id: File descriptor, with a value of -1 represents a closed file. - * flag: Flags used for opening the file. - * size_read: The default number of 1-byte characters to read at a time and is often used for the read buffer size. + * stream: File stream. + * id: File descriptor, with a value of -1 represents a closed file. + * flag: Flags used for opening the file. + * size_read: The default number of 1-byte characters to read at a time and is often used for the read buffer size. * size_write: The default number of 1-byte characters to read at a time and is often used for the write buffer size. */ #ifndef _di_f_file_t_ diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index d0e0b32..513896b 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -230,7 +230,6 @@ extern "C" { if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!macro_f_file_type_is_fifo(mode) && !macro_f_file_type_is_character(mode) && !macro_f_file_type_is_block(mode)) { return F_status_set_error(F_supported_not); } @@ -307,6 +306,10 @@ extern "C" { #ifndef _di_f_file_descriptor_ f_status_t f_file_descriptor(f_file_t *file) { + #ifndef _di_level_0_parameter_checking_ + if (!file) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + file->id = fileno(file->stream); if (file->id == -1) { @@ -323,15 +326,16 @@ extern "C" { if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - f_status_t status = F_none; struct stat stat_file; memset(&stat_file, 0, sizeof(struct stat)); - status = private_f_file_stat(path, F_false, &stat_file); + const f_status_t status = private_f_file_stat(path, F_false, &stat_file); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_file_found_not) return F_false; + if (F_status_set_fine(status) == F_file_found_not) { + return F_false; + } return status; } @@ -346,15 +350,16 @@ extern "C" { if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - f_status_t status = F_none; struct stat stat_file; memset(&stat_file, 0, sizeof(struct stat)); - status = private_f_file_stat_at(at_id, path, flag, &stat_file); + const f_status_t status = private_f_file_stat_at(at_id, path, flag, &stat_file); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_file_found_not) return F_false; + if (F_status_set_fine(status) == F_file_found_not) { + return F_false; + } return status; } @@ -380,9 +385,9 @@ extern "C" { memset(&stat_file, 0, sizeof(struct stat)); - f_status_t status = private_f_file_stat(path, F_true, &stat_file); - if (F_status_is_error(status)) { - return status; + { + const f_status_t status = private_f_file_stat(path, F_true, &stat_file); + if (F_status_is_error(status)) return status; } *group = stat_file.st_gid; @@ -401,10 +406,14 @@ extern "C" { memset(&stat_file, 0, sizeof(struct stat)); - f_status_t status = private_f_file_stat(path, dereference, &stat_file); - if (F_status_is_error(status)) return status; + { + const f_status_t status = private_f_file_stat(path, dereference, &stat_file); + if (F_status_is_error(status)) return status; + } - if (macro_f_file_type_get(stat_file.st_mode) == type) return F_true; + if (macro_f_file_type_get(stat_file.st_mode) == type) { + return F_true; + } return F_false; } @@ -434,7 +443,9 @@ extern "C" { return F_status_set_error(F_file_stat); } - if (stat_file.st_mode == (S_IFMT & S_IFDIR)) return F_true; + if (stat_file.st_mode == (S_IFMT & S_IFDIR)) { + return F_true; + } return F_false; } @@ -949,7 +960,7 @@ extern "C" { mode_umask |= f_file_mode_t_block_world & f_file_mode_t_mask_bit_execute; } - for (f_array_length_t i = 0; syntax && string[i]; i++) { + for (f_array_length_t i = 0; syntax && string[i]; ++i) { if (string[i] == f_string_ascii_o_s[0]) { on |= 1; @@ -1001,7 +1012,7 @@ extern "C" { mode_mask = f_file_mode_t_block_all; } - for (i++; string[i]; i++) { + for (++i; string[i]; ++i) { if (string[i] == f_string_ascii_r_s[0]) { what = f_file_mode_t_mask_bit_read; @@ -1108,7 +1119,7 @@ extern "C" { if (string[i]) { f_array_length_t j = 0; - for (; string[i + j] && j < 4; j++) { + for (; string[i + j] && j < 4; ++j) { if (j) { *mode <<= 8; @@ -1170,9 +1181,9 @@ extern "C" { memset(&stat_file, 0, sizeof(struct stat)); - const f_status_t status = private_f_file_stat(path, F_true, &stat_file); - if (F_status_is_error(status)) { - return status; + { + const f_status_t status = private_f_file_stat(path, F_true, &stat_file); + if (F_status_is_error(status)) return status; } *mode = stat_file.st_mode; @@ -1192,9 +1203,9 @@ extern "C" { memset(&stat_file, 0, sizeof(struct stat)); - const f_status_t status = private_f_file_stat(path, F_true, &stat_file); - if (F_status_is_error(status)) { - return status; + { + const f_status_t status = private_f_file_stat(path, F_true, &stat_file); + if (F_status_is_error(status)) return status; } *mode = stat_file.st_mode; @@ -1389,9 +1400,9 @@ extern "C" { memset(&stat_file, 0, sizeof(struct stat)); - const f_status_t status = private_f_file_stat(path, F_true, &stat_file); - if (F_status_is_error(status)) { - return status; + { + const f_status_t status = private_f_file_stat(path, F_true, &stat_file); + if (F_status_is_error(status)) return status; } *owner = stat_file.st_uid; @@ -1407,7 +1418,9 @@ extern "C" { if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_file_closed); + if (file.id == -1) { + return F_status_set_error(F_file_closed); + } f_status_t status = F_none; ssize_t size_read = 0; @@ -1455,7 +1468,9 @@ extern "C" { if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_file_closed); + if (file.id == -1) { + return F_status_set_error(F_file_closed); + } f_status_t status = F_none; ssize_t size_read = 0; @@ -1506,7 +1521,9 @@ extern "C" { if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_file_closed); + if (file.id == -1) { + return F_status_set_error(F_file_closed); + } f_array_length_t buffer_size = file.size_read; f_array_length_t buffer_count = 0; @@ -1742,9 +1759,10 @@ extern "C" { memset(&stat_file, 0, sizeof(struct stat)); - f_status_t status = private_f_file_stat(path, dereference, &stat_file); - - if (F_status_is_error(status)) return status; + { + const f_status_t status = private_f_file_stat(path, dereference, &stat_file); + if (F_status_is_error(status)) return status; + } *size = stat_file.st_size; @@ -1764,9 +1782,10 @@ extern "C" { memset(&stat_file, 0, sizeof(struct stat)); - f_status_t status = private_f_file_stat_at(at_id, path, dereference, &stat_file); - - if (F_status_is_error(status)) return status; + { + const f_status_t status = private_f_file_stat_at(at_id, path, dereference, &stat_file); + if (F_status_is_error(status)) return status; + } *size = stat_file.st_size; @@ -1785,9 +1804,10 @@ extern "C" { memset(&stat_file, 0, sizeof(struct stat)); - f_status_t status = private_f_file_stat_by_id(id, &stat_file); - - if (F_status_is_error(status)) return status; + { + const f_status_t status = private_f_file_stat_by_id(id, &stat_file); + if (F_status_is_error(status)) return status; + } *size = stat_file.st_size; @@ -1968,7 +1988,9 @@ extern "C" { if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!file.stream) return F_status_set_error(F_file_closed); + if (!file.stream) { + return F_status_set_error(F_file_closed); + } f_status_t status = F_none; ssize_t size_read = 0; @@ -2167,7 +2189,9 @@ extern "C" { if (amount < 1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!file.stream) return F_status_set_error(F_file_closed); + if (!file.stream) { + return F_status_set_error(F_file_closed); + } if (!buffer.used) { if (written) *written = 0; @@ -2179,17 +2203,23 @@ extern "C" { if (written) { private_f_file_stream_write_until(file, buffer.string, amount, buffer.used, written); - if (status == F_none && *written == buffer.used) return F_none_eos; + if (status == F_none && *written == buffer.used) { + return F_none_eos; + } } else { f_array_length_t written_local = 0; private_f_file_stream_write_until(file, buffer.string, amount, buffer.used, &written_local); - if (status == F_none && written_local == buffer.used) return F_none_eos; + if (status == F_none && written_local == buffer.used) { + return F_none_eos; + } } - if (F_status_is_error(status)) return F_status_set_error(status); + if (F_status_is_error(status)) { + return F_status_set_error(status); + } return status; } @@ -2203,10 +2233,13 @@ extern "C" { if (amount < 1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!file.stream) return F_status_set_error(F_file_closed); + if (!file.stream) { + return F_status_set_error(F_file_closed); + } if (!buffer.used) { if (written) *written = 0; + return F_data_not; } @@ -2222,8 +2255,13 @@ extern "C" { private_f_file_stream_write_until(file, buffer.string, amount, write_max, written); if (status == F_none) { - if (*written == buffer.used) return F_none_eos; - if (*written == write_max) return F_none_stop; + if (*written == buffer.used) { + return F_none_eos; + } + + if (*written == write_max) { + return F_none_stop; + } } } else { @@ -2232,8 +2270,13 @@ extern "C" { private_f_file_stream_write_until(file, buffer.string, amount, write_max, &written_local); if (status == F_none) { - if (written_local == buffer.used) return F_none_eos; - if (written_local == write_max) return F_none_stop; + if (written_local == buffer.used) { + return F_none_eos; + } + + if (written_local == write_max) { + return F_none_stop; + } } } @@ -2250,10 +2293,13 @@ extern "C" { if (!total) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!file.stream) return F_status_set_error(F_file_closed); + if (!file.stream) { + return F_status_set_error(F_file_closed); + } if (!buffer.used || !total) { if (written) *written = 0; + return F_data_not; } @@ -2269,8 +2315,13 @@ extern "C" { private_f_file_stream_write_until(file, buffer.string, amount, write_max, written); if (status == F_none) { - if (*written == buffer.used) return F_none_eos; - if (*written == write_max) return F_none_stop; + if (*written == buffer.used) { + return F_none_eos; + } + + if (*written == write_max) { + return F_none_stop; + } } } else { @@ -2279,8 +2330,13 @@ extern "C" { private_f_file_stream_write_until(file, buffer.string, amount, buffer.used, &written_local); if (status == F_none) { - if (written_local == buffer.used) return F_none_eos; - if (written_local == write_max) return F_none_stop; + if (written_local == buffer.used) { + return F_none_eos; + } + + if (written_local == write_max) { + return F_none_stop; + } } } @@ -2298,10 +2354,13 @@ extern "C" { if (range.start >= buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!file.stream) return F_status_set_error(F_file_closed); + if (!file.stream) { + return F_status_set_error(F_file_closed); + } if (!buffer.used) { if (written) *written = 0; + return F_data_not; } @@ -2318,8 +2377,13 @@ extern "C" { private_f_file_stream_write_until(file, buffer.string + range.start, amount, write_max, written); if (status == F_none) { - if (range.start + *written == buffer.used) return F_none_stop; - if (range.start + *written == total) return F_none_eos; + if (range.start + *written == buffer.used) { + return F_none_stop; + } + + if (range.start + *written == total) { + return F_none_eos; + } } } else { @@ -2328,8 +2392,13 @@ extern "C" { private_f_file_stream_write_until(file, buffer.string + range.start, amount, write_max, &written_local); if (status == F_none) { - if (range.start + written_local == buffer.used) return F_none_eos; - if (range.start + written_local == total) return F_none_stop; + if (range.start + written_local == buffer.used) { + return F_none_eos; + } + + if (range.start + written_local == total) { + return F_none_stop; + } } } @@ -2485,10 +2554,13 @@ extern "C" { if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_file_closed); + if (file.id == -1) { + return F_status_set_error(F_file_closed); + } if (!buffer.used) { if (written) *written = 0; + return F_data_not; } @@ -2497,17 +2569,23 @@ extern "C" { if (written) { private_f_file_write_until(file, buffer.string, buffer.used, written); - if (status == F_none && *written == buffer.used) return F_none_eos; + if (status == F_none && *written == buffer.used) { + return F_none_eos; + } } else { f_array_length_t written_local = 0; private_f_file_write_until(file, buffer.string, buffer.used, &written_local); - if (status == F_none && written_local == buffer.used) return F_none_eos; + if (status == F_none && written_local == buffer.used) { + return F_none_eos; + } } - if (F_status_is_error(status)) return F_status_set_error(status); + if (F_status_is_error(status)) { + return F_status_set_error(status); + } return status; } @@ -2520,10 +2598,13 @@ extern "C" { if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_file_closed); + if (file.id == -1) { + return F_status_set_error(F_file_closed); + } if (!buffer.used) { if (written) *written = 0; + return F_data_not; } @@ -2539,8 +2620,13 @@ extern "C" { private_f_file_write_until(file, buffer.string, write_max, written); if (status == F_none) { - if (*written == buffer.used) return F_none_eos; - if (*written == write_max) return F_none_stop; + if (*written == buffer.used) { + return F_none_eos; + } + + if (*written == write_max) { + return F_none_stop; + } } } else { @@ -2549,8 +2635,13 @@ extern "C" { private_f_file_write_until(file, buffer.string, write_max, &written_local); if (status == F_none) { - if (written_local == buffer.used) return F_none_eos; - if (written_local == write_max) return F_none_stop; + if (written_local == buffer.used) { + return F_none_eos; + } + + if (written_local == write_max) { + return F_none_stop; + } } } @@ -2566,10 +2657,13 @@ extern "C" { if (!total) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_file_closed); + if (file.id == -1) { + return F_status_set_error(F_file_closed); + } if (!buffer.used || !total) { if (written) *written = 0; + return F_data_not; } @@ -2585,8 +2679,13 @@ extern "C" { private_f_file_write_until(file, buffer.string, write_max, written); if (status == F_none) { - if (*written == buffer.used) return F_none_eos; - if (*written == write_max) return F_none_stop; + if (*written == buffer.used) { + return F_none_eos; + } + + if (*written == write_max) { + return F_none_stop; + } } } else { @@ -2595,8 +2694,13 @@ extern "C" { private_f_file_write_until(file, buffer.string, buffer.used, &written_local); if (status == F_none) { - if (written_local == buffer.used) return F_none_eos; - if (written_local == write_max) return F_none_stop; + if (written_local == buffer.used) { + return F_none_eos; + } + + if (written_local == write_max) { + return F_none_stop; + } } } @@ -2613,10 +2717,13 @@ extern "C" { if (range.start >= buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id == -1) return F_status_set_error(F_file_closed); + if (file.id == -1) { + return F_status_set_error(F_file_closed); + } if (!buffer.used) { if (written) *written = 0; + return F_data_not; } @@ -2633,8 +2740,13 @@ extern "C" { private_f_file_write_until(file, buffer.string + range.start, write_max, written); if (status == F_none) { - if (range.start + *written == buffer.used) return F_none_stop; - if (range.start + *written == total) return F_none_eos; + if (range.start + *written == buffer.used) { + return F_none_stop; + } + + if (range.start + *written == total) { + return F_none_eos; + } } } else { @@ -2643,8 +2755,13 @@ extern "C" { private_f_file_write_until(file, buffer.string + range.start, write_max, &written_local); if (status == F_none) { - if (range.start + written_local == buffer.used) return F_none_eos; - if (range.start + written_local == total) return F_none_stop; + if (range.start + written_local == buffer.used) { + return F_none_eos; + } + + if (range.start + written_local == total) { + return F_none_stop; + } } } diff --git a/level_0/f_file/c/file.h b/level_0/f_file/c/file.h index 46fcc77..ba9c4f6 100644 --- a/level_0/f_file/c/file.h +++ b/level_0/f_file/c/file.h @@ -95,6 +95,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_group (with error bit) if the current user does not have access to assign the specified group. * F_access_mode (with error bit) if the current user does not have access to assign the file mode. @@ -132,6 +133,7 @@ extern "C" { * * @return * F_none on success. + * * F_file_close (with error bit) if fclose() failed for any other reason. * F_file_descriptor (with error bit) if file descriptor is invalid. * F_file_synchronize (with error bit) on flush failure. @@ -156,6 +158,7 @@ extern "C" { * * @return * F_none on success. + * * F_file_close (with error bit) if fclose() failed for any other reason. * F_file_descriptor (with error bit) if file descriptor is invalid. * F_file_synchronize (with error bit) on flush failure. @@ -198,6 +201,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if filesystem is too busy to perform write. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -237,6 +241,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if filesystem is too busy to perform write. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -277,6 +282,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if filesystem is too busy to perform write. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -318,6 +324,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_file_found (with error bit) if a file was found while exclusive is TRUE. @@ -358,6 +365,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. @@ -389,6 +397,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_file_found (with error bit) if a file was found while exclusive is TRUE. @@ -420,6 +429,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. @@ -453,6 +463,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_file_found (with error bit) if a file was found while exclusive is TRUE. @@ -487,6 +498,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. @@ -515,6 +527,7 @@ extern "C" { * * @return * F_none is returned on success. + * * F_parameter (with error bit) if a parameter is invalid. * F_file (with error bit) if file is not a valid stream. * @@ -536,6 +549,7 @@ extern "C" { * @return * F_true if path was found. * F_false if path was not found. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_loop (with error bit) on loop error. @@ -566,6 +580,7 @@ extern "C" { * @return * F_true if file exists. * F_false if file does not exist. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) on invalid directory. * F_false (with error bit) on unknown/unhandled errors. @@ -589,6 +604,7 @@ extern "C" { * * @return * F_none is returned on success. + * * F_file_descriptor (with error bit) if file descriptor is invalid. * F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted. * F_input_output (with error bit) on I/O error. @@ -613,6 +629,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -646,6 +663,7 @@ extern "C" { * F_true if path was found and path is type. * F_false if path was found and path is not type. * F_file_found_not if the path was not found. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_loop (with error bit) on loop error. @@ -676,6 +694,7 @@ extern "C" { * F_true if path was found and path is type. * F_false if path was found and path is not type. * F_file_found_not if the path was not found. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_loop (with error bit) on loop error. @@ -703,6 +722,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -741,6 +761,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if filesystem is too busy to perform write. * F_buffer (with error bit) if the buffer is invalid. @@ -777,6 +798,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -818,6 +840,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -858,6 +881,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -894,6 +918,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -934,6 +959,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * @see f_file_mode_from_string() @@ -1020,6 +1046,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * F_syntax (with error bit) if the string fails to follow the syntax rules. * @@ -1041,6 +1068,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -1068,6 +1096,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -1096,6 +1125,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_mode (with error bit) if the current user does not have access to assign the file mode. * F_directory (with error bit) on invalid directory. @@ -1129,6 +1159,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_mode (with error bit) if the current user does not have access to assign the file mode. * F_file_found_not (with error bit) if file at path was not found. @@ -1159,6 +1190,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * @see f_file_mode_from_string() @@ -1181,6 +1213,7 @@ extern "C" { * * @return * F_none on success. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if string is too large to store in the buffer. @@ -1205,6 +1238,7 @@ extern "C" { * * @return * F_none on success. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if string is too large to store in the buffer. @@ -1232,6 +1266,7 @@ extern "C" { * * @return * F_none is returned on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -1275,6 +1310,7 @@ extern "C" { * * @return * F_none on success. + * * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. * F_file_found_not (with error bit) if the file was not found. * F_file_open (with error bit) if the file is already open. @@ -1296,6 +1332,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -1325,6 +1362,7 @@ extern "C" { * * @return * F_none_eof on success and EOF was reached. + * * F_block (with error bit) if file descriptor is set to non-block and the read would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -1355,6 +1393,7 @@ extern "C" { * @return * F_none on success. * F_none_eof on success and EOF was reached. + * * F_block (with error bit) if file descriptor is set to non-block and the read would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -1391,6 +1430,7 @@ extern "C" { * @return * F_none_eof on success and EOF was reached. * F_none_stop on success and total was reached. + * * F_block (with error bit) if file descriptor is set to non-block and the read would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -1414,6 +1454,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if file is busy. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -1446,6 +1487,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if file is busy. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -1485,6 +1527,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -1533,6 +1576,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -1578,6 +1622,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_group (with error bit) if the current user does not have access to assign the specified group. * F_access_owner (with error bit) if the current user does not have access to assign the specified owner. @@ -1619,6 +1664,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_group (with error bit) if the current user does not have access to assign the specified group. * F_access_owner (with error bit) if the current user does not have access to assign the specified owner. @@ -1655,6 +1701,7 @@ extern "C" { * * @return * F_none on success. + * * F_bound_not (with error bit) if SEEK_DATA or SEEK_HOLE is specified as whence and offset is beyond the end of file. * F_file_descriptor (with error bit) if the file descriptor is invalid. * F_file_type_pipe (with error bit) if file descriptor represents a pipe, socket, or FIFO. @@ -1681,6 +1728,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -1711,6 +1759,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -1736,6 +1785,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -1764,6 +1814,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -1793,6 +1844,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -1818,6 +1870,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -1845,6 +1898,7 @@ extern "C" { * * @return * F_none is returned on success. + * * F_access_denied (with error bit) on access denied. * F_block (with error bit) if the action would block and non-blocking is set on the stream. * F_buffer (with error bit) if the buffer is invalid. @@ -1887,6 +1941,7 @@ extern "C" { * * @return * F_none is returned on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_deadlock (with error bit) if operation would cause a deadlock. @@ -1922,6 +1977,7 @@ extern "C" { * * @return * F_none is returned on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -1965,6 +2021,7 @@ extern "C" { * * @return * F_none_eof on success and EOF was reached. + * * F_block (with error bit) if file descriptor is set to non-block and the read would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -1998,6 +2055,7 @@ extern "C" { * @return * F_none on success. * F_none_eof on success and EOF was reached. + * * F_block (with error bit) if file descriptor is set to non-block and the read would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -2037,6 +2095,7 @@ extern "C" { * @return * F_none_eof on success and EOF was reached. * F_none_stop on success and total was reached. + * * F_block (with error bit) if file descriptor is set to non-block and the read would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -2073,6 +2132,7 @@ extern "C" { * @return * F_none is returned on success. * F_access_denied (with error bit) on access denied. + * * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. * F_file_descriptor (with error bit) if unable to load the file descriptor. @@ -2116,6 +2176,7 @@ extern "C" { * @return * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -2151,6 +2212,7 @@ extern "C" { * @return * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -2187,6 +2249,7 @@ extern "C" { * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). * F_none_eos on success but range.stop exceeded buffer.used (only wrote up to buffer.used). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -2223,6 +2286,7 @@ extern "C" { * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). * F_none_eos on success but range.stop exceeded buffer.used (only wrote up to buffer.used). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_descriptor (with error bit) if the file descriptor is invalid. @@ -2253,6 +2317,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -2297,6 +2362,7 @@ extern "C" { * F_none on success. * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. + * * F_busy (with error bit) if filesystem is too busy to perform write. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. @@ -2335,6 +2401,7 @@ extern "C" { * @return * F_none if path was found and and the type was loaded in the type parameter. * F_file_found_not if the path was not found. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_loop (with error bit) on loop error. @@ -2364,6 +2431,7 @@ extern "C" { * @return * F_none if path was found and and the type was loaded in the type parameter. * F_file_found_not if the path was not found. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_loop (with error bit) on loop error. @@ -2393,6 +2461,7 @@ extern "C" { * @return * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -2425,6 +2494,7 @@ extern "C" { * @return * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -2458,6 +2528,7 @@ extern "C" { * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). * F_none_eos on success but range.stop exceeded buffer.used (only wrote up to buffer.used). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -2491,6 +2562,7 @@ extern "C" { * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). * F_none_eos on success but range.stop exceeded buffer.used (only wrote up to buffer.used). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_descriptor (with error bit) if the file descriptor is invalid. diff --git a/level_0/f_file/c/private-file.c b/level_0/f_file/c/private-file.c index f9ed45a..44268f5 100644 --- a/level_0/f_file/c/private-file.c +++ b/level_0/f_file/c/private-file.c @@ -31,6 +31,7 @@ extern "C" { #if !defined(_di_f_file_copy_) || !defined(_di_f_file_clone_) f_status_t private_f_file_copy_content(const f_string_t source, const f_string_t destination, const f_number_unsigned_t size_block) { + f_file_t file_source = f_file_t_initialize; f_file_t file_destination = f_file_t_initialize; @@ -76,6 +77,7 @@ extern "C" { #if !defined(_di_f_file_copy_at_) || !defined(_di_f_file_clone_at_) f_status_t private_f_file_copy_content_at(const int at_id, const f_string_t source, const f_string_t destination, const f_number_unsigned_t size_block) { + f_file_t file_source = f_file_t_initialize; f_file_t file_destination = f_file_t_initialize; @@ -121,6 +123,7 @@ extern "C" { #if !defined(_di_f_file_create_) || !defined(_di_f_file_copy_) f_status_t private_f_file_create(const f_string_t path, const mode_t mode, const bool exclusive) { + f_file_t file = f_file_t_initialize; file.flag = f_file_flag_close_execute | f_file_flag_create | f_file_flag_write_only; @@ -141,6 +144,7 @@ extern "C" { #if !defined(_di_f_file_create_at_) || !defined(_di_f_file_copy_at_) f_status_t private_f_file_create_at(const int at_id, const f_string_t path, const mode_t mode, const bool exclusive) { + f_file_t file = f_file_t_initialize; file.flag = f_file_flag_close_execute | f_file_flag_create | f_file_flag_write_only; @@ -384,6 +388,7 @@ extern "C" { #if !defined(_di_f_file_link_read_) || !defined(_di_f_file_copy_) f_status_t private_f_file_link_read(const f_string_t path, const struct stat link_stat, f_string_dynamic_t *target) { + // create a NULL terminated string based on file stat. if (link_stat.st_size + 1 > target->size) { if (link_stat.st_size + 1 > f_array_length_t_size) { @@ -420,6 +425,7 @@ extern "C" { #if !defined(_di_f_file_link_read_at_) || !defined(_di_f_file_copy_at_) f_status_t private_f_file_link_read_at(const int at_id, const f_string_t path, const struct stat link_stat, f_string_dynamic_t *target) { + // create a NULL terminated string based on file stat. if (link_stat.st_size + 1 > target->size) { if (link_stat.st_size + 1 > f_array_length_t_size) { @@ -579,6 +585,7 @@ extern "C" { #if !defined(_di_f_file_role_change_) || !defined(_di_f_file_copy_) f_status_t private_f_file_role_change(const f_string_t path, const uid_t uid, const gid_t gid, const bool dereference) { + int result = 0; if (dereference) { @@ -628,6 +635,7 @@ extern "C" { #if !defined(_di_f_file_role_change_at_) || !defined(_di_f_file_copy_at_) f_status_t private_f_file_role_change_at(const int at_id, const f_string_t path, const uid_t uid, const gid_t gid, const int flag) { + int result = 0; if (uid != -1) { @@ -705,6 +713,7 @@ extern "C" { #if !defined(_di_f_file_stat_by_id_) || !defined(_di_f_file_size_by_id_) f_status_t private_f_file_stat_by_id(const int id, struct stat *file_stat) { + const int result = fstat(id, file_stat); if (result < 0) { @@ -754,6 +763,7 @@ extern "C" { #if !defined(f_file_stream_write) || !defined(_di_f_file_stream_write_block_) || !defined(f_file_stream_write_until) || !defined(f_file_stream_write_range) f_status_t private_f_file_stream_write_until(const f_file_t file, const f_string_t string, const f_array_length_t amount, const f_array_length_t total, f_array_length_t *written) { + *written = 0; f_status_t status = F_none; @@ -803,6 +813,7 @@ extern "C" { #if !defined(f_file_write) || !defined(_di_f_file_write_block_) || !defined(f_file_write_until) || !defined(f_file_write_range) f_status_t private_f_file_write_until(const f_file_t file, const f_string_t string, const f_array_length_t total, f_array_length_t *written) { + *written = 0; f_status_t status = F_none; diff --git a/level_0/f_file/c/private-file.h b/level_0/f_file/c/private-file.h index 0b6bd8b..375f232 100644 --- a/level_0/f_file/c/private-file.h +++ b/level_0/f_file/c/private-file.h @@ -28,6 +28,7 @@ extern "C" { * * @return * F_none on success. + * * F_file_close (with error bit) if fclose() failed for any other reason. * F_file_descriptor (with error bit) if file descriptor is invalid. * F_file_synchronize (with error bit) on flush failure. @@ -66,6 +67,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if filesystem is too busy to perform write. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -112,6 +114,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if filesystem is too busy to perform write. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -157,6 +160,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if filesystem is too busy to perform write. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -192,6 +196,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -228,6 +233,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -263,6 +269,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_file_found (with error bit) if a file was found while exclusive is TRUE. @@ -297,6 +304,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. @@ -336,6 +344,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_file_found (with error bit) if a file was found while exclusive is TRUE. @@ -377,6 +386,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. @@ -409,6 +419,7 @@ extern "C" { * * @return * F_none is returned on success. + * * F_file_descriptor (with error bit) if file descriptor is invalid. * F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted. * F_input_output (with error bit) on I/O error. @@ -437,6 +448,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -475,6 +487,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_busy (with error bit) if filesystem is too busy to perform write. * F_buffer (with error bit) if the buffer is invalid. @@ -514,6 +527,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -550,6 +564,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -582,6 +597,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_mode (with error bit) if the current user does not have access to assign the file mode. * F_directory (with error bit) on invalid directory. @@ -615,6 +631,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_mode (with error bit) if the current user does not have access to assign the file mode. * F_file_found_not (with error bit) if file at path was not found. @@ -649,6 +666,7 @@ extern "C" { * * @return * F_none on success. + * * F_file_descriptor (with error bit) if unable to load the file descriptor (the file pointer may still be valid). * F_file_found_not (with error bit) if the file was not found. * F_file_open (with error bit) if the file is already open. @@ -679,6 +697,7 @@ extern "C" { * * @return * F_none on success. + * * F_directory_descriptor (with error bit) for bad directory descriptor for at_id. * F_file_found_not (with error bit) if the file was not found. * F_file_open (with error bit) if the file is already open. @@ -707,6 +726,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_group (with error bit) if the current user does not have access to assign the specified group. * F_access_owner (with error bit) if the current user does not have access to assign the specified owner. @@ -746,6 +766,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_group (with error bit) if the current user does not have access to assign the specified group. * F_access_owner (with error bit) if the current user does not have access to assign the specified owner. @@ -782,6 +803,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -817,6 +839,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -846,6 +869,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) if access to the file was denied. * F_directory (with error bit) on invalid directory. * F_file_found_not (with error bit) if the file was not found. @@ -902,6 +926,7 @@ extern "C" { * @return * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file (with error bit) if file descriptor is in an error state. @@ -939,6 +964,7 @@ extern "C" { * @return * F_none on success. * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file (with error bit) if file descriptor is in an error state. diff --git a/level_0/f_fss/c/fss-common.h b/level_0/f_fss/c/fss-common.h index b6be7fa..1c96e6f 100644 --- a/level_0/f_fss/c/fss-common.h +++ b/level_0/f_fss/c/fss-common.h @@ -104,13 +104,13 @@ extern "C" { * * Only "next" and "end" are only meaningful for a Content and will be treated as "none" for an Object. * - * none: disable completeness. - * end: complete as if this is the final piece of a set (such as FSS-0001, adding terminating EOL). - * full: complete and add terminating EOL, where applicable. - * full_trim: complete and add terminating EOL but remove any leading or trailing whitespace, where applicable. - * next: complete as if this is a piece of a set (such as FSS-0001, adding a separating space). - * partial: complete, but do not add terminating EOL, where applicable. - * partial_trim: complete, but do not add terminating EOL and remove any leading or trailing whitespace, where applicable. + * none: Disable completeness. + * end: Complete as if this is the final piece of a set (such as FSS-0001, adding terminating EOL). + * full: Complete and add terminating EOL, where applicable. + * full_trim: Complete and add terminating EOL but remove any leading or trailing whitespace, where applicable. + * next: Complete as if this is a piece of a set (such as FSS-0001, adding a separating space). + * partial: Complete, but do not add terminating EOL, where applicable. + * partial_trim: Complete, but do not add terminating EOL and remove any leading or trailing whitespace, where applicable. */ #ifndef _di_f_fss_complete_ enum { @@ -152,7 +152,7 @@ extern "C" { * * @todo change this to use a range instead if a length to support multiple sub-headers. * - * type: the kind of fss file is this. + * type: The kind of fss file is this. * length: Total length of the header. */ #ifndef _di_f_fss_header_t_ diff --git a/level_0/f_fss/c/fss.c b/level_0/f_fss/c/fss.c index 12ad940..58b4f0f 100644 --- a/level_0/f_fss/c/fss.c +++ b/level_0/f_fss/c/fss.c @@ -26,7 +26,8 @@ extern "C" { if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - for (f_array_length_t i = 0; i < delimits.used; i++) { + for (f_array_length_t i = 0; i < delimits.used; ++i) { + if (delimits.array[i] < buffer->used) { buffer->string[delimits.array[i]] = f_fss_delimit_placeholder; } @@ -42,7 +43,8 @@ extern "C" { if (!buffer) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - for (f_array_length_t i = 0; i < delimits.used; i++) { + for (f_array_length_t i = 0; i < delimits.used; ++i) { + if (delimits.array[i] < buffer->used && delimits.array[i] >= range.start && delimits.array[i] <= range.stop) { buffer->string[delimits.array[i]] = f_fss_delimit_placeholder; } @@ -62,14 +64,15 @@ extern "C" { return F_none; } - for (f_array_length_t i = before; i > 0; i--) { + for (f_array_length_t i = before; i > 0; --i) { + if (buffer.string[i] == f_fss_eol) { - (*line)++; + ++(*line); } } // for if (buffer.string[0] == f_fss_eol) { - (*line)++; + ++(*line); } return F_none; @@ -86,14 +89,15 @@ extern "C" { return F_none; } - for (f_array_length_t i = before; i > range.start; i--) { + for (f_array_length_t i = before; i > range.start; --i) { + if (buffer.string[i] == f_fss_eol) { - (*line)++; + ++(*line); } } // for if (buffer.string[range.start] == f_fss_eol) { - (*line)++; + ++(*line); } return F_none; @@ -173,7 +177,8 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - for (;; range->start++) { + for (;; ++range->start) { + if (range->start >= buffer.used) return F_none_eos; if (range->start > range->stop) return F_none_stop; if (buffer.string[range->start] == f_fss_eol) break; @@ -204,7 +209,7 @@ extern "C" { while (position < buffer->used && position <= range.stop) { if (buffer->string[position] == f_fss_delimit_placeholder) { - distance++; + ++distance; } // do not waste time trying to process what is only going to be replaced with a delimit placeholder. @@ -225,8 +230,8 @@ extern "C" { while (utf_width) { buffer->string[position] = buffer->string[position + distance]; - utf_width--; - position++; + --utf_width; + ++position; } // while } } @@ -237,7 +242,7 @@ extern "C" { buffer->string[position] = buffer->string[position + distance]; } - position++; + ++position; } } @@ -245,7 +250,7 @@ extern "C" { while (position < buffer->used + distance && position <= range.stop) { buffer->string[position] = f_fss_delimit_placeholder; - position++; + ++position; } } @@ -259,7 +264,8 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - for (;; range->start++) { + for (;; ++range->start) { + if (range->start >= buffer.used) return F_none_eos; if (range->start > range->stop) return F_none_stop; if (buffer.string[range->start] != f_fss_delimit_placeholder) break; @@ -299,7 +305,7 @@ extern "C" { } if (buffer.string[range->start] == f_fss_delimit_placeholder) { - range->start++; + ++range->start; if (range->start >= buffer.used) { return F_none_eos; @@ -490,7 +496,9 @@ extern "C" { } } // for - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return F_none; } diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index 8d41691..e536868 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -48,6 +48,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_fss_apply_delimit_ @@ -68,6 +69,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_fss_apply_delimit_between_ @@ -90,6 +92,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_count_lines_ @@ -114,6 +117,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_count_lines_range_ @@ -133,6 +137,7 @@ extern "C" { * @return * F_true if the character in the buffer is a graph character. * F_false if the character in the buffer is not a graph character. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_graph(). @@ -156,6 +161,7 @@ extern "C" { * @return * F_true if the character in the buffer is a space character. * F_false if the character in the buffer is not a space character. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_control(). @@ -181,6 +187,7 @@ extern "C" { * @return * F_true if the character in the buffer is a space character. * F_false if the character in the buffer is not a space character. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_control(). @@ -205,6 +212,7 @@ extern "C" { * F_none on success. * F_none_eos on success and EOS was reached. * F_none_stop on success and stop point was reached. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_seek_to_eol_ @@ -227,6 +235,7 @@ extern "C" { * F_none on success. * F_none_eos on success and EOS was reached. * F_none_stop on success and stop point was reached. + * * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if UTF-8 cannot be fully processed (buffer or range range not long enough). */ @@ -247,6 +256,7 @@ extern "C" { * F_none on success. * F_none_eos on success and EOS was reached. * F_none_stop on success and stop point was reached. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_fss_skip_past_delimit_ @@ -270,6 +280,7 @@ extern "C" { * F_none_eol on success and EOL was reached. * F_none_eos on success and EOS was reached. * F_none_stop on success and stop point was reached. + * * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment was found. * F_complete_not_utf_eos (with error bit) if unable to get entire UTF-8 sequence due to EOS. * F_complete_not_utf_stop (with error bit) if unable to get entire UTF-8 sequence due to stop point reached. @@ -304,6 +315,7 @@ extern "C" { * F_none_eol on success and EOL was reached. * F_none_eos on success and EOS was reached. * F_none_stop on success and stop point was reached. + * * F_complete_not_utf (with error bit) if an incomplete UTF-8 fragment was found. * F_complete_not_utf_eos (with error bit) if unable to get entire UTF-8 sequence due to EOS. * F_complete_not_utf_stop (with error bit) if unable to get entire UTF-8 sequence due to stop point reached. diff --git a/level_0/f_fss/c/fss_comment.h b/level_0/f_fss/c/fss_comment.h index 16b14fa..12205f1 100644 --- a/level_0/f_fss/c/fss_comment.h +++ b/level_0/f_fss/c/fss_comment.h @@ -26,9 +26,9 @@ extern "C" { /** * An array of f_fss_comment_t. * - * array: the array of fss quote. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of fss quote. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_fss_comments_t_ typedef f_string_ranges_t f_fss_comments_t; @@ -52,9 +52,9 @@ extern "C" { /** * An array of f_fss_comments_t. * - * array: the array of fss quotes. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of fss quotes. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_fss_commentss_t_ typedef f_string_rangess_t f_fss_commentss_t; diff --git a/level_0/f_fss/c/fss_delimit.h b/level_0/f_fss/c/fss_delimit.h index a7dd549..276ee02 100644 --- a/level_0/f_fss/c/fss_delimit.h +++ b/level_0/f_fss/c/fss_delimit.h @@ -26,9 +26,9 @@ extern "C" { /** * An array of f_fss_delimit_t. * - * array: the array of fss quote. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of fss quote. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_fss_delimits_t_ typedef f_array_lengths_t f_fss_delimits_t; @@ -52,9 +52,9 @@ extern "C" { /** * An array of f_fss_delimits_t. * - * array: the array of fss quotes. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of fss quotes. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_fss_delimitss_t_ typedef f_array_lengthss_t f_fss_delimitss_t; diff --git a/level_0/f_fss/c/fss_named.h b/level_0/f_fss/c/fss_named.h index ff31315..41690b6 100644 --- a/level_0/f_fss/c/fss_named.h +++ b/level_0/f_fss/c/fss_named.h @@ -59,9 +59,9 @@ extern "C" { /** * This holds an array of f_fss_named_t. * - * array: an array of f_fss_named_t. - * size: Total amount of allocated space. - * used: Total number of allocated spaces used. + * array: An array of f_fss_named_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_fss_nameds_t_ typedef struct { diff --git a/level_0/f_fss/c/fss_quote.h b/level_0/f_fss/c/fss_quote.h index 21a1e9e..229eb9e 100644 --- a/level_0/f_fss/c/fss_quote.h +++ b/level_0/f_fss/c/fss_quote.h @@ -36,9 +36,9 @@ extern "C" { /** * An array of f_fss_quote_t. * - * array: the array of fss quote. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of fss quote. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_fss_quotes_t_ typedef f_uint8s_t f_fss_quotes_t; @@ -62,9 +62,9 @@ extern "C" { /** * An array of f_fss_quotes_t. * - * array: the array of fss quotes. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of fss quotes. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_fss_quotess_t_ typedef f_uint8ss_t f_fss_quotess_t; diff --git a/level_0/f_fss/c/private-fss.c b/level_0/f_fss/c/private-fss.c index 9db55c9..6c88c95 100644 --- a/level_0/f_fss/c/private-fss.c +++ b/level_0/f_fss/c/private-fss.c @@ -7,6 +7,7 @@ extern "C" { #if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) f_status_t private_f_fss_items_adjust(const f_array_length_t length, f_fss_items_t *items) { + f_status_t status = F_none; for (f_array_length_t i = length; i < items->size; ++i) { @@ -29,6 +30,7 @@ extern "C" { #if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_) f_status_t private_f_fss_items_resize(const f_array_length_t length, f_fss_items_t *items) { + f_status_t status = F_none; for (f_array_length_t i = length; i < items->size; ++i) { @@ -51,6 +53,7 @@ extern "C" { #if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) f_status_t private_f_fss_named_adjust(const f_array_length_t length, f_fss_named_t *named) { + f_status_t status = F_none; macro_f_string_ranges_t_adjust(status, named->objects, length) @@ -67,6 +70,7 @@ extern "C" { #if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) f_status_t private_f_fss_named_resize(const f_array_length_t length, f_fss_named_t *named) { + f_status_t status = F_none; macro_f_string_ranges_t_resize(status, named->objects, length) @@ -83,6 +87,7 @@ extern "C" { #if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_) f_status_t private_f_fss_nameds_adjust(const f_array_length_t length, f_fss_nameds_t *nameds) { + f_status_t status = F_none; for (f_array_length_t i = length; i < nameds->size; ++i) { @@ -106,6 +111,7 @@ extern "C" { #if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_increase_) || !defined(_di_f_fss_nameds_increase_by_) || !defined(_di_f_fss_nameds_resize_) f_status_t private_f_fss_nameds_resize(const f_array_length_t length, f_fss_nameds_t *nameds) { + f_status_t status = F_none; for (f_array_length_t i = length; i < nameds->size; ++i) { @@ -129,6 +135,7 @@ extern "C" { #if !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_) f_status_t private_f_fss_nest_adjust(const f_array_length_t length, f_fss_nest_t *nest) { + f_status_t status = F_none; for (f_array_length_t i = length; i < nest->size; ++i) { @@ -152,6 +159,7 @@ extern "C" { #if !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_increase_) || !defined(_di_f_fss_nest_increase_by_) || !defined(_di_f_fss_nest_resize_) f_status_t private_f_fss_nest_resize(const f_array_length_t length, f_fss_nest_t *nest) { + f_status_t status = F_none; for (f_array_length_t i = length; i < nest->size; ++i) { @@ -175,6 +183,7 @@ extern "C" { #if !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_) f_status_t private_f_fss_nests_adjust(const f_array_length_t length, f_fss_nests_t *nests) { + f_status_t status = F_none; for (f_array_length_t i = length; i < nests->size; ++i) { @@ -198,6 +207,7 @@ extern "C" { #if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_) f_status_t private_f_fss_nests_resize(const f_array_length_t length, f_fss_nests_t *nests) { + f_status_t status = F_none; for (f_array_length_t i = length; i < nests->size; ++i) { @@ -221,6 +231,7 @@ extern "C" { #if !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_) f_status_t private_f_fss_set_adjust(const f_array_length_t length, f_fss_set_t *set) { + f_status_t status = F_none; macro_f_fss_objects_t_adjust(status, set->objects, length); @@ -234,6 +245,7 @@ extern "C" { #if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_) f_status_t private_f_fss_set_resize(const f_array_length_t length, f_fss_set_t *set) { + f_status_t status = F_none; macro_f_fss_objects_t_resize(status, set->objects, length); @@ -247,6 +259,7 @@ extern "C" { #if !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_) f_status_t private_f_fss_set_quote_adjust(const f_array_length_t length, f_fss_set_quote_t *set_quote) { + f_status_t status = F_none; macro_f_fss_objects_t_adjust(status, set_quote->objects, length); @@ -266,6 +279,7 @@ extern "C" { #if !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_) f_status_t private_f_fss_set_quote_resize(const f_array_length_t length, f_fss_set_quote_t *set_quote) { + f_status_t status = F_none; macro_f_fss_objects_t_resize(status, set_quote->objects, length); @@ -285,6 +299,7 @@ extern "C" { #if !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_) f_status_t private_f_fss_set_quotes_adjust(const f_array_length_t length, f_fss_set_quotes_t *set_quotes) { + f_status_t status = F_none; for (f_array_length_t i = length; i < set_quotes->size; ++i) { @@ -351,6 +366,7 @@ extern "C" { #if !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_) f_status_t private_f_fss_sets_adjust(const f_array_length_t length, f_fss_sets_t *sets) { + f_status_t status = F_none; for (f_array_length_t i = length; i < sets->size; ++i) { @@ -378,6 +394,7 @@ extern "C" { #if !defined(_di_f_fss_sets_decrease_by_) || !defined(_di_f_fss_sets_increase_) || !defined(_di_f_fss_sets_increase_by_) || !defined(_di_f_fss_sets_resize_) f_status_t private_f_fss_sets_resize(const f_array_length_t length, f_fss_sets_t *sets) { + f_status_t status = F_none; for (f_array_length_t i = length; i < sets->size; ++i) { diff --git a/level_0/f_iki/c/iki.c b/level_0/f_iki/c/iki.c index a161329..139d57b 100644 --- a/level_0/f_iki/c/iki.c +++ b/level_0/f_iki/c/iki.c @@ -119,7 +119,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_iki_syntax_placeholder) { - range->start++; + ++range->start; continue; } @@ -150,7 +150,7 @@ extern "C" { // found a valid vocabulary name. if (buffer->string[range->start] == f_iki_syntax_quote_single || buffer->string[range->start] == f_iki_syntax_quote_double) { quote = buffer->string[range->start]; - range->start++; + ++range->start; break; } @@ -158,6 +158,7 @@ extern "C" { macro_f_iki_seek_word_dash_plus(status, buffer, range, width_max, F_false); if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(delimits); + return status; } @@ -172,7 +173,7 @@ extern "C" { while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_iki_syntax_placeholder) { - range->start++; + ++range->start; continue; } @@ -181,7 +182,7 @@ extern "C" { vocabulary_delimited = F_true; quote = buffer->string[range->start]; - range->start++; + ++range->start; break; } else { @@ -201,6 +202,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(delimits); + return status; } } // while @@ -214,6 +216,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(delimits); + return status; } @@ -223,14 +226,17 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(delimits); + return status; } else if (range->start > range->stop) { macro_f_array_lengths_t_delete_simple(delimits); + return F_data_not_stop; } else if (range->start >= buffer->used) { macro_f_array_lengths_t_delete_simple(delimits); + return F_data_not_eos; } @@ -242,6 +248,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(delimits); + return status; } } // while @@ -253,7 +260,8 @@ extern "C" { while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_iki_syntax_placeholder) { - range->start++; + ++range->start; + continue; } @@ -265,17 +273,18 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(delimits); + return status; } delimits.array[delimits.used] = vocabulary_slash_first; - delimits.used++; + ++delimits.used; find_next = F_true; vocabulary_delimited = F_false; quote = 0; - range->start++; + ++range->start; break; } else { @@ -296,24 +305,24 @@ extern "C" { variable->array[variable->used].start = found_vocabulary.start; variable->array[variable->used].stop = range->start; - variable->used++; + ++variable->used; vocabulary->array[vocabulary->used].start = found_vocabulary.start; vocabulary->array[vocabulary->used].stop = found_vocabulary.stop; - vocabulary->used++; + ++vocabulary->used; content->array[content->used].start = found_content; content->array[content->used].stop = range->start - 1; - content->used++; + ++content->used; - for (f_array_length_t i = 0; i < delimits.used; i++) { + for (f_array_length_t i = 0; i < delimits.used; ++i) { buffer->string[delimits.array[i]] = f_iki_syntax_placeholder; } // for macro_f_array_lengths_t_delete_simple(delimits); if (F_status_is_error(status)) return status; - range->start++; + ++range->start; if (range->start > range->stop) { return F_none_stop; @@ -333,7 +342,8 @@ extern "C" { while (range->start <= range->stop && range->start < buffer->used) { if (buffer->string[range->start] == f_iki_syntax_placeholder) { - range->start++; + ++range->start; + continue; } @@ -343,7 +353,7 @@ extern "C" { f_array_length_t i = 0; if (content_slash_total % 2) { - content_slash_delimits++; + ++content_slash_delimits; } if (delimits.used + content_slash_delimits > delimits.size) { @@ -356,6 +366,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(delimits); + return status; } } @@ -367,9 +378,9 @@ extern "C" { if (buffer->string[content_range.start] == f_iki_syntax_slash) { delimits.array[delimits.used] = content_range.start; - delimits.used++; + ++delimits.used; - i++; + ++i; } status = f_utf_buffer_increment(*buffer, (&content_range), 1); @@ -389,16 +400,17 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(delimits); + return status; } delimits.array[delimits.used] = vocabulary_slash_first; - delimits.used++; + ++delimits.used; vocabulary_delimited = F_false; quote = 0; - range->start++; + ++range->start; // skip past all initial non-word, non-dash, and non-plus. macro_f_iki_seek_word_dash_plus(status, buffer, range, width_max, F_true); @@ -418,29 +430,30 @@ extern "C" { if (F_status_is_error(status)) { macro_f_array_lengths_t_delete_simple(delimits); + return status; } variable->array[variable->used].start = found_vocabulary.start; variable->array[variable->used].stop = range->start; - variable->used++; + ++variable->used; vocabulary->array[vocabulary->used].start = found_vocabulary.start; vocabulary->array[vocabulary->used].stop = found_vocabulary.stop; - vocabulary->used++; + ++vocabulary->used; content->array[content->used].start = found_content; content->array[content->used].stop = range->start - 1; - content->used++; + ++content->used; - for (f_array_length_t i = 0; i < delimits.used; i++) { + for (f_array_length_t i = 0; i < delimits.used; ++i) { buffer->string[delimits.array[i]] = f_iki_syntax_placeholder; } // for macro_f_array_lengths_t_delete_simple(delimits); if (F_status_is_error(status)) return status; - range->start++; + ++range->start; if (range->start > range->stop) { return F_none_stop; @@ -460,7 +473,7 @@ extern "C" { break; } - content_slash_total++; + ++content_slash_total; status = f_utf_buffer_increment(*buffer, range, 1); @@ -492,7 +505,7 @@ extern "C" { } } while (range->start <= range->stop && range->start < buffer->used); - for (f_array_length_t i = 0; i < delimits.used; i++) { + for (f_array_length_t i = 0; i < delimits.used; ++i) { buffer->string[delimits.array[i]] = f_iki_syntax_placeholder; } // for diff --git a/level_0/f_iki/c/iki.h b/level_0/f_iki/c/iki.h index 825ab1d..272181a 100644 --- a/level_0/f_iki/c/iki.h +++ b/level_0/f_iki/c/iki.h @@ -64,6 +64,7 @@ extern "C" { * @return * F_true on success and string is a valid content name. * F_false on success and string is not a valid content name. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_iki_content_partial_is_ @@ -79,6 +80,7 @@ extern "C" { * @return * F_true on success and string is a valid object name. * F_false on success and string is not a valid object name. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_word(). @@ -98,6 +100,7 @@ extern "C" { * @return * F_true on success and string is a valid object name. * F_false on success and string is not a valid object name. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_word(). @@ -138,6 +141,7 @@ extern "C" { * F_data_not on success, but there were no IKI vocabulary names found. * F_data_not_eos on success and EOS was reached, but there were no IKI vocabulary names found. * F_data_not_stop on success and stop point was reached, but there were no IKI vocabulary names found. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if a string length is too large to store in the buffer. diff --git a/level_0/f_iki/c/private-iki.c b/level_0/f_iki/c/private-iki.c index 529f81c..294ec84 100644 --- a/level_0/f_iki/c/private-iki.c +++ b/level_0/f_iki/c/private-iki.c @@ -7,20 +7,22 @@ extern "C" { #if !defined(_di_f_iki_content_is_) || !defined(_di_f_iki_content_partial_is_) f_status_t private_f_iki_content_partial_is(const f_string_static_t buffer, const f_string_range_t range, const uint8_t quote) { + f_array_length_t delimits = 0; - for (f_array_length_t i = 0; i < buffer.used; i++) { + for (f_array_length_t i = 0; i < buffer.used; ++i) { if (buffer.string[i] == quote) { if (delimits && delimits % 2) { delimits = 0; + continue; } return F_false; } else if (buffer.string[i] == f_iki_syntax_slash) { - delimits++; + ++delimits; } else { delimits = 0; @@ -33,9 +35,10 @@ extern "C" { #if !defined(_di_f_iki_object_is_) || !defined(_di_f_iki_object_partial_is_) f_status_t private_f_iki_object_partial_is(const f_string_static_t buffer, const f_string_range_t range) { + f_status_t status = F_none; - for (f_array_length_t i = 0; i < buffer.used; i++) { + for (f_array_length_t i = 0; i < buffer.used; ++i) { status = f_utf_is_word(buffer.string + i, buffer.used - i, F_false); if (F_status_is_error(status)) return status; diff --git a/level_0/f_iki/c/private-iki.h b/level_0/f_iki/c/private-iki.h index d64edd2..8487955 100644 --- a/level_0/f_iki/c/private-iki.h +++ b/level_0/f_iki/c/private-iki.h @@ -31,6 +31,7 @@ extern "C" { * @return * F_true on success and string is a valid content name. * F_false on success and string is not a valid content name. + * * F_parameter (with error bit) if a parameter is invalid. * * @see f_iki_content_is() @@ -53,6 +54,7 @@ extern "C" { * @return * F_true on success and string is a valid object name. * F_false on success and string is not a valid object name. + * * F_parameter (with error bit) if a parameter is invalid. * * @see f_iki_object_is() diff --git a/level_0/f_limit/c/limit-common.h b/level_0/f_limit/c/limit-common.h index 58972e4..11bc435 100644 --- a/level_0/f_limit/c/limit-common.h +++ b/level_0/f_limit/c/limit-common.h @@ -19,8 +19,8 @@ extern "C" { /** * A limit value structure. * - * rlim_cur: the soft limit. - * rlim_max: the hard limit. + * rlim_cur: The soft limit. + * rlim_max: The hard limit. */ #ifndef _di_f_limit_value_t_ typedef struct rlimit f_limit_value_t; @@ -66,8 +66,8 @@ extern "C" { /** * A limit value structure. * - * type: the limit resource type code. - * value: the limit value containing the soft and hard limit. + * type: The limit resource type code. + * value: The limit value containing the soft and hard limit. */ #ifndef _di_f_limit_set_t_ typedef struct { diff --git a/level_0/f_limit/c/limit.c b/level_0/f_limit/c/limit.c index fd87ab9..4eef881 100644 --- a/level_0/f_limit/c/limit.c +++ b/level_0/f_limit/c/limit.c @@ -39,6 +39,7 @@ extern "C" { } for (f_array_length_t i = 0; i < source.used; ++i) { + destination->array[i].type = source.array[i].type; destination->array[i].value = source.array[i].value; } // for @@ -63,6 +64,7 @@ extern "C" { } for (f_array_length_t i = 0; i < source.used; ++i) { + destination->array[i].rlim_cur = source.array[i].rlim_cur; destination->array[i].rlim_max = source.array[i].rlim_max; } // for diff --git a/level_0/f_memory/c/memory.c b/level_0/f_memory/c/memory.c index 38ae773..f195196 100644 --- a/level_0/f_memory/c/memory.c +++ b/level_0/f_memory/c/memory.c @@ -27,7 +27,9 @@ extern "C" { #endif // _di_level_0_parameter_checking_ // prevent double-frees. - if (!*pointer || !size) return F_data_not; + if (!*pointer || !size) { + return F_data_not; + } #ifdef _f_memory_FORCE_secure_memory_ if (!length) { @@ -52,7 +54,9 @@ extern "C" { #endif // _di_level_0_parameter_checking_ // prevent double-frees. - if (!*pointer) return F_data_not; + if (!*pointer) { + return F_data_not; + } #ifndef _f_memory_FORCE_fast_memory_ if (!length) { @@ -77,7 +81,9 @@ extern "C" { #endif // _di_level_0_parameter_checking_ // prevent double-allocations. - if (*pointer || !length) return F_data_not; + if (*pointer || !length) { + return F_data_not; + } // Some people use malloc(size * length) to produce the same results. // This has been observed to sometimes causes an increase in L1/L2 cache misses (0.02% L1 increase, 0.01% L2 increase). @@ -105,12 +111,16 @@ extern "C" { #endif // _di_level_0_parameter_checking_ // prevent double-allocations. - if (*pointer || !length) return F_data_not; + if (*pointer || !length) { + return F_data_not; + } const int result = posix_memalign(pointer, alignment, length); if (result) { - if (result == EINVAL) return F_status_set_error(F_parameter); + if (result == EINVAL) { + return F_status_set_error(F_parameter); + } return F_status_set_error(F_memory_not); } diff --git a/level_0/f_path/c/path.c b/level_0/f_path/c/path.c index b75eb3c..721a05b 100644 --- a/level_0/f_path/c/path.c +++ b/level_0/f_path/c/path.c @@ -98,7 +98,7 @@ extern "C" { return F_false; } - for (f_array_length_t i = 0; i < length; i++) { + for (f_array_length_t i = 0; i < length; ++i) { if (path[i] == f_path_separator_s[0]) { return F_true; diff --git a/level_0/f_path/c/path.h b/level_0/f_path/c/path.h index f2d9317..129c827 100644 --- a/level_0/f_path/c/path.h +++ b/level_0/f_path/c/path.h @@ -37,6 +37,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -62,6 +63,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_directory (with error bit) if a supposed directory in path is not actually a directory. @@ -93,6 +95,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_buffer_too_small (with error bit) if the buffer is too small to store the path. @@ -148,6 +151,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_buffer_too_small (with error bit) if the buffer is too small to store the path. diff --git a/level_0/f_path/c/private-path.c b/level_0/f_path/c/private-path.c index d26edc4..1a9d46a 100644 --- a/level_0/f_path/c/private-path.c +++ b/level_0/f_path/c/private-path.c @@ -7,6 +7,7 @@ extern "C" { #if !defined(_di_f_path_current_) || !defined(_di_f_path_real_) f_status_t private_f_path_real(const f_string_t path, f_string_dynamic_t *real) { + char buffer[f_path_length_max]; if (!realpath(path, buffer)) { diff --git a/level_0/f_path/c/private-path.h b/level_0/f_path/c/private-path.h index 0ce42b3..069031b 100644 --- a/level_0/f_path/c/private-path.h +++ b/level_0/f_path/c/private-path.h @@ -29,6 +29,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_input_output (with error bit) on I/O error. diff --git a/level_0/f_pipe/c/pipe.h b/level_0/f_pipe/c/pipe.h index 9aef03c..818e561 100644 --- a/level_0/f_pipe/c/pipe.h +++ b/level_0/f_pipe/c/pipe.h @@ -46,6 +46,7 @@ extern "C" { * @return * F_true if there is piped data. * F_false if there is no piped data. + * * F_file_stat (with error bit) on stat() error. * * @see fstat() @@ -60,6 +61,7 @@ extern "C" { * @return * F_true if there is piped data. * F_false if there is no piped data. + * * F_file_stat (with error bit) on stat() error. * * @see fstat() @@ -76,6 +78,7 @@ extern "C" { * @return * F_false if there is no piped data. * F_true if there is piped data. + * * F_file_stat (with error bit) on stat() error. * * @see fstat() diff --git a/level_0/f_print/c/print.c b/level_0/f_print/c/print.c index e198601..2f5e5f1 100644 --- a/level_0/f_print/c/print.c +++ b/level_0/f_print/c/print.c @@ -11,7 +11,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!string || !length) return F_data_not; + if (!string || !length) { + return F_data_not; + } return private_f_print(output, string, length); } @@ -23,7 +25,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used) return F_data_not; + if (!buffer.used) { + return F_data_not; + } return private_f_print(output, buffer.string, buffer.used); } @@ -35,7 +39,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used) return F_data_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { + return F_data_not; + } f_array_length_t length = (range.stop - range.start) + 1; @@ -53,7 +59,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!string || length == 0) return F_data_not; + if (!string || length == 0) { + return F_data_not; + } return private_f_print_except(output, string, 0, length, except); } @@ -77,7 +85,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used) return F_data_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { + return F_data_not; + } f_array_length_t length = (range.stop - range.start) + 1; @@ -95,7 +105,9 @@ extern "C" { if (id == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!string || length == 0) return F_data_not; + if (!string || length == 0) { + return F_data_not; + } return private_f_print_to(id, string, length); } @@ -107,7 +119,9 @@ extern "C" { if (id == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used) return F_data_not; + if (!buffer.used) { + return F_data_not; + } return private_f_print_to(id, buffer.string, buffer.used); } @@ -119,7 +133,9 @@ extern "C" { if (id == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used) return F_data_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { + return F_data_not; + } f_array_length_t length = (range.stop - range.start) + 1; @@ -137,7 +153,9 @@ extern "C" { if (id == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!string || length == 0) return F_data_not; + if (!string || length == 0) { + return F_data_not; + } return private_f_print_to_except(id, string, 0, length, except); } @@ -149,7 +167,9 @@ extern "C" { if (id == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used) return F_data_not; + if (!buffer.used) { + return F_data_not; + } return private_f_print_to_except(id, buffer.string, 0, buffer.used, except); } @@ -161,7 +181,9 @@ extern "C" { if (id == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used) return F_data_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { + return F_data_not; + } f_array_length_t length = (range.stop - range.start) + 1; diff --git a/level_0/f_print/c/print.h b/level_0/f_print/c/print.h index b57a69c..af93515 100644 --- a/level_0/f_print/c/print.h +++ b/level_0/f_print/c/print.h @@ -46,6 +46,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_output (with error bit) on failure. * F_parameter (with error bit) if a parameter is invalid. * @@ -70,6 +71,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_output (with error bit) on failure. * F_parameter (with error bit) if a parameter is invalid. * @@ -96,6 +98,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_output (with error bit) on failure. * F_parameter (with error bit) if a parameter is invalid. * @@ -126,6 +129,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_output (with error bit) on failure. * F_parameter (with error bit) if a parameter is invalid. * @@ -154,6 +158,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_output (with error bit) on failure. * F_parameter (with error bit) if a parameter is invalid. * @@ -184,6 +189,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_output (with error bit) on failure. * F_parameter (with error bit) if a parameter is invalid. * @@ -211,6 +217,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -241,6 +248,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -273,6 +281,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -311,6 +320,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -347,6 +357,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -385,6 +396,7 @@ extern "C" { * @return * F_none on success. * F_data_not if there is nothing to print. + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. diff --git a/level_0/f_print/c/private-print.c b/level_0/f_print/c/private-print.c index b13b502..275081b 100644 --- a/level_0/f_print/c/private-print.c +++ b/level_0/f_print/c/private-print.c @@ -53,7 +53,8 @@ extern "C" { for (; i < length; ++i) { if (string[i]) { - total++; + ++total; + continue; } @@ -109,7 +110,8 @@ extern "C" { if (j >= except.used || except.array[j] != i) { if (string[i]) { - total++; + ++total; + continue; } } diff --git a/level_0/f_print/c/private-print.h b/level_0/f_print/c/private-print.h index bb80832..e269804 100644 --- a/level_0/f_print/c/private-print.h +++ b/level_0/f_print/c/private-print.h @@ -30,6 +30,7 @@ extern "C" { * @return * F_none on success. * F_data_not if length is 0. + * * F_output (with error bit) on failure. * F_parameter (with error bit) if a parameter is invalid. * @@ -61,6 +62,7 @@ extern "C" { * @return * F_none on success. * F_data_not if length is 0. + * * F_output (with error bit) on failure. * F_parameter (with error bit) if a parameter is invalid. * @@ -87,6 +89,7 @@ extern "C" { * @return * F_none on success. * F_data_not if length is 0. + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. @@ -124,6 +127,7 @@ extern "C" { * @return * F_none on success. * F_data_not if length is 0. + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. diff --git a/level_0/f_serialize/c/private-serialize.c b/level_0/f_serialize/c/private-serialize.c index a1e0b27..81dd50b 100644 --- a/level_0/f_serialize/c/private-serialize.c +++ b/level_0/f_serialize/c/private-serialize.c @@ -16,6 +16,7 @@ extern "C" { unsigned short width = 0; for (; i < serialize.used; i += width) { + width = macro_f_utf_byte_width(serialize.string[i]); if (serialize.string[i] == f_serialize_simple_splitter_s[0]) { @@ -35,7 +36,7 @@ extern "C" { } start = i + width; - current++; + ++current; } else if (i == serialize.used) { if (current == index) { @@ -46,7 +47,9 @@ extern "C" { return F_none_eos; } - if (i + width > serialize.used) return F_status_set_error(F_complete_not_utf_eos); + if (i + width > serialize.used) { + return F_status_set_error(F_complete_not_utf_eos); + } } // for return F_data_not_eos; diff --git a/level_0/f_serialize/c/private-serialize.h b/level_0/f_serialize/c/private-serialize.h index 5deccf9..c22c706 100644 --- a/level_0/f_serialize/c/private-serialize.h +++ b/level_0/f_serialize/c/private-serialize.h @@ -31,6 +31,7 @@ extern "C" { * F_none on success. * F_none_eos on success at end of string. * F_data_not_eos if end of string reached before index was reached. + * * F_complete_not_utf_eos (with error bit) if end of string is reached before a complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. */ diff --git a/level_0/f_serialize/c/serialize.c b/level_0/f_serialize/c/serialize.c index 0be821b..e19a543 100644 --- a/level_0/f_serialize/c/serialize.c +++ b/level_0/f_serialize/c/serialize.c @@ -47,6 +47,7 @@ extern "C" { uint8_t width = 0; while (i < serialize.used) { + width = macro_f_utf_byte_width(serialize.string[i]); if (serialize.string[i] == f_serialize_simple_splitter_s[0] || i + 1 >= serialize.used) { @@ -55,7 +56,7 @@ extern "C" { if (start == i) { strings->array[strings->used].used = 0; - strings->used++; + ++strings->used; } else { f_array_length_t total; @@ -64,6 +65,7 @@ extern "C" { total = (i - start) + 1; } else { + // subtract one from stop point to disclused the f_serialize_simple_splitter_s[0] character. total = ((i - 1) - start) + 1; } @@ -114,6 +116,7 @@ extern "C" { uint8_t width = 0; for (; i < serialize.used; i += width) { + width = macro_f_utf_byte_width(serialize.string[i]); if (serialize.string[i] == f_serialize_simple_splitter_s[0] || i + 1 >= serialize.used) { @@ -121,6 +124,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (start == i) { + // provide an invalid start to stop range to communicate that there is no data. locations->array[locations->used].start = 1; locations->array[locations->used].stop = 0; @@ -130,12 +134,13 @@ extern "C" { locations->array[locations->used].stop = i; } else { + // subtract one from stop point to disclused the f_serialize_simple_splitter_s[0] character. locations->array[locations->used].start = start; locations->array[locations->used].stop = i - 1; } - locations->used++; + ++locations->used; if (i + width > serialize.used) { return F_status_set_error(F_complete_not_utf_eos); @@ -177,6 +182,7 @@ extern "C" { if (status == F_data_not_eos) { dynamic->used = 0; + return status; } diff --git a/level_0/f_string/c/private-string.c b/level_0/f_string/c/private-string.c index d5b7dc5..e863f3b 100644 --- a/level_0/f_string/c/private-string.c +++ b/level_0/f_string/c/private-string.c @@ -33,7 +33,7 @@ extern "C" { f_array_length_t first = 0; f_array_length_t size = 0; - for (; i < length; i++) { + for (; i < length; ++i) { if (source[i]) continue; @@ -50,7 +50,7 @@ extern "C" { } while (i + 1 < length && !source[i + 1]) { - i++; + ++i; } // while first = i + 1; @@ -131,6 +131,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < dynamics->size; ++i) { + status = private_f_string_dynamic_adjust(0, &dynamics->array[i]); if (F_status_is_error(status)) return status; } // for @@ -182,6 +183,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < dynamics->size; ++i) { + status = private_f_string_dynamic_resize(0, &dynamics->array[i]); if (F_status_is_error(status)) return status; } // for @@ -367,7 +369,7 @@ extern "C" { f_array_length_t size = 0; - for (f_array_length_t i = 0; i <= length; i++) { + for (f_array_length_t i = 0; i <= length; ++i) { if (i == length) { if (i > first) { @@ -407,7 +409,7 @@ extern "C" { } while (i + 1 < length && !source[i + 1]) { - i++; + ++i; } // while first = i + 1; @@ -471,6 +473,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < quantityss->size; ++i) { + status = private_f_string_quantitys_adjust(0, &quantityss->array[i]); if (F_status_is_error(status)) return status; } // for @@ -499,6 +502,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < quantityss->size; ++i) { + status = private_f_string_quantitys_resize(0, &quantityss->array[i]); if (F_status_is_error(status)) return status; } // for @@ -569,6 +573,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < rangess->size; ++i) { + status = private_f_string_ranges_adjust(0, &rangess->array[i]); if (F_status_is_error(status)) return status; } // for @@ -597,6 +602,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < rangess->size; ++i) { + status = private_f_string_ranges_resize(0, &rangess->array[i]); if (F_status_is_error(status)) return status; } // for diff --git a/level_0/f_string/c/string.c b/level_0/f_string/c/string.c index 70f2625..744480b 100644 --- a/level_0/f_string/c/string.c +++ b/level_0/f_string/c/string.c @@ -11,7 +11,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } return private_f_string_append(source, length, destination); } @@ -23,20 +25,28 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; - if (destination->used < length) return private_f_string_append(source, length, destination); + if (!length) { + return F_data_not_eos; + } + + if (destination->used < length) { + return private_f_string_append(source, length, destination); + } f_array_length_t i = 1; f_array_length_t j = 1; while (i <= length && j <= destination->used) { + if (!source[length - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -44,8 +54,8 @@ extern "C" { return private_f_string_append(source, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -58,7 +68,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } if (destination->used < length) { return private_f_string_append_nulless(source, length, destination); @@ -68,13 +80,16 @@ extern "C" { f_array_length_t j = 1; while (i <= length && j <= destination->used) { + if (!source[length - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -82,8 +97,8 @@ extern "C" { return private_f_string_append_nulless(source, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -96,7 +111,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } return private_f_string_append_nulless(source, length, destination); } @@ -108,7 +125,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } if (glue_length && destination->used) { f_status_t status = private_f_string_append(glue, glue_length, destination); @@ -125,7 +144,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } if (glue_length && destination->used) { f_status_t status = private_f_string_append_nulless(glue, glue_length, destination); @@ -142,7 +163,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } if (glue_length && destination->used) { f_status_t status = private_f_string_prepend(glue, glue_length, destination); @@ -159,7 +182,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } if (glue_length && destination->used) { f_status_t status = private_f_string_prepend_nulless(glue, glue_length, destination); @@ -176,7 +201,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } return private_f_string_prepend(source, length, destination); } @@ -188,7 +215,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } if (destination->used < length) { return private_f_string_prepend(source, length, destination); @@ -200,12 +229,14 @@ extern "C" { while (i < length && j < destination->used) { if (!source[i]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -213,8 +244,8 @@ extern "C" { return private_f_string_prepend(source, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -227,7 +258,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } if (destination->used < length) { return private_f_string_prepend_nulless(source, length, destination); @@ -239,12 +272,14 @@ extern "C" { while (i < length && j < destination->used) { if (!source[i]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -252,8 +287,8 @@ extern "C" { return private_f_string_prepend_nulless(source, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -266,7 +301,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } return private_f_string_prepend_nulless(source, length, destination); } @@ -278,12 +315,17 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } while (string[range->start] != f_string_eol_s[0]) { - range->start++; - if (range->start > range->stop) return F_none_stop; + ++range->start; + + if (range->start > range->stop) { + return F_none_stop; + } } // while return F_none; @@ -296,14 +338,21 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } while (string[range->start] != seek_to) { - if (string[range->start] == f_string_eol_s[0]) return F_none_eol; - range->start++; + if (string[range->start] == f_string_eol_s[0]) { + return F_none_eol; + } + + ++range->start; - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } } // while return F_none; @@ -316,12 +365,17 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } while (string[range->start] != seek_to) { - range->start++; - if (range->start > range->stop) return F_none_stop; + ++range->start; + + if (range->start > range->stop) { + return F_none_stop; + } } // while return F_none; diff --git a/level_0/f_string/c/string_dynamic.c b/level_0/f_string/c/string_dynamic.c index c54b584..c1116e3 100644 --- a/level_0/f_string/c/string_dynamic.c +++ b/level_0/f_string/c/string_dynamic.c @@ -25,7 +25,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } return private_f_string_append(source.string, source.used, destination); } @@ -37,7 +39,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (destination->used < source.used) { return private_f_string_append(source.string, source.used, destination); @@ -47,13 +51,16 @@ extern "C" { f_array_length_t j = 1; while (i <= source.used && j <= destination->used) { + if (!source.string[source.used - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -61,8 +68,8 @@ extern "C" { return private_f_string_append(source.string, source.used, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -75,7 +82,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (destination->used < source.used) { return private_f_string_append_nulless(source.string, source.used, destination); @@ -85,13 +94,16 @@ extern "C" { f_array_length_t j = 1; while (i <= source.used && j <= destination->used) { + if (!source.string[source.used - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -99,8 +111,8 @@ extern "C" { return private_f_string_append_nulless(source.string, source.used, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -113,7 +125,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } return private_f_string_append_nulless(source.string, source.used, destination); } @@ -189,7 +203,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (glue_length && destination->used) { const f_status_t status = private_f_string_append(glue, glue_length, destination); @@ -206,7 +222,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (glue_length && destination->used) { const f_status_t status = private_f_string_append_nulless(glue, glue_length, destination); @@ -223,7 +241,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (glue_length && destination->used) { const f_status_t status = private_f_string_prepend(glue, glue_length, destination); @@ -240,7 +260,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (glue_length && destination->used) { const f_status_t status = private_f_string_prepend_nulless(glue, glue_length, destination); @@ -258,8 +280,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return private_f_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -272,8 +299,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } const f_array_length_t length = (range.stop - range.start) + 1; @@ -285,13 +317,16 @@ extern "C" { f_array_length_t j = 1; while (i <= length && j <= destination->used) { + if (!source.string[range.stop - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -299,8 +334,8 @@ extern "C" { return private_f_string_append(source.string + range.start, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -314,8 +349,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } const f_array_length_t length = (range.stop - range.start) + 1; @@ -327,13 +367,16 @@ extern "C" { f_array_length_t j = 1; while (i <= length && j <= destination->used) { + if (!source.string[range.stop - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -341,8 +384,8 @@ extern "C" { return private_f_string_append_nulless(source.string + range.start, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -356,8 +399,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return private_f_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -370,8 +418,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } if (glue_length && destination->used) { f_status_t status = private_f_string_append(glue, glue_length, destination); @@ -389,8 +442,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } if (glue_length && destination->used) { f_status_t status = private_f_string_append_nulless(glue, glue_length, destination); @@ -408,8 +466,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } if (glue_length && destination->used) { f_status_t status = private_f_string_prepend(glue, glue_length, destination); @@ -427,8 +490,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } if (glue_length && destination->used) { f_status_t status = private_f_string_prepend_nulless(glue, glue_length, destination); @@ -446,8 +514,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return private_f_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -460,8 +533,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } const f_array_length_t length = (range.stop - range.start) + 1; @@ -473,13 +551,16 @@ extern "C" { f_array_length_t j = 0; while (i < length && j < destination->used) { + if (!source.string[i + range.start]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -487,8 +568,8 @@ extern "C" { return private_f_string_prepend(source.string + range.start, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -502,8 +583,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } const f_array_length_t length = (range.stop - range.start) + 1; @@ -515,13 +601,16 @@ extern "C" { f_array_length_t j = 0; while (i < length && j < destination->used) { + if (!source.string[i + range.start]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -529,8 +618,8 @@ extern "C" { return private_f_string_prepend_nulless(source.string + range.start, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -544,8 +633,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return private_f_string_prepend_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -557,7 +651,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } return private_f_string_prepend(source.string, source.used, destination); } @@ -569,7 +665,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (destination->used < source.used) { return private_f_string_prepend(source.string, source.used, destination); @@ -579,13 +677,16 @@ extern "C" { f_array_length_t j = 0; while (i < source.used && j < destination->used) { + if (!source.string[i]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -593,8 +694,8 @@ extern "C" { return private_f_string_prepend(source.string, source.used, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -607,7 +708,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (destination->used < source.used) { return private_f_string_prepend_nulless(source.string, source.used, destination); @@ -617,13 +720,16 @@ extern "C" { f_array_length_t j = 0; while (i < source.used && j < destination->used) { + if (!source.string[i]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -631,8 +737,8 @@ extern "C" { return private_f_string_prepend_nulless(source.string, source.used, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -671,7 +777,8 @@ extern "C" { if (range->start > range->stop) return F_data_not_stop; while (buffer.string[range->start] != f_string_eol_s[0]) { - range->start++; + + ++range->start; if (range->start >= buffer.used) return F_none_eos; if (range->start > range->stop) return F_none_stop; @@ -761,7 +868,8 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (destination->used) { - for (; destination->used; destination->used--) { + for (; destination->used; --destination->used) { + if (!destination->string[destination->used - 1]) continue; break; } // for @@ -801,7 +909,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not; + if (!source.used) { + return F_data_not; + } return private_f_string_dynamics_append(source, destination); } diff --git a/level_0/f_string/c/string_dynamic.h b/level_0/f_string/c/string_dynamic.h index c9e8cd2..1133965 100644 --- a/level_0/f_string/c/string_dynamic.h +++ b/level_0/f_string/c/string_dynamic.h @@ -26,9 +26,9 @@ extern "C" { * * A special macro_f_string_static_t_initialize() is provided for the special purpose of easily initialize a static string. * - * string: the string. - * size: total amount of space available. - * used: total number of space used. + * string: The string. + * size: Total amount of space available. + * used: Total number of space used. */ #ifndef _di_f_string_static_t_ typedef struct { @@ -56,9 +56,9 @@ extern "C" { * This is a sub-type of f_string_static_t, allowing it to be passed into any f_string_static_t type. * It is recommended that f_string_static_t are not otherwise casted into f_string_dynamic_t to avoid potential memory allocation issues. * - * string: the string. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * string: The string. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_string_dynamic_t_ typedef f_string_static_t f_string_dynamic_t; @@ -82,9 +82,9 @@ extern "C" { /** * An array of static dynamics. * - * array: the array of static dynamics. - * size: total amount of space available. - * used: total number of space used. + * array: The array of static dynamics. + * size: Total amount of space available. + * used: Total number of space used. */ #ifndef _di_f_string_statics_t_ typedef struct { @@ -105,9 +105,9 @@ extern "C" { /** * An array of dynamic dynamics. * - * array: the array of dynamic dynamics. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of dynamic dynamics. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_string_dynamics_t_ typedef f_string_statics_t f_string_dynamics_t; diff --git a/level_0/f_string/c/string_quantity.c b/level_0/f_string/c/string_quantity.c index 83a515e..75cb24f 100644 --- a/level_0/f_string/c/string_quantity.c +++ b/level_0/f_string/c/string_quantity.c @@ -21,7 +21,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not; + if (!source.used) { + return F_data_not; + } f_status_t status = F_none; diff --git a/level_0/f_string/c/string_range.c b/level_0/f_string/c/string_range.c index 9568682..ebca973 100644 --- a/level_0/f_string/c/string_range.c +++ b/level_0/f_string/c/string_range.c @@ -21,7 +21,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not; + if (!source.used) { + return F_data_not; + } f_status_t status = F_none; diff --git a/level_0/f_string/c/string_triple.c b/level_0/f_string/c/string_triple.c index 8e6c7bf..1780d17 100644 --- a/level_0/f_string/c/string_triple.c +++ b/level_0/f_string/c/string_triple.c @@ -21,7 +21,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not; + if (!source.used) { + return F_data_not; + } f_status_t status = F_none; diff --git a/level_0/f_string/c/string_triple.h b/level_0/f_string/c/string_triple.h index c5e68cb..b0a9ff5 100644 --- a/level_0/f_string/c/string_triple.h +++ b/level_0/f_string/c/string_triple.h @@ -19,8 +19,8 @@ extern "C" { /** * A string triple consisting of a set of three strings. * - * one: A string representing the first string in the triple. - * two: A string representing the second string in the triple. + * one: A string representing the first string in the triple. + * two: A string representing the second string in the triple. * three: A string representing the third string in the triple. */ #ifndef _di_f_string_triple_t_ @@ -57,9 +57,9 @@ extern "C" { /** * An array of string triples. * - * array: the array of string triples. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of string triples. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_string_triples_t_ typedef struct { diff --git a/level_0/f_thread/c/private-thread.c b/level_0/f_thread/c/private-thread.c index a4df8c7..5f7e31c 100644 --- a/level_0/f_thread/c/private-thread.c +++ b/level_0/f_thread/c/private-thread.c @@ -786,6 +786,7 @@ extern "C" { #if !defined(_di_f_thread_spins_decrease_) || !defined(_di_f_thread_spins_decrease_by_) || !defined(_di_f_thread_spins_increase_) || !defined(_di_f_thread_spins_increase_by_) f_status_t private_f_thread_spins_resize(const f_array_length_t length, f_thread_spins_t *spins) { + f_status_t status = F_none; for (f_array_length_t i = length; i < spins->size; ++i) { diff --git a/level_0/f_thread/c/thread-common.h b/level_0/f_thread/c/thread-common.h index edeecd6..b632455 100644 --- a/level_0/f_thread/c/thread-common.h +++ b/level_0/f_thread/c/thread-common.h @@ -33,9 +33,9 @@ extern "C" { /** * An array of f_thread_attribute_t. * - * array: the array of f_thread_attribute_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_attribute_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_attributes_t_ typedef struct { @@ -77,9 +77,9 @@ extern "C" { /** * An array of f_thread_barrier_t. * - * array: the array of f_thread_barrier_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_barrier_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_barriers_t_ typedef struct { @@ -122,9 +122,9 @@ extern "C" { /** * An array of f_thread_barrier_attribute_t. * - * array: the array of f_thread_barrier_attribute_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_barrier_attribute_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_barrier_attributes_t_ typedef struct { @@ -167,9 +167,9 @@ extern "C" { /** * An array of thread conditions. * - * array: the array of f_thread_condition_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_condition_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_conditions_t_ typedef struct { @@ -212,9 +212,9 @@ extern "C" { /** * An array of thread condition attributes. * - * array: the array of f_thread_condition_attribute_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_condition_attribute_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_condition_attributes_t_ typedef struct { @@ -254,9 +254,9 @@ extern "C" { /** * An array of thread IDs. * - * array: the array of f_thread_id_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_id_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_ids_t_ typedef struct { @@ -296,9 +296,9 @@ extern "C" { /** * An array of thread keys. * - * array: the array of f_thread_key_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_key_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_keys_t_ typedef struct { @@ -341,9 +341,9 @@ extern "C" { /** * An array of thread locks. * - * array: the array of f_thread_lock_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_lock_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_locks_t_ typedef struct { @@ -384,9 +384,9 @@ extern "C" { /** * An array of read/write lock attributees. * - * array: the array of f_thread_lock_attribute_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_lock_attribute_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_lock_attributes_t_ typedef struct { @@ -431,9 +431,9 @@ extern "C" { /** * An array of thread mutexes. * - * array: the array of f_thread_mutex_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_mutex_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_mutexs_t_ typedef struct { @@ -476,9 +476,9 @@ extern "C" { /** * An array of thread mutex_attributees. * - * array: the array of f_thread_mutex_attribute_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_mutex_attribute_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_mutex_attributes_t_ typedef struct { @@ -518,9 +518,9 @@ extern "C" { /** * An array of thread onces. * - * array: the array of f_thread_once_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_once_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_onces_t_ typedef struct { @@ -562,9 +562,9 @@ extern "C" { /** * An array of thread semaphorees. * - * array: the array of f_thread_semaphore_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_semaphore_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_semaphores_t_ typedef struct { @@ -616,9 +616,9 @@ extern "C" { /** * An array of f_thread_set_t. * - * array: the array of f_thread_set_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_set_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_sets_t_ typedef struct { @@ -647,7 +647,7 @@ extern "C" { /** * A typedef representing pthread_spinlock_t. * - * Note: there appears to be no pthread init macro for spinlock, so initialize manually similarly to how the other inits work. + * Note: There appears to be no pthread init macro for spinlock, so initialize manually similarly to how the other inits work. */ #ifndef _di_f_thread_spin_t_ typedef pthread_spinlock_t f_thread_spin_t; @@ -660,9 +660,9 @@ extern "C" { /** * An array of thread spins. * - * array: the array of f_thread_spin_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_thread_spin_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_thread_spins_t_ typedef struct { diff --git a/level_0/f_type/c/type.h b/level_0/f_type/c/type.h index d301e09..250001a 100644 --- a/level_0/f_type/c/type.h +++ b/level_0/f_type/c/type.h @@ -393,9 +393,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of an array of array lengths. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of an array of array lengths. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_array_lengthss_t_ typedef struct { @@ -413,9 +413,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of f_cell_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_cell_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_f_cells_t_ typedef struct { @@ -473,9 +473,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of an array of array int8_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of an array of array int8_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_int8ss_t_ typedef struct { @@ -513,9 +513,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of an array of array uint8_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of an array of array uint8_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_uint8ss_t_ typedef struct { @@ -553,9 +553,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of an array of array int16_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of an array of array int16_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_int16ss_t_ typedef struct { @@ -593,9 +593,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of an array of array uint16_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of an array of array uint16_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_uint16ss_t_ typedef struct { @@ -633,9 +633,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of an array of array int32_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of an array of array int32_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_int32ss_t_ typedef struct { @@ -673,9 +673,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of an array of array uint32_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of an array of array uint32_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_uint32ss_t_ typedef struct { @@ -713,9 +713,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of an array of array int64_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of an array of array int64_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_int64ss_t_ typedef struct { @@ -753,9 +753,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of an array of array uint64_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of an array of array uint64_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_uint64ss_t_ typedef struct { @@ -800,9 +800,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of f_int128_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_int128_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_int128s_t_ typedef struct { @@ -820,9 +820,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of and array of f_int128_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of and array of f_int128_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_int128ss_t_ typedef struct { @@ -840,9 +840,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of f_uint128_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of f_uint128_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_uint128s_t_ typedef struct { @@ -860,9 +860,9 @@ extern "C" { * * The macros are defined in type_array.h or type_array-common.h. * - * array: the array of and array of f_uint128_t. - * size: total amount of allocated space. - * used: total number of allocated spaces used. + * array: The array of and array of f_uint128_t. + * size: Total amount of allocated space. + * used: Total number of allocated spaces used. */ #ifndef _di_uint128ss_t_ typedef struct { diff --git a/level_0/f_utf/c/private-utf.c b/level_0/f_utf/c/private-utf.c index 4bd0a9b..11e6352 100644 --- a/level_0/f_utf/c/private-utf.c +++ b/level_0/f_utf/c/private-utf.c @@ -2183,6 +2183,7 @@ extern "C" { #if !defined(_di_f_utf_character_is_zero_width_) || !defined(_di_f_utf_is_zero_width_) f_status_t private_f_utf_character_is_zero_width(const f_utf_character_t character, const uint8_t width) { + // reduce the number of checks by grouping checks by first byte. const uint8_t byte_first = macro_f_utf_character_t_to_char_1(character); @@ -2240,7 +2241,7 @@ extern "C" { f_array_length_t first = 0; f_array_length_t size = 0; - for (; i < length; i++) { + for (; i < length; ++i) { if (source[i]) continue; @@ -2257,7 +2258,7 @@ extern "C" { } while (i + 1 < length && !source[i + 1]) { - i++; + ++i; } // while first = i + 1; @@ -2338,6 +2339,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < dynamics->size; ++i) { + status = private_f_utf_string_dynamic_adjust(0, &dynamics->array[i]); if (F_status_is_error(status)) return status; } // for @@ -2574,7 +2576,7 @@ extern "C" { f_array_length_t size = 0; - for (f_array_length_t i = 0; i <= length; i++) { + for (f_array_length_t i = 0; i <= length; ++i) { if (i == length) { if (i > first) { @@ -2614,7 +2616,7 @@ extern "C" { } while (i + 1 < length && !source[i + 1]) { - i++; + ++i; } // while first = i + 1; @@ -2678,6 +2680,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < quantityss->size; ++i) { + status = private_f_utf_string_quantitys_adjust(0, &quantityss->array[i]); if (F_status_is_error(status)) return status; } // for @@ -2706,6 +2709,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < quantityss->size; ++i) { + status = private_f_utf_string_quantitys_resize(0, &quantityss->array[i]); if (F_status_is_error(status)) return status; } // for @@ -2776,6 +2780,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < rangess->size; ++i) { + status = private_f_utf_string_ranges_adjust(0, &rangess->array[i]); if (F_status_is_error(status)) return status; } // for @@ -2804,6 +2809,7 @@ extern "C" { f_status_t status = F_none; for (f_array_length_t i = length; i < rangess->size; ++i) { + status = private_f_utf_string_ranges_resize(0, &rangess->array[i]); if (F_status_is_error(status)) return status; } // for diff --git a/level_0/f_utf/c/private-utf.h b/level_0/f_utf/c/private-utf.h index 62aa1a1..91ace79 100644 --- a/level_0/f_utf/c/private-utf.h +++ b/level_0/f_utf/c/private-utf.h @@ -30,6 +30,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_alpha() @@ -52,6 +53,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_alpha_digit() @@ -74,6 +76,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_alpha_numeric() @@ -96,6 +99,7 @@ extern "C" { * @return * F_true if a UTF-8 control picture character. * F_false if not a UTF-8 control picture character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_ascii() @@ -118,6 +122,7 @@ extern "C" { * @return * F_true if a UTF-8 control picture character. * F_false if not a UTF-8 control picture character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_combining() @@ -140,6 +145,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_control() @@ -162,6 +168,7 @@ extern "C" { * @return * F_true if a UTF-8 control picture character. * F_false if not a UTF-8 control picture character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_control_picture() @@ -184,6 +191,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_digit() @@ -206,6 +214,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_emoji() @@ -228,6 +237,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_numeric() @@ -250,6 +260,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_phonetic() @@ -272,6 +283,7 @@ extern "C" { * @return * F_true if a UTF-8 character. * F_false if not a UTF-8 character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_private() @@ -294,6 +306,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_punctuation() @@ -316,6 +329,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_symbol() @@ -338,6 +352,7 @@ extern "C" { * @return * F_true if a UTF-8 character. * F_false if not a UTF-8 character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_unassigned() @@ -360,6 +375,7 @@ extern "C" { * @return * F_true if a UTF-8 character. * F_false if not a UTF-8 character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_valid() @@ -382,6 +398,7 @@ extern "C" { * @return * F_true if a UTF-8 whitespace. * F_false if not a UTF-8 whitespace. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_whitespace() @@ -404,6 +421,7 @@ extern "C" { * @return * F_true if a UTF-8 phonetic whitespace. * F_false if not a UTF-8 phonetic whitespace. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_whitespace_modifier() @@ -426,6 +444,7 @@ extern "C" { * @return * F_true if a UTF-8 whitespace. * F_false if not a UTF-8 whitespace. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_whitespace_other() @@ -452,6 +471,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_word() @@ -478,6 +498,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_word_dash() @@ -504,6 +525,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_word_dash_plus() @@ -526,6 +548,7 @@ extern "C" { * @return * F_true if a UTF-8 non-printing or zero-width character. * F_false if not a UTF-8 non-printing or zero-width character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_zero_width() diff --git a/level_0/f_utf/c/utf.c b/level_0/f_utf/c/utf.c index 8632f85..876c71b 100644 --- a/level_0/f_utf/c/utf.c +++ b/level_0/f_utf/c/utf.c @@ -12,7 +12,9 @@ extern "C" { if (step < 1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range->start > range->stop || range->start >= buffer.used) return F_data_not; + if (!buffer.used || range->start > range->stop || range->start >= buffer.used) { + return F_data_not; + } f_array_length_t i = 0; uint8_t width = 0; @@ -28,8 +30,9 @@ extern "C" { return F_none_eos; } - i++; + ++i; range->start -= width; + } while (i < step); return F_none; @@ -43,7 +46,9 @@ extern "C" { if (step < 1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!buffer.used || range->start > range->stop || range->start >= buffer.used) return F_data_not; + if (!buffer.used || range->start > range->stop || range->start >= buffer.used) { + return F_data_not; + } f_array_length_t i = 0; uint8_t width = 0; @@ -68,8 +73,9 @@ extern "C" { return F_none_eos; } - i++; + ++i; range->start += width; + } while (i < step); return F_none; @@ -87,6 +93,7 @@ extern "C" { if (!width) { *character_utf = macro_f_utf_character_t_from_char_1(character[0]); + return F_none; } else if (width == 1) { @@ -123,6 +130,7 @@ extern "C" { #ifndef _di_f_utf_character_is_ f_status_t f_utf_character_is(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -139,6 +147,7 @@ extern "C" { #ifndef _di_f_utf_character_is_alpha_ f_status_t f_utf_character_is_alpha(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -159,6 +168,7 @@ extern "C" { #ifndef _di_f_utf_character_is_alpha_digit_ f_status_t f_utf_character_is_alpha_digit(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -179,6 +189,7 @@ extern "C" { #ifndef _di_f_utf_character_is_alpha_numeric_ f_status_t f_utf_character_is_alpha_numeric(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -199,6 +210,7 @@ extern "C" { #ifndef _di_f_utf_character_is_ascii_ f_status_t f_utf_character_is_ascii(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (width == 1) { @@ -211,6 +223,7 @@ extern "C" { #ifndef _di_f_utf_character_is_combining_ f_status_t f_utf_character_is_combining(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -232,6 +245,7 @@ extern "C" { #ifndef _di_f_utf_character_is_control_ f_status_t f_utf_character_is_control(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -252,6 +266,7 @@ extern "C" { #ifndef _di_f_utf_character_is_control_picture_ f_status_t f_utf_character_is_control_picture(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -274,6 +289,7 @@ extern "C" { #ifndef _di_f_utf_character_is_digit_ f_status_t f_utf_character_is_digit(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -294,6 +310,7 @@ extern "C" { #ifndef _di_f_utf_character_is_emoji_ f_status_t f_utf_character_is_emoji(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -314,6 +331,7 @@ extern "C" { #ifndef _di_f_utf_character_is_fragment_ f_status_t f_utf_character_is_fragment(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (width == 1) return F_true; @@ -324,6 +342,7 @@ extern "C" { #ifndef _di_f_utf_character_is_graph_ f_status_t f_utf_character_is_graph(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -356,6 +375,7 @@ extern "C" { #ifndef _di_f_utf_character_is_numeric_ f_status_t f_utf_character_is_numeric(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -376,6 +396,7 @@ extern "C" { #ifndef _di_f_utf_character_is_phonetic_ f_status_t f_utf_character_is_phonetic(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -394,6 +415,7 @@ extern "C" { #ifndef _di_f_utf_character_is_private_ f_status_t f_utf_character_is_private(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -412,6 +434,7 @@ extern "C" { #ifndef _di_f_utf_character_is_punctuation_ f_status_t f_utf_character_is_punctuation(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -459,6 +482,7 @@ extern "C" { #ifndef _di_f_utf_character_is_symbol_ f_status_t f_utf_character_is_symbol(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -491,6 +515,7 @@ extern "C" { #ifndef _di_f_utf_character_is_unassigned_ f_status_t f_utf_character_is_unassigned(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width || width == 1) { @@ -503,6 +528,7 @@ extern "C" { #ifndef _di_f_utf_character_is_valid_ f_status_t f_utf_character_is_valid(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (width == 1) { @@ -515,6 +541,7 @@ extern "C" { #ifndef _di_f_utf_character_is_whitespace_ f_status_t f_utf_character_is_whitespace(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -535,6 +562,7 @@ extern "C" { #ifndef _di_f_utf_character_is_whitespace_modifier_ f_status_t f_utf_character_is_whitespace_modifier(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -552,6 +580,7 @@ extern "C" { #ifndef _di_f_utf_character_is_whitespace_other_ f_status_t f_utf_character_is_whitespace_other(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -570,6 +599,7 @@ extern "C" { #ifndef _di_f_utf_character_is_word_ f_status_t f_utf_character_is_word(const f_utf_character_t character, const bool strict) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -590,6 +620,7 @@ extern "C" { #ifndef _di_f_utf_character_is_word_dash_ f_status_t f_utf_character_is_word_dash(const f_utf_character_t character, const bool strict) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -610,6 +641,7 @@ extern "C" { #ifndef _di_f_utf_character_is_word_dash_plus_ f_status_t f_utf_character_is_word_dash_plus(const f_utf_character_t character, const bool strict) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -630,6 +662,7 @@ extern "C" { #ifndef _di_f_utf_character_is_zero_width_ f_status_t f_utf_character_is_zero_width(const f_utf_character_t character) { + const uint8_t width = macro_f_utf_character_t_width_is(character); if (!width) { @@ -772,10 +805,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -806,10 +836,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -840,10 +867,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -866,10 +890,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -897,10 +918,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -931,10 +949,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -962,10 +977,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -996,10 +1008,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1030,10 +1039,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1080,10 +1086,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1127,10 +1130,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1147,6 +1147,7 @@ extern "C" { const uint8_t width = macro_f_utf_byte_width_is(*character); if (!width) { + // There are no ASCII phonetic characters. return F_false; } @@ -1158,10 +1159,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1178,6 +1176,7 @@ extern "C" { const uint8_t width = macro_f_utf_byte_width_is(*character); if (!width) { + // There are no ASCII private characters. return F_false; } @@ -1189,10 +1188,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1250,10 +1246,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1296,10 +1289,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1322,10 +1312,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1348,10 +1335,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1382,10 +1366,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1414,10 +1395,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1446,10 +1424,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1480,10 +1455,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1514,10 +1486,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1548,10 +1517,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1590,10 +1556,7 @@ extern "C" { f_utf_character_t character_utf = 0; { - f_status_t status = 0; - - status = f_utf_char_to_character(character, width_max, &character_utf); - + const f_status_t status = f_utf_char_to_character(character, width_max, &character_utf); if (F_status_is_error(status)) return status; } @@ -1626,13 +1589,16 @@ extern "C" { f_array_length_t j = 1; while (i <= length && j <= destination->used) { + if (!source[length - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -1640,8 +1606,8 @@ extern "C" { return private_f_utf_string_append(source, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -1654,7 +1620,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } if (destination->used < length) { return private_f_utf_string_append_nulless(source, length, destination); @@ -1664,13 +1632,16 @@ extern "C" { f_array_length_t j = 1; while (i <= length && j <= destination->used) { + if (!source[length - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -1678,8 +1649,8 @@ extern "C" { return private_f_utf_string_append_nulless(source, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -1796,12 +1767,14 @@ extern "C" { while (i < length && j < destination->used) { if (!source[i]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -1809,8 +1782,8 @@ extern "C" { return private_f_utf_string_prepend(source, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -1823,7 +1796,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } if (destination->used < length) { return private_f_utf_string_prepend_nulless(source, length, destination); @@ -1835,12 +1810,14 @@ extern "C" { while (i < length && j < destination->used) { if (!source[i]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -1848,8 +1825,8 @@ extern "C" { return private_f_utf_string_prepend_nulless(source, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -1874,7 +1851,9 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } while (string[range->start] != f_utf_character_t_eol) { @@ -1882,9 +1861,11 @@ extern "C" { return F_status_set_error(F_utf); } - range->start++; + ++range->start; - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } } // while return F_none; @@ -1897,7 +1878,9 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } while (string[range->start] != seek_to) { @@ -1905,11 +1888,15 @@ extern "C" { return F_status_set_error(F_utf); } - if (string[range->start] == f_utf_character_t_eol) return F_none_eol; + if (string[range->start] == f_utf_character_t_eol) { + return F_none_eol; + } - range->start++; + ++range->start; - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } } // while return F_none; @@ -1922,7 +1909,9 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } while (string[range->start] != seek_to) { @@ -1930,9 +1919,11 @@ extern "C" { return F_status_set_error(F_utf); } - range->start++; + ++range->start; - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } } // while return F_none; diff --git a/level_0/f_utf/c/utf.h b/level_0/f_utf/c/utf.h index 8dfb700..1a90547 100644 --- a/level_0/f_utf/c/utf.h +++ b/level_0/f_utf/c/utf.h @@ -82,6 +82,7 @@ extern "C" { * F_none_stop if the stop range is reached before all steps are completed. * F_none_eos if the end of buffer is reached before all steps are completed. * F_data_not if buffer is empty or out of range. + * * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. */ @@ -113,6 +114,7 @@ extern "C" { * F_none_stop if the stop range is reached before all steps are completed. * F_none_eos if the end of buffer is reached before all steps are completed. * F_data_not if buffer is empty or out of range. + * * F_complete_not_utf_stop (with error bit) if the stop range is reached before the complete UTF-8 character can be processed. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. @@ -132,6 +134,7 @@ extern "C" { * @return * F_true if a UTF-8 character. * F_false if not a UTF-8 character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is_valid() @@ -149,6 +152,7 @@ extern "C" { * @return * F_true if a UTF-8 alphabet character. * F_false if not a UTF-8 alphabet character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isalpha() @@ -170,6 +174,7 @@ extern "C" { * @return * F_true if a UTF-8 alpha-digit character. * F_false if not a UTF-8 alpha-digit character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isalnum() @@ -189,6 +194,7 @@ extern "C" { * @return * F_true if a UTF-8 alpha-numeric character. * F_false if not a UTF-8 alpha-numeric character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isalnum() @@ -206,6 +212,7 @@ extern "C" { * @return * F_true if an ASCII character. * F_false if not an ASCII character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_ascii_ @@ -221,6 +228,7 @@ extern "C" { * @return * F_true if a UTF-8 control picture character. * F_false if not a UTF-8 control picture character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_combining_ @@ -236,6 +244,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see iscntrl() @@ -255,6 +264,7 @@ extern "C" { * @return * F_true if a UTF-8 control picture character. * F_false if not a UTF-8 control picture character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_control_picture_ @@ -274,6 +284,7 @@ extern "C" { * @return * F_true if a UTF-8 digit character. * F_false if not a UTF-8 digit character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isdigit() @@ -293,6 +304,7 @@ extern "C" { * @return * F_true if a UTF-8 emoji character. * F_false if not a UTF-8 emoji character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_emoji_ @@ -324,6 +336,7 @@ extern "C" { * @return * F_true if a UTF-8 character. * F_false if not a UTF-8 character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is() @@ -342,6 +355,7 @@ extern "C" { * @return * F_true if a UTF-8 graph. * F_false if not a UTF-8 graph. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isgraph() @@ -361,6 +375,7 @@ extern "C" { * @return * F_true if a UTF-8 numeric character. * F_false if not a UTF-8 numeric character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isdigit() @@ -378,6 +393,7 @@ extern "C" { * @return * F_true if a UTF-8 phonetic character. * F_false if not a UTF-8 phonetic character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_phonetic_ @@ -393,6 +409,7 @@ extern "C" { * @return * F_true if a UTF-8 private character. * F_false if not a UTF-8 private character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_private_ @@ -410,6 +427,7 @@ extern "C" { * @return * F_true if a UTF-8 punctuation character. * F_false if not a UTF-8 punctuation character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_punctuation_ @@ -427,6 +445,7 @@ extern "C" { * @return * F_true if a UTF-8 symbol character. * F_false if not a UTF-8 symbol character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_symbol_ @@ -445,6 +464,7 @@ extern "C" { * @return * F_true if a UTF-8 unassigned character. * F_false if not a UTF-8 unassigned character. + * * F_utf (with error bit) if character is an inunassigned UTF-8 character. * * @see f_utf_character_is() @@ -468,6 +488,7 @@ extern "C" { * @return * F_true if a UTF-8 character. * F_false if not a UTF-8 character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see f_utf_character_is() @@ -494,6 +515,7 @@ extern "C" { * @return * F_true if a UTF-8 whitespace. * F_false if not a UTF-8 whitespace. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isspace() @@ -516,6 +538,7 @@ extern "C" { * @return * F_true if a UTF-8 modifier character. * F_false if not a UTF-8 modifier character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_whitespace_modifier_ @@ -533,6 +556,7 @@ extern "C" { * @return * F_true if a UTF-8 (other) whitespace. * F_false if not a UTF-8 (other) whitespace. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isspace() @@ -558,6 +582,7 @@ extern "C" { * @return * F_true if a UTF-8 word character. * F_false if not a UTF-8 word character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isalnum() @@ -588,6 +613,7 @@ extern "C" { * @return * F_true if a UTF-8 word or dash character. * F_false if not a UTF-8 word or dash character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isalnum() @@ -618,6 +644,7 @@ extern "C" { * @return * F_true if a UTF-8 word or dash character. * F_false if not a UTF-8 word or dash character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. * * @see isalnum() @@ -637,6 +664,7 @@ extern "C" { * @return * F_true if a UTF-8 non-printing or zero-width character. * F_false if not a UTF-8 non-printing or zero-width character. + * * F_utf (with error bit) if character is an invalid UTF-8 character. */ #ifndef _di_f_utf_character_is_zero_width_ @@ -661,6 +689,7 @@ extern "C" { * * @return * F_none if conversion was successful. + * * F_failure (with error bit) if width is not long enough to convert. * F_parameter (with error bit) if a parameter is invalid. * F_memory_not (with error bit) on out of memory. @@ -699,6 +728,7 @@ extern "C" { * @return * F_true if a UTF-8 character. * F_false if not a UTF-8 character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_parameter (with error bit) if a parameter is invalid. */ @@ -719,6 +749,7 @@ extern "C" { * @return * F_true if a UTF-8 alphabet character. * F_false if not a UTF-8 alphabet character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see isalpha() @@ -743,7 +774,8 @@ extern "C" { * * @return * F_true if a UTF-8 alphabet character. - * F_false if not a UTF-8 alpha-numeric character.x + * F_false if not a UTF-8 alpha-numeric character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see isalnum() @@ -766,7 +798,8 @@ extern "C" { * * @return * F_true if a UTF-8 alphabet character. - * F_false if not a UTF-8 alpha-numeric character.x + * F_false if not a UTF-8 alpha-numeric character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see isalnum() @@ -788,6 +821,7 @@ extern "C" { * @return * F_true if an ASCII character. * F_false if not an ASCII character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_is_ascii_ @@ -807,6 +841,7 @@ extern "C" { * @return * F_true if a UTF-8 control picture character. * F_false if not a UTF-8 control picture character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_is_combining_ @@ -826,6 +861,7 @@ extern "C" { * @return * F_true if a UTF-8 control character. * F_false if not a UTF-8 control character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see iscntrl() @@ -849,6 +885,7 @@ extern "C" { * @return * F_true if a UTF-8 control picture character. * F_false if not a UTF-8 control picture character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_is_control_picture_ @@ -868,6 +905,7 @@ extern "C" { * @return * F_true if a UTF-8 digit character. * F_false if not a UTF-8 digit character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see isdigit() @@ -944,6 +982,7 @@ extern "C" { * @return * F_true if a UTF-8 graph. * F_false if not a UTF-8 graph. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_maybe (with error bit) if this could be a graph but width is not long enough. * F_parameter (with error bit) if a parameter is invalid. @@ -969,6 +1008,7 @@ extern "C" { * @return * F_true if a UTF-8 numeric character. * F_false if not a UTF-8 numeric character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see isdigit() @@ -990,6 +1030,7 @@ extern "C" { * @return * F_true if a UTF-8 phonetic character. * F_false if not a UTF-8 phonetic character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_is_phonetic_ @@ -1009,6 +1050,7 @@ extern "C" { * @return * F_true if a UTF-8 punctuation character. * F_false if not a UTF-8 punctuation character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_is_private_ @@ -1030,6 +1072,7 @@ extern "C" { * @return * F_true if a UTF-8 punctuation character. * F_false if not a UTF-8 punctuation character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_is_punctuation_ @@ -1051,6 +1094,7 @@ extern "C" { * @return * F_true if a UTF-8 symbol character. * F_false if not a UTF-8 symbol character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_is_symbol_ @@ -1072,6 +1116,7 @@ extern "C" { * @return * F_true if an unassigned UTF-8 character. * F_false if not an unassigned UTF-8 character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_parameter (with error bit) if a parameter is inunassigned. */ @@ -1097,6 +1142,7 @@ extern "C" { * @return * F_true if a valid UTF-8 character. * F_false if not a valid UTF-8 character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_parameter (with error bit) if a parameter is invalid. */ @@ -1125,6 +1171,7 @@ extern "C" { * @return * F_true if a UTF-8 whitespace. * F_false if not a UTF-8 whitespace. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_maybe (with error bit) if this could be a whitespace but width is not long enough. * F_parameter (with error bit) if a parameter is invalid. @@ -1153,6 +1200,7 @@ extern "C" { * @return * F_true if a UTF-8 whitespace. * F_false if not a UTF-8 whitespace. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_maybe (with error bit) if this could be a whitespace but width is not long enough. * F_parameter (with error bit) if a parameter is invalid. @@ -1176,6 +1224,7 @@ extern "C" { * @return * F_true if a UTF-8 whitespace. * F_false if not a UTF-8 whitespace. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_maybe (with error bit) if this could be a whitespace but width is not long enough. * F_parameter (with error bit) if a parameter is invalid. @@ -1205,6 +1254,7 @@ extern "C" { * @return * F_true if a UTF-8 word character. * F_false if not a UTF-8 word character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see isalnum() @@ -1239,6 +1289,7 @@ extern "C" { * @return * F_true if a UTF-8 word or dash character. * F_false if not a UTF-8 word or dash character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see isalnum() @@ -1273,6 +1324,7 @@ extern "C" { * @return * F_true if a UTF-8 word or dash character. * F_false if not a UTF-8 word or dash character. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * * @see isalnum() @@ -1296,6 +1348,7 @@ extern "C" { * @return * F_true if a UTF-8 whitespace. * F_false if not a UTF-8 whitespace. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_maybe (with error bit) if this could be a whitespace but width is not long enough. * F_parameter (with error bit) if a parameter is invalid. @@ -1319,6 +1372,7 @@ extern "C" { * * @return * F_none if conversion was successful. + * * F_failure (with error bit) if width is not long enough to convert. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if character is an invalid UTF-8 character. diff --git a/level_0/f_utf/c/utf_dynamic.c b/level_0/f_utf/c/utf_dynamic.c index c4a4e3b..ed18677 100644 --- a/level_0/f_utf/c/utf_dynamic.c +++ b/level_0/f_utf/c/utf_dynamic.c @@ -25,7 +25,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } return private_f_utf_string_append(source.string, source.used, destination); } @@ -47,13 +49,15 @@ extern "C" { f_array_length_t j = 1; while (i <= source.used && j <= destination->used) { + if (!source.string[source.used - i]) { - i++; + ++i; continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -61,8 +65,8 @@ extern "C" { return private_f_utf_string_append(source.string, source.used, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -85,13 +89,16 @@ extern "C" { f_array_length_t j = 1; while (i <= source.used && j <= destination->used) { + if (!source.string[source.used - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -99,8 +106,8 @@ extern "C" { return private_f_utf_string_append_nulless(source.string, source.used, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -189,7 +196,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (glue_length && destination->used) { const f_status_t status = private_f_utf_string_append(glue, glue_length, destination); @@ -206,7 +215,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (glue_length && destination->used) { const f_status_t status = private_f_utf_string_append_nulless(glue, glue_length, destination); @@ -223,7 +234,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (glue_length && destination->used) { const f_status_t status = private_f_utf_string_prepend(glue, glue_length, destination); @@ -240,7 +253,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (glue_length && destination->used) { const f_status_t status = private_f_utf_string_prepend_nulless(glue, glue_length, destination); @@ -258,8 +273,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return private_f_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -272,8 +292,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } const f_array_length_t length = (range.stop - range.start) + 1; @@ -285,13 +310,16 @@ extern "C" { f_array_length_t j = 1; while (i <= length && j <= destination->used) { + if (!source.string[range.stop - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -299,8 +327,8 @@ extern "C" { return private_f_utf_string_append(source.string + range.start, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -327,13 +355,16 @@ extern "C" { f_array_length_t j = 1; while (i <= length && j <= destination->used) { + if (!source.string[range.stop - i]) { - i++; + ++i; + continue; } if (!destination->string[destination->used - j]) { - j++; + ++j; + continue; } @@ -341,8 +372,8 @@ extern "C" { return private_f_utf_string_append_nulless(source.string + range.start, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -356,8 +387,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return private_f_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -370,8 +406,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } if (glue_length && destination->used) { f_status_t status = private_f_utf_string_append(glue, glue_length, destination); @@ -389,8 +430,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } if (glue_length && destination->used) { f_status_t status = private_f_utf_string_append_nulless(glue, glue_length, destination); @@ -408,8 +454,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } if (glue_length && destination->used) { f_status_t status = private_f_utf_string_prepend(glue, glue_length, destination); @@ -427,8 +478,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } if (glue_length && destination->used) { f_status_t status = private_f_utf_string_prepend_nulless(glue, glue_length, destination); @@ -446,8 +502,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return private_f_utf_string_prepend(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -460,8 +521,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } const f_array_length_t length = (range.stop - range.start) + 1; @@ -473,13 +539,16 @@ extern "C" { f_array_length_t j = 0; while (i < length && j < destination->used) { + if (!source.string[i + range.start]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -487,8 +556,8 @@ extern "C" { return private_f_utf_string_prepend(source.string + range.start, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -502,8 +571,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } const f_array_length_t length = (range.stop - range.start) + 1; @@ -515,13 +589,16 @@ extern "C" { f_array_length_t j = 0; while (i < length && j < destination->used) { + if (!source.string[i + range.start]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -529,8 +606,8 @@ extern "C" { return private_f_utf_string_prepend_nulless(source.string + range.start, length, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -579,13 +656,16 @@ extern "C" { f_array_length_t j = 0; while (i < source.used && j < destination->used) { + if (!source.string[i]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -593,8 +673,8 @@ extern "C" { return private_f_utf_string_prepend(source.string, source.used, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -607,7 +687,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } if (destination->used < source.used) { return private_f_utf_string_prepend_nulless(source.string, source.used, destination); @@ -617,13 +699,16 @@ extern "C" { f_array_length_t j = 0; while (i < source.used && j < destination->used) { + if (!source.string[i]) { - i++; + ++i; + continue; } if (!destination->string[j]) { - j++; + ++j; + continue; } @@ -631,8 +716,8 @@ extern "C" { return private_f_utf_string_prepend_nulless(source.string, source.used, destination); } - i++; - j++; + ++i; + ++j; } // while return F_none; @@ -676,7 +761,7 @@ extern "C" { return F_status_set_error(F_utf); } - range->start++; + ++range->start; if (range->start >= buffer.used) return F_none_eos; if (range->start > range->stop) return F_none_stop; @@ -703,7 +788,7 @@ extern "C" { if (buffer.string[range->start] == f_utf_character_t_eol) return F_none_eol; - range->start++; + ++range->start; if (range->start >= buffer.used) return F_none_eos; if (range->start > range->stop) return F_none_stop; @@ -728,7 +813,7 @@ extern "C" { return F_status_set_error(F_utf); } - range->start++; + ++range->start; if (range->start >= buffer.used) return F_none_eos; if (range->start > range->stop) return F_none_stop; @@ -776,6 +861,7 @@ extern "C" { if (destination->used) { for (; destination->used; destination->used--) { + if (!destination->string[destination->used - 1]) continue; break; } // for diff --git a/level_0/f_utf/c/utf_triple.c b/level_0/f_utf/c/utf_triple.c index f4cb4e0..95a09ac 100644 --- a/level_0/f_utf/c/utf_triple.c +++ b/level_0/f_utf/c/utf_triple.c @@ -21,7 +21,9 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!source.used) return F_data_not; + if (!source.used) { + return F_data_not; + } f_status_t status = F_none; diff --git a/level_1/fl_console/c/console.c b/level_1/fl_console/c/console.c index 9166b13..fe77f70 100644 --- a/level_1/fl_console/c/console.c +++ b/level_1/fl_console/c/console.c @@ -15,19 +15,20 @@ extern "C" { if (!length) { directory->used = 0; + return F_none; } if (length > 1) { while (length > 1 && argument[length - 1] == f_path_separator_s[0]) { - length--; + --length; } // while if (argument[0] == f_path_separator_s[0]) { f_array_length_t begin = 1; while (begin < length && argument[begin] == f_path_separator_s[0]) { - begin++; + ++begin; } // while length -= begin; @@ -60,7 +61,7 @@ extern "C" { f_array_length_t begin = 3; while (begin < length && argument[begin] == f_path_separator_s[0]) { - begin++; + ++begin; } // while length -= begin; @@ -97,7 +98,7 @@ extern "C" { f_array_length_t begin = 2; while (begin < length && argument[begin] == f_path_separator_s[0]) { - begin++; + ++begin; } // while length -= begin; @@ -129,7 +130,7 @@ extern "C" { } } else { - length++; + ++length; macro_f_string_dynamic_t_clear((*directory)) macro_f_string_dynamic_t_resize(status, (*directory), length) diff --git a/level_1/fl_console/c/console.h b/level_1/fl_console/c/console.h index f9d3ae8..dc003e7 100644 --- a/level_1/fl_console/c/console.h +++ b/level_1/fl_console/c/console.h @@ -53,6 +53,7 @@ extern "C" { * * @return * F_none on success. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. */ diff --git a/level_1/fl_control_group/c/control_group.h b/level_1/fl_control_group/c/control_group.h index 5c5bcc1..1dfc77c 100644 --- a/level_1/fl_control_group/c/control_group.h +++ b/level_1/fl_control_group/c/control_group.h @@ -46,6 +46,7 @@ extern "C" { * * @return * F_none on success. + * * F_memory_not (with error bit) if a out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_prohibited (with error bit) if the current user/process has insufficient privileges to set certain cgroup settings. diff --git a/level_1/fl_conversion/c/conversion.c b/level_1/fl_conversion/c/conversion.c index f9f47bc..494d703 100644 --- a/level_1/fl_conversion/c/conversion.c +++ b/level_1/fl_conversion/c/conversion.c @@ -20,11 +20,11 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_binary(string[i], &digit) == F_none) { if (digits) { - digits++; + ++digits; if (negative) { if (digits > f_conversion_digits_binary_signed) { @@ -80,11 +80,11 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_binary(string[i], &digit) == F_none) { if (digits) { - digits++; + ++digits; if (digits > f_conversion_digits_binary_unsigned) { return F_status_set_error(F_number_overflow); @@ -124,12 +124,12 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { if (digits) { - digits++; + ++digits; if (negative) { if (digits > f_conversion_digits_decimal_signed) { @@ -189,12 +189,12 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { if (digits) { - digits++; + ++digits; if (digits > f_conversion_digits_decimal_unsigned) { if ((converted * 10) + digit > f_number_t_size_unsigned || (converted * 10) + digit < converted) { @@ -236,7 +236,7 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { @@ -301,12 +301,12 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { if (digits) { - digits++; + ++digits; if (digits > f_conversion_digits_duodecimal_unsigned) { if ((converted * 12) + digit > f_number_t_size_unsigned || (converted * 12) + digit < converted) { @@ -348,12 +348,12 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { if (digits) { - digits++; + ++digits; if (negative) { if (digits > f_conversion_digits_hexidecimal_signed) { @@ -413,12 +413,12 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { if (digits) { - digits++; + ++digits; if (digits > f_conversion_digits_hexidecimal_unsigned) { if ((converted << 4) + digit > f_number_t_size_unsigned || (converted << 4) + digit < converted) { @@ -460,12 +460,12 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_octal(string[i], &digit) == F_none) { if (digits) { - digits++; + ++digits; if (negative) { if (digits > f_conversion_digits_octal_signed) { @@ -525,12 +525,12 @@ extern "C" { f_number_unsigned_t digit = 0; f_number_unsigned_t converted = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { if (f_conversion_character_to_octal(string[i], &digit) == F_none) { if (digits) { - digits++; + ++digits; if (digits > f_conversion_digits_octal_unsigned) { if ((converted << 3) + digit > f_number_t_size_unsigned || (converted << 3) + digit < converted) { @@ -576,13 +576,15 @@ extern "C" { f_array_length_t offset = 0; f_status_t status = F_none; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { + width = macro_f_utf_byte_width_is(string[i]); if (!width) { if (isspace(string[i])) { if (!mode && !vector) { - offset++; + ++offset; + continue; } @@ -597,6 +599,7 @@ extern "C" { if (status == F_true) { offset = i + 1; + continue; } @@ -654,7 +657,7 @@ extern "C" { if (string[i] == 0x2b) { if (!mode && !vector) { vector = 1; - offset++; + ++offset; } else { return F_status_set_error(F_number); @@ -665,7 +668,7 @@ extern "C" { if (string[i] == 0x2d) { if (!mode && !vector) { vector = -1; - offset++; + ++offset; } else { return F_status_set_error(F_number); @@ -732,13 +735,15 @@ extern "C" { f_status_t status = F_none; int8_t sign_found = 0; - for (f_array_length_t i = range.start; i <= range.stop; i++) { + for (f_array_length_t i = range.start; i <= range.stop; ++i) { + width = macro_f_utf_byte_width_is(string[i]); if (!width) { if (isspace(string[i])) { if (!mode) { - offset++; + ++offset; + continue; } @@ -753,6 +758,7 @@ extern "C" { if (status == F_true) { offset = i + 1; + continue; } @@ -807,12 +813,12 @@ extern "C" { } if (string[i] == 0x2b) { - offset++; + ++offset; sign_found = 1; } if (string[i] == 0x2d) { - offset++; + ++offset; sign_found = -1; } diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index bce412e..c1b11b0 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -16,9 +16,11 @@ extern "C" { } f_status_t status = f_directory_exists(path); - if (F_status_is_error(status)) return status; - if (status == F_true) return F_directory_found; + + if (status == F_true) { + return F_directory_found; + } { f_array_length_t at_tree = 0; @@ -96,7 +98,7 @@ extern "C" { { f_array_length_t i = source_length; - for (; i > 0; i--, static_source.used--) { + for (; i > 0; --i, --static_source.used) { if (!source[i - 1]) continue; if (source[i - 1] == f_path_separator_s[0]) continue; @@ -106,7 +108,7 @@ extern "C" { i = destination_length; - for (; i > 0; i--, static_destination.used--) { + for (; i > 0; --i, --static_destination.used) { if (!destination[i - 1]) continue; if (destination[i - 1] == f_path_separator_s[0]) continue; @@ -150,7 +152,7 @@ extern "C" { { f_array_length_t i = source_length; - for (; i > 0; i--, static_source.used--) { + for (; i > 0; --i, --static_source.used) { if (!source[i - 1]) continue; if (source[i - 1] == f_path_separator_s[0]) continue; @@ -160,7 +162,7 @@ extern "C" { i = destination_length; - for (; i > 0; i--, static_destination.used--) { + for (; i > 0; --i, --static_destination.used) { if (!destination[i - 1]) continue; if (destination[i - 1] == f_path_separator_s[0]) continue; @@ -218,7 +220,7 @@ extern "C" { { f_array_length_t i = source_length; - for (; i > 0; i--, static_source.used--) { + for (; i > 0; --i, --static_source.used) { if (!source[i - 1]) continue; if (source[i - 1] == f_path_separator_s[0]) continue; @@ -228,7 +230,7 @@ extern "C" { i = destination_length; - for (; i > 0; i--, static_destination.used--) { + for (; i > 0; --i, --static_destination.used) { if (!destination[i - 1]) continue; if (destination[i - 1] == f_path_separator_s[0]) continue; @@ -272,7 +274,7 @@ extern "C" { { f_array_length_t i = source_length; - for (; i > 0; i--, static_source.used--) { + for (; i > 0; --i, --static_source.used) { if (!source[i - 1]) continue; if (source[i - 1] == f_path_separator_s[0]) continue; @@ -282,7 +284,7 @@ extern "C" { i = destination_length; - for (; i > 0; i--, static_destination.used--) { + for (; i > 0; --i, --static_destination.used) { if (!destination[i - 1]) continue; if (destination[i - 1] == f_path_separator_s[0]) continue; @@ -332,7 +334,7 @@ extern "C" { f_status_t status = F_none; - for (; i > 0; i--) { + for (; i > 0; --i) { if (!path->string[i]) continue; @@ -361,7 +363,7 @@ extern "C" { else { first_nulless = F_true; - for (j = i; j > 0; j--) { + for (j = i; j > 0; --j) { if (!path->string[j]) continue; status = f_utf_is_control(path->string + j, path->used - j); diff --git a/level_1/fl_directory/c/directory.h b/level_1/fl_directory/c/directory.h index 7eaac49..faf4547 100644 --- a/level_1/fl_directory/c/directory.h +++ b/level_1/fl_directory/c/directory.h @@ -77,9 +77,12 @@ extern "C" { typedef struct { f_number_unsigned_t depth_max; f_number_unsigned_t size_block; + bool exclusive; f_file_t output; + void (*verbose)(const f_file_t, const f_string_t, const f_string_t); + f_directory_statuss_t *failures; } fl_directory_recurse_t; @@ -104,6 +107,7 @@ extern "C" { * F_none on success. * F_data_not on success, but there was no string to process (length is 0). * F_directory_found on success, but the directory already exists. + * * F_access_denied (with error bit) on access denied. * F_directory (with error bit) if a supposed directory in path is not actually a directory. * F_directory_link_max (with error bit) max links limit reached or exceeded. @@ -154,6 +158,7 @@ extern "C" { * * @return * F_none on success. + * * F_failure (with error bit) for any other failure, failures might be populated with individual status codes. * * Errors (with error bit) from: f_directory_create(). @@ -199,6 +204,7 @@ extern "C" { * * @return * F_none on success. + * * F_failure (with error bit) for any other failure, failures might be populated with individual status codes. * * Errors (with error bit) from: f_directory_exists(). @@ -236,6 +242,7 @@ extern "C" { * * @return * F_none on success. + * * F_failure (with error bit) for any other failure, failures might be populated with individual status codes. * * Errors (with error bit) from: f_directory_create(). @@ -279,6 +286,7 @@ extern "C" { * * @return * F_none on success. + * * F_failure (with error bit) for any other failure, failures might be populated with individual status codes. * * Errors (with error bit) from: f_directory_exists(). @@ -312,6 +320,7 @@ extern "C" { * @return * F_none on success. * F_data_not if directory is empty. + * * F_directory_descriptor (with error bit) on directory file descriptor error. * F_directory_open (with error bit) on directory open error. * F_directory_stream (with error bit) on directory stream error. @@ -348,6 +357,7 @@ extern "C" { * @return * F_none on success. * F_data_not if path.used is 0. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. * @@ -377,6 +387,7 @@ extern "C" { * @return * F_none on success. * F_data_not if length is 0. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. * @@ -403,6 +414,7 @@ extern "C" { * @return * F_none on success. * F_data_not if source.used is 0. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. * diff --git a/level_1/fl_directory/c/private-directory.c b/level_1/fl_directory/c/private-directory.c index 04b921c..4a85946 100644 --- a/level_1/fl_directory/c/private-directory.c +++ b/level_1/fl_directory/c/private-directory.c @@ -7,6 +7,7 @@ extern "C" { #if !defined(_di_fl_directory_clone_) f_status_t private_fl_directory_clone(const f_string_static_t source, const f_string_static_t destination, const bool role, const fl_directory_recurse_t recurse, const f_number_unsigned_t depth) { + f_status_t status = F_none; f_directory_listing_t listing = f_directory_listing_t_initialize; @@ -36,9 +37,9 @@ extern "C" { uint8_t i = 0; f_array_length_t j = 0; - for (; i < 7; i++) { + for (; i < 7; ++i) { - for (j = 0; F_status_is_fine(status) && j < list[i]->used; j++) { + for (j = 0; F_status_is_fine(status) && j < list[i]->used; ++j) { status = private_fl_directory_clone_file(list[i]->array[j], source, destination, role, recurse); } // for @@ -46,7 +47,8 @@ extern "C" { } // for } - for (f_array_length_t i = 0; F_status_is_fine(status) && i < listing.directory.used; i++) { + for (f_array_length_t i = 0; F_status_is_fine(status) && i < listing.directory.used; ++i) { + f_string_static_t source_sub = f_string_static_t_initialize; f_string_static_t destination_sub = f_string_static_t_initialize; @@ -124,9 +126,13 @@ extern "C" { macro_f_string_dynamics_t_delete_simple(listing.directory); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } - if (recurse.failures && failures_used < recurse.failures->used) return F_failure; + if (recurse.failures && failures_used < recurse.failures->used) { + return F_failure; + } return F_none; } @@ -134,6 +140,7 @@ extern "C" { #if !defined(_di_fl_directory_clone_file_) f_status_t private_fl_directory_clone_file(const f_string_static_t file, const f_string_static_t source, const f_string_static_t destination, const bool role, const fl_directory_recurse_t recurse) { + char path_source[source.used + file.used + 2]; char path_destination[destination.used + file.used + 2]; @@ -203,7 +210,7 @@ extern "C" { recurse.failures->array[recurse.failures->used].path.used = size; recurse.failures->array[recurse.failures->used].path.size = size + 1; recurse.failures->array[recurse.failures->used].status = status_failure; - recurse.failures->used++; + ++recurse.failures->used; return F_failure; } @@ -218,6 +225,7 @@ extern "C" { #if !defined(_di_fl_directory_copy_) f_status_t private_fl_directory_copy(const f_string_static_t source, const f_string_static_t destination, const f_mode_t mode, const fl_directory_recurse_t recurse, const f_number_unsigned_t depth) { + f_status_t status = F_none; f_directory_listing_t listing = f_directory_listing_t_initialize; @@ -225,6 +233,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_directory_listing_t_delete_simple(listing); + return status; } @@ -247,8 +256,9 @@ extern "C" { uint8_t i = 0; f_array_length_t j = 0; - for (; i < 7; i++) { - for (j = 0; F_status_is_fine(status) && j < list[i]->used; j++) { + for (; i < 7; ++i) { + + for (j = 0; F_status_is_fine(status) && j < list[i]->used; ++j) { status = private_fl_directory_copy_file(list[i]->array[j], source, destination, mode, recurse); } // for @@ -256,7 +266,8 @@ extern "C" { } // for } - for (f_array_length_t i = 0; F_status_is_fine(status) && i < listing.directory.used; i++) { + for (f_array_length_t i = 0; F_status_is_fine(status) && i < listing.directory.used; ++i) { + f_string_static_t source_sub = f_string_static_t_initialize; f_string_static_t destination_sub = f_string_static_t_initialize; @@ -320,9 +331,13 @@ extern "C" { macro_f_string_dynamics_t_delete_simple(listing.directory); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } - if (recurse.failures && failures_used < recurse.failures->used) return F_failure; + if (recurse.failures && failures_used < recurse.failures->used) { + return F_failure; + } return F_none; } @@ -350,7 +365,9 @@ extern "C" { return F_status_set_error(status); } - if (!recurse.failures) return F_failure; + if (!recurse.failures) { + return F_failure; + } const f_status_t status_failure = status; @@ -400,7 +417,7 @@ extern "C" { recurse.failures->array[recurse.failures->used].path.used = size; recurse.failures->array[recurse.failures->used].path.size = size + 1; recurse.failures->array[recurse.failures->used].status = status_failure; - recurse.failures->used++; + ++recurse.failures->used; return F_failure; } @@ -415,6 +432,7 @@ extern "C" { #if !defined(_di_fl_directory_list_) f_status_t private_fl_directory_list(const f_string_t path, int (*filter)(const struct dirent *), int (*sort)(const struct dirent **, const struct dirent **), const bool dereference, f_directory_listing_t *listing) { + struct dirent **entity = 0; f_array_length_t size = 0; @@ -468,8 +486,12 @@ extern "C" { if (length == -1) { closedir(parent); - if (errno == ENOMEM) return F_status_set_error(F_memory_not); - else return F_status_set_error(F_failure); + if (errno == ENOMEM) { + return F_status_set_error(F_memory_not); + } + else { + return F_status_set_error(F_failure); + } } f_string_dynamics_t *names = 0; @@ -478,13 +500,14 @@ extern "C" { int mode = 0; size_t i = 0; - for (; i < length; i++) { + for (; i < length; ++i) { size = strnlen(entity[i]->d_name, f_directory_name_max); // There is no reason to include "." and ".." in the directory listing. if (!strncmp(entity[i]->d_name, "..", 3) || !strncmp(entity[i]->d_name, ".", 2)) { f_memory_resize(1, 0, sizeof(char *), (void **) & entity[i]); + continue; } @@ -549,14 +572,14 @@ extern "C" { memcpy(names->array[names->used].string, entity[i]->d_name, size); names->array[names->used].used = size; - names->used++; + ++names->used; f_memory_resize(1, 0, sizeof(char *), (void **) & entity[i]); } // for closedir(parent); - for (; i < length; i++) { + for (; i < length; ++i) { f_memory_resize(1, 0, sizeof(char *), (void **) & entity[i]); } // for @@ -571,6 +594,7 @@ extern "C" { #if !defined(_di_fl_directory_path_push_) || !defined(_di_fl_directory_path_push_dynamic_) f_status_t private_fl_directory_path_push(const f_string_t source, const f_array_length_t length, f_string_dynamic_t *destination) { + bool terminated_null = F_false; bool separator_prepend = F_false; bool separator_append = F_false; @@ -589,10 +613,11 @@ extern "C" { terminated_null = F_true; total = 1; - destination->used--; + --destination->used; } - for (i = destination->used - 1; i > 0; i--) { + for (i = destination->used - 1; i > 0; --i) { + if (!destination->string[i]) continue; status = f_utf_is_control(destination->string + i, destination->used - i); @@ -606,7 +631,8 @@ extern "C" { if (destination->string[i] == f_path_separator_s[0]) { if (i - 1 > 0) { - for (j = i - 1; j > 0; j--) { + for (j = i - 1; j > 0; --j) { + if (!destination->string[j]) continue; status = f_utf_is_control(destination->string + j, destination->used - j); @@ -629,7 +655,7 @@ extern "C" { } else { separator_prepend = F_true; - total++; + ++total; } break; @@ -638,12 +664,12 @@ extern "C" { if (destination->used > 0 && !i) { if (destination->string[0] != 0 && destination->string[0] != f_path_separator_s[0]) { separator_prepend = F_true; - total++; + ++total; } } } - for (i = length - 1; i > 0; i--) { + for (i = length - 1; i > 0; --i) { if (!source[i]) continue; status = f_utf_is_control(source + i, length - i); @@ -657,11 +683,12 @@ extern "C" { if (source[i] == f_path_separator_s[0]) { if (!separator_prepend && destination->used > 0) { - destination->used--; + --destination->used; } if (i - 1 > 0) { - for (j = i - 1; j > 0; j--) { + for (j = i - 1; j > 0; --j) { + if (!source[j]) continue; status = f_utf_is_control(source + j, length - j); @@ -684,7 +711,7 @@ extern "C" { } else { separator_append = F_true; - total++; + ++total; } break; @@ -692,10 +719,11 @@ extern "C" { if (!i && source[0] != f_path_separator_s[0]) { separator_append = F_true; - total++; + ++total; } - for (i = 0; i < length_truncated; i++) { + for (i = 0; i < length_truncated; ++i) { + if (!source[i]) continue; status = f_utf_is_control(source + i, length - i); @@ -711,7 +739,8 @@ extern "C" { if (source[0] == f_path_separator_s[0]) { if (i + 1 < length_truncated) { - for (j = i + 1; j < length_truncated; j++) { + for (j = i + 1; j < length_truncated; ++j) { + if (!source[j]) continue; status = f_utf_is_control(source + j, length - j); @@ -750,8 +779,8 @@ extern "C" { if (separator_prepend) { destination->string[destination->used] = f_path_separator_s[0]; - destination->used++; - total--; + ++destination->used; + --total; } if (length_truncated - start > 0) { diff --git a/level_1/fl_directory/c/private-directory.h b/level_1/fl_directory/c/private-directory.h index 80cc9de..512b879 100644 --- a/level_1/fl_directory/c/private-directory.h +++ b/level_1/fl_directory/c/private-directory.h @@ -36,6 +36,7 @@ extern "C" { * * @return * F_none on success. + * * F_failure (with error bit) for any other failure, failures might be populated with individual status codes. * * @see fl_directory_clone() @@ -67,6 +68,7 @@ extern "C" { * * @return * F_none on success. + * * F_array_too_large (with error bit) if a buffer would exceed max length. * F_failure (with error bit) for any other failure, failures might be populated with individual status codes. * @@ -96,6 +98,7 @@ extern "C" { * * @return * F_none on success. + * * F_failure (with error bit) for any other failure, failures might be populated with individual status codes. * * @see fl_directory_copy() @@ -125,6 +128,7 @@ extern "C" { * * @return * F_none on success. + * * F_array_too_large (with error bit) if a buffer would exceed max length. * F_failure (with error bit) for any other failure, failures might be populated with individual status codes. * @@ -155,6 +159,7 @@ extern "C" { * @return * F_none on success. * F_data_not if directory is empty. + * * F_directory_descriptor (with error bit) on directory file descriptor error. * F_directory_open (with error bit) on directory open error. * F_directory_stream (with error bit) on directory stream error. @@ -193,6 +198,7 @@ extern "C" { * @return * F_none on success. * F_data_not if length is 0. + * * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. * diff --git a/level_1/fl_environment/c/environment.c b/level_1/fl_environment/c/environment.c index 37954ae..1c45df9 100644 --- a/level_1/fl_environment/c/environment.c +++ b/level_1/fl_environment/c/environment.c @@ -30,15 +30,17 @@ extern "C" { if (F_status_is_error(status)) { environment->array[environment->used].name.used = 0; + return status; } if (status == F_data_not || status == F_exist_not) { environment->array[environment->used].name.used = 0; + return status; } - environment->used++; + ++environment->used; return F_none; } @@ -69,15 +71,17 @@ extern "C" { if (F_status_is_error(status)) { environment->array[environment->used].name.used = 0; + return status; } if (status == F_data_not || status == F_exist_not) { environment->array[environment->used].name.used = 0; + continue; } - environment->used++; + ++environment->used; } // for return F_none; @@ -102,7 +106,7 @@ extern "C" { if (F_status_is_error(status)) return status; macro_f_string_dynamic_t_clear(paths->array[paths->used]); - paths->used++; + ++paths->used; return F_none; } @@ -111,7 +115,7 @@ extern "C" { f_array_length_t first = 0; f_array_length_t total = 0; - for (i = 0; i <= length; i++) { + for (i = 0; i <= length; ++i) { if (i == length || path[i] == f_path_separator_variable_s[0]) { macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large); @@ -119,7 +123,7 @@ extern "C" { if (!i) { macro_f_string_dynamic_t_clear(paths->array[paths->used]); - paths->used++; + ++paths->used; first = 1; continue; @@ -178,7 +182,7 @@ extern "C" { if (F_status_is_error(status)) return status; macro_f_string_dynamic_t_clear(paths->array[paths->used]); - paths->used++; + ++paths->used; return F_none; } @@ -190,7 +194,7 @@ extern "C" { f_string_dynamic_t part = f_string_dynamic_t_initialize; - for (i = 0; i <= path.used; i++) { + for (i = 0; i <= path.used; ++i) { if (i == path.used || path.string[i] == f_path_separator_variable_s[0]) { macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large); @@ -198,7 +202,7 @@ extern "C" { if (!i) { macro_f_string_dynamic_t_clear(paths->array[paths->used]); - paths->used++; + ++paths->used; first = 1; continue; @@ -211,11 +215,12 @@ extern "C" { macro_f_string_dynamic_t_resize(status, part, total) if (F_status_is_error(status)) return status; - for (j = 0; j < total; j++) { + for (j = 0; j < total; ++j) { + if (!path.string[first + j]) continue; part.string[part.used] = path.string[first + j]; - part.used++; + ++part.used; } // for if (part.string[part.used - 1] != f_path_separator_s[0]) { @@ -223,7 +228,7 @@ extern "C" { if (F_status_is_error(status)) return status; part.string[part.used] = f_path_separator_s[0]; - part.used++; + ++part.used; } } @@ -270,8 +275,8 @@ extern "C" { f_string_dynamic_t part = f_string_dynamic_t_initialize; - for (; i > 0; i--) { - j--; + // @fixme i is unsgned, it will never be less than 0! + for (; i > 0; --i, --j) { if (!j || path[j] == f_path_separator_variable_s[0]) { macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large); @@ -347,13 +352,14 @@ extern "C" { f_status_t status = F_none; if (!path.used) { + // When PATH is "", this is actually a valid search path for PWD. // Therefore append an equivalent representation of PWD (string used length is 0). macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large); if (F_status_is_error(status)) return status; macro_f_string_dynamic_t_clear(paths->array[paths->used]); - paths->used++; + ++paths->used; return F_none; } @@ -366,8 +372,8 @@ extern "C" { f_string_dynamic_t part = f_string_dynamic_t_initialize; - for (; i > 0; i--) { - j--; + // @fixme i is unsgned, it will never be less than 0! + for (; i > 0; --i, --j) { if (!j || path.string[j] == f_path_separator_variable_s[0]) { macro_f_memory_structure_increment(status, (*paths), 1, f_memory_default_allocation_step, macro_f_string_dynamics_t_resize, F_array_too_large); @@ -381,11 +387,12 @@ extern "C" { macro_f_string_dynamic_t_resize(status, part, total) if (F_status_is_error(status)) return status; - for (k = 0; k < total; k++) { + for (k = 0; k < total; ++k) { + if (!path.string[i + k]) continue; part.string[part.used] = path.string[i + k]; - part.used++; + ++part.used; } // for if (part.string[part.used - 1] != f_path_separator_s[0]) { @@ -393,13 +400,14 @@ extern "C" { if (F_status_is_error(status)) return status; part.string[part.used] = f_path_separator_s[0]; - part.used++; + ++part.used; } } last = j; } else if (!j) { + // when j = 0, the total is actually the entire length to max. total = last - j; @@ -407,11 +415,11 @@ extern "C" { macro_f_string_dynamic_t_resize(status, part, total) if (F_status_is_error(status)) return status; - for (k = 0; k < total; k++) { + for (k = 0; k < total; ++k) { if (!path.string[i + k]) continue; part.string[part.used] = path.string[i + k]; - part.used++; + ++part.used; } // for if (part.string[part.used - 1] != f_path_separator_s[0]) { diff --git a/level_1/fl_environment/c/environment.h b/level_1/fl_environment/c/environment.h index cb4b3bb..bd74d09 100644 --- a/level_1/fl_environment/c/environment.h +++ b/level_1/fl_environment/c/environment.h @@ -102,6 +102,7 @@ extern "C" { * * @return * F_none on success. + * * F_array_too_large (with error bit) if paths array is too large for further addressing. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. @@ -125,6 +126,7 @@ extern "C" { * * @return * F_none on success. + * * F_array_too_large (with error bit) if paths array is too large for further addressing. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. @@ -150,6 +152,7 @@ extern "C" { * * @return * F_none on success. + * * F_array_too_large (with error bit) if paths array is too large for further addressing. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. @@ -175,6 +178,7 @@ extern "C" { * * @return * F_none on success. + * * F_array_too_large (with error bit) if paths array is too large for further addressing. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index bc8ddf4..592cde4 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -20,6 +20,7 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } @@ -39,7 +40,8 @@ extern "C" { if (F_status_is_error(status)) return status; if (status == F_none_eol) { - range->start++; + ++range->start; + return FL_fss_found_content_not; } @@ -56,7 +58,7 @@ extern "C" { found->array[found->used].start = range->start; - for (;; range->start++) { + for (;; ++range->start) { status = f_fss_skip_past_delimit(buffer, range); if (F_status_is_error(status)) return status; @@ -95,6 +97,7 @@ extern "C" { if (F_status_is_error(status_allocation)) { destination->used = destination_used; + return status_allocation; } @@ -111,6 +114,7 @@ extern "C" { if (F_status_is_error(status2)) { destination->used = destination_used; + return status2; } } @@ -169,10 +173,11 @@ extern "C" { const f_array_length_t destination_used = destination->used; - for (; range->start <= range->stop && range->start < content.used; range->start++) { + for (; range->start <= range->stop && range->start < content.used; ++range->start) { if (content.string[range->start] == f_fss_eol) { destination->used = destination_used; + return F_status_set_error(F_none_eol); } diff --git a/level_1/fl_fss/c/fss_basic.h b/level_1/fl_fss/c/fss_basic.h index 3e3e935..7901177 100644 --- a/level_1/fl_fss/c/fss_basic.h +++ b/level_1/fl_fss/c/fss_basic.h @@ -60,6 +60,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_buffer_increment(). @@ -100,6 +101,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_buffer_increment(). @@ -141,6 +143,7 @@ extern "C" { * F_none_stop on success after reaching the range stop. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. @@ -181,6 +184,7 @@ extern "C" { * F_none_stop on success after reaching the range stop. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * * F_memory_not (with error bit) on out of memory. * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_1/fl_fss/c/fss_basic_list.c b/level_1/fl_fss/c/fss_basic_list.c index b8cd77b..b31d8d0 100644 --- a/level_1/fl_fss/c/fss_basic_list.c +++ b/level_1/fl_fss/c/fss_basic_list.c @@ -22,7 +22,7 @@ extern "C" { if (status == F_none_eol) { // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -53,7 +53,7 @@ extern "C" { } // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -80,7 +80,7 @@ extern "C" { break; } - slash_count++; + ++slash_count; } // for private_macro_fl_fss_object_return_on_overflow((buffer), (*range), (*found), (*delimits), delimits_used, F_data_not_eos, F_data_not_stop); @@ -121,16 +121,17 @@ extern "C" { if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; - delimits->used++; + ++delimits->used; } - slash_count--; + --slash_count; } status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } } // while @@ -142,6 +143,7 @@ extern "C" { } range->start = start + 1; + return FL_fss_found_object_not; } } @@ -153,7 +155,7 @@ extern "C" { if (F_status_is_error(status)) break; delimits->array[delimits->used++] = slash_first; - range->start++; + ++range->start; } else { graph_first = F_false; @@ -209,6 +211,7 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } @@ -224,7 +227,7 @@ extern "C" { status = f_fss_seek_to_eol(buffer, range); // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -273,7 +276,8 @@ extern "C" { newline_last = range->start; graph_first = 0x1; - range->start++; + ++range->start; + continue; } @@ -281,7 +285,7 @@ extern "C" { slash_first = range->start; slash_count = 1; - for (range->start++; range->start <= range->stop && range->start < buffer.used; range->start++) { + for (++range->start; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (buffer.string[range->start] == f_fss_delimit_placeholder) { continue; @@ -289,14 +293,14 @@ extern "C" { break; } - slash_count++; + ++slash_count; } // for if (range->start > range->stop || range->start >= buffer.used) break; if (buffer.string[range->start] == f_fss_basic_list_open) { graph_first = 0x0; - range->start++; + ++range->start; while (range->start <= range->stop && range->start < buffer.used) { @@ -334,7 +338,7 @@ extern "C" { delimits->array[delimits->used++] = range->start; } - slash_count--; + --slash_count; } status = f_utf_buffer_increment(buffer, range, 1); @@ -357,14 +361,14 @@ extern "C" { else if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment) { graph_first = 0x2; comment_delimit = slash_first; - range->start++; + ++range->start; } continue; } if (buffer.string[range->start] == f_fss_basic_list_open) { - range->start++; + ++range->start; graph_first = 0x0; while (range->start <= range->stop && range->start < buffer.used) { @@ -424,7 +428,7 @@ extern "C" { if (F_status_is_error(status)) break; if (range->start > range->stop || range->start >= buffer.used) { - range->start--; + --range->start; } else { newline_last = range->start; @@ -451,6 +455,7 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; comments->used = comments_used; + return status; } @@ -538,7 +543,7 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = object.string[range->start + i]; } // for } @@ -550,6 +555,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -566,7 +572,7 @@ extern "C" { break; } - slash_count++; + ++slash_count; } // for if (F_status_is_error(status)) break; @@ -600,7 +606,7 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = object.string[range->start + i]; } // for } @@ -611,6 +617,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -620,6 +627,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } } @@ -628,6 +636,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -825,7 +834,7 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = content.string[range->start + i]; } // for } @@ -836,6 +845,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } diff --git a/level_1/fl_fss/c/fss_basic_list.h b/level_1/fl_fss/c/fss_basic_list.h index fc48db1..1fb1864 100644 --- a/level_1/fl_fss/c/fss_basic_list.h +++ b/level_1/fl_fss/c/fss_basic_list.h @@ -57,6 +57,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_array_too_large (with error bit) if a buffer is too large. * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. @@ -105,6 +106,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_array_too_large (with error bit) if a buffer is too large. * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. @@ -150,7 +152,8 @@ extern "C" { * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_none_stop on success after reaching stopping point . + * F_none_stop on success after reaching stopping point. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. @@ -195,6 +198,7 @@ extern "C" { * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_none_stop on success after reaching stopping point . + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_1/fl_fss/c/fss_embedded_list.c b/level_1/fl_fss/c/fss_embedded_list.c index 9df8c1a..48023e8 100644 --- a/level_1/fl_fss/c/fss_embedded_list.c +++ b/level_1/fl_fss/c/fss_embedded_list.c @@ -22,7 +22,7 @@ extern "C" { if (status == F_none_eol) { // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -39,7 +39,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -65,7 +65,7 @@ extern "C" { } // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -102,7 +102,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_embedded_list_open) { graph_first = F_false; stop = range->start - 1; - range->start++; + ++range->start; while (range->start <= range->stop && range->start < buffer.used) { @@ -133,10 +133,10 @@ extern "C" { if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; - delimits->used++; + ++delimits->used; } - slash_count--; + --slash_count; } status = f_utf_buffer_increment(buffer, range, 1); @@ -163,7 +163,7 @@ extern "C" { if (F_status_is_error(status)) break; delimits->array[delimits->used++] = slash_first; - range->start++; + ++range->start; } else { graph_first = F_false; @@ -199,7 +199,7 @@ extern "C" { found->stop = stop; // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object; } @@ -231,6 +231,7 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } } // while @@ -241,6 +242,7 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } @@ -348,6 +350,7 @@ extern "C" { if (F_status_is_error(status)) break; while (range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_delimit_placeholder || buffer.string[range->start] == f_fss_delimit_slash)) { + position_previous = range->start; if (buffer.string[range->start] == f_fss_delimit_slash) { @@ -460,7 +463,7 @@ extern "C" { delimits->array[delimits->used++] = range->start; } - slash_count--; + --slash_count; } // Delimit slashes and placeholders are required to be in the ASCII range. @@ -471,7 +474,7 @@ extern "C" { // when slashes are even, the object is valid and needs to be processed. if (is_object) { - depth++; + ++depth; if (depth > positions_start.size) { macro_f_array_lengths_t_resize(status, positions_start, positions_start.size + f_fss_default_allocation_step); @@ -704,7 +707,7 @@ extern "C" { return FL_fss_found_content; } - depth--; + --depth; } else { @@ -751,7 +754,7 @@ extern "C" { if (F_status_is_error(status)) break; if (range->start > range->stop || range->start >= buffer.used) { - range->start--; + --range->start; } else { if (graph_first == 0x2) { @@ -904,7 +907,7 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = object.string[range->start + i]; } // for } @@ -916,6 +919,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -924,7 +928,7 @@ extern "C" { if (object.string[range->start] == f_fss_delimit_slash) { slash_count = 1; - for (range->start++; range->start <= range->stop && range->start < object.used; range->start++) { + for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) { if (object.string[range->start] == f_fss_delimit_placeholder) { continue; @@ -932,7 +936,7 @@ extern "C" { break; } - slash_count++; + ++slash_count; } // for if (F_status_is_error(status)) break; @@ -946,7 +950,7 @@ extern "C" { status = f_string_dynamic_increase_by(slash_count, destination); if (F_status_is_error(status)) break; - while (slash_count--) { + while (--slash_count) { destination->string[destination->used++] = f_fss_delimit_slash; } // while @@ -972,7 +976,7 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = object.string[range->start + i]; } // for } @@ -983,6 +987,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -992,6 +997,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -1003,6 +1009,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -1092,13 +1099,13 @@ extern "C" { destination->string[destination->used++] = content.string[range->start]; - for (range->start++; range->start <= range->stop && range->start < content.used; range->start++) { + for (++range->start; range->start <= range->stop && range->start < content.used; ++range->start) { if (content.string[range->start] == f_fss_delimit_placeholder) continue; if (content.string[range->start] != f_fss_delimit_slash) break; destination->string[destination->used++] = f_fss_delimit_slash; - slash_count++; + ++slash_count; } // for if (content.string[range->start] == f_fss_embedded_list_open || content.string[range->start] == f_fss_embedded_list_close) { diff --git a/level_1/fl_fss/c/fss_embedded_list.h b/level_1/fl_fss/c/fss_embedded_list.h index 8328e28..b63a828 100644 --- a/level_1/fl_fss/c/fss_embedded_list.h +++ b/level_1/fl_fss/c/fss_embedded_list.h @@ -57,6 +57,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_array_too_large (with error bit) if a buffer is too large. * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. @@ -109,6 +110,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_array_too_large (with error bit) if a buffer is too large. * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. @@ -154,6 +156,7 @@ extern "C" { * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_none_stop on success after reaching stopping point . + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. @@ -201,7 +204,8 @@ extern "C" { * F_none_eos on success after reaching the end of the buffer. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. - * F_none_stop on success after reaching stopping point . + * F_none_stop on success after reaching stopping point. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index e485180..5b7c327 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -20,11 +20,13 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } if (status == FL_fss_found_object_not || status == F_data_not || status == F_data_not_eos || status == F_data_not_stop) { delimits->used = delimits_used; + return status; } @@ -80,12 +82,13 @@ extern "C" { if (F_status_is_error(status_allocate)) { delimits->used = delimits_used; + return status_allocate; } } found->array[found->used] = content_partial; - found->used++; + ++found->used; if (quotes) { quotes->array[quotes->used] = quoted; @@ -123,6 +126,7 @@ extern "C" { } else if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } } // while diff --git a/level_1/fl_fss/c/fss_extended.h b/level_1/fl_fss/c/fss_extended.h index fea847a..3ecac9b 100644 --- a/level_1/fl_fss/c/fss_extended.h +++ b/level_1/fl_fss/c/fss_extended.h @@ -60,6 +60,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_buffer_increment(). @@ -103,6 +104,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_buffer_increment(). @@ -145,6 +147,7 @@ extern "C" { * F_none_stop on success after reaching the range stop. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. @@ -189,6 +192,7 @@ extern "C" { * F_none_stop on success after reaching the range stop. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. diff --git a/level_1/fl_fss/c/fss_extended_list.c b/level_1/fl_fss/c/fss_extended_list.c index 8ef9f85..6825fd8 100644 --- a/level_1/fl_fss/c/fss_extended_list.c +++ b/level_1/fl_fss/c/fss_extended_list.c @@ -22,7 +22,7 @@ extern "C" { if (status == F_none_eol) { // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -39,7 +39,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -65,7 +65,7 @@ extern "C" { } // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -102,7 +102,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_extended_list_open) { graph_first = F_false; stop = range->start - 1; - range->start++; + ++range->start; while (range->start <= range->stop && range->start < buffer.used) { @@ -133,10 +133,10 @@ extern "C" { if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; - delimits->used++; + ++delimits->used; } - slash_count--; + --slash_count; } status = f_utf_buffer_increment(buffer, range, 1); @@ -163,7 +163,7 @@ extern "C" { if (F_status_is_error(status)) break; delimits->array[delimits->used++] = slash_first; - range->start++; + ++range->start; } else { graph_first = F_false; @@ -199,7 +199,7 @@ extern "C" { found->stop = stop; // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object; } @@ -221,6 +221,7 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } @@ -231,6 +232,7 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } } // while @@ -241,6 +243,7 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; + return status; } @@ -283,7 +286,8 @@ extern "C" { if (status == F_none_eol) { newline_last = range->start; - range->start++; + ++range->start; + continue; } @@ -291,7 +295,7 @@ extern "C" { slash_first = range->start; slash_count = 1; - for (range->start++; range->start <= range->stop && range->start < buffer.used; ++range->start) { + for (++range->start; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (buffer.string[range->start] == f_fss_delimit_placeholder) { continue; @@ -299,7 +303,7 @@ extern "C" { break; } - slash_count++; + ++slash_count; } // for if (range->start > range->stop || range->start >= buffer.used) break; @@ -308,7 +312,7 @@ extern "C" { // For example '}' = valid close, '\}' represents '}', '\\}' represents '\}', '\\\}' represents '\\}', '\\\\}' represents '\\\}', and so on.. // With one or more slashes, even if delimited, this line may never designate a valid content close. if (buffer.string[range->start] == f_fss_extended_list_close) { - range->start++; + ++range->start; while (range->start <= range->stop && range->start < buffer.used) { @@ -347,7 +351,7 @@ extern "C" { } if (buffer.string[range->start] == f_fss_extended_list_close) { - range->start++; + ++range->start; while (range->start <= range->stop && range->start < buffer.used) { @@ -387,7 +391,7 @@ extern "C" { if (F_status_is_error(status)) break; if (range->start > range->stop || range->start >= buffer.used) { - range->start--; + --range->start; } else { newline_last = range->start; @@ -406,6 +410,7 @@ extern "C" { if (F_status_is_error(status)) { delimits->used = delimits_used; comments->used = comments_used; + return status; } @@ -506,6 +511,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -514,7 +520,7 @@ extern "C" { if (object.string[range->start] == f_fss_delimit_slash) { slash_count = 1; - for (range->start++; range->start <= range->stop && range->start < object.used; range->start++) { + for (++range->start; range->start <= range->stop && range->start < object.used; ++range->start) { if (object.string[range->start] == f_fss_delimit_placeholder) { continue; @@ -562,7 +568,7 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = object.string[range->start + i]; } // for } @@ -582,6 +588,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -593,6 +600,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -682,13 +690,13 @@ extern "C" { destination->string[destination->used++] = content.string[range->start]; - for (range->start++; range->start <= range->stop && range->start < content.used; range->start++) { + for (++range->start; range->start <= range->stop && range->start < content.used; ++range->start) { if (content.string[range->start] == f_fss_delimit_placeholder) continue; if (content.string[range->start] != f_fss_delimit_slash) break; destination->string[destination->used++] = f_fss_delimit_slash; - slash_count++; + ++slash_count; } // for if (content.string[range->start] == f_fss_extended_list_close) { @@ -766,7 +774,7 @@ extern "C" { if (ignore && ignore->used) { - for (r = 0; r < ignore->used; r++) { + for (r = 0; r < ignore->used; ++r) { if (start >= ignore->array[r].start && start <= ignore->array[r].stop) break; } // for @@ -776,6 +784,7 @@ extern "C" { destination->string[destination->used++] = content.string[start]; range->start = start + 1; + continue; } } @@ -837,7 +846,7 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = content.string[range->start + i]; } // for } @@ -848,6 +857,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } diff --git a/level_1/fl_fss/c/fss_extended_list.h b/level_1/fl_fss/c/fss_extended_list.h index b866fac..ae4700a 100644 --- a/level_1/fl_fss/c/fss_extended_list.h +++ b/level_1/fl_fss/c/fss_extended_list.h @@ -57,6 +57,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_array_too_large (with error bit) if a buffer is too large. * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. @@ -107,6 +108,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_array_too_large (with error bit) if a buffer is too large. * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. @@ -152,6 +154,7 @@ extern "C" { * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_none_stop on success after reaching stopping point . + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. @@ -200,6 +203,7 @@ extern "C" { * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_none_stop on success after reaching stopping point . + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index 66021b4..1380e58 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -8,6 +8,7 @@ extern "C" { #if !defined(_di_fl_fss_basic_object_write_string_) || !defined(_di_fl_fss_extended_object_write_string_) f_status_t private_fl_fss_basic_write_object_trim(const f_fss_quote_t quote, const f_array_length_t used_start, f_string_dynamic_t *destination) { + f_status_t status = F_none; f_string_range_t destination_range = macro_f_string_range_t_initialize(destination->used); f_array_length_t i = 0; @@ -15,14 +16,14 @@ extern "C" { uint8_t width = 0; // if there are any spaces, then this will be quoted so find the first non-placeholder character. - for (; destination_range.start < destination->used; destination_range.start++) { + for (; destination_range.start < destination->used; ++destination_range.start) { if (destination->string[destination_range.start] != f_fss_delimit_placeholder) break; } // for if (destination->string[destination_range.start] == quote) { const f_array_length_t front = destination_range.start; - for (destination_range.start++; destination_range.start < destination->used; destination_range.start++) { + for (++destination_range.start; destination_range.start < destination->used; ++destination_range.start) { if (destination->string[destination_range.start] == f_fss_delimit_placeholder) { continue; @@ -32,6 +33,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -39,13 +41,14 @@ extern "C" { width = macro_f_utf_byte_width(destination->string[destination_range.start]); - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination_range.start + i] = f_fss_delimit_placeholder; } // for } // for // find the last quote. for (destination_range.start = destination->used - 1; destination_range.start > front; destination_range.start--) { + if (destination->string[destination_range.start] == quote) { destination_range.start--; break; @@ -74,13 +77,13 @@ extern "C" { width = macro_f_utf_byte_width(destination->string[destination_range.start]); - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination_range.start + i] = f_fss_delimit_placeholder; } // for } // for // if there is no whitespace between the quotes, post-trimming, then remove the quotes. - for (destination_range.start = front; destination_range.start < rear; destination_range.start++) { + for (destination_range.start = front; destination_range.start < rear; ++destination_range.start) { status = f_fss_is_space(*destination, destination_range); @@ -104,9 +107,10 @@ extern "C" { #if !defined(_di_fl_fss_basic_list_content_write_string_) || !defined(_di_fl_fss_extended_list_content_write_string_) || !defined(_di_fl_fss_embedded_list_content_write_string_) f_status_t private_fl_fss_basic_list_write_add_until_end(const f_string_static_t buffer, f_string_range_t *range, f_string_dynamic_t *destination) { + f_status_t status = F_none; - for (; range->start <= range->stop && range->start < buffer.used; range->start++) { + for (; range->start <= range->stop && range->start < buffer.used; ++range->start) { if (buffer.string[range->start] == f_fss_delimit_placeholder) continue; if (buffer.string[range->start] == f_fss_eol) break; @@ -123,13 +127,14 @@ extern "C" { #if !defined(_di_fl_fss_basic_list_object_write_string_) || !defined(_di_fl_fss_extended_list_object_write_string_) f_status_t private_fl_fss_basic_list_write_object_trim(const f_array_length_t used_start, f_string_dynamic_t *destination) { + f_status_t status = F_none; f_string_range_t destination_range = macro_f_string_range_t_initialize(destination->used); f_array_length_t i = 0; uint8_t width = 0; - for (; destination_range.start < destination->used; destination_range.start++) { + for (; destination_range.start < destination->used; ++destination_range.start) { if (destination->string[destination_range.start] == f_fss_delimit_placeholder) { continue; @@ -139,6 +144,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -146,7 +152,7 @@ extern "C" { width = macro_f_utf_byte_width(destination->string[destination_range.start]); - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination_range.start + i] = f_fss_delimit_placeholder; } // for } // for @@ -154,7 +160,8 @@ extern "C" { for (destination_range.start = destination->used - 1; destination_range.start > 0; destination_range.start--) { if (destination->string[destination_range.start] == f_fss_delimit_placeholder) { - destination->used--; + --destination->used; + continue; } @@ -165,6 +172,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -178,6 +186,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -199,7 +208,7 @@ extern "C" { if (status == F_none_eol) { // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -219,14 +228,20 @@ extern "C" { if (object_as && buffer.string[range->start] == f_fss_comment) { while (buffer.string[range->start] != f_fss_eol) { - range->start++; - if (range->start >= buffer.used) return F_data_not_eos; - if (range->start > range->stop) return F_data_not_stop; + ++range->start; + + if (range->start >= buffer.used) { + return F_data_not_eos; + } + + if (range->start > range->stop) { + return F_data_not_stop; + } } // while // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -286,11 +301,13 @@ extern "C" { if (range->start >= buffer.used) { found->stop = buffer.used - 1; + return F_none_eos; } if (range->start > range->stop) { found->stop = range->stop; + return F_none_stop; } @@ -302,7 +319,7 @@ extern "C" { if (F_status_is_error(status)) return status; delimits->array[delimits->used] = first_slash; - delimits->used++; + ++delimits->used; status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; @@ -337,7 +354,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_content_not; } @@ -373,7 +390,7 @@ extern "C" { break; } - slash_count++; + ++slash_count; status = f_utf_buffer_increment(buffer, range, 1); if (F_status_is_error(status)) return status; @@ -381,11 +398,13 @@ extern "C" { if (range->start >= buffer.used) { found->stop = buffer.used - 1; + return F_terminated_not_group_eos; } if (range->start > range->stop) { found->stop = range->stop; + return F_terminated_not_group_stop; } @@ -394,12 +413,13 @@ extern "C" { // check to see if there is a whitespace, EOS, or EOL after the quoted, if not, then this is not a closing quoted and delimits do not apply. if (range->start + 1 <= range->stop && range->start + 1 < buffer.used) { - range->start++; + ++range->start; status = f_fss_skip_past_delimit(buffer, range); if (F_status_is_error(status)) return status; if (range->start > range->stop || range->start >= buffer.used) { + // EOS or EOL was reached, so it is a valid closing quoted. // (for EOL, this is always TRUE, for EOS this could be false but there is no way to know this, so assume TRUE (@todo maybe none on stop?). status = F_true; @@ -410,6 +430,7 @@ extern "C" { } } else { + // EOS or EOL was reached, so it is a valid closing quoted. // (for EOL, this is always TRUE, for EOS this could be false but there is no way to know this, so assume TRUE (@todo maybe none on stop?). status = F_true; @@ -436,7 +457,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; - delimits->used++; + ++delimits->used; } slash_count--; @@ -449,7 +470,7 @@ extern "C" { range->start = location + 1; while (buffer.string[range->start] == f_fss_delimit_placeholder) { - range->start++; + ++range->start; if (range->start >= buffer.used) return F_none_eos; if (range->start > range->stop) return F_none_stop; @@ -486,7 +507,7 @@ extern "C" { found->stop = location - 1; // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_content_not; } @@ -507,7 +528,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; - delimits->used++; + ++delimits->used; } slash_count--; @@ -531,7 +552,7 @@ extern "C" { location = range->start; if (range->start + 1 <= range->stop && range->start + 1 < buffer.used) { - range->start++; + ++range->start; status = f_fss_skip_past_delimit(buffer, range); if (F_status_is_error(status)) return status; @@ -574,7 +595,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_content_not; } @@ -599,11 +620,13 @@ extern "C" { if (range->start >= buffer.used) { found->stop = buffer.used - 1; + return F_data_not_eos; } if (range->start > range->stop) { found->stop = range->stop; + return F_data_not_stop; } @@ -619,11 +642,13 @@ extern "C" { if (range->start >= buffer.used) { found->stop = buffer.used - 1; + return F_none_eos; } if (range->start > range->stop) { found->stop = range->stop; + return F_none_stop; } } @@ -631,7 +656,7 @@ extern "C" { else if (buffer.string[range->start] == f_fss_eol) { // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -642,11 +667,13 @@ extern "C" { if (range->start >= buffer.used) { found->stop = buffer.used - 1; + return F_terminated_not_group_eos; } if (range->start > range->stop) { found->stop = range->stop; + return F_terminated_not_group_stop; } } @@ -656,7 +683,7 @@ extern "C" { if (F_status_is_error(status)) return status; // move the start position to after the EOL. - range->start++; + ++range->start; return FL_fss_found_object_not; } @@ -711,10 +738,10 @@ extern "C" { item_first = range->start++; item_total = 1; - for (; range->start <= range->stop && range->start < object.used; range->start++) { + for (; range->start <= range->stop && range->start < object.used; ++range->start) { if (object.string[range->start] == f_fss_delimit_slash) { - item_total++; + ++item_total; } else if (object.string[range->start] != f_fss_delimit_placeholder) { break; @@ -737,7 +764,7 @@ extern "C" { status = f_string_dynamic_increase_by(item_total, destination); if (F_status_is_error(status)) break; - for (i = 0; i < item_total; i++) { + for (i = 0; i < item_total; ++i) { destination->string[destination->used++] = f_fss_delimit_slash; } // for } @@ -746,7 +773,7 @@ extern "C" { status = f_string_dynamic_increase_by(item_total, destination); if (F_status_is_error(status)) break; - for (i = 0; i < item_total; i++) { + for (i = 0; i < item_total; ++i) { destination->string[destination->used++] = f_fss_delimit_slash; } // for @@ -769,7 +796,7 @@ extern "C" { status = f_string_dynamic_increase_by(item_total + 1, destination); if (F_status_is_error(status)) break; - for (i = 0; i < item_total; i++) { + for (i = 0; i < item_total; ++i) { destination->string[destination->used++] = f_fss_delimit_slash; } // for @@ -799,7 +826,7 @@ extern "C" { status = f_string_dynamic_increase_by(item_total, destination); if (F_status_is_error(status)) break; - for (i = 0; i < item_total; i++) { + for (i = 0; i < item_total; ++i) { destination->string[destination->used++] = f_fss_delimit_slash; } // for } @@ -810,13 +837,13 @@ extern "C" { status = f_string_dynamic_increase_by(item_total + width + 1, destination); if (F_status_is_error(status)) break; - for (i = 0; i < item_total; i++) { + for (i = 0; i < item_total; ++i) { destination->string[destination->used++] = f_fss_delimit_slash; } // for destination->string[destination->used++] = quote; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = object.string[range->start + i]; } // for } @@ -830,12 +857,13 @@ extern "C" { status = f_string_dynamic_increase_by(item_total + 1, destination); if (F_status_is_error(status)) break; - for (i = 0; i < item_total; i++) { + for (i = 0; i < item_total; ++i) { destination->string[destination->used++] = f_fss_delimit_slash; } // for destination->string[destination->used++] = object.string[range->start]; - range->start++; + ++range->start; + continue; } else { @@ -854,14 +882,14 @@ extern "C" { if (F_status_is_error(status)) break; // there is nothing to delimit, so all slashes should be printed as is. - for (i = 0; i < item_total; i++) { + for (i = 0; i < item_total; ++i) { destination->string[destination->used++] = f_fss_delimit_slash; } // for status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = object.string[range->start + i]; } // for } @@ -921,7 +949,7 @@ extern "C" { destination->string[destination->used++] = quote; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = object.string[range->start + i]; } // for } @@ -944,7 +972,7 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; i++) { + for (i = 0; i < width; ++i) { destination->string[destination->used++] = object.string[range->start + i]; } // for } @@ -955,6 +983,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -963,6 +992,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } @@ -972,7 +1002,7 @@ extern "C" { // The start quote may or may not need to be delimited in this case. if (destination->string[input_start] == quote) { - for (i = input_start + 1; i <= range->stop && i < object.used; i++) { + for (i = input_start + 1; i <= range->stop && i < object.used; ++i) { if (object.string[i] != f_fss_delimit_placeholder) break; } // for @@ -986,6 +1016,7 @@ extern "C" { if (F_status_is_error(status)) { destination->used = used_start; + return status; } diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index 2e80fe9..2b25a0f 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -118,6 +118,7 @@ extern "C" { * F_data_not_stop no data found after reaching stopping point (essentially only comments are found). * F_terminated_not_group_eos if EOS was reached before the a group termination was reached. * F_terminated_not_group_stop if stop point was reached before the a group termination was reached. + * * F_array_too_large (with error bit) if a buffer is too large. * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. @@ -170,6 +171,7 @@ extern "C" { * F_none_stop on success after reaching the range stop. * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. diff --git a/level_1/fl_iki/c/iki.c b/level_1/fl_iki/c/iki.c index b93fa82..dcf3e0a 100644 --- a/level_1/fl_iki/c/iki.c +++ b/level_1/fl_iki/c/iki.c @@ -6,6 +6,11 @@ extern "C" { #ifndef _di_fl_iki_read_ f_status_t fl_iki_read(f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content) { + #ifndef _di_level_1_parameter_checking_ + if (!buffer) return F_status_set_error(F_parameter); + if (!range) return F_status_set_error(F_parameter); + #endif // _di_level_1_parameter_checking_ + f_status_t status = F_none; do { @@ -19,6 +24,7 @@ extern "C" { if (status == F_none_eos || status == F_none_stop) { return status; } + } while (range->start <= range->stop && range->start < buffer->used); return F_none; diff --git a/level_1/fl_iki/c/iki.h b/level_1/fl_iki/c/iki.h index 04735c3..656dcbc 100644 --- a/level_1/fl_iki/c/iki.h +++ b/level_1/fl_iki/c/iki.h @@ -55,6 +55,7 @@ extern "C" { * F_none_eos on success and an IKI vocabulary name was found and end of string was reached. * F_data_not_eos on success and EOS was reached, but there were no IKI vocabularie names found. * F_data_not_stop on success and stop point was reached, but there were no IKI vocabularie names found. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if a string length is too large to store in the buffer. diff --git a/level_1/fl_print/c/print.c b/level_1/fl_print/c/print.c index 70cf3f4..32f6b33 100644 --- a/level_1/fl_print/c/print.c +++ b/level_1/fl_print/c/print.c @@ -11,7 +11,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string || !length) return F_data_not; + if (!string || !length) { + return F_data_not; + } return private_fl_print_trim_except(output, string, 0, length, except); } @@ -23,7 +25,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used) return F_data_not; + if (!buffer.used) { + return F_data_not; + } return private_fl_print_trim_except(output, buffer.string, 0, buffer.used, except); } @@ -35,7 +39,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used) return F_data_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { + return F_data_not; + } f_array_length_t length = (range.stop - range.start) + 1; @@ -53,7 +59,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string || !length) return F_data_not; + if (!string || !length) { + return F_data_not; + } return private_fl_print_trim_except_utf(output, string, 0, length, except); } @@ -65,7 +73,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used) return F_data_not; + if (!buffer.used) { + return F_data_not; + } return private_fl_print_trim_except_utf(output, buffer.string, 0, buffer.used, except); } @@ -77,7 +87,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used) return F_data_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { + return F_data_not; + } f_array_length_t length = (range.stop - range.start) + 1; @@ -95,7 +107,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string || !length) return F_data_not; + if (!string || !length) { + return F_data_not; + } return private_fl_print_trim(output, string, length); } @@ -107,7 +121,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used) return F_data_not; + if (!buffer.used) { + return F_data_not; + } return private_fl_print_trim(output, buffer.string, buffer.used); } @@ -119,7 +135,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used) return F_data_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { + return F_data_not; + } f_array_length_t length = (range.stop - range.start) + 1; @@ -137,7 +155,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string || !length) return F_data_not; + if (!string || !length) { + return F_data_not; + } return private_fl_print_trim_utf(output, string, length); } @@ -149,7 +169,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used) return F_data_not; + if (!buffer.used) { + return F_data_not; + } return private_fl_print_trim_utf(output, buffer.string, buffer.used); } @@ -161,7 +183,9 @@ extern "C" { if (!output) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used || range.start > range.stop || range.start >= buffer.used) return F_data_not; + if (!buffer.used || range.start > range.stop || range.start >= buffer.used) { + return F_data_not; + } f_array_length_t length = (range.stop - range.start) + 1; diff --git a/level_1/fl_print/c/print.h b/level_1/fl_print/c/print.h index 6b97c35..a9aded1 100644 --- a/level_1/fl_print/c/print.h +++ b/level_1/fl_print/c/print.h @@ -46,6 +46,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -78,6 +79,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -112,6 +114,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -145,6 +148,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -177,6 +181,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -211,6 +216,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -240,6 +246,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -268,6 +275,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -298,6 +306,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -327,6 +336,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -355,6 +365,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -385,6 +396,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_1/fl_print/c/private-print.c b/level_1/fl_print/c/private-print.c index c07c816..9510542 100644 --- a/level_1/fl_print/c/private-print.c +++ b/level_1/fl_print/c/private-print.c @@ -24,6 +24,7 @@ extern "C" { if (e < except.used && except.array[e] == i) { i++; + continue; } @@ -53,6 +54,7 @@ extern "C" { if (e < except.used && except.array[e] == i) { i++; + continue; } @@ -70,7 +72,9 @@ extern "C" { if (status == F_true) { j = i + macro_f_utf_byte_width(string[i]); - if (j == stop) return F_none; + if (j == stop) { + return F_none; + } ej = e; @@ -82,6 +86,7 @@ extern "C" { if (ej < except.used && except.array[ej] == j) { j++; + continue; } @@ -99,6 +104,7 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i < j; i++) { + if (!string[i]) continue; for (; e < except.used && except.array[e] < i; ++e) { @@ -107,7 +113,9 @@ extern "C" { if (e < except.used && except.array[e] == i) continue; - if (!fputc(string[i], output)) return F_status_set_error(F_output); + if (!fputc(string[i], output)) { + return F_status_set_error(F_output); + } } // for break; @@ -119,7 +127,9 @@ extern "C" { if (status == F_true) break; } - if (!fputc(string[i], output)) return F_status_set_error(F_output); + if (!fputc(string[i], output)) { + return F_status_set_error(F_output); + } i += macro_f_utf_byte_width(string[i]); } // while @@ -160,6 +170,7 @@ extern "C" { } // for for (; i < stop; ++i) { + if (!string[i]) continue; for (; e < except.used && except.array[e] < i; ++e) { @@ -181,7 +192,9 @@ extern "C" { if (status == F_true) { j = i + 1; - if (j == stop) return F_none; + if (j == stop) { + return F_none; + } for (ej = e; j < stop; j++) { @@ -204,6 +217,7 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i < j; i++) { + if (!string[i]) continue; for (; e < except.used && except.array[e] < i; ++e) { @@ -212,7 +226,9 @@ extern "C" { if (e < except.used && except.array[e] == i) continue; - if (!fputc(string[i], output)) return F_status_set_error(F_output); + if (!fputc(string[i], output)) { + return F_status_set_error(F_output); + } } // for break; @@ -222,7 +238,9 @@ extern "C" { if (status == F_true) break; } - if (!fputc(string[i], output)) return F_status_set_error(F_output); + if (!fputc(string[i], output)) { + return F_status_set_error(F_output); + } } // for return F_none; @@ -255,6 +273,7 @@ extern "C" { } // for for (; i < length; i += macro_f_utf_byte_width(string[i])) { + if (!string[i]) continue; width_max = (length - i) + 1; @@ -271,7 +290,9 @@ extern "C" { if (status == F_true) { j = i + macro_f_utf_byte_width(string[i]); - if (j == length) return F_none; + if (j == length) { + return F_none; + } for (; j < length; j += macro_f_utf_byte_width(string[j])) { @@ -289,8 +310,12 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i < j; i++) { + if (!string[i]) continue; - if (!fputc(string[i], output)) return F_status_set_error(F_output); + + if (!fputc(string[i], output)) { + return F_status_set_error(F_output); + } } // for break; @@ -300,7 +325,9 @@ extern "C" { if (status == F_true) break; } - if (!fputc(string[i], output)) return F_status_set_error(F_output); + if (!fputc(string[i], output)) { + return F_status_set_error(F_output); + } } // for return F_none; @@ -331,12 +358,15 @@ extern "C" { } // for for (; i < length; i++) { + if (!string[i]) continue; status = f_utf_character_is_whitespace(string[i]); if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); + if (F_status_set_fine(status) == F_maybe) { + return F_status_set_error(F_utf); + } return status; } @@ -344,7 +374,9 @@ extern "C" { if (status == F_true) { j = i + 1; - if (j == length) return F_none; + if (j == length) { + return F_none; + } for (; j < length; j++) { @@ -361,8 +393,12 @@ extern "C" { // all whitespaces found so far must be printed when a non-whitespace is found. if (status == F_false) { for (; i < j; i++) { + if (!string[i]) continue; - if (!fputc(string[i], output)) return F_status_set_error(F_output); + + if (!fputc(string[i], output)) { + return F_status_set_error(F_output); + } } // for break; @@ -372,7 +408,9 @@ extern "C" { if (status == F_true) break; } - if (!fputc(string[i], output)) return F_status_set_error(F_output); + if (!fputc(string[i], output)) { + return F_status_set_error(F_output); + } } // for return F_none; diff --git a/level_1/fl_print/c/private-print.h b/level_1/fl_print/c/private-print.h index c2fe58f..763305c 100644 --- a/level_1/fl_print/c/private-print.h +++ b/level_1/fl_print/c/private-print.h @@ -35,6 +35,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -70,6 +71,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -100,6 +102,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. @@ -130,6 +133,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but there is nothing to print. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_output (with error bit) on error when printing to output. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_1/fl_status/c/status.c b/level_1/fl_status/c/status.c index d880b4f..09e52fb 100644 --- a/level_1/fl_status/c/status.c +++ b/level_1/fl_status/c/status.c @@ -15,7 +15,8 @@ extern "C" { switch (unmasked_code) { #ifndef _di_F_status_boolean_ case F_false: - *string = FL_status_string_false; break; + *string = FL_status_string_false; + break; case F_true: *string = FL_status_string_true; break; @@ -1324,6 +1325,7 @@ extern "C" { default: *string = 0; + return F_status_set_error(F_data); } diff --git a/level_1/fl_status/c/status.h b/level_1/fl_status/c/status.h index 64fb73f..55578a6 100644 --- a/level_1/fl_status/c/status.h +++ b/level_1/fl_status/c/status.h @@ -947,6 +947,7 @@ extern "C" { * * @return * F_none on success. + * * F_data (with error bit) if there status is unknown. * F_parameter (with error bit) if a parameter is invalid. */ diff --git a/level_1/fl_string/c/private-string.c b/level_1/fl_string/c/private-string.c index 5e4b7b7..717e407 100644 --- a/level_1/fl_string/c/private-string.c +++ b/level_1/fl_string/c/private-string.c @@ -7,6 +7,7 @@ extern "C" { #if !defined(_di_fl_string_compare_) || !defined(_di_fl_string_dynamic_compare_) || !defined(_di_fl_string_dynamic_partial_compare_) f_status_t private_fl_string_compare(const f_string_t string1, const f_string_t string2, const f_array_length_t offset1, const f_array_length_t offset2, const f_array_length_t stop1, const f_array_length_t stop2) { + f_array_length_t i1 = offset1; f_array_length_t i2 = offset2; @@ -38,6 +39,7 @@ extern "C" { #if !defined(_di_fl_string_compare_except_) || !defined(_di_fl_string_dynamic_compare_except_) || !defined(_di_fl_string_dynamic_partial_compare_except_) f_status_t private_fl_string_compare_except(const f_string_t string1, const f_string_t string2, const f_array_length_t offset1, const f_array_length_t offset2, const f_array_length_t stop1, const f_array_length_t stop2, const f_array_lengths_t except1, const f_array_lengths_t except2) { + f_array_length_t i1 = offset1; f_array_length_t i2 = offset2; @@ -58,6 +60,7 @@ extern "C" { while (e1 < except1.used && except1.array[e1] < i1) e1++; if (e1 < except1.used && except1.array[e1] == i1) { i1++; + continue; } @@ -65,10 +68,13 @@ extern "C" { while (e2 < except2.used && except2.array[e2] < i2) e2++; if (e2 < except2.used && except2.array[e2] == i2) { i2++; + continue; } - if (string1[i1] != string2[i2]) return F_equal_to_not; + if (string1[i1] != string2[i2]) { + return F_equal_to_not; + } i1++; i2++; @@ -81,7 +87,9 @@ extern "C" { while (e1 < except1.used && except1.array[e1] < i1) e1++; if (e1 < except1.used && except1.array[e1] == i1) continue; - if (string1[i1] != 0) return F_equal_to_not; + if (string1[i1] != 0) { + return F_equal_to_not; + } } // for for (; i2 < stop2; i2++) { @@ -90,7 +98,9 @@ extern "C" { while (e2 < except2.used && except2.array[e2] < i2) e2++; if (e2 < except2.used && except2.array[e2] == i2) continue; - if (string2[i2] != 0) return F_equal_to_not; + if (string2[i2] != 0) { + return F_equal_to_not; + } } // for return F_equal_to; @@ -99,6 +109,7 @@ extern "C" { #if !defined(_di_fl_string_compare_except_trim_) || !defined(_di_fl_string_dynamic_compare_except_trim_) || !defined(_di_fl_string_dynamic_partial_compare_except_trim_) f_status_t private_fl_string_compare_except_trim(const f_string_t string1, const f_string_t string2, const f_array_length_t offset1, const f_array_length_t offset2, const f_array_length_t stop1, const f_array_length_t stop2, const f_array_lengths_t except1, const f_array_lengths_t except2) { + f_array_length_t i1 = offset1; f_array_length_t i2 = offset2; @@ -121,6 +132,7 @@ extern "C" { while (e1 < except1.used && except1.array[e1] < i1) e1++; if (e1 < except1.used && except1.array[e1] == i1) { width = 1; + continue; } @@ -151,6 +163,7 @@ extern "C" { while (e2 < except2.used && except2.array[e2] < i2) e2++; if (e2 < except2.used && except2.array[e2] == i2) { width = 1; + continue; } @@ -190,8 +203,10 @@ extern "C" { // skip past except characters in string1. while (ej < except1.used && except1.array[ej] < j) ej++; + if (ej < except1.used && except1.array[ej] == j) { width = 1; + continue; } @@ -249,7 +264,9 @@ extern "C" { } } // for - if (size1 != size2) return F_equal_to_not; + if (size1 != size2) { + return F_equal_to_not; + } } while (i1 <= last1 && i2 <= last2) { @@ -264,19 +281,25 @@ extern "C" { // skip past except characters in string1. while (e1 < except1.used && except1.array[e1] < i1) e1++; + if (e1 < except1.used && except1.array[e1] == i1) { i1++; + continue; } // skip past except characters in string2. while (e2 < except2.used && except2.array[e2] < i2) e2++; + if (e2 < except2.used && except2.array[e2] == i2) { i2++; + continue; } - if (string1[i1] != string2[i2]) return F_equal_to_not; + if (string1[i1] != string2[i2]) { + return F_equal_to_not; + } i1++; i2++; @@ -313,6 +336,7 @@ extern "C" { #if !defined(_di_fl_string_compare_trim_) || !defined(_di_fl_string_dynamic_compare_trim_) || !defined(_di_fl_string_dynamic_partial_compare_trim_) f_status_t private_fl_string_compare_trim(const f_string_t string1, const f_string_t string2, const f_array_length_t offset1, const f_array_length_t offset2, const f_array_length_t stop1, const f_array_length_t stop2) { + f_array_length_t i1 = offset1; f_array_length_t i2 = offset2; @@ -426,7 +450,9 @@ extern "C" { } } // for - if (size1 != size2) return F_equal_to_not; + if (size1 != size2) { + return F_equal_to_not; + } } for (; i1 < last1 && i2 < last2; i1++, i2++) { @@ -439,16 +465,20 @@ extern "C" { while (i2 < last2 && !string2[i2]) i2++; if (i2 == last2) break; - if (string1[i1] != string2[i2]) return F_equal_to_not; + if (string1[i1] != string2[i2]) { + return F_equal_to_not; + } } // for // only return F_equal_to if all remaining characters are NULL. while (i1 < last1) { + if (string1[i1] != 0) return F_equal_to_not; i1++; } // while while (i2 < last2) { + if (string2[i2] != 0) return F_equal_to_not; i2++; } // while @@ -459,6 +489,7 @@ extern "C" { #if !defined(_di_fl_string_rip_) || !defined(_di_fl_string_dynamic_rip_) || !defined(_di_fl_string_rip_nulless_) || !defined(_di_fl_string_dynamic_rip_nulless_) f_status_t private_fl_string_rip_find_range(const f_string_t source, f_array_length_t *start, f_array_length_t *stop) { + const f_array_length_t stop_original = *stop; f_status_t status = F_none; @@ -537,7 +568,9 @@ extern "C" { return status; } - if (status == F_true) return F_data_not; + if (status == F_true) { + return F_data_not; + } } return F_none; diff --git a/level_1/fl_string/c/private-string.h b/level_1/fl_string/c/private-string.h index c215f5a..2389cfd 100644 --- a/level_1/fl_string/c/private-string.h +++ b/level_1/fl_string/c/private-string.h @@ -108,6 +108,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_utf (with error bit) if a character is not valid UTF-8. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -142,6 +143,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_utf (with error bit) if a character is not valid UTF-8. * * Errors (with error bit) from: f_utf_is_whitespace(). diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 650c883..6518717 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -210,18 +210,30 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } f_array_length_t begin = range.start; f_array_length_t end = range.stop; const f_status_t status = private_fl_string_rip_find_range(source.string, &begin, &end); - if (F_status_is_error(status)) return status; - if (status == F_data_not) return status; + if (F_status_is_error(status)) { + return status; + } - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (status == F_data_not) { + return status; + } + + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return f_string_append(source.string + begin, (end - begin) + 1, destination); } @@ -236,18 +248,30 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!source.used) return F_data_not_eos; + if (!source.used) { + return F_data_not_eos; + } f_array_length_t begin = range.start; f_array_length_t end = range.stop; const f_status_t status = private_fl_string_rip_find_range(source.string, &begin, &end); - if (F_status_is_error(status)) return status; - if (status == F_data_not) return status; + if (F_status_is_error(status)) { + return status; + } + + if (status == F_data_not) { + return status; + } - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return f_string_append_nulless(source.string + begin, (end - begin) + 1, destination); } @@ -259,8 +283,13 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string) return F_data_not; - if (range->start > range->stop) return F_data_not_stop; + if (!string) { + return F_data_not; + } + + if (range->start > range->stop) { + return F_data_not_stop; + } const unsigned short seek_width = macro_f_utf_character_t_width(seek_to_this); @@ -277,10 +306,14 @@ extern "C" { if (!width) { width = 1; - if (string[range->start] == f_string_eol_s[0]) return F_none_eol; + if (string[range->start] == f_string_eol_s[0]) { + return F_none_eol; + } if (seek_width == width) { - if (string[range->start] == seek_to_this) return F_none; + if (string[range->start] == seek_to_this) { + return F_none; + } } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -288,21 +321,30 @@ extern "C" { return F_status_set_error(F_complete_not_utf); } else { - if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop); + if (range->start + width > range->stop) { + return F_status_set_error(F_complete_not_utf_stop); + } if (width == seek_width) { f_utf_character_t character = 0; status = f_utf_char_to_character(string + range->start, width_max, &character); - if (F_status_is_error(status)) return status; - if (character == seek_to_this) return F_none; + if (F_status_is_error(status)) { + return status; + } + + if (character == seek_to_this) { + return F_none; + } } } range->start += width; - if (range->start >= range->stop) return F_none_stop; + if (range->start >= range->stop) { + return F_none_stop; + } } // while return F_none_eos; @@ -315,8 +357,13 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string) return F_data_not; - if (range->start > range->stop) return F_data_not_stop; + if (!string) { + return F_data_not; + } + + if (range->start > range->stop) { + return F_data_not_stop; + } f_status_t status = F_none; unsigned short width = 0; @@ -325,30 +372,42 @@ extern "C" { while (string[range->start] == placeholder || (status = f_utf_is_graph(string + range->start, width_max)) == F_false) { - if (F_status_is_error(status)) return status; - if (string[range->start] == f_string_eol_s[0]) return F_none_eol; + if (F_status_is_error(status)) { + return status; + } + + if (string[range->start] == f_string_eol_s[0]) { + return F_none_eol; + } width = macro_f_utf_byte_width_is(string[range->start]); if (!width) { width = 1; } - // Do not operate on UTF-8 fragments that are not the first byte of the character. else if (width == 1) { + + // Do not operate on UTF-8 fragments that are not the first byte of the character. return F_status_set_error(F_complete_not_utf); } else { - if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop); + if (range->start + width > range->stop) { + return F_status_set_error(F_complete_not_utf_stop); + } } range->start += width; - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } width_max = (range->stop - range->start) + 1; } // while - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return F_none; } @@ -360,8 +419,13 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string) return F_data_not; - if (range->start > range->stop) return F_data_not_stop; + if (!string) { + return F_data_not; + } + + if (range->start > range->stop) { + return F_data_not_stop; + } f_status_t status = F_none; unsigned short width = 0; @@ -369,30 +433,43 @@ extern "C" { f_array_length_t width_max = (range->stop - range->start) + 1; while (string[range->start] == placeholder || (status = f_utf_is_whitespace(string + range->start, width_max)) == F_false) { - if (F_status_is_error(status)) return status; - if (string[range->start] == f_string_eol_s[0]) return F_none_eol; + + if (F_status_is_error(status)) { + return status; + } + + if (string[range->start] == f_string_eol_s[0]) { + return F_none_eol; + } width = macro_f_utf_byte_width_is(string[range->start]); if (!width) { width = 1; } - // Do not operate on UTF-8 fragments that are not the first byte of the character. else if (width == 1) { + + // Do not operate on UTF-8 fragments that are not the first byte of the character. return F_status_set_error(F_complete_not_utf); } else { - if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop); + if (range->start + width > range->stop) { + return F_status_set_error(F_complete_not_utf_stop); + } } range->start += width; - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } width_max = (range->stop - range->start) + 1; } // while - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return F_none; } @@ -404,8 +481,13 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!string) return F_data_not; - if (range->start > range->stop) return F_data_not_stop; + if (!string) { + return F_data_not; + } + + if (range->start > range->stop) { + return F_data_not_stop; + } const unsigned short seek_width = macro_f_utf_character_t_width(seek_to_this); @@ -416,6 +498,7 @@ extern "C" { f_array_length_t width_max = 0; while (range->start <= range->stop) { + width_max = (range->stop - range->start) + 1; width = macro_f_utf_byte_width_is(string[range->start]); @@ -423,7 +506,9 @@ extern "C" { width = 1; if (seek_width == width) { - if (string[range->start] == seek_to_this) return F_none; + if (string[range->start] == seek_to_this) { + return F_none; + } } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -431,20 +516,30 @@ extern "C" { return F_status_set_error(F_complete_not_utf); } else { - if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop); + if (range->start + width > range->stop) { + return F_status_set_error(F_complete_not_utf_stop); + } if (width == seek_width) { f_utf_character_t character = 0; + status = f_utf_char_to_character(string + range->start, width_max, &character); - if (F_status_is_error(status)) return status; - if (character == seek_to_this) return F_none; + if (F_status_is_error(status)) { + return status; + } + + if (character == seek_to_this) { + return F_none; + } } } range->start += width; - if (range->start >= range->stop) return F_none_stop; + if (range->start >= range->stop) { + return F_none_stop; + } } // while return F_none_eos; @@ -457,15 +552,22 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } f_array_length_t begin = 0; f_array_length_t end = length - 1; const f_status_t status = private_fl_string_rip_find_range(source, &begin, &end); - if (F_status_is_error(status)) return status; - if (status == F_data_not) return status; + if (F_status_is_error(status)) { + return status; + } + + if (status == F_data_not) { + return status; + } return f_string_append(source + begin, (end - begin) + 1, destination); } @@ -477,15 +579,22 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } f_array_length_t begin = 0; f_array_length_t end = length - 1; const f_status_t status = private_fl_string_rip_find_range(source, &begin, &end); - if (F_status_is_error(status)) return status; - if (status == F_data_not) return status; + if (F_status_is_error(status)) { + return status; + } + + if (status == F_data_not) { + return status; + } return f_string_append_nulless(source + begin, (end - begin) + 1, destination); } @@ -497,17 +606,19 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } const unsigned short seek_width = macro_f_utf_character_t_width(seek_to); f_status_t status = F_none; unsigned short width = 0; - f_array_length_t width_max = (range->stop - range->start) + 1; for (; range->start <= range->stop; range->start += width) { + width_max = (range->stop - range->start) + 1; width = macro_f_utf_byte_width_is(string[range->start]); @@ -515,10 +626,14 @@ extern "C" { if (!width) { width = 1; - if (string[range->start] == f_string_eol_s[0]) return F_none_eol; + if (string[range->start] == f_string_eol_s[0]) { + return F_none_eol; + } if (seek_width == width) { - if (string[range->start] == seek_to) return F_none; + if (string[range->start] == seek_to) { + return F_none; + } } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -526,14 +641,22 @@ extern "C" { return F_status_set_error(F_complete_not_utf); } else { - if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_eos); + if (range->start + width > range->stop) { + return F_status_set_error(F_complete_not_utf_eos); + } if (width == seek_width) { f_utf_character_t character = 0; + status = f_utf_char_to_character(string + range->start, width_max, &character); - if (F_status_is_error(status)) return status; - if (character == seek_to) return F_none; + if (F_status_is_error(status)) { + return status; + } + + if (character == seek_to) { + return F_none; + } } } } // for @@ -548,7 +671,9 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } f_status_t status = F_none; unsigned short width = 0; @@ -556,30 +681,43 @@ extern "C" { f_array_length_t width_max = (range->stop - range->start) + 1; while (string[range->start] == placeholder || (status = f_utf_is_graph(string + range->start, width_max)) == F_false) { - if (F_status_is_error(status)) return status; - if (string[range->start] == f_string_eol_s[0]) return F_none_eol; + + if (F_status_is_error(status)) { + return status; + } + + if (string[range->start] == f_string_eol_s[0]) { + return F_none_eol; + } width = macro_f_utf_byte_width_is(string[range->start]); if (!width) { width = 1; } - // Do not operate on UTF-8 fragments that are not the first byte of the character. else if (width == 1) { + + // Do not operate on UTF-8 fragments that are not the first byte of the character. return F_status_set_error(F_complete_not_utf); } else { - if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop); + if (range->start + width > range->stop) { + return F_status_set_error(F_complete_not_utf_stop); + } } range->start += width; - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } width_max = (range->stop - range->start) + 1; } // while - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return F_none; } @@ -591,7 +729,9 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } f_status_t status = F_none; unsigned short width = 0; @@ -599,33 +739,43 @@ extern "C" { f_array_length_t width_max = (range->stop - range->start) + 1; while (string[range->start] == placeholder || (status = f_utf_is_whitespace(string + range->start, width_max)) == F_false) { + if (F_status_is_error(status)) { return status; } - if (string[range->start] == f_string_eol_s[0]) return F_none_eol; + if (string[range->start] == f_string_eol_s[0]) { + return F_none_eol; + } width = macro_f_utf_byte_width_is(string[range->start]); if (!width) { width = 1; } - // Do not operate on UTF-8 fragments that are not the first byte of the character. else if (width == 1) { + + // Do not operate on UTF-8 fragments that are not the first byte of the character. return F_status_set_error(F_complete_not_utf); } else { - if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop); + if (range->start + width > range->stop) { + return F_status_set_error(F_complete_not_utf_stop); + } } range->start += width; - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } width_max = (range->stop - range->start) + 1; } // while - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return F_none; } @@ -637,17 +787,19 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } const unsigned short seek_width = macro_f_utf_character_t_width(seek_to); f_status_t status = F_none; unsigned short width = 0; - f_array_length_t width_max = 0; for (; range->start <= range->stop; range->start += width) { + width_max = (range->stop - range->start) + 1; width = macro_f_utf_byte_width_is(string[range->start]); @@ -656,7 +808,9 @@ extern "C" { width = 1; if (seek_width == width) { - if (string[range->start] == seek_to) return F_none; + if (string[range->start] == seek_to) { + return F_none; + } } } // Do not operate on UTF-8 fragments that are not the first byte of the character. @@ -664,14 +818,22 @@ extern "C" { return F_status_set_error(F_complete_not_utf); } else { - if (range->start + width > range->stop) return F_status_set_error(F_complete_not_utf_stop); + if (range->start + width > range->stop) { + return F_status_set_error(F_complete_not_utf_stop); + } if (width == seek_width) { f_utf_character_t character = 0; + status = f_utf_char_to_character(string + range->start, width_max, &character); - if (F_status_is_error(status)) return status; - if (character == seek_to) return F_none; + if (F_status_is_error(status)) { + return status; + } + + if (character == seek_to) { + return F_none; + } } } } // for diff --git a/level_1/fl_string/c/string.h b/level_1/fl_string/c/string.h index ab6f1d3..41e9b4b 100644 --- a/level_1/fl_string/c/string.h +++ b/level_1/fl_string/c/string.h @@ -52,6 +52,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_compare_ @@ -83,6 +84,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_compare_except_ @@ -115,6 +117,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -144,6 +147,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -168,6 +172,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_compare_ @@ -195,6 +200,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_compare_except_ @@ -227,6 +233,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -259,6 +266,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -295,6 +303,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -324,6 +333,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -349,6 +359,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -378,6 +389,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -406,6 +418,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_partial_compare_ @@ -428,6 +441,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_partial_compare_dynamic_ @@ -459,6 +473,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_partial_compare_except_ @@ -488,6 +503,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_partial_compare_except_dynamic_ @@ -521,6 +537,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_partial_compare_except_string_ @@ -553,6 +570,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -587,6 +605,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -625,6 +644,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -655,6 +675,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_string_dynamic_partial_compare_string_ @@ -678,6 +699,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -709,6 +731,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_is_whitespace(). @@ -737,6 +760,7 @@ extern "C" { * F_none on success. * F_data_not_eos if source length is 0. * F_data_not_stop if range.start > range.stop. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -765,6 +789,7 @@ extern "C" { * F_none on success. * F_data_not_eos if source length is 0. * F_data_not_stop if range.start > range.stop. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. */ @@ -789,6 +814,7 @@ extern "C" { * F_none_stop on success, but stopped at end of range. * F_data_not on success, but there was no string data to seek. * F_data_not_stop on success, but the range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. @@ -818,6 +844,7 @@ extern "C" { * F_none_stop on success, but stopped at end of range. * F_data_not on success, but there was no string data to seek. * F_data_not_stop on success, but the range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_not (with error bit) on out of memory. @@ -847,6 +874,7 @@ extern "C" { * F_none_stop on success, but stopped at end of range. * F_data_not on success, but there was no string data to seek. * F_data_not_stop on success, but the range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_not (with error bit) on out of memory. @@ -876,6 +904,7 @@ extern "C" { * F_none_stop on success, but stopped at end of range. * F_data_not on success, but there was no string data to seek. * F_data_not_stop on success, but the range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. @@ -906,6 +935,7 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * @@ -936,6 +966,7 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * @@ -962,6 +993,7 @@ extern "C" { * F_none on success. * F_none_eol on success, but stopped at EOL. * F_data_not_stop if range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. @@ -990,6 +1022,7 @@ extern "C" { * F_none on success. * F_none_eol on success, but stopped at EOL. * F_data_not_stop if range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_not (with error bit) on out of memory. @@ -1019,6 +1052,7 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_stop on success, but stopped stop location. * F_data_not_stop if range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_not (with error bit) on out of memory. @@ -1047,6 +1081,7 @@ extern "C" { * F_none on success. * F_none_stop on success, but stopped stop location. * F_data_not_stop if range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_1/fl_utf/c/private-utf.c b/level_1/fl_utf/c/private-utf.c index d93b3ac..1117ae7 100644 --- a/level_1/fl_utf/c/private-utf.c +++ b/level_1/fl_utf/c/private-utf.c @@ -7,6 +7,7 @@ extern "C" { #if !defined(_di_fl_utf_string_compare_) || !defined(_di_fl_utf_string_dynamic_compare_) || !defined(_di_fl_utf_string_dynamic_partial_compare_) f_status_t private_fl_utf_string_compare(const f_utf_string_t string1, const f_utf_string_t string2, const f_array_length_t offset1, const f_array_length_t offset2, const f_array_length_t stop1, const f_array_length_t stop2) { + f_array_length_t i1 = offset1; f_array_length_t i2 = offset2; @@ -38,6 +39,7 @@ extern "C" { #if !defined(_di_fl_utf_string_compare_trim_) || !defined(_di_fl_utf_string_dynamic_compare_trim_) || !defined(_di_fl_utf_string_dynamic_partial_compare_trim_) f_status_t private_fl_utf_string_compare_trim(const f_utf_string_t string1, const f_utf_string_t string2, const f_array_length_t offset1, const f_array_length_t offset2, const f_array_length_t stop1, const f_array_length_t stop2) { + f_array_length_t i1 = offset1; f_array_length_t i2 = offset2; @@ -53,6 +55,7 @@ extern "C" { status = f_utf_character_is_whitespace(string1[i1]); if (F_status_is_error(status)) { + // ignore possibly invalid UTF-8 codes. if (F_status_set_fine(status) != F_maybe) { return status; @@ -72,6 +75,7 @@ extern "C" { status = f_utf_character_is_whitespace(string2[i2]); if (F_status_is_error(status)) { + // ignore possibly invalid UTF-8 codes. if (F_status_set_fine(status) != F_maybe) { return status; @@ -88,9 +92,10 @@ extern "C" { // size1 and size2 are to represent to total number of characters after trim. f_array_length_t size1 = 0; f_array_length_t size2 = 0; + f_array_length_t j = 0; // determine where the last non-whitespace is in string1. - for (f_array_length_t j = i1; j < stop1; j++) { + for (j = i1; j < stop1; j++) { // skip past NULL in string1. while (j < stop1 && !string1[j]) j++; @@ -112,7 +117,7 @@ extern "C" { } // for // determine where the last non-whitespace is in string2. - for (f_array_length_t j = i2; j < stop2; j++) { + for (j = i2; j < stop2; j++) { // skip past NULL in string2. while (j < stop2 && !string2[j]) j++; @@ -121,6 +126,7 @@ extern "C" { status = f_utf_character_is_whitespace(string2[j]); if (F_status_is_error(status)) { + // ignore possibly invalid UTF-8 codes. if (F_status_set_fine(status) != F_maybe) { return status; @@ -133,7 +139,9 @@ extern "C" { } } // for - if (size1 != size2) return F_equal_to_not; + if (size1 != size2) { + return F_equal_to_not; + } } for (; i1 < last1 && i2 < last2; i1++, i2++) { @@ -219,7 +227,9 @@ extern "C" { return status; } - if (status == F_true) return F_data_not; + if (status == F_true) { + return F_data_not; + } } return F_none; diff --git a/level_1/fl_utf/c/private-utf.h b/level_1/fl_utf/c/private-utf.h index 316f717..0fbb28b 100644 --- a/level_1/fl_utf/c/private-utf.h +++ b/level_1/fl_utf/c/private-utf.h @@ -36,6 +36,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * @see fl_utf_string_compare() @@ -67,6 +68,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * @see fl_utf_string_compare_trim() @@ -94,6 +96,7 @@ extern "C" { * @return * F_none on success. * F_data_not on success but only whitespace found. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index 9571db6..8df0ee8 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -59,8 +59,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return f_utf_string_append(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -74,8 +79,13 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!source.used) return F_data_not_eos; - if (range.start > range.stop) return F_data_not_stop; + if (!source.used) { + return F_data_not_eos; + } + + if (range.start > range.stop) { + return F_data_not_stop; + } return f_utf_string_append_nulless(source.string + range.start, (range.stop - range.start) + 1, destination); } @@ -88,8 +98,13 @@ extern "C" { if (buffer.used <= range->start) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used) return F_data_not_eos; - if (range->start > range->stop) return F_data_not_stop; + if (!buffer.used) { + return F_data_not_eos; + } + + if (range->start > range->stop) { + return F_data_not_stop; + } f_utf_character_t seek_to_character = seek_to_this << 24; @@ -109,8 +124,13 @@ extern "C" { return F_status_set_error(F_utf); } - if (range->start >= buffer.used) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (range->start >= buffer.used) { + return F_none_eos; + } + + if (range->start > range->stop) { + return F_none_stop; + } } // while return F_none; @@ -124,8 +144,13 @@ extern "C" { if (buffer.used <= range->start) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used) return F_data_not_eos; - if (range->start > range->stop) return F_data_not_stop; + if (!buffer.used) { + return F_data_not_eos; + } + + if (range->start > range->stop) { + return F_data_not_stop; + } f_status_t status = F_none; @@ -135,8 +160,13 @@ extern "C" { while (buffer.string[range->start] == placeholder || (status = f_utf_character_is_graph(buffer.string[range->start])) == F_false) { - if (F_status_is_error(status)) return status; - if (buffer.string[range->start] == f_utf_character_t_eol) return F_none_eol; + if (F_status_is_error(status)) { + return status; + } + + if (buffer.string[range->start] == f_utf_character_t_eol) { + return F_none_eol; + } range->start++; @@ -144,11 +174,18 @@ extern "C" { return F_status_set_error(F_utf); } - if (range->start >= buffer.used) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (range->start >= buffer.used) { + return F_none_eos; + } + + if (range->start > range->stop) { + return F_none_stop; + } } // while - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return F_none; } @@ -198,8 +235,13 @@ extern "C" { if (buffer.used <= range->start) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!buffer.used) return F_data_not_eos; - if (range->start > range->stop) return F_data_not_stop; + if (!buffer.used) { + return F_data_not_eos; + } + + if (range->start > range->stop) { + return F_data_not_stop; + } f_utf_character_t seek_to_character = seek_to_this << 24; @@ -208,14 +250,20 @@ extern "C" { } while (buffer.string[range->start] != seek_to_character) { + range->start++; if (macro_f_utf_character_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); } - if (range->start >= buffer.used) return F_none_eos; - if (range->start > range->stop) return F_none_stop; + if (range->start >= buffer.used) { + return F_none_eos; + } + + if (range->start > range->stop) { + return F_none_stop; + } } // while return F_none; @@ -228,15 +276,22 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } f_array_length_t begin = 0; f_array_length_t end = length - 1; f_status_t status = private_fl_utf_string_rip_find_range(source, &begin, &end); - if (F_status_is_error(status)) return status; - if (status == F_data_not) return status; + if (F_status_is_error(status)) { + return status; + } + + if (status == F_data_not) { + return status; + } return f_utf_string_append(source + begin, (end - begin) + 1, destination); } @@ -248,15 +303,22 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!length) return F_data_not_eos; + if (!length) { + return F_data_not_eos; + } f_array_length_t begin = 0; f_array_length_t end = length - 1; f_status_t status = private_fl_utf_string_rip_find_range(source, &begin, &end); - if (F_status_is_error(status)) return status; - if (status == F_data_not) return status; + if (F_status_is_error(status)) { + return status; + } + + if (status == F_data_not) { + return status; + } return f_utf_string_append_nulless(source + begin, (end - begin) + 1, destination); } @@ -268,7 +330,9 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } f_utf_character_t seek_to_character = seek_to_this << 24; @@ -278,8 +342,13 @@ extern "C" { return F_status_set_error(F_utf); } - if (string[range->start] == f_utf_character_t_eol) return F_none_eol; - if (string[range->start] == seek_to_character) return F_none; + if (string[range->start] == f_utf_character_t_eol) { + return F_none_eol; + } + + if (string[range->start] == seek_to_character) { + return F_none; + } } // for return F_none_stop; @@ -292,7 +361,9 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } f_status_t status = F_none; @@ -302,8 +373,13 @@ extern "C" { while (string[range->start] == placeholder || (status = f_utf_character_is_graph(string[range->start])) == F_false) { - if (F_status_is_error(status)) return status; - if (string[range->start] == f_utf_character_t_eol) return F_none_eol; + if (F_status_is_error(status)) { + return status; + } + + if (string[range->start] == f_utf_character_t_eol) { + return F_none_eol; + } range->start++; @@ -311,10 +387,14 @@ extern "C" { return F_status_set_error(F_utf); } - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } } // while - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return F_none; } @@ -326,16 +406,25 @@ extern "C" { if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (range->start > range->stop) return F_data_not_stop; + if (range->start > range->stop) { + return F_data_not_stop; + } f_status_t status = F_none; - if (macro_f_utf_character_t_width_is(string[range->start]) == 1) return F_status_set_error(F_utf); + if (macro_f_utf_character_t_width_is(string[range->start]) == 1) { + return F_status_set_error(F_utf); + } while (string[range->start] == placeholder || (status = f_utf_character_is_graph(string[range->start])) == F_true) { - if (F_status_is_error(status)) return status; - if (string[range->start] == f_utf_character_t_eol) return F_none_eol; + if (F_status_is_error(status)) { + return status; + } + + if (string[range->start] == f_utf_character_t_eol) { + return F_none_eol; + } range->start++; @@ -343,10 +432,14 @@ extern "C" { return F_status_set_error(F_utf); } - if (range->start > range->stop) return F_none_stop; + if (range->start > range->stop) { + return F_none_stop; + } } // while - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return F_none; } diff --git a/level_1/fl_utf/c/utf.h b/level_1/fl_utf/c/utf.h index 1cd7443..90a9656 100644 --- a/level_1/fl_utf/c/utf.h +++ b/level_1/fl_utf/c/utf.h @@ -52,6 +52,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_utf_string_compare_ @@ -77,6 +78,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_character_is_whitespace(). @@ -101,6 +103,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. */ @@ -123,6 +126,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if a character in the string is an invalid UTF-8 character. * @@ -152,6 +156,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_utf_string_dynamic_partial_compare_ @@ -177,6 +182,7 @@ extern "C" { * @return * F_equal_to when both strings equal. * F_equal_to_not when both strings do not equal. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_utf_character_is_whitespace(). @@ -204,6 +210,7 @@ extern "C" { * F_none on success. * F_data_not_eos if source length is 0. * F_data_not_stop if range.start > range.stop. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -231,6 +238,7 @@ extern "C" { * F_none on success. * F_data_not_eos if source length is 0. * F_data_not_stop if range.start > range.stop. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. */ @@ -255,6 +263,7 @@ extern "C" { * F_none_eos on success, but stopped at end of buffer. * F_data_not_eos if buffer length is 0. * F_data_not_stop if range.start > range.stop. + * * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ @@ -278,6 +287,7 @@ extern "C" { * F_none_eos on success, but stopped at end of buffer. * F_data_not_eos if buffer length is 0. * F_data_not_stop if range.start > range.stop. + * * F_parameter (with error bit) if a parameter is invalid * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. * @@ -306,6 +316,7 @@ extern "C" { * F_none_stop on success, but stopped stop location. * F_data_not_eos if buffer length is 0. * F_data_not_stop if range.start > range.stop. + * * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. * @@ -334,6 +345,7 @@ extern "C" { * F_none_stop on success, but stopped stop location. * F_data_not_eos if buffer length is 0. * F_data_not_stop if range.start > range.stop. + * * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. * F_parameter (with error bit) if a parameter is invalid. */ @@ -357,6 +369,7 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * @@ -386,6 +399,7 @@ extern "C" { * @return * F_none on success. * F_data_not_eos if source length is 0. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * @@ -413,6 +427,7 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_eos on success, but stopped at end of buffer. * F_data_not_stop if range.start > range.stop. + * * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ @@ -435,6 +450,7 @@ extern "C" { * F_none on success. * F_none_eol on success, but stopped at EOL. * F_data_not_stop if range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_not (with error bit) on out of memory. @@ -465,6 +481,7 @@ extern "C" { * F_none_eol on success, but stopped at EOL. * F_none_stop on success, but stopped stop location. * F_data_not_stop if range.start > range.stop. + * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. * F_memory_not (with error bit) on out of memory. @@ -494,6 +511,7 @@ extern "C" { * F_none on success. * F_none_eos on success, but stopped at end of buffer. * F_none_stop on success, but stopped stop location. + * * F_data_not_stop if range.start > range.stop. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. diff --git a/level_1/fl_utf_file/c/private-utf_file.c b/level_1/fl_utf_file/c/private-utf_file.c index 811dddd..1626ddb 100644 --- a/level_1/fl_utf_file/c/private-utf_file.c +++ b/level_1/fl_utf_file/c/private-utf_file.c @@ -184,6 +184,7 @@ extern "C" { if (*written + write_size > write_max) { write_size = write_max - *written; } + } while (*written < write_max); return F_none; diff --git a/level_1/fl_utf_file/c/private-utf_file.h b/level_1/fl_utf_file/c/private-utf_file.h index 39d6554..fe774ed 100644 --- a/level_1/fl_utf_file/c/private-utf_file.h +++ b/level_1/fl_utf_file/c/private-utf_file.h @@ -64,6 +64,7 @@ extern "C" { * F_none_eos on success but range.stop exceeded buffer.used (only wrote up to buffer.used). * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). * F_complete_not_utf_stop if max write was reached but was unable to completely write a given UTF-8 block (incomplete UTF-8 is not written, not even partially). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file_closed (with error bit) if file is not open. diff --git a/level_1/fl_utf_file/c/utf_file.c b/level_1/fl_utf_file/c/utf_file.c index a04c712..924bf2a 100644 --- a/level_1/fl_utf_file/c/utf_file.c +++ b/level_1/fl_utf_file/c/utf_file.c @@ -12,8 +12,13 @@ extern "C" { if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (file.id < 0) return F_status_set_error(F_file); - if (!file.id) return F_status_set_error(F_file_closed); + if (file.id < 0) { + return F_status_set_error(F_file); + } + + if (!file.id) { + return F_status_set_error(F_file_closed); + } f_status_t status = F_none; @@ -133,8 +138,13 @@ extern "C" { if (buffer->used > buffer->size) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (file.id < 0) return F_status_set_error(F_file); - if (!file.id) return F_status_set_error(F_file_closed); + if (file.id < 0) { + return F_status_set_error(F_file); + } + + if (!file.id) { + return F_status_set_error(F_file_closed); + } f_status_t status = F_none; @@ -201,18 +211,26 @@ extern "C" { if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id < 0) return F_status_set_error(F_file); - if (!file.id) return F_status_set_error(F_file_closed); + if (file.id < 0) { + return F_status_set_error(F_file); + } + + if (!file.id) { + return F_status_set_error(F_file_closed); + } if (!buffer.used) { *written = 0; + return F_data_not; } const f_status_t status = private_fl_utf_file_write_until(file, buffer.string, buffer.used, written); if (F_status_is_error(status)) return F_status_set_error(status); - if (status == F_none && *written == buffer.used) return F_none_eos; + if (status == F_none && *written == buffer.used) { + return F_none_eos; + } return status; } @@ -225,11 +243,17 @@ extern "C" { if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id < 0) return F_status_set_error(F_file); - if (!file.id) return F_status_set_error(F_file_closed); + if (file.id < 0) { + return F_status_set_error(F_file); + } + + if (!file.id) { + return F_status_set_error(F_file_closed); + } if (!buffer.used) { *written = 0; + return F_data_not; } @@ -242,7 +266,9 @@ extern "C" { const f_status_t status = private_fl_utf_file_write_until(file, buffer.string, write_max, written); if (F_status_is_error(status)) return F_status_set_error(status); - if (status == F_none && *written == buffer.used) return F_none_eos; + if (status == F_none && *written == buffer.used) { + return F_none_eos; + } return status; } @@ -255,11 +281,17 @@ extern "C" { if (buffer.used > buffer.size) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id < 0) return F_status_set_error(F_file); - if (!file.id) return F_status_set_error(F_file_closed); + if (file.id < 0) { + return F_status_set_error(F_file); + } + + if (!file.id) { + return F_status_set_error(F_file_closed); + } if (!buffer.used || !total) { *written = 0; + return F_data_not; } @@ -272,7 +304,9 @@ extern "C" { const f_status_t status = private_fl_utf_file_write_until(file, buffer.string, write_max, written); if (F_status_is_error(status)) return F_status_set_error(status); - if (status == F_none && *written == buffer.used) return F_none_eos; + if (status == F_none && *written == buffer.used) { + return F_none_eos; + } return status; } @@ -287,11 +321,17 @@ extern "C" { if (range.start >= buffer.used) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (file.id < 0) return F_status_set_error(F_file); - if (!file.id) return F_status_set_error(F_file_closed); + if (file.id < 0) { + return F_status_set_error(F_file); + } + + if (!file.id) { + return F_status_set_error(F_file_closed); + } if (!buffer.used) { *written = 0; + return F_data_not; } @@ -306,8 +346,13 @@ extern "C" { if (F_status_is_error(status)) return F_status_set_error(status); if (status == F_none) { - if (range.start + *written == total) return F_none_stop; - if (range.start + *written == buffer.used) return F_none_eos; + if (range.start + *written == total) { + return F_none_stop; + } + + if (range.start + *written == buffer.used) { + return F_none_eos; + } } return status; diff --git a/level_1/fl_utf_file/c/utf_file.h b/level_1/fl_utf_file/c/utf_file.h index d710b10..76f137d 100644 --- a/level_1/fl_utf_file/c/utf_file.h +++ b/level_1/fl_utf_file/c/utf_file.h @@ -40,6 +40,7 @@ extern "C" { * @return * F_none on success. * F_none_eof on success and EOF was reached. + * * F_block (with error bit) if file descriptor is set to non-block and the read would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file (with error bit) if file descriptor is in an error state. @@ -73,6 +74,7 @@ extern "C" { * @return * F_none on success. * F_none_eof on success and EOF was reached. + * * F_block (with error bit) if file descriptor is set to non-block and the read would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file (with error bit) if file descriptor is in an error state. @@ -107,6 +109,7 @@ extern "C" { * @return * F_none on success. * F_none_eof on success and EOF was reached. + * * F_block (with error bit) if file descriptor is set to non-block and the read would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file (with error bit) if file descriptor is in an error state. @@ -141,6 +144,7 @@ extern "C" { * F_none_eos on success but range.stop exceeded buffer.used (only wrote up to buffer.used). * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). * F_complete_not_utf_stop if max write was reached but was unable to completely write a given UTF-8 block (incomplete UTF-8 is not written, not even partially). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file (with error bit) if file descriptor is in an error state. @@ -175,6 +179,7 @@ extern "C" { * F_none_eos on success but range.stop exceeded buffer.used (only wrote up to buffer.used). * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). * F_complete_not_utf_stop if max write was reached but was unable to completely write a given UTF-8 block (incomplete UTF-8 is not written, not even partially). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file (with error bit) if file descriptor is in an error state. @@ -209,6 +214,7 @@ extern "C" { * F_none_eos on success but range.stop exceeded buffer.used (only wrote up to buffer.used). * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). * F_complete_not_utf_stop if max write was reached but was unable to completely write a given UTF-8 block (incomplete UTF-8 is not written, not even partially). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file (with error bit) if file descriptor is in an error state. @@ -243,6 +249,7 @@ extern "C" { * F_none_eos on success but range.stop exceeded buffer.used (only wrote up to buffer.used). * F_none_stop on success but no data was written (written == 0) (not an error and often happens if file type is not a regular file). * F_complete_not_utf_stop if max write was reached but was unable to completely write a given UTF-8 block (incomplete UTF-8 is not written, not even partially). + * * F_block (with error bit) if file descriptor is set to non-block and the write would result in a blocking operation. * F_buffer (with error bit) if the buffer is invalid. * F_file (with error bit) if file descriptor is in an error state. diff --git a/level_2/fll_control_group/c/control_group.h b/level_2/fll_control_group/c/control_group.h index 001990d..2fd9065 100644 --- a/level_2/fll_control_group/c/control_group.h +++ b/level_2/fll_control_group/c/control_group.h @@ -41,6 +41,7 @@ extern "C" { * * @return * F_none on success. + * * F_directory_not (with error bit) if control_group.path does not exist. * * Errors (with error bit) from: f_directory_exists(). diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 4fa5631..f56d99d 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -18,6 +18,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_string_dynamic_t_delete_simple(argument); + return status; } } @@ -26,6 +27,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_string_dynamic_t_delete_simple(argument); + return status; } @@ -399,10 +401,7 @@ extern "C" { close(descriptors[0]); const f_status_t status = private_fll_execute_as_child(*as, parameter, (int *) result); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } const int code = direct ? execv(program, fixed_arguments) : execvp(program, fixed_arguments); @@ -569,10 +568,7 @@ extern "C" { if (as) { const f_status_t status = private_fll_execute_as_child(*as, parameter, (int *) result); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } const int code = direct ? execv(program, fixed_arguments) : execvp(program, fixed_arguments); diff --git a/level_2/fll_file/c/file.c b/level_2/fll_file/c/file.c index c9367fe..b3e5bed 100644 --- a/level_2/fll_file/c/file.c +++ b/level_2/fll_file/c/file.c @@ -44,10 +44,7 @@ extern "C" { if (status == F_true) { status = fl_directory_clone(source, destination, source_length, destination_length, F_true, recurse); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; status = f_directory_remove(source, recurse.depth_max, F_false); @@ -57,10 +54,7 @@ extern "C" { } else { status = f_file_clone(source, destination, F_true, recurse.size_block, recurse.exclusive); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; status = f_file_remove(source); diff --git a/level_2/fll_file/c/file.h b/level_2/fll_file/c/file.h index 491cc26..cda3dc8 100644 --- a/level_2/fll_file/c/file.h +++ b/level_2/fll_file/c/file.h @@ -47,6 +47,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_mode (with error bit) if the current user does not have access to assign the file mode. * F_directory (with error bit) on invalid directory. @@ -92,6 +93,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_buffer (with error bit) if the buffer is invalid. * F_busy (with error bit) if filesystem is too busy to perform write. @@ -150,6 +152,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_group (with error bit) if the current user does not have access to assign the specified group. * F_access_owner (with error bit) if the current user does not have access to assign the specified owner. diff --git a/level_2/fll_file/c/private-file.c b/level_2/fll_file/c/private-file.c index 93d7f61..3fc4119 100644 --- a/level_2/fll_file/c/private-file.c +++ b/level_2/fll_file/c/private-file.c @@ -22,6 +22,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_directory_listing_t_delete_simple(listing); + return status; } @@ -119,6 +120,7 @@ extern "C" { if (F_status_is_error(status)) { macro_f_directory_listing_t_delete_simple(listing); + return status; } diff --git a/level_2/fll_file/c/private-file.h b/level_2/fll_file/c/private-file.h index f68784d..abefd0a 100644 --- a/level_2/fll_file/c/private-file.h +++ b/level_2/fll_file/c/private-file.h @@ -31,6 +31,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_mode (with error bit) if the current user does not have access to assign the file mode. * F_directory (with error bit) on invalid directory. @@ -69,6 +70,7 @@ extern "C" { * * @return * F_none on success. + * * F_access_denied (with error bit) on access denied. * F_access_group (with error bit) if the current user does not have access to assign the specified group. * F_access_owner (with error bit) if the current user does not have access to assign the specified owner. diff --git a/level_2/fll_fss/c/fss.h b/level_2/fll_fss/c/fss.h index f0b303c..2e83f1b 100644 --- a/level_2/fll_fss/c/fss.h +++ b/level_2/fll_fss/c/fss.h @@ -41,7 +41,9 @@ extern "C" { * @return * F_none on success * FL_fss_header_not if no header is found. + * * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. + * * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. * * Errors (with error bit) from: fl_conversion_string_to_hexidecimal_unsigned(). @@ -61,7 +63,9 @@ extern "C" { * @return * F_none on success. * FL_fss_header_not if no header is found. + * * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. @@ -108,6 +112,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). @@ -154,6 +159,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). @@ -202,6 +208,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). @@ -252,6 +259,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). @@ -305,6 +313,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). @@ -356,6 +365,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). @@ -409,6 +419,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). @@ -459,6 +470,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). @@ -507,6 +519,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). @@ -551,6 +564,7 @@ extern "C" { * @return * F_none on success. * F_data_not when there is no buffer, objects or contents to process. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_string_compare_trim(). diff --git a/level_2/fll_fss/c/fss_basic.c b/level_2/fll_fss/c/fss_basic.c index c37c228..eee76e2 100644 --- a/level_2/fll_fss/c/fss_basic.c +++ b/level_2/fll_fss/c/fss_basic.c @@ -108,8 +108,13 @@ extern "C" { // If at least some valid object was found, then return F_none equivelents. if (objects->used > initial_used) { - if (status == F_data_not_eos) return F_none_eos; - if (status == F_data_not_stop) return F_none_stop; + if (status == F_data_not_eos) { + return F_none_eos; + } + + if (status == F_data_not_stop) { + return F_none_stop; + } } return status; @@ -141,6 +146,7 @@ extern "C" { if (objects_quoted) { objects_quoted->used++; } + } while (range->start < f_array_length_t_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 9b083fb..a76c189 100644 --- a/level_2/fll_fss/c/fss_basic.h +++ b/level_2/fll_fss/c/fss_basic.h @@ -57,6 +57,7 @@ extern "C" { * F_data_not_eol if there is no data to write and EOL was reached (@todo: review related code and detemine what this is doing). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_number_overflow (with error bit) if the maximimum buffer size is reached. @@ -89,6 +90,7 @@ extern "C" { * F_none_stop on success after reaching stopping point. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_2/fll_fss/c/fss_basic_list.c b/level_2/fll_fss/c/fss_basic_list.c index 1953e17..6a5fbf8 100644 --- a/level_2/fll_fss/c/fss_basic_list.c +++ b/level_2/fll_fss/c/fss_basic_list.c @@ -82,6 +82,7 @@ extern "C" { contents->array[contents->used].used++; objects->used++; contents->used++; + return status; } else if (status == F_data_not_eos || status == F_data_not_stop) { @@ -119,6 +120,7 @@ extern "C" { objects->used++; contents->used++; + } while (range->start < f_array_length_t_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 d45cb6c..2767a80 100644 --- a/level_2/fll_fss/c/fss_basic_list.h +++ b/level_2/fll_fss/c/fss_basic_list.h @@ -56,6 +56,7 @@ extern "C" { * F_data_not_eol if there is no data to write and EOL was reached (@todo: review related code and detemine what this is doing). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_number_overflow (with error bit) if the maximimum buffer size is reached. @@ -88,6 +89,7 @@ extern "C" { * F_none_stop on success after reaching stopping point. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_2/fll_fss/c/fss_embedded_list.c b/level_2/fll_fss/c/fss_embedded_list.c index 36ac201..93054ca 100644 --- a/level_2/fll_fss/c/fss_embedded_list.c +++ b/level_2/fll_fss/c/fss_embedded_list.c @@ -64,13 +64,13 @@ extern "C" { found_data = F_true; status = fl_fss_embedded_list_content_read(buffer, range, nest, contents_delimits ? contents_delimits : objects_delimits, comments); - break; } else if (status == FL_fss_found_object_content_not) { found_data = F_true; break; } + } while (status == FL_fss_found_object_not); if (status == F_none_eos || status == F_none_stop) { @@ -80,8 +80,13 @@ extern "C" { // If at least some valid object was found, then return F_none equivalents. if (nest->depth[0].used > initial_used) { - if (status == F_data_not_eos) return F_none_eos; - if (status == F_data_not_stop) return F_none_stop; + if (status == F_data_not_eos) { + return F_none_eos; + } + + if (status == F_data_not_stop) { + return F_none_stop; + } } return status; @@ -90,8 +95,13 @@ extern "C" { // If at least some valid object was found, then return F_none equivalents. if (nest->depth[0].used > initial_used) { - if (status == F_data_not_eos) return F_none_eos; - if (status == F_data_not_stop) return F_none_stop; + if (status == F_data_not_eos) { + return F_none_eos; + } + + if (status == F_data_not_stop) { + return F_none_stop; + } } return status; @@ -99,14 +109,16 @@ extern "C" { else if (status != FL_fss_found_object && status != FL_fss_found_content && status != FL_fss_found_content_not && status != FL_fss_found_object_content_not) { return status; } - // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. else if (range->start >= range->stop || range->start >= buffer.used) { + + // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. if (range->start >= buffer.used) { return F_none_eos; } return F_none_stop; } + } while (range->start < f_array_length_t_size); return F_status_is_error(F_number_overflow); diff --git a/level_2/fll_fss/c/fss_embedded_list.h b/level_2/fll_fss/c/fss_embedded_list.h index cbd18ab..cd01980 100644 --- a/level_2/fll_fss/c/fss_embedded_list.h +++ b/level_2/fll_fss/c/fss_embedded_list.h @@ -53,6 +53,8 @@ extern "C" { * F_data_not_eol if there is no data to write and EOL was reached (@todo: review related code and detemine what this is doing). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. + * FL_fss_found_object_content_not on success and object was found but no content was found (start location is at end of object). + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. @@ -64,7 +66,6 @@ extern "C" { * F_terminated_not_nest_stop (with error bit) if stop location is reached while inside a nested list before a closing bracket is found (object was found). * F_terminated_not_stop (with error bit) if stop location is reached before a closing bracket is found (object was found). * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. - * FL_fss_found_object_content_not on success and object was found but no content was found (start location is at end of object). * * Errors (with error bit) from: fl_fss_embedded_list_content_read(). * Errors (with error bit) from: fl_fss_embedded_list_object_read(). @@ -97,6 +98,7 @@ extern "C" { * F_none_stop on success after reaching stopping point. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_2/fll_fss/c/fss_extended.c b/level_2/fll_fss/c/fss_extended.c index 93511e2..200470d 100644 --- a/level_2/fll_fss/c/fss_extended.c +++ b/level_2/fll_fss/c/fss_extended.c @@ -23,7 +23,6 @@ extern "C" { f_fss_quotes_t *quoted_content = 0; do { - if (objects->used == objects->size) { macro_f_fss_objects_t_increase(status2, (*objects)); if (F_status_is_error(status2)) return status2; @@ -43,7 +42,6 @@ extern "C" { } do { - if (objects_quoted) { quoted_object = &objects_quoted->array[objects_quoted->used]; } @@ -100,10 +98,7 @@ extern "C" { } status = fl_fss_extended_content_read(buffer, range, &contents->array[contents->used], quoted_content, contents_delimits ? contents_delimits : objects_delimits); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; break; } @@ -135,8 +130,13 @@ extern "C" { // If at least some valid object was found, then return F_none equivelents. if (objects->used > initial_used) { - if (status == F_data_not_eos) return F_none_eos; - if (status == F_data_not_stop) return F_none_stop; + if (status == F_data_not_eos) { + return F_none_eos; + } + + if (status == F_data_not_stop) { + return F_none_stop; + } } return status; @@ -144,8 +144,9 @@ extern "C" { else if (status != FL_fss_found_object && status != FL_fss_found_content && status != FL_fss_found_content_not && status != FL_fss_found_object_content_not && status != F_terminated_not_group) { return status; } - // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. else if (range->start >= range->stop || range->start >= buffer.used) { + + // When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop. if (status == FL_fss_found_object || status == FL_fss_found_content || status == FL_fss_found_content_not || status == FL_fss_found_object_content_not || status == F_terminated_not_group) { objects->used++; contents->used++; @@ -160,12 +161,16 @@ extern "C" { } if (range->start >= buffer.used) { - if (status == F_terminated_not_group) return F_terminated_not_group_eos; + if (status == F_terminated_not_group) { + return F_terminated_not_group_eos; + } return F_none_eos; } - if (status == F_terminated_not_group) return F_terminated_not_group_stop; + if (status == F_terminated_not_group) { + return F_terminated_not_group_stop; + } return F_none_stop; } @@ -180,6 +185,7 @@ extern "C" { if (contents_quoted) { contents_quoted->used++; } + } while (range->start < f_array_length_t_size); return F_status_is_error(F_number_overflow); @@ -220,10 +226,7 @@ extern "C" { } status = fl_fss_extended_content_write_string(contents.array[i], quote, complete, &range, destination); - - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; } // for } diff --git a/level_2/fll_fss/c/fss_extended.h b/level_2/fll_fss/c/fss_extended.h index 541bc05..10a1ec7 100644 --- a/level_2/fll_fss/c/fss_extended.h +++ b/level_2/fll_fss/c/fss_extended.h @@ -58,6 +58,7 @@ extern "C" { * F_data_not_stop no data to write due start location being greater than stop location. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_eol if there is no data to write and EOL was reached (@todo: review related code and detemine what this is doing). + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * F_memory_not (with error bit) on out of memory. @@ -90,6 +91,7 @@ extern "C" { * F_none_stop on success after reaching stopping point. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_2/fll_fss/c/fss_extended_list.c b/level_2/fll_fss/c/fss_extended_list.c index aeb057c..cf2132b 100644 --- a/level_2/fll_fss/c/fss_extended_list.c +++ b/level_2/fll_fss/c/fss_extended_list.c @@ -82,6 +82,7 @@ extern "C" { contents->array[contents->used].used++; objects->used++; contents->used++; + return status; } else if (status == F_data_not_eos || status == F_data_not_stop) { @@ -119,6 +120,7 @@ extern "C" { objects->used++; contents->used++; + } while (range->start < f_array_length_t_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 4b0f407..da8690b 100644 --- a/level_2/fll_fss/c/fss_extended_list.h +++ b/level_2/fll_fss/c/fss_extended_list.h @@ -57,6 +57,8 @@ extern "C" { * F_data_not_eol if there is no data to write and EOL was reached (@todo: review related code and detemine what this is doing). * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. + * FL_fss_found_object_content_not on success and object was found but no content was found (start location is at end of object). + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_complete_not_utf_eos (with error bit) if the end of buffer is reached before the complete UTF-8 character can be processed. * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed. @@ -68,7 +70,6 @@ extern "C" { * F_terminated_not_nest_stop (with error bit) if stop location is reached while inside a nested list before a closing bracket is found (object was found). * F_terminated_not_stop (with error bit) if stop location is reached before a closing bracket is found (object was found). * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. - * FL_fss_found_object_content_not on success and object was found but no content was found (start location is at end of object). * * Errors (with error bit) from: fl_fss_extended_list_content_read(). * Errors (with error bit) from: fl_fss_extended_list_object_read(). @@ -101,6 +102,7 @@ extern "C" { * F_none_stop on success after reaching stopping point. * F_data_not_eos no data to write due start location being greater than or equal to buffer size. * F_data_not_stop no data to write due start location being greater than stop location. + * * F_complete_not_utf (with error bit) is returned on failure to read/process a UTF-8 character due to the character being potentially incomplete. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. diff --git a/level_2/fll_fss/c/fss_status.c b/level_2/fll_fss/c/fss_status.c index 3ebec8d..f67771c 100644 --- a/level_2/fll_fss/c/fss_status.c +++ b/level_2/fll_fss/c/fss_status.c @@ -18,7 +18,9 @@ extern "C" { } // Numbers are not valid status code strings. - if ((status = f_conversion_character_is_decimal(string[0])) == F_true) { + status = f_conversion_character_is_decimal(string[0]); + + if (status == F_true) { return F_status_set_error(F_data); } @@ -29,11 +31,13 @@ extern "C" { #ifndef _di_fll_fss_status_error_ if (fl_string_compare(string, fll_fss_status_string_format, length, fll_fss_status_string_format_length) == F_equal_to) { *code = FL_fss_format; + return F_none; } if (fl_string_compare(string, fll_fss_status_string_format_eos, length, fll_fss_status_string_format_eos_length) == F_equal_to) { *code = FL_fss_format_eos; + return F_none; } #endif // _di_fll_fss_status_error_ @@ -41,21 +45,25 @@ extern "C" { #ifndef _di_fll_fss_status_warning_ if (fl_string_compare(string, fll_fss_status_string_header_not, length, fll_fss_status_string_header_not_length) == F_equal_to) { *code = FL_fss_header_not; + return F_none; } if (fl_string_compare(string, fll_fss_status_string_accepted_invalid, length, fll_fss_status_string_accepted_invalid_length) == F_equal_to) { *code = FL_fss_accepted_invalid; + return F_none; } if (fl_string_compare(string, fll_fss_status_string_header_not_eos, length, fll_fss_status_string_header_not_eos_length) == F_equal_to) { *code = FL_fss_header_not_eos; + return F_none; } if (fl_string_compare(string, fll_fss_status_string_accepted_invalid_eos, length, fll_fss_status_string_accepted_invalid_eos_length) == F_equal_to) { *code = FL_fss_accepted_invalid_eos; + return F_none; } #endif // _di_fll_fss_status_warning_ @@ -63,26 +71,31 @@ extern "C" { #ifndef _di_fll_fss_status_success_ if (fl_string_compare(string, fll_fss_status_string_found_object, length, fll_fss_status_string_found_object_length) == F_equal_to) { *code = FL_fss_found_object; + return F_none; } if (fl_string_compare(string, fll_fss_status_string_found_content, length, fll_fss_status_string_found_content_length) == F_equal_to) { *code = FL_fss_found_content; + return F_none; } if (fl_string_compare(string, fll_fss_status_string_found_object_not, length, fll_fss_status_string_found_object_not_length) == F_equal_to) { *code = FL_fss_found_object_not; + return F_none; } if (fl_string_compare(string, fll_fss_status_string_found_content_not, length, fll_fss_status_string_found_content_not_length) == F_equal_to) { *code = FL_fss_found_content_not; + return F_none; } if (fl_string_compare(string, fll_fss_status_string_found_object_content_not, length, fll_fss_status_string_found_object_content_not_length) == F_equal_to) { *code = FL_fss_found_object_content_not; + return F_none; } #endif // _di_fll_fss_status_success_ @@ -90,17 +103,20 @@ extern "C" { #ifndef _di_fll_fss_status_codes_ if (fl_string_compare(string, fll_fss_status_string_found_comment, length, fll_fss_status_string_found_comment_length) == F_equal_to) { *code = FL_fss_found_object; + return F_none; } #endif // _di_fll_fss_status_codes_ if (fl_string_compare(string, fll_fss_status_string_status_code_first, length, fll_fss_status_string_status_code_first_length) == F_equal_to) { *code = FL_fss_status_code_first; + return F_none; } if (fl_string_compare(string, fll_fss_status_string_status_code_last, length, fll_fss_status_string_status_code_last_length) == F_equal_to) { *code = FL_fss_status_code_last; + return F_none; } diff --git a/level_2/fll_fss/c/fss_status.h b/level_2/fll_fss/c/fss_status.h index 99ae9ff..2c0aced 100644 --- a/level_2/fll_fss/c/fss_status.h +++ b/level_2/fll_fss/c/fss_status.h @@ -96,6 +96,7 @@ extern "C" { * @return * F_none on success. * F_data_not if string is empty. + * * F_data (with error bit) if not found. * F_parameter (with error bit) if a parameter is invalid. * @@ -115,6 +116,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: fl_status_to_string(). diff --git a/level_2/fll_fss/c/private-fss.c b/level_2/fll_fss/c/private-fss.c index addc98c..9ecf4b7 100644 --- a/level_2/fll_fss/c/private-fss.c +++ b/level_2/fll_fss/c/private-fss.c @@ -7,9 +7,11 @@ extern "C" { #if !defined(_di_fll_fss_identify_) || !defined(_di_fll_fss_identify_file_) f_status_t private_fll_fss_identify(const f_string_static_t buffer, f_fss_header_t *header) { + register f_array_length_t i = 0; if (buffer.used < 10) { + // "# fss-0000" is always at least 10 characters. return FL_fss_header_not; } @@ -102,6 +104,7 @@ extern "C" { i++; if (f_conversion_character_is_hexidecimal(buffer.string[i]) == F_true) { + // @todo this needs to be changed to support sub-headers (maybe something like FL_fss_accepted_additional). i++; diff --git a/level_2/fll_fss/c/private-fss.h b/level_2/fll_fss/c/private-fss.h index f429627..a85921c 100644 --- a/level_2/fll_fss/c/private-fss.h +++ b/level_2/fll_fss/c/private-fss.h @@ -28,7 +28,9 @@ extern "C" { * @return * F_none on success * FL_fss_header_not if no header is found. + * * FL_fss_accepted_invalid (with warning bit) if header is technically invalid but can be identified. + * * FL_fss_header_not (with error bit) if the an error occurred prior to identifying a valid header. * * Errors (with error bit) from: fl_conversion_string_to_hexidecimal_unsigned(). diff --git a/level_2/fll_iki/c/iki.c b/level_2/fll_iki/c/iki.c index d8ed16b..0ce214f 100644 --- a/level_2/fll_iki/c/iki.c +++ b/level_2/fll_iki/c/iki.c @@ -33,33 +33,33 @@ extern "C" { } #endif // _di_fll_iki_content_partial_escape_ -#ifndef _di_fll_iki_content_escape_un_ - f_status_t fll_iki_content_escape_un(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *unescaped) { +#ifndef _di_fll_iki_content_partial_unescape_ + f_status_t fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) { #ifndef _di_level_2_parameter_checking_ if (content.used > content.size) return F_status_set_error(F_parameter); + if (range.start > range.stop) return F_status_set_error(F_parameter); + if (range.start >= content.used) return F_status_set_error(F_parameter); if (quote != f_iki_syntax_quote_single && quote != f_iki_syntax_quote_double) return F_status_set_error(F_parameter); if (unescaped->used > unescaped->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - const f_string_range_t range = macro_f_string_range_t_initialize(content.used); - - return private_fll_iki_content_partial_escape_un(content, range, quote, unescaped); + return private_fll_iki_content_partial_unescape(content, range, quote, unescaped); } -#endif // _di_fll_iki_content_escape_un_ +#endif // _di_fll_iki_content_partial_unescape_ -#ifndef _di_fll_iki_content_partial_escape_un_ - f_status_t fll_iki_content_partial_escape_un(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) { +#ifndef _di_fll_iki_content_unescape_ + f_status_t fll_iki_content_unescape(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *unescaped) { #ifndef _di_level_2_parameter_checking_ if (content.used > content.size) return F_status_set_error(F_parameter); - if (range.start > range.stop) return F_status_set_error(F_parameter); - if (range.start >= content.used) return F_status_set_error(F_parameter); if (quote != f_iki_syntax_quote_single && quote != f_iki_syntax_quote_double) return F_status_set_error(F_parameter); if (unescaped->used > unescaped->size) return F_status_set_error(F_parameter); #endif // _di_level_2_parameter_checking_ - return private_fll_iki_content_partial_escape_un(content, range, quote, unescaped); + const f_string_range_t range = macro_f_string_range_t_initialize(content.used); + + return private_fll_iki_content_partial_unescape(content, range, quote, unescaped); } -#endif // _di_fll_iki_content_partial_escape_un_ +#endif // _di_fll_iki_content_unescape_ #ifdef __cplusplus } // extern "C" diff --git a/level_2/fll_iki/c/iki.h b/level_2/fll_iki/c/iki.h index 842122a..f0f2d6a 100644 --- a/level_2/fll_iki/c/iki.h +++ b/level_2/fll_iki/c/iki.h @@ -50,6 +50,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: macro_f_string_dynamic_t_resize(). @@ -77,6 +78,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: macro_f_string_dynamic_t_resize(). @@ -87,12 +89,14 @@ extern "C" { #endif // _di_fll_iki_content_partial_escape_ /** - * Unescape a string from IKI content to allow it to be used normally. + * Unescape a string, found within the given range, from IKI content to allow it to be used normally. * * This does not copy NULL characters. * * @param content * The string to escape. + * @param range + * The range within the buffer that represents the content. * @param quote * The quote character in use. * This must be either a single (') or double (") quote. @@ -102,25 +106,24 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * F_syntax (with error bit) if the given string is invalid, such as having an undelimited quote. * * Errors (with error bit) from: macro_f_string_dynamic_t_resize(). * Errors (with error bit) from: f_string_dynamic_increase_by(). */ -#ifndef _di_fll_iki_content_escape_un_ - extern f_status_t fll_iki_content_escape_un(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *unescaped); -#endif // _di_fll_iki_content_escape_un_ +#ifndef _di_fll_iki_content_partial_unescape_ + extern f_status_t fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped); +#endif // _di_fll_iki_content_partial_unescape_ /** - * Unescape a string, found within the given range, from IKI content to allow it to be used normally. + * Unescape a string from IKI content to allow it to be used normally. * * This does not copy NULL characters. * * @param content * The string to escape. - * @param range - * The range within the buffer that represents the content. * @param quote * The quote character in use. * This must be either a single (') or double (") quote. @@ -130,15 +133,16 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * F_syntax (with error bit) if the given string is invalid, such as having an undelimited quote. * * Errors (with error bit) from: macro_f_string_dynamic_t_resize(). * Errors (with error bit) from: f_string_dynamic_increase_by(). */ -#ifndef _di_fll_iki_content_partial_escape_un_ - extern f_status_t fll_iki_content_partial_escape_un(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped); -#endif // _di_fll_iki_content_partial_escape_un_ +#ifndef _di_fll_iki_content_unescape_ + extern f_status_t fll_iki_content_unescape(const f_string_static_t content, const uint8_t quote, f_string_dynamic_t *unescaped); +#endif // _di_fll_iki_content_unescape_ #ifdef __cplusplus } // extern "C" diff --git a/level_2/fll_iki/c/private-iki.c b/level_2/fll_iki/c/private-iki.c index a1046d5..acac135 100644 --- a/level_2/fll_iki/c/private-iki.c +++ b/level_2/fll_iki/c/private-iki.c @@ -69,8 +69,8 @@ extern "C" { } #endif // !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) -#if !defined(_di_fll_iki_content_escape_un_) || !defined(_di_fll_iki_content_partial_escape_un_) - f_status_t private_fll_iki_content_partial_escape_un(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) { +#if !defined(_di_fll_iki_content_unescape_) || !defined(_di_fll_iki_content_partial_unescape_) + f_status_t private_fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) { f_status_t status = F_none; // ensure escaped is at least the same size as content. @@ -183,7 +183,7 @@ extern "C" { return F_none; } -#endif // !defined(_di_fll_iki_content_escape_un_) || !defined(_di_fll_iki_content_partial_escape_un_) +#endif // !defined(_di_fll_iki_content_unescape_) || !defined(_di_fll_iki_content_partial_unescape_) #ifdef __cplusplus } // extern "C" diff --git a/level_2/fll_iki/c/private-iki.h b/level_2/fll_iki/c/private-iki.h index 49986c8..dfbc2cd 100644 --- a/level_2/fll_iki/c/private-iki.h +++ b/level_2/fll_iki/c/private-iki.h @@ -33,6 +33,7 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: macro_f_string_dynamic_t_resize(). @@ -43,7 +44,7 @@ extern "C" { #endif // !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) /** - * Private implementation of fll_iki_content_escape_un(). + * Private implementation of fll_iki_content_unescape(). * * Intended to be shared to each of the different implementation variations. * @@ -60,15 +61,16 @@ extern "C" { * * @return * F_none on success. + * * F_parameter (with error bit) if a parameter is invalid. * F_syntax (with error bit) if the given string is invalid, such as having an undelimited quote. * * Errors (with error bit) from: macro_f_string_dynamic_t_resize(). * Errors (with error bit) from: f_string_dynamic_increase_by(). */ -#if !defined(_di_fll_iki_content_escape_un_) || !defined(_di_fll_iki_content_partial_escape_un_) - extern f_status_t private_fll_iki_content_partial_escape_un(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) f_attribute_visibility_internal; -#endif // !defined(_di_fll_iki_content_escape_un_) || !defined(_di_fll_iki_content_partial_escape_un_) +#if !defined(_di_fll_iki_content_unescape_) || !defined(_di_fll_iki_content_partial_unescape_) + extern f_status_t private_fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const uint8_t quote, f_string_dynamic_t *unescaped) f_attribute_visibility_internal; +#endif // !defined(_di_fll_iki_content_unescape_) || !defined(_di_fll_iki_content_partial_unescape_) #ifdef __cplusplus } // extern "C" diff --git a/level_2/fll_path/c/path.c b/level_2/fll_path/c/path.c index 74c2b65..ed22733 100644 --- a/level_2/fll_path/c/path.c +++ b/level_2/fll_path/c/path.c @@ -31,6 +31,7 @@ extern "C" { if (!path[0]) { return F_none; } + at = 0; } @@ -43,6 +44,7 @@ extern "C" { if (!previous_1 || previous_1 == f_path_separator_s[0]) { previous_1 = f_path_separator_current_s[0]; previous_2 = 0; + continue; } @@ -62,6 +64,7 @@ extern "C" { if (previous_1 == f_path_separator_s[0]) { size_chunk = 0; position = 0; + continue; } diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index c43da39..d0d0b2e 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -189,6 +189,7 @@ extern "C" { * @return * F_none on success. * F_data_not if "values" parameters were expected but not found. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * @@ -238,6 +239,7 @@ extern "C" { * @return * F_none on success. * F_data_not if nothing to rip, no allocations or reallocations are performed. + * * F_array_too_large (with error bit) if a buffer would exceed max length. * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. @@ -267,6 +269,7 @@ extern "C" { * @return * F_none on success. * F_data_not if nothing to rip, no allocations or reallocations are performed. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. @@ -294,6 +297,7 @@ extern "C" { * @return * F_none on success. * F_data_not if nothing to rip, no allocations or reallocations are performed. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * @@ -324,6 +328,7 @@ extern "C" { * @return * F_none on success. * F_data_not if nothing to rip, no allocations or reallocations are performed. + * * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string is too large. diff --git a/level_2/fll_status/c/status.c b/level_2/fll_status/c/status.c index dba1cf2..5a8f874 100644 --- a/level_2/fll_status/c/status.c +++ b/level_2/fll_status/c/status.c @@ -29,11 +29,13 @@ extern "C" { #ifndef _di_F_status_boolean_ if (fl_string_compare(string, FL_status_string_false, length, FL_status_string_false_length) == F_equal_to) { *code = F_false; + return F_none; } if (fl_string_compare(string, FL_status_string_true, length, FL_status_string_true_length) == F_equal_to) { *code = F_true; + return F_none; } #endif // _di_F_status_boolean_ @@ -41,321 +43,385 @@ extern "C" { #ifndef _di_F_status_signal_ if (fl_string_compare(string, FL_status_string_signal_hangup, length, FL_status_string_signal_hangup_length) == F_equal_to) { *code = F_signal_hangup; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_interrupt, length, FL_status_string_signal_interrupt_length) == F_equal_to) { *code = F_signal_interrupt; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_quit, length, FL_status_string_signal_quit_length) == F_equal_to) { *code = F_signal_quit; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_illegal, length, FL_status_string_signal_illegal_length) == F_equal_to) { *code = F_signal_illegal; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_trap, length, FL_status_string_signal_trap_length) == F_equal_to) { *code = F_signal_trap; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_abort, length, FL_status_string_signal_abort_length) == F_equal_to) { *code = F_signal_abort; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_bus_error, length, FL_status_string_signal_bus_error_length) == F_equal_to) { *code = F_signal_bus_error; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_floating_point_error, length, FL_status_string_signal_floating_point_error_length) == F_equal_to) { *code = F_signal_floating_point_error; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_kill, length, FL_status_string_signal_kill_length) == F_equal_to) { *code = F_signal_kill; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_user_1, length, FL_status_string_signal_user_1_length) == F_equal_to) { *code = F_signal_user_1; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_segmentation_fault, length, FL_status_string_signal_segmentation_fault_length) == F_equal_to) { *code = F_signal_segmentation_fault; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_user_2, length, FL_status_string_signal_user_2_length) == F_equal_to) { *code = F_signal_user_2; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_broken_pipe, length, FL_status_string_signal_broken_pipe_length) == F_equal_to) { *code = F_signal_broken_pipe; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_alarm_clock, length, FL_status_string_signal_alarm_clock_length) == F_equal_to) { *code = F_signal_alarm_clock; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_termination, length, FL_status_string_signal_termination_length) == F_equal_to) { *code = F_signal_termination; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_stack_fault, length, FL_status_string_signal_stack_fault_length) == F_equal_to) { *code = F_signal_stack_fault; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_child, length, FL_status_string_signal_child_length) == F_equal_to) { *code = F_signal_child; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_continue, length, FL_status_string_signal_continue_length) == F_equal_to) { *code = F_signal_continue; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_stop, length, FL_status_string_signal_stop_length) == F_equal_to) { *code = F_signal_stop; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_keyboard_stop, length, FL_status_string_signal_keyboard_stop_length) == F_equal_to) { *code = F_signal_keyboard_stop; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_tty_in, length, FL_status_string_signal_tty_in_length) == F_equal_to) { *code = F_signal_tty_in; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_tty_out, length, FL_status_string_signal_tty_out_length) == F_equal_to) { *code = F_signal_tty_out; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_urgent, length, FL_status_string_signal_urgent_length) == F_equal_to) { *code = F_signal_urgent; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_cpu_limit, length, FL_status_string_signal_cpu_limit_length) == F_equal_to) { *code = F_signal_cpu_limit; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_file_size_limit, length, FL_status_string_signal_file_size_limit_length) == F_equal_to) { *code = F_signal_file_size_limit; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_virtual_alarm_clock, length, FL_status_string_signal_virtual_alarm_clock_length) == F_equal_to) { *code = F_signal_virtual_alarm_clock; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_profile_alarm_clock, length, FL_status_string_signal_profile_alarm_clock_length) == F_equal_to) { *code = F_signal_profile_alarm_clock; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_window_size_change, length, FL_status_string_signal_window_size_change_length) == F_equal_to) { *code = F_signal_window_size_change; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_pollable_event, length, FL_status_string_signal_pollable_event_length) == F_equal_to) { *code = F_signal_pollable_event; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_power_failure, length, FL_status_string_signal_power_failure_length) == F_equal_to) { *code = F_signal_power_failure; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_bad_system_call, length, FL_status_string_signal_bad_system_call_length) == F_equal_to) { *code = F_signal_bad_system_call; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_32, length, FL_status_string_signal_reserved_32_length) == F_equal_to) { *code = F_signal_reserved_32; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_33, length, FL_status_string_signal_reserved_33_length) == F_equal_to) { *code = F_signal_reserved_33; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_34, length, FL_status_string_signal_reserved_34_length) == F_equal_to) { *code = F_signal_reserved_34; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_35, length, FL_status_string_signal_reserved_35_length) == F_equal_to) { *code = F_signal_reserved_35; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_36, length, FL_status_string_signal_reserved_36_length) == F_equal_to) { *code = F_signal_reserved_36; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_37, length, FL_status_string_signal_reserved_37_length) == F_equal_to) { *code = F_signal_reserved_37; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_38, length, FL_status_string_signal_reserved_38_length) == F_equal_to) { *code = F_signal_reserved_38; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_39, length, FL_status_string_signal_reserved_39_length) == F_equal_to) { *code = F_signal_reserved_39; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_40, length, FL_status_string_signal_reserved_40_length) == F_equal_to) { *code = F_signal_reserved_40; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_41, length, FL_status_string_signal_reserved_41_length) == F_equal_to) { *code = F_signal_reserved_41; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_42, length, FL_status_string_signal_reserved_42_length) == F_equal_to) { *code = F_signal_reserved_42; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_43, length, FL_status_string_signal_reserved_43_length) == F_equal_to) { *code = F_signal_reserved_43; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_44, length, FL_status_string_signal_reserved_44_length) == F_equal_to) { *code = F_signal_reserved_44; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_45, length, FL_status_string_signal_reserved_45_length) == F_equal_to) { *code = F_signal_reserved_45; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_46, length, FL_status_string_signal_reserved_46_length) == F_equal_to) { *code = F_signal_reserved_46; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_47, length, FL_status_string_signal_reserved_47_length) == F_equal_to) { *code = F_signal_reserved_47; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_48, length, FL_status_string_signal_reserved_48_length) == F_equal_to) { *code = F_signal_reserved_48; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_49, length, FL_status_string_signal_reserved_49_length) == F_equal_to) { *code = F_signal_reserved_49; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_50, length, FL_status_string_signal_reserved_50_length) == F_equal_to) { *code = F_signal_reserved_50; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_51, length, FL_status_string_signal_reserved_51_length) == F_equal_to) { *code = F_signal_reserved_51; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_52, length, FL_status_string_signal_reserved_52_length) == F_equal_to) { *code = F_signal_reserved_52; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_53, length, FL_status_string_signal_reserved_53_length) == F_equal_to) { *code = F_signal_reserved_53; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_54, length, FL_status_string_signal_reserved_54_length) == F_equal_to) { *code = F_signal_reserved_54; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_55, length, FL_status_string_signal_reserved_55_length) == F_equal_to) { *code = F_signal_reserved_55; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_56, length, FL_status_string_signal_reserved_56_length) == F_equal_to) { *code = F_signal_reserved_56; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_57, length, FL_status_string_signal_reserved_57_length) == F_equal_to) { *code = F_signal_reserved_57; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_58, length, FL_status_string_signal_reserved_58_length) == F_equal_to) { *code = F_signal_reserved_58; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_59, length, FL_status_string_signal_reserved_59_length) == F_equal_to) { *code = F_signal_reserved_59; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_60, length, FL_status_string_signal_reserved_60_length) == F_equal_to) { *code = F_signal_reserved_60; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_61, length, FL_status_string_signal_reserved_61_length) == F_equal_to) { *code = F_signal_reserved_61; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_62, length, FL_status_string_signal_reserved_62_length) == F_equal_to) { *code = F_signal_reserved_62; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_63, length, FL_status_string_signal_reserved_63_length) == F_equal_to) { *code = F_signal_reserved_63; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_reserved_64, length, FL_status_string_signal_reserved_64_length) == F_equal_to) { *code = F_signal_reserved_64; + return F_none; } #endif // _di_F_status_signal_ @@ -363,851 +429,1021 @@ extern "C" { #ifndef _di_F_status_basic_ if (fl_string_compare(string, FL_status_string_none, length, FL_status_string_none_length) == F_equal_to) { *code = F_none; + return F_none; } if (fl_string_compare(string, FL_status_string_absolute, length, FL_status_string_absolute_length) == F_equal_to) { *code = F_absolute; + return F_none; } if (fl_string_compare(string, FL_status_string_absolute_not, length, FL_status_string_absolute_not_length) == F_equal_to) { *code = F_absolute_not; + return F_none; } if (fl_string_compare(string, FL_status_string_address, length, FL_status_string_address_length) == F_equal_to) { *code = F_address; + return F_none; } if (fl_string_compare(string, FL_status_string_address_not, length, FL_status_string_address_not_length) == F_equal_to) { *code = F_address_not; + return F_none; } if (fl_string_compare(string, FL_status_string_block, length, FL_status_string_block_length) == F_equal_to) { *code = F_block; + return F_none; } if (fl_string_compare(string, FL_status_string_block_not, length, FL_status_string_block_not_length) == F_equal_to) { *code = F_block_not; + return F_none; } if (fl_string_compare(string, FL_status_string_bound, length, FL_status_string_bound_length) == F_equal_to) { *code = F_bound; + return F_none; } if (fl_string_compare(string, FL_status_string_bound_not, length, FL_status_string_bound_not_length) == F_equal_to) { *code = F_bound_not; + return F_none; } if (fl_string_compare(string, FL_status_string_capability, length, FL_status_string_capability_length) == F_equal_to) { *code = F_capability; + return F_none; } if (fl_string_compare(string, FL_status_string_capability_not, length, FL_status_string_capability_not_length) == F_equal_to) { *code = F_capability_not; + return F_none; } if (fl_string_compare(string, FL_status_string_child, length, FL_status_string_child_length) == F_equal_to) { *code = F_child; + return F_none; } if (fl_string_compare(string, FL_status_string_child_not, length, FL_status_string_child_not_length) == F_equal_to) { *code = F_child_not; + return F_none; } if (fl_string_compare(string, FL_status_string_complete, length, FL_status_string_complete_length) == F_equal_to) { *code = F_complete; + return F_none; } if (fl_string_compare(string, FL_status_string_complete_not, length, FL_status_string_complete_not_length) == F_equal_to) { *code = F_complete_not; + return F_none; } if (fl_string_compare(string, FL_status_string_connected, length, FL_status_string_connected_length) == F_equal_to) { *code = F_connected; + return F_none; } if (fl_string_compare(string, FL_status_string_connected_not, length, FL_status_string_connected_not_length) == F_equal_to) { *code = F_connected_not; + return F_none; } if (fl_string_compare(string, FL_status_string_container, length, FL_status_string_container_length) == F_equal_to) { *code = F_container; + return F_none; } if (fl_string_compare(string, FL_status_string_container_not, length, FL_status_string_container_not_length) == F_equal_to) { *code = F_container_not; + return F_none; } if (fl_string_compare(string, FL_status_string_control, length, FL_status_string_control_length) == F_equal_to) { *code = F_control; + return F_none; } if (fl_string_compare(string, FL_status_string_control_not, length, FL_status_string_control_not_length) == F_equal_to) { *code = F_control_not; + return F_none; } if (fl_string_compare(string, FL_status_string_control_group, length, FL_status_string_control_group_length) == F_equal_to) { *code = F_control_group; + return F_none; } if (fl_string_compare(string, FL_status_string_control_group_not, length, FL_status_string_control_group_not_length) == F_equal_to) { *code = F_control_group_not; + return F_none; } if (fl_string_compare(string, FL_status_string_critical, length, FL_status_string_critical_length) == F_equal_to) { *code = F_critical; + return F_none; } if (fl_string_compare(string, FL_status_string_critical_not, length, FL_status_string_critical_not_length) == F_equal_to) { *code = F_critical_not; + return F_none; } if (fl_string_compare(string, FL_status_string_dead, length, FL_status_string_dead_length) == F_equal_to) { *code = F_dead; + return F_none; } if (fl_string_compare(string, FL_status_string_dead_not, length, FL_status_string_dead_not_length) == F_equal_to) { *code = F_dead_not; + return F_none; } if (fl_string_compare(string, FL_status_string_deadlock, length, FL_status_string_deadlock_length) == F_equal_to) { *code = F_deadlock; + return F_none; } if (fl_string_compare(string, FL_status_string_deadlock_not, length, FL_status_string_deadlock_not_length) == F_equal_to) { *code = F_deadlock_not; + return F_none; } if (fl_string_compare(string, FL_status_string_descriptor, length, FL_status_string_descriptor_length) == F_equal_to) { *code = F_descriptor; + return F_none; } if (fl_string_compare(string, FL_status_string_descriptor_not, length, FL_status_string_descriptor_not_length) == F_equal_to) { *code = F_descriptor_not; + return F_none; } if (fl_string_compare(string, FL_status_string_device, length, FL_status_string_device_length) == F_equal_to) { *code = F_device; + return F_none; } if (fl_string_compare(string, FL_status_string_device_not, length, FL_status_string_device_not_length) == F_equal_to) { *code = F_device_not; + return F_none; } if (fl_string_compare(string, FL_status_string_done, length, FL_status_string_done_length) == F_equal_to) { *code = F_done; + return F_none; } if (fl_string_compare(string, FL_status_string_done_not, length, FL_status_string_done_not_length) == F_equal_to) { *code = F_done_not; + return F_none; } if (fl_string_compare(string, FL_status_string_dummy, length, FL_status_string_dummy_length) == F_equal_to) { *code = F_dummy; + return F_none; } if (fl_string_compare(string, FL_status_string_dummy_not, length, FL_status_string_dummy_not_length) == F_equal_to) { *code = F_dummy_not; + return F_none; } if (fl_string_compare(string, FL_status_string_empty, length, FL_status_string_empty_length) == F_equal_to) { *code = F_empty; + return F_none; } if (fl_string_compare(string, FL_status_string_empty_not, length, FL_status_string_empty_not_length) == F_equal_to) { *code = F_empty_not; + return F_none; } if (fl_string_compare(string, FL_status_string_encoding, length, FL_status_string_encoding_length) == F_equal_to) { *code = F_encoding; + return F_none; } if (fl_string_compare(string, FL_status_string_encoding_not, length, FL_status_string_encoding_not_length) == F_equal_to) { *code = F_encoding_not; + return F_none; } if (fl_string_compare(string, FL_status_string_eoa, length, FL_status_string_eoa_length) == F_equal_to) { *code = F_eoa; + return F_none; } if (fl_string_compare(string, FL_status_string_eoa_not, length, FL_status_string_eoa_not_length) == F_equal_to) { *code = F_eoa_not; + return F_none; } if (fl_string_compare(string, FL_status_string_eof, length, FL_status_string_eof_length) == F_equal_to) { *code = F_eof; + return F_none; } if (fl_string_compare(string, FL_status_string_eof_not, length, FL_status_string_eof_not_length) == F_equal_to) { *code = F_eof_not; + return F_none; } if (fl_string_compare(string, FL_status_string_eol, length, FL_status_string_eol_length) == F_equal_to) { *code = F_eol; + return F_none; } if (fl_string_compare(string, FL_status_string_eol_not, length, FL_status_string_eol_not_length) == F_equal_to) { *code = F_eol_not; + return F_none; } if (fl_string_compare(string, FL_status_string_eos, length, FL_status_string_eos_length) == F_equal_to) { *code = F_eos; + return F_none; } if (fl_string_compare(string, FL_status_string_eos_not, length, FL_status_string_eos_not_length) == F_equal_to) { *code = F_eos_not; + return F_none; } if (fl_string_compare(string, FL_status_string_execute, length, FL_status_string_execute_length) == F_equal_to) { *code = F_execute; + return F_none; } if (fl_string_compare(string, FL_status_string_execute_not, length, FL_status_string_execute_not_length) == F_equal_to) { *code = F_execute_not; + return F_none; } if (fl_string_compare(string, FL_status_string_exist, length, FL_status_string_exist_length) == F_equal_to) { *code = F_exist; + return F_none; } if (fl_string_compare(string, FL_status_string_exist_not, length, FL_status_string_exist_not_length) == F_equal_to) { *code = F_exist_not; + return F_none; } if (fl_string_compare(string, FL_status_string_failure, length, FL_status_string_failure_length) == F_equal_to) { *code = F_failure; + return F_none; } if (fl_string_compare(string, FL_status_string_failure_not, length, FL_status_string_failure_not_length) == F_equal_to) { *code = F_failure_not; + return F_none; } if (fl_string_compare(string, FL_status_string_fork, length, FL_status_string_fork_length) == F_equal_to) { *code = F_fork; + return F_none; } if (fl_string_compare(string, FL_status_string_fork_not, length, FL_status_string_fork_not_length) == F_equal_to) { *code = F_fork_not; + return F_none; } if (fl_string_compare(string, FL_status_string_found, length, FL_status_string_found_length) == F_equal_to) { *code = F_found; + return F_none; } if (fl_string_compare(string, FL_status_string_found_not, length, FL_status_string_found_not_length) == F_equal_to) { *code = F_found_not; + return F_none; } if (fl_string_compare(string, FL_status_string_full, length, FL_status_string_full_length) == F_equal_to) { *code = F_full; + return F_none; } if (fl_string_compare(string, FL_status_string_full_not, length, FL_status_string_full_not_length) == F_equal_to) { *code = F_full_not; + return F_none; } if (fl_string_compare(string, FL_status_string_group, length, FL_status_string_group_length) == F_equal_to) { *code = F_group; + return F_none; } if (fl_string_compare(string, FL_status_string_group_not, length, FL_status_string_group_not_length) == F_equal_to) { *code = F_group_not; + return F_none; } if (fl_string_compare(string, FL_status_string_ignore, length, FL_status_string_ignore_length) == F_equal_to) { *code = F_ignore; + return F_none; } if (fl_string_compare(string, FL_status_string_ignore_not, length, FL_status_string_ignore_not_length) == F_equal_to) { *code = F_ignore_not; + return F_none; } if (fl_string_compare(string, FL_status_string_implemented, length, FL_status_string_implemented_length) == F_equal_to) { *code = F_implemented; + return F_none; } if (fl_string_compare(string, FL_status_string_implemented_not, length, FL_status_string_implemented_not_length) == F_equal_to) { *code = F_implemented_not; + return F_none; } if (fl_string_compare(string, FL_status_string_input, length, FL_status_string_input_length) == F_equal_to) { *code = F_input; + return F_none; } if (fl_string_compare(string, FL_status_string_input_not, length, FL_status_string_input_not_length) == F_equal_to) { *code = F_input_not; + return F_none; } if (fl_string_compare(string, FL_status_string_input_output, length, FL_status_string_input_output_length) == F_equal_to) { *code = F_input_output; + return F_none; } if (fl_string_compare(string, FL_status_string_interrupt, length, FL_status_string_interrupt_length) == F_equal_to) { *code = F_interrupt; + return F_none; } if (fl_string_compare(string, FL_status_string_interrupt_not, length, FL_status_string_interrupt_not_length) == F_equal_to) { *code = F_interrupt_not; + return F_none; } if (fl_string_compare(string, FL_status_string_known, length, FL_status_string_known_length) == F_equal_to) { *code = F_known; + return F_none; } if (fl_string_compare(string, FL_status_string_known_not, length, FL_status_string_known_not_length) == F_equal_to) { *code = F_known_not; + return F_none; } if (fl_string_compare(string, FL_status_string_limit, length, FL_status_string_limit_length) == F_equal_to) { *code = F_limit; + return F_none; } if (fl_string_compare(string, FL_status_string_limit_not, length, FL_status_string_limit_not_length) == F_equal_to) { *code = F_limit_not; + return F_none; } if (fl_string_compare(string, FL_status_string_link, length, FL_status_string_link_length) == F_equal_to) { *code = F_link; + return F_none; } if (fl_string_compare(string, FL_status_string_link_not, length, FL_status_string_link_not_length) == F_equal_to) { *code = F_link_not; + return F_none; } if (fl_string_compare(string, FL_status_string_live, length, FL_status_string_live_length) == F_equal_to) { *code = F_live; + return F_none; } if (fl_string_compare(string, FL_status_string_live_not, length, FL_status_string_live_not_length) == F_equal_to) { *code = F_live_not; + return F_none; } if (fl_string_compare(string, FL_status_string_lock, length, FL_status_string_lock_length) == F_equal_to) { *code = F_lock; + return F_none; } if (fl_string_compare(string, FL_status_string_lock_not, length, FL_status_string_lock_not_length) == F_equal_to) { *code = F_lock_not; + return F_none; } if (fl_string_compare(string, FL_status_string_loop, length, FL_status_string_loop_length) == F_equal_to) { *code = F_loop; + return F_none; } if (fl_string_compare(string, FL_status_string_loop_not, length, FL_status_string_loop_not_length) == F_equal_to) { *code = F_loop_not; + return F_none; } if (fl_string_compare(string, FL_status_string_maybe, length, FL_status_string_maybe_length) == F_equal_to) { *code = F_maybe; + return F_none; } if (fl_string_compare(string, FL_status_string_maybe_not, length, FL_status_string_maybe_not_length) == F_equal_to) { *code = F_maybe_not; + return F_none; } if (fl_string_compare(string, FL_status_string_memory, length, FL_status_string_memory_length) == F_equal_to) { *code = F_memory; + return F_none; } if (fl_string_compare(string, FL_status_string_memory_not, length, FL_status_string_memory_not_length) == F_equal_to) { *code = F_memory_not; + return F_none; } if (fl_string_compare(string, FL_status_string_minor, length, FL_status_string_minor_length) == F_equal_to) { *code = F_minor; + return F_none; } if (fl_string_compare(string, FL_status_string_minor_not, length, FL_status_string_minor_not_length) == F_equal_to) { *code = F_minor_not; + return F_none; } if (fl_string_compare(string, FL_status_string_moderate, length, FL_status_string_moderate_length) == F_equal_to) { *code = F_moderate; + return F_none; } if (fl_string_compare(string, FL_status_string_moderate_not, length, FL_status_string_moderate_not_length) == F_equal_to) { *code = F_moderate_not; + return F_none; } if (fl_string_compare(string, FL_status_string_mount, length, FL_status_string_mount_length) == F_equal_to) { *code = F_mount; + return F_none; } if (fl_string_compare(string, FL_status_string_mount_not, length, FL_status_string_mount_not_length) == F_equal_to) { *code = F_mount_not; + return F_none; } if (fl_string_compare(string, FL_status_string_name, length, FL_status_string_name_length) == F_equal_to) { *code = F_name; + return F_none; } if (fl_string_compare(string, FL_status_string_name_not, length, FL_status_string_name_not_length) == F_equal_to) { *code = F_name_not; + return F_none; } if (fl_string_compare(string, FL_status_string_nice, length, FL_status_string_nice_length) == F_equal_to) { *code = F_nice; + return F_none; } if (fl_string_compare(string, FL_status_string_nice_not, length, FL_status_string_nice_not_length) == F_equal_to) { *code = F_nice_not; + return F_none; } if (fl_string_compare(string, FL_status_string_optional, length, FL_status_string_optional_length) == F_equal_to) { *code = F_optional; + return F_none; } if (fl_string_compare(string, FL_status_string_optional_not, length, FL_status_string_optional_not_length) == F_equal_to) { *code = F_optional_not; + return F_none; } if (fl_string_compare(string, FL_status_string_output, length, FL_status_string_output_length) == F_equal_to) { *code = F_output; + return F_none; } if (fl_string_compare(string, FL_status_string_output_not, length, FL_status_string_output_not_length) == F_equal_to) { *code = F_output_not; + return F_none; } if (fl_string_compare(string, FL_status_string_parameter, length, FL_status_string_parameter_length) == F_equal_to) { *code = F_parameter; + return F_none; } if (fl_string_compare(string, FL_status_string_parameter_not, length, FL_status_string_parameter_not_length) == F_equal_to) { *code = F_parameter_not; + return F_none; } if (fl_string_compare(string, FL_status_string_parent, length, FL_status_string_parent_length) == F_equal_to) { *code = F_parent; + return F_none; } if (fl_string_compare(string, FL_status_string_parent_not, length, FL_status_string_parent_not_length) == F_equal_to) { *code = F_parent_not; + return F_none; } if (fl_string_compare(string, FL_status_string_pipe, length, FL_status_string_pipe_length) == F_equal_to) { *code = F_pipe; + return F_none; } if (fl_string_compare(string, FL_status_string_pipe_not, length, FL_status_string_pipe_not_length) == F_equal_to) { *code = F_pipe_not; + return F_none; } if (fl_string_compare(string, FL_status_string_port, length, FL_status_string_port_length) == F_equal_to) { *code = F_port; + return F_none; } if (fl_string_compare(string, FL_status_string_port_not, length, FL_status_string_port_not_length) == F_equal_to) { *code = F_port_not; + return F_none; } if (fl_string_compare(string, FL_status_string_processor, length, FL_status_string_processor_length) == F_equal_to) { *code = F_processor; + return F_none; } if (fl_string_compare(string, FL_status_string_processor_not, length, FL_status_string_processor_not_length) == F_equal_to) { *code = F_processor_not; + return F_none; } if (fl_string_compare(string, FL_status_string_prohibited, length, FL_status_string_prohibited_length) == F_equal_to) { *code = F_prohibited; + return F_none; } if (fl_string_compare(string, FL_status_string_prohibited_not, length, FL_status_string_prohibited_not_length) == F_equal_to) { *code = F_prohibited_not; + return F_none; } if (fl_string_compare(string, FL_status_string_range, length, FL_status_string_range_length) == F_equal_to) { *code = F_range; + return F_none; } if (fl_string_compare(string, FL_status_string_range_not, length, FL_status_string_range_not_length) == F_equal_to) { *code = F_range_not; + return F_none; } if (fl_string_compare(string, FL_status_string_read, length, FL_status_string_read_length) == F_equal_to) { *code = F_read; + return F_none; } if (fl_string_compare(string, FL_status_string_read_not, length, FL_status_string_read_not_length) == F_equal_to) { *code = F_read_not; + return F_none; } if (fl_string_compare(string, FL_status_string_read_only, length, FL_status_string_read_only_length) == F_equal_to) { *code = F_read_only; + return F_none; } if (fl_string_compare(string, FL_status_string_ready, length, FL_status_string_ready_length) == F_equal_to) { *code = F_ready; + return F_none; } if (fl_string_compare(string, FL_status_string_ready_not, length, FL_status_string_ready_not_length) == F_equal_to) { *code = F_ready_not; + return F_none; } if (fl_string_compare(string, FL_status_string_recover, length, FL_status_string_recover_length) == F_equal_to) { *code = F_recover; + return F_none; } if (fl_string_compare(string, FL_status_string_recover_not, length, FL_status_string_recover_not_length) == F_equal_to) { *code = F_recover_not; + return F_none; } if (fl_string_compare(string, FL_status_string_recurse, length, FL_status_string_recurse_length) == F_equal_to) { *code = F_recurse; + return F_none; } if (fl_string_compare(string, FL_status_string_recurse_not, length, FL_status_string_recurse_not_length) == F_equal_to) { *code = F_recurse_not; + return F_none; } if (fl_string_compare(string, FL_status_string_relative, length, FL_status_string_relative_length) == F_equal_to) { *code = F_relative; + return F_none; } if (fl_string_compare(string, FL_status_string_relative_not, length, FL_status_string_relative_not_length) == F_equal_to) { *code = F_relative_not; + return F_none; } if (fl_string_compare(string, FL_status_string_require, length, FL_status_string_require_length) == F_equal_to) { *code = F_require; + return F_none; } if (fl_string_compare(string, FL_status_string_require_not, length, FL_status_string_require_not_length) == F_equal_to) { *code = F_require_not; + return F_none; } if (fl_string_compare(string, FL_status_string_resource, length, FL_status_string_resource_length) == F_equal_to) { *code = F_resource; + return F_none; } if (fl_string_compare(string, FL_status_string_resource_not, length, FL_status_string_resource_not_length) == F_equal_to) { *code = F_resource_not; + return F_none; } if (fl_string_compare(string, FL_status_string_search, length, FL_status_string_search_length) == F_equal_to) { *code = F_search; + return F_none; } if (fl_string_compare(string, FL_status_string_search_not, length, FL_status_string_search_not_length) == F_equal_to) { *code = F_search_not; + return F_none; } if (fl_string_compare(string, FL_status_string_schedule, length, FL_status_string_schedule_length) == F_equal_to) { *code = F_schedule; + return F_none; } if (fl_string_compare(string, FL_status_string_schedule_not, length, FL_status_string_schedule_not_length) == F_equal_to) { *code = F_schedule_not; + return F_none; } if (fl_string_compare(string, FL_status_string_signal, length, FL_status_string_signal_length) == F_equal_to) { *code = F_signal; + return F_none; } if (fl_string_compare(string, FL_status_string_signal_not, length, FL_status_string_signal_not_length) == F_equal_to) { *code = F_signal_not; + return F_none; } if (fl_string_compare(string, FL_status_string_space, length, FL_status_string_space_length) == F_equal_to) { *code = F_space; + return F_none; } if (fl_string_compare(string, FL_status_string_space_not, length, FL_status_string_space_not_length) == F_equal_to) { *code = F_space_not; + return F_none; } if (fl_string_compare(string, FL_status_string_stop, length, FL_status_string_stop_length) == F_equal_to) { *code = F_stop; + return F_none; } if (fl_string_compare(string, FL_status_string_stop_not, length, FL_status_string_stop_not_length) == F_equal_to) { *code = F_stop_not; + return F_none; } if (fl_string_compare(string, FL_status_string_string, length, FL_status_string_string_length) == F_equal_to) { *code = F_string; + return F_none; } if (fl_string_compare(string, FL_status_string_string_not, length, FL_status_string_string_not_length) == F_equal_to) { *code = F_string_not; + return F_none; } if (fl_string_compare(string, FL_status_string_string_too_large, length, FL_status_string_string_too_large_length) == F_equal_to) { *code = F_string_too_large; + return F_none; } if (fl_string_compare(string, FL_status_string_string_too_small, length, FL_status_string_string_too_small_length) == F_equal_to) { *code = F_string_too_small; + return F_none; } if (fl_string_compare(string, FL_status_string_supported, length, FL_status_string_supported_length) == F_equal_to) { *code = F_supported; + return F_none; } if (fl_string_compare(string, FL_status_string_supported_not, length, FL_status_string_supported_not_length) == F_equal_to) { *code = F_supported_not; + return F_none; } if (fl_string_compare(string, FL_status_string_syntax, length, FL_status_string_syntax_length) == F_equal_to) { *code = F_syntax; + return F_none; } if (fl_string_compare(string, FL_status_string_syntax_not, length, FL_status_string_syntax_not_length) == F_equal_to) { *code = F_syntax_not; + return F_none; } if (fl_string_compare(string, FL_status_string_thread, length, FL_status_string_thread_length) == F_equal_to) { *code = F_thread; + return F_none; } if (fl_string_compare(string, FL_status_string_thread_not, length, FL_status_string_thread_not_length) == F_equal_to) { *code = F_thread_not; + return F_none; } if (fl_string_compare(string, FL_status_string_time, length, FL_status_string_time_length) == F_equal_to) { *code = F_time; + return F_none; } if (fl_string_compare(string, FL_status_string_time_not, length, FL_status_string_time_not_length) == F_equal_to) { *code = F_time_not; + return F_none; } if (fl_string_compare(string, FL_status_string_user, length, FL_status_string_user_length) == F_equal_to) { *code = F_user; + return F_none; } if (fl_string_compare(string, FL_status_string_user_not, length, FL_status_string_user_not_length) == F_equal_to) { *code = F_user_not; + return F_none; } if (fl_string_compare(string, FL_status_string_utf, length, FL_status_string_utf_length) == F_equal_to) { *code = F_utf; + return F_none; } if (fl_string_compare(string, FL_status_string_utf_not, length, FL_status_string_utf_not_length) == F_equal_to) { *code = F_utf_not; + return F_none; } if (fl_string_compare(string, FL_status_string_valid, length, FL_status_string_valid_length) == F_equal_to) { *code = F_valid; + return F_none; } if (fl_string_compare(string, FL_status_string_valid_not, length, FL_status_string_valid_not_length) == F_equal_to) { *code = F_valid_not; + return F_none; } if (fl_string_compare(string, FL_status_string_value, length, FL_status_string_value_length) == F_equal_to) { *code = F_value; + return F_none; } if (fl_string_compare(string, FL_status_string_value_not, length, FL_status_string_value_not_length) == F_equal_to) { *code = F_value_not; + return F_none; } if (fl_string_compare(string, FL_status_string_wait, length, FL_status_string_wait_length) == F_equal_to) { *code = F_wait; + return F_none; } if (fl_string_compare(string, FL_status_string_wait_not, length, FL_status_string_wait_not_length) == F_equal_to) { *code = F_wait_not; + return F_none; } if (fl_string_compare(string, FL_status_string_warn, length, FL_status_string_warn_length) == F_equal_to) { *code = F_warn; + return F_none; } if (fl_string_compare(string, FL_status_string_warn_not, length, FL_status_string_warn_not_length) == F_equal_to) { *code = F_warn_not; + return F_none; } if (fl_string_compare(string, FL_status_string_world, length, FL_status_string_world_length) == F_equal_to) { *code = F_world; + return F_none; } if (fl_string_compare(string, FL_status_string_world_not, length, FL_status_string_world_not_length) == F_equal_to) { *code = F_world_not; + return F_none; } if (fl_string_compare(string, FL_status_string_write, length, FL_status_string_write_length) == F_equal_to) { *code = F_write; + return F_none; } if (fl_string_compare(string, FL_status_string_write_not, length, FL_status_string_write_not_length) == F_equal_to) { *code = F_write_not; + return F_none; } if (fl_string_compare(string, FL_status_string_write_only, length, FL_status_string_write_only_length) == F_equal_to) { *code = F_write_only; + return F_none; } #endif // _di_F_status_basic_ @@ -1215,21 +1451,25 @@ extern "C" { #ifndef _di_F_status_array_ if (fl_string_compare(string, FL_status_string_array, length, FL_status_string_array_length) == F_equal_to) { *code = F_array; + return F_none; } if (fl_string_compare(string, FL_status_string_array_not, length, FL_status_string_array_not_length) == F_equal_to) { *code = F_array_not; + return F_none; } if (fl_string_compare(string, FL_status_string_array_too_large, length, FL_status_string_array_too_large_length) == F_equal_to) { *code = F_array_too_large; + return F_none; } if (fl_string_compare(string, FL_status_string_array_too_small, length, FL_status_string_array_too_small_length) == F_equal_to) { *code = F_array_too_small; + return F_none; } #endif // _di_F_status_array_ @@ -1237,46 +1477,55 @@ extern "C" { #ifndef _di_F_status_available_ if (fl_string_compare(string, FL_status_string_available, length, FL_status_string_available_length) == F_equal_to) { *code = F_available; + return F_none; } if (fl_string_compare(string, FL_status_string_available_not, length, FL_status_string_available_not_length) == F_equal_to) { *code = F_available_not; + return F_none; } if (fl_string_compare(string, FL_status_string_available_not_address, length, FL_status_string_available_not_address_length) == F_equal_to) { *code = F_available_not_address; + return F_none; } if (fl_string_compare(string, FL_status_string_available_not_buffer, length, FL_status_string_available_not_buffer_length) == F_equal_to) { *code = F_available_not_buffer; + return F_none; } if (fl_string_compare(string, FL_status_string_available_not_device, length, FL_status_string_available_not_device_length) == F_equal_to) { *code = F_available_not_device; + return F_none; } if (fl_string_compare(string, FL_status_string_available_not_pipe, length, FL_status_string_available_not_pipe_length) == F_equal_to) { *code = F_available_not_pipe; + return F_none; } if (fl_string_compare(string, FL_status_string_available_not_port, length, FL_status_string_available_not_port_length) == F_equal_to) { *code = F_available_not_port; + return F_none; } if (fl_string_compare(string, FL_status_string_available_not_process, length, FL_status_string_available_not_process_length) == F_equal_to) { *code = F_available_not_process; + return F_none; } if (fl_string_compare(string, FL_status_string_available_not_socket, length, FL_status_string_available_not_socket_length) == F_equal_to) { *code = F_available_not_socket; + return F_none; } #endif // _di_F_status_available_ @@ -1284,46 +1533,55 @@ extern "C" { #ifndef _di_F_status_busy_ if (fl_string_compare(string, FL_status_string_busy, length, FL_status_string_busy_length) == F_equal_to) { *code = F_busy; + return F_none; } if (fl_string_compare(string, FL_status_string_busy_address, length, FL_status_string_busy_address_length) == F_equal_to) { *code = F_busy_address; + return F_none; } if (fl_string_compare(string, FL_status_string_busy_buffer, length, FL_status_string_busy_buffer_length) == F_equal_to) { *code = F_busy_buffer; + return F_none; } if (fl_string_compare(string, FL_status_string_busy_device, length, FL_status_string_busy_device_length) == F_equal_to) { *code = F_busy_device; + return F_none; } if (fl_string_compare(string, FL_status_string_busy_not, length, FL_status_string_busy_not_length) == F_equal_to) { *code = F_busy_not; + return F_none; } if (fl_string_compare(string, FL_status_string_busy_pipe, length, FL_status_string_busy_pipe_length) == F_equal_to) { *code = F_busy_pipe; + return F_none; } if (fl_string_compare(string, FL_status_string_busy_port, length, FL_status_string_busy_port_length) == F_equal_to) { *code = F_busy_port; + return F_none; } if (fl_string_compare(string, FL_status_string_busy_process, length, FL_status_string_busy_process_length) == F_equal_to) { *code = F_busy_process; + return F_none; } if (fl_string_compare(string, FL_status_string_busy_socket, length, FL_status_string_busy_socket_length) == F_equal_to) { *code = F_busy_socket; + return F_none; } #endif // _di_F_status_busy_ @@ -1331,86 +1589,103 @@ extern "C" { #ifndef _di_F_status_number_ if (fl_string_compare(string, FL_status_string_number, length, FL_status_string_number_length) == F_equal_to) { *code = F_number; + return F_none; } if (fl_string_compare(string, FL_status_string_number_decimal, length, FL_status_string_number_decimal_length) == F_equal_to) { *code = F_number_decimal; + return F_none; } if (fl_string_compare(string, FL_status_string_number_decimal_not, length, FL_status_string_number_decimal_not_length) == F_equal_to) { *code = F_number_decimal_not; + return F_none; } if (fl_string_compare(string, FL_status_string_number_divide_by_zero, length, FL_status_string_number_divide_by_zero_length) == F_equal_to) { *code = F_number_divide_by_zero; + return F_none; } if (fl_string_compare(string, FL_status_string_number_negative, length, FL_status_string_number_negative_length) == F_equal_to) { *code = F_number_negative; + return F_none; } if (fl_string_compare(string, FL_status_string_number_negative_not, length, FL_status_string_number_negative_not_length) == F_equal_to) { *code = F_number_negative_not; + return F_none; } if (fl_string_compare(string, FL_status_string_number_not, length, FL_status_string_number_not_length) == F_equal_to) { *code = F_number_not; + return F_none; } if (fl_string_compare(string, FL_status_string_number_overflow, length, FL_status_string_number_overflow_length) == F_equal_to) { *code = F_number_overflow; + return F_none; } if (fl_string_compare(string, FL_status_string_number_positive, length, FL_status_string_number_positive_length) == F_equal_to) { *code = F_number_positive; + return F_none; } if (fl_string_compare(string, FL_status_string_number_positive_not, length, FL_status_string_number_positive_not_length) == F_equal_to) { *code = F_number_positive_not; + return F_none; } if (fl_string_compare(string, FL_status_string_number_too_large, length, FL_status_string_number_too_large_length) == F_equal_to) { *code = F_number_too_large; + return F_none; } if (fl_string_compare(string, FL_status_string_number_too_small, length, FL_status_string_number_too_small_length) == F_equal_to) { *code = F_number_too_small; + return F_none; } if (fl_string_compare(string, FL_status_string_number_underflow, length, FL_status_string_number_underflow_length) == F_equal_to) { *code = F_number_underflow; + return F_none; } if (fl_string_compare(string, FL_status_string_number_whole, length, FL_status_string_number_whole_length) == F_equal_to) { *code = F_number_whole; + return F_none; } if (fl_string_compare(string, FL_status_string_number_whole_not, length, FL_status_string_number_whole_not_length) == F_equal_to) { *code = F_number_whole_not; + return F_none; } if (fl_string_compare(string, FL_status_string_number_zero, length, FL_status_string_number_zero_length) == F_equal_to) { *code = F_number_zero; + return F_none; } if (fl_string_compare(string, FL_status_string_number_zero_not, length, FL_status_string_number_zero_not_length) == F_equal_to) { *code = F_number_zero_not; + return F_none; } #endif // _di_F_status_number_ @@ -1418,236 +1693,283 @@ extern "C" { #ifndef _di_F_status_buffer_ if (fl_string_compare(string, FL_status_string_buffer, length, FL_status_string_buffer_length) == F_equal_to) { *code = F_buffer; + return F_none; } if (fl_string_compare(string, FL_status_string_buffer_not, length, FL_status_string_buffer_not_length) == F_equal_to) { *code = F_buffer_not; + return F_none; } if (fl_string_compare(string, FL_status_string_buffer_too_large, length, FL_status_string_buffer_too_large_length) == F_equal_to) { *code = F_buffer_too_large; + return F_none; } if (fl_string_compare(string, FL_status_string_buffer_too_small, length, FL_status_string_buffer_too_small_length) == F_equal_to) { *code = F_buffer_too_small; + return F_none; } if (fl_string_compare(string, FL_status_string_complete_not_utf, length, FL_status_string_complete_not_utf_length) == F_equal_to) { *code = F_complete_not_utf; + return F_none; } if (fl_string_compare(string, FL_status_string_complete_not_utf_block, length, FL_status_string_complete_not_utf_block_length) == F_equal_to) { *code = F_complete_not_utf_block; + return F_none; } if (fl_string_compare(string, FL_status_string_complete_not_utf_eoa, length, FL_status_string_complete_not_utf_eoa_length) == F_equal_to) { *code = F_complete_not_utf_eoa; + return F_none; } if (fl_string_compare(string, FL_status_string_complete_not_utf_eof, length, FL_status_string_complete_not_utf_eof_length) == F_equal_to) { *code = F_complete_not_utf_eof; + return F_none; } if (fl_string_compare(string, FL_status_string_complete_not_utf_eol, length, FL_status_string_complete_not_utf_eol_length) == F_equal_to) { *code = F_complete_not_utf_eol; + return F_none; } if (fl_string_compare(string, FL_status_string_complete_not_utf_eos, length, FL_status_string_complete_not_utf_eos_length) == F_equal_to) { *code = F_complete_not_utf_eos; + return F_none; } if (fl_string_compare(string, FL_status_string_complete_not_utf_stop, length, FL_status_string_complete_not_utf_stop_length) == F_equal_to) { *code = F_complete_not_utf_stop; + return F_none; } if (fl_string_compare(string, FL_status_string_none_block, length, FL_status_string_none_block_length) == F_equal_to) { *code = F_none_block; + return F_none; } if (fl_string_compare(string, FL_status_string_none_eoa, length, FL_status_string_none_eoa_length) == F_equal_to) { *code = F_none_eoa; + return F_none; } if (fl_string_compare(string, FL_status_string_none_eof, length, FL_status_string_none_eof_length) == F_equal_to) { *code = F_none_eof; + return F_none; } if (fl_string_compare(string, FL_status_string_none_eol, length, FL_status_string_none_eol_length) == F_equal_to) { *code = F_none_eol; + return F_none; } if (fl_string_compare(string, FL_status_string_none_eos, length, FL_status_string_none_eos_length) == F_equal_to) { *code = F_none_eos; + return F_none; } if (fl_string_compare(string, FL_status_string_none_stop, length, FL_status_string_none_stop_length) == F_equal_to) { *code = F_none_stop; + return F_none; } if (fl_string_compare(string, FL_status_string_data, length, FL_status_string_data_length) == F_equal_to) { *code = F_data; + return F_none; } if (fl_string_compare(string, FL_status_string_data_not, length, FL_status_string_data_not_length) == F_equal_to) { *code = F_data_not; + return F_none; } if (fl_string_compare(string, FL_status_string_data_not_block, length, FL_status_string_data_not_block_length) == F_equal_to) { *code = F_data_not_block; + return F_none; } if (fl_string_compare(string, FL_status_string_data_not_eoa, length, FL_status_string_data_not_eoa_length) == F_equal_to) { *code = F_data_not_eoa; + return F_none; } if (fl_string_compare(string, FL_status_string_data_not_eof, length, FL_status_string_data_not_eof_length) == F_equal_to) { *code = F_data_not_eof; + return F_none; } if (fl_string_compare(string, FL_status_string_data_not_eol, length, FL_status_string_data_not_eol_length) == F_equal_to) { *code = F_data_not_eol; + return F_none; } if (fl_string_compare(string, FL_status_string_data_not_eos, length, FL_status_string_data_not_eos_length) == F_equal_to) { *code = F_data_not_eos; + return F_none; } if (fl_string_compare(string, FL_status_string_data_not_stop, length, FL_status_string_data_not_stop_length) == F_equal_to) { *code = F_data_not_stop; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated, length, FL_status_string_terminated_length) == F_equal_to) { *code = F_terminated; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not, length, FL_status_string_terminated_not_length) == F_equal_to) { *code = F_terminated_not; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_block, length, FL_status_string_terminated_not_block_length) == F_equal_to) { *code = F_terminated_not_block; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_eoa, length, FL_status_string_terminated_not_eoa_length) == F_equal_to) { *code = F_terminated_not_eoa; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_eof, length, FL_status_string_terminated_not_eof_length) == F_equal_to) { *code = F_terminated_not_eof; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_eol, length, FL_status_string_terminated_not_eol_length) == F_equal_to) { *code = F_terminated_not_eol; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_eos, length, FL_status_string_terminated_not_eos_length) == F_equal_to) { *code = F_terminated_not_eos; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_group, length, FL_status_string_terminated_not_group_length) == F_equal_to) { *code = F_terminated_not_group; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_group_block, length, FL_status_string_terminated_not_group_block_length) == F_equal_to) { *code = F_terminated_not_group_block; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_group_eoa, length, FL_status_string_terminated_not_group_eoa_length) == F_equal_to) { *code = F_terminated_not_group_eoa; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_group_eof, length, FL_status_string_terminated_not_group_eof_length) == F_equal_to) { *code = F_terminated_not_group_eof; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_group_eol, length, FL_status_string_terminated_not_group_eol_length) == F_equal_to) { *code = F_terminated_not_group_eol; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_group_eos, length, FL_status_string_terminated_not_group_eos_length) == F_equal_to) { *code = F_terminated_not_group_eos; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_group_stop, length, FL_status_string_terminated_not_group_stop_length) == F_equal_to) { *code = F_terminated_not_group_stop; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_nest, length, FL_status_string_terminated_not_nest_length) == F_equal_to) { *code = F_terminated_not_nest; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_nest_block, length, FL_status_string_terminated_not_nest_block_length) == F_equal_to) { *code = F_terminated_not_nest_block; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_nest_eoa, length, FL_status_string_terminated_not_nest_eoa_length) == F_equal_to) { *code = F_terminated_not_nest_eoa; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_nest_eof, length, FL_status_string_terminated_not_nest_eof_length) == F_equal_to) { *code = F_terminated_not_nest_eof; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_nest_eol, length, FL_status_string_terminated_not_nest_eol_length) == F_equal_to) { *code = F_terminated_not_nest_eol; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_nest_eos, length, FL_status_string_terminated_not_nest_eos_length) == F_equal_to) { *code = F_terminated_not_nest_eos; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_nest_stop, length, FL_status_string_terminated_not_nest_stop_length) == F_equal_to) { *code = F_terminated_not_nest_stop; + return F_none; } if (fl_string_compare(string, FL_status_string_terminated_not_stop, length, FL_status_string_terminated_not_stop_length) == F_equal_to) { *code = F_terminated_not_stop; + return F_none; } #endif // _di_F_status_buffer_ @@ -1655,16 +1977,19 @@ extern "C" { #ifndef _di_F_status_process_ if (fl_string_compare(string, FL_status_string_process, length, FL_status_string_process_length) == F_equal_to) { *code = F_process; + return F_none; } if (fl_string_compare(string, FL_status_string_process_not, length, FL_status_string_process_not_length) == F_equal_to) { *code = F_process_not; + return F_none; } if (fl_string_compare(string, FL_status_string_process_too_many, length, FL_status_string_process_too_many_length) == F_equal_to) { *code = F_process_too_many; + return F_none; } #endif // _di_F_status_process_ @@ -1672,211 +1997,253 @@ extern "C" { #ifndef _di_F_status_file_ if (fl_string_compare(string, FL_status_string_file, length, FL_status_string_file_length) == F_equal_to) { *code = F_file; + return F_none; } if (fl_string_compare(string, FL_status_string_file_close, length, FL_status_string_file_close_length) == F_equal_to) { *code = F_file_close; + return F_none; } if (fl_string_compare(string, FL_status_string_file_closed, length, FL_status_string_file_closed_length) == F_equal_to) { *code = F_file_closed; + return F_none; } if (fl_string_compare(string, FL_status_string_file_descriptor, length, FL_status_string_file_descriptor_length) == F_equal_to) { *code = F_file_descriptor; + return F_none; } if (fl_string_compare(string, FL_status_string_file_descriptor_max, length, FL_status_string_file_descriptor_max_length) == F_equal_to) { *code = F_file_descriptor_max; + return F_none; } if (fl_string_compare(string, FL_status_string_file_descriptor_not, length, FL_status_string_file_descriptor_not_length) == F_equal_to) { *code = F_file_descriptor_not; + return F_none; } if (fl_string_compare(string, FL_status_string_file_empty, length, FL_status_string_file_empty_length) == F_equal_to) { *code = F_file_empty; + return F_none; } if (fl_string_compare(string, FL_status_string_file_flush, length, FL_status_string_file_flush_length) == F_equal_to) { *code = F_file_flush; + return F_none; } if (fl_string_compare(string, FL_status_string_file_found, length, FL_status_string_file_found_length) == F_equal_to) { *code = F_file_found; + return F_none; } if (fl_string_compare(string, FL_status_string_file_found_not, length, FL_status_string_file_found_not_length) == F_equal_to) { *code = F_file_found_not; + return F_none; } if (fl_string_compare(string, FL_status_string_file_not, length, FL_status_string_file_not_length) == F_equal_to) { *code = F_file_not; + return F_none; } if (fl_string_compare(string, FL_status_string_file_open, length, FL_status_string_file_open_length) == F_equal_to) { *code = F_file_open; + return F_none; } if (fl_string_compare(string, FL_status_string_file_open_max, length, FL_status_string_file_open_max_length) == F_equal_to) { *code = F_file_open_max; + return F_none; } if (fl_string_compare(string, FL_status_string_file_opened, length, FL_status_string_file_opened_length) == F_equal_to) { *code = F_file_opened; + return F_none; } if (fl_string_compare(string, FL_status_string_file_overflow, length, FL_status_string_file_overflow_length) == F_equal_to) { *code = F_file_overflow; + return F_none; } if (fl_string_compare(string, FL_status_string_file_purge, length, FL_status_string_file_purge_length) == F_equal_to) { *code = F_file_purge; + return F_none; } if (fl_string_compare(string, FL_status_string_file_read, length, FL_status_string_file_read_length) == F_equal_to) { *code = F_file_read; + return F_none; } if (fl_string_compare(string, FL_status_string_file_reallocation, length, FL_status_string_file_reallocation_length) == F_equal_to) { *code = F_file_reallocation; + return F_none; } if (fl_string_compare(string, FL_status_string_file_seek, length, FL_status_string_file_seek_length) == F_equal_to) { *code = F_file_seek; + return F_none; } if (fl_string_compare(string, FL_status_string_file_stat, length, FL_status_string_file_stat_length) == F_equal_to) { *code = F_file_stat; + return F_none; } if (fl_string_compare(string, FL_status_string_file_synchronize, length, FL_status_string_file_synchronize_length) == F_equal_to) { *code = F_file_synchronize; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_block, length, FL_status_string_file_type_block_length) == F_equal_to) { *code = F_file_type_block; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_character, length, FL_status_string_file_type_character_length) == F_equal_to) { *code = F_file_type_character; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_directory, length, FL_status_string_file_type_directory_length) == F_equal_to) { *code = F_file_type_directory; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_link, length, FL_status_string_file_type_link_length) == F_equal_to) { *code = F_file_type_link; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_not_block, length, FL_status_string_file_type_not_block_length) == F_equal_to) { *code = F_file_type_not_block; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_not_character, length, FL_status_string_file_type_not_character_length) == F_equal_to) { *code = F_file_type_not_character; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_not_directory, length, FL_status_string_file_type_not_directory_length) == F_equal_to) { *code = F_file_type_not_directory; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_not_fifo, length, FL_status_string_file_type_not_fifo_length) == F_equal_to) { *code = F_file_type_not_fifo; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_not_link, length, FL_status_string_file_type_not_link_length) == F_equal_to) { *code = F_file_type_not_link; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_not_pipe, length, FL_status_string_file_type_not_pipe_length) == F_equal_to) { *code = F_file_type_not_pipe; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_not_regular, length, FL_status_string_file_type_not_regular_length) == F_equal_to) { *code = F_file_type_not_regular; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_not_socket, length, FL_status_string_file_type_not_socket_length) == F_equal_to) { *code = F_file_type_not_socket; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_not_unknown, length, FL_status_string_file_type_not_unknown_length) == F_equal_to) { *code = F_file_type_not_unknown; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_pipe, length, FL_status_string_file_type_pipe_length) == F_equal_to) { *code = F_file_type_pipe; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_regular, length, FL_status_string_file_type_regular_length) == F_equal_to) { *code = F_file_type_regular; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_socket, length, FL_status_string_file_type_socket_length) == F_equal_to) { *code = F_file_type_socket; + return F_none; } if (fl_string_compare(string, FL_status_string_file_type_unknown, length, FL_status_string_file_type_unknown_length) == F_equal_to) { *code = F_file_type_unknown; + return F_none; } if (fl_string_compare(string, FL_status_string_file_underflow, length, FL_status_string_file_underflow_length) == F_equal_to) { *code = F_file_underflow; + return F_none; } if (fl_string_compare(string, FL_status_string_file_utf, length, FL_status_string_file_utf_length) == F_equal_to) { *code = F_file_utf; + return F_none; } if (fl_string_compare(string, FL_status_string_file_utf_not, length, FL_status_string_file_utf_not_length) == F_equal_to) { *code = F_file_utf_not; + return F_none; } if (fl_string_compare(string, FL_status_string_file_write, length, FL_status_string_file_write_length) == F_equal_to) { *code = F_file_write; + return F_none; } #endif // _di_F_status_file_ @@ -1884,21 +2251,25 @@ extern "C" { #ifndef _di_F_status_filesystem_ if (fl_string_compare(string, FL_status_string_filesystem, length, FL_status_string_filesystem_length) == F_equal_to) { *code = F_filesystem; + return F_none; } if (fl_string_compare(string, FL_status_string_filesystem_not, length, FL_status_string_filesystem_not_length) == F_equal_to) { *code = F_filesystem_not; + return F_none; } if (fl_string_compare(string, FL_status_string_filesystem_quota_block, length, FL_status_string_filesystem_quota_block_length) == F_equal_to) { *code = F_filesystem_quota_block; + return F_none; } if (fl_string_compare(string, FL_status_string_filesystem_quota_reached, length, FL_status_string_filesystem_quota_reached_length) == F_equal_to) { *code = F_filesystem_quota_reached; + return F_none; } #endif // _di_F_status_filesystem_ @@ -1906,101 +2277,121 @@ extern "C" { #ifndef _di_F_status_directory_ if (fl_string_compare(string, FL_status_string_directory, length, FL_status_string_directory_length) == F_equal_to) { *code = F_directory; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_close, length, FL_status_string_directory_close_length) == F_equal_to) { *code = F_directory_close; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_closed, length, FL_status_string_directory_closed_length) == F_equal_to) { *code = F_directory_closed; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_descriptor, length, FL_status_string_directory_descriptor_length) == F_equal_to) { *code = F_directory_descriptor; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_empty, length, FL_status_string_directory_empty_length) == F_equal_to) { *code = F_directory_empty; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_empty_not, length, FL_status_string_directory_empty_not_length) == F_equal_to) { *code = F_directory_empty_not; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_found, length, FL_status_string_directory_found_length) == F_equal_to) { *code = F_directory_found; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_found_not, length, FL_status_string_directory_found_not_length) == F_equal_to) { *code = F_directory_found_not; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_flush, length, FL_status_string_directory_flush_length) == F_equal_to) { *code = F_directory_flush; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_link_max, length, FL_status_string_directory_link_max_length) == F_equal_to) { *code = F_directory_link_max; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_not, length, FL_status_string_directory_not_length) == F_equal_to) { *code = F_directory_not; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_open, length, FL_status_string_directory_open_length) == F_equal_to) { *code = F_directory_open; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_purge, length, FL_status_string_directory_purge_length) == F_equal_to) { *code = F_directory_purge; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_read, length, FL_status_string_directory_read_length) == F_equal_to) { *code = F_directory_read; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_stream, length, FL_status_string_directory_stream_length) == F_equal_to) { *code = F_directory_stream; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_supported_not, length, FL_status_string_directory_supported_not_length) == F_equal_to) { *code = F_directory_supported_not; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_synchronize, length, FL_status_string_directory_synchronize_length) == F_equal_to) { *code = F_directory_synchronize; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_utf, length, FL_status_string_directory_utf_length) == F_equal_to) { *code = F_directory_utf; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_utf_not, length, FL_status_string_directory_utf_not_length) == F_equal_to) { *code = F_directory_utf_not; + return F_none; } if (fl_string_compare(string, FL_status_string_directory_write, length, FL_status_string_directory_write_length) == F_equal_to) { *code = F_directory_write; + return F_none; } #endif // _di_F_status_directory_ @@ -2008,31 +2399,37 @@ extern "C" { #ifndef _di_F_status_socket_ if (fl_string_compare(string, FL_status_string_socket, length, FL_status_string_socket_length) == F_equal_to) { *code = F_socket; + return F_none; } if (fl_string_compare(string, FL_status_string_socket_client, length, FL_status_string_socket_client_length) == F_equal_to) { *code = F_socket_client; + return F_none; } if (fl_string_compare(string, FL_status_string_socket_not, length, FL_status_string_socket_not_length) == F_equal_to) { *code = F_socket_not; + return F_none; } if (fl_string_compare(string, FL_status_string_socket_receive, length, FL_status_string_socket_receive_length) == F_equal_to) { *code = F_socket_receive; + return F_none; } if (fl_string_compare(string, FL_status_string_socket_send, length, FL_status_string_socket_send_length) == F_equal_to) { *code = F_socket_send; + return F_none; } if (fl_string_compare(string, FL_status_string_socket_target, length, FL_status_string_socket_target_length) == F_equal_to) { *code = F_socket_target; + return F_none; } #endif // _di_F_status_socket_ @@ -2040,21 +2437,25 @@ extern "C" { #ifndef _di_F_status_compare_ if (fl_string_compare(string, FL_status_string_equal_to, length, FL_status_string_equal_to_length) == F_equal_to) { *code = F_equal_to; + return F_none; } if (fl_string_compare(string, FL_status_string_equal_to_not, length, FL_status_string_equal_to_not_length) == F_equal_to) { *code = F_equal_to_not; + return F_none; } if (fl_string_compare(string, FL_status_string_than_greater, length, FL_status_string_than_greater_length) == F_equal_to) { *code = F_than_greater; + return F_none; } if (fl_string_compare(string, FL_status_string_than_less, length, FL_status_string_than_less_length) == F_equal_to) { *code = F_than_less; + return F_none; } #endif // _di_F_status_compare_ @@ -2062,106 +2463,127 @@ extern "C" { #ifndef _di_F_status_access_ if (fl_string_compare(string, FL_status_string_access, length, FL_status_string_access_length) == F_equal_to) { *code = F_access; + return F_none; } if (fl_string_compare(string, FL_status_string_access_denied, length, FL_status_string_access_denied_length) == F_equal_to) { *code = F_access_denied; + return F_none; } if (fl_string_compare(string, FL_status_string_access_denied_user, length, FL_status_string_access_denied_user_length) == F_equal_to) { *code = F_access_denied_user; + return F_none; } if (fl_string_compare(string, FL_status_string_access_denied_group, length, FL_status_string_access_denied_group_length) == F_equal_to) { *code = F_access_denied_group; + return F_none; } if (fl_string_compare(string, FL_status_string_access_denied_world, length, FL_status_string_access_denied_world_length) == F_equal_to) { *code = F_access_denied_world; + return F_none; } if (fl_string_compare(string, FL_status_string_access_denied_read, length, FL_status_string_access_denied_read_length) == F_equal_to) { *code = F_access_denied_read; + return F_none; } if (fl_string_compare(string, FL_status_string_access_denied_write, length, FL_status_string_access_denied_write_length) == F_equal_to) { *code = F_access_denied_write; + return F_none; } if (fl_string_compare(string, FL_status_string_access_denied_execute, length, FL_status_string_access_denied_execute_length) == F_equal_to) { *code = F_access_denied_execute; + return F_none; } if (fl_string_compare(string, FL_status_string_access_denied_super, length, FL_status_string_access_denied_super_length) == F_equal_to) { *code = F_access_denied_super; + return F_none; } if (fl_string_compare(string, FL_status_string_access_granted, length, FL_status_string_access_granted_length) == F_equal_to) { *code = F_access_granted; + return F_none; } if (fl_string_compare(string, FL_status_string_access_granted_user, length, FL_status_string_access_granted_user_length) == F_equal_to) { *code = F_access_granted_user; + return F_none; } if (fl_string_compare(string, FL_status_string_access_granted_group, length, FL_status_string_access_granted_group_length) == F_equal_to) { *code = F_access_granted_group; + return F_none; } if (fl_string_compare(string, FL_status_string_access_granted_world, length, FL_status_string_access_granted_world_length) == F_equal_to) { *code = F_access_granted_world; + return F_none; } if (fl_string_compare(string, FL_status_string_access_granted_read, length, FL_status_string_access_granted_read_length) == F_equal_to) { *code = F_access_granted_read; + return F_none; } if (fl_string_compare(string, FL_status_string_access_granted_write, length, FL_status_string_access_granted_write_length) == F_equal_to) { *code = F_access_granted_write; + return F_none; } if (fl_string_compare(string, FL_status_string_access_granted_execute, length, FL_status_string_access_granted_execute_length) == F_equal_to) { *code = F_access_granted_execute; + return F_none; } if (fl_string_compare(string, FL_status_string_access_granted_super, length, FL_status_string_access_granted_super_length) == F_equal_to) { *code = F_access_granted_super; + return F_none; } if (fl_string_compare(string, FL_status_string_access_group, length, FL_status_string_access_group_length) == F_equal_to) { *code = F_access_mode; + return F_none; } if (fl_string_compare(string, FL_status_string_access_mode, length, FL_status_string_access_mode_length) == F_equal_to) { *code = F_access_group; + return F_none; } if (fl_string_compare(string, FL_status_string_access_not, length, FL_status_string_access_not_length) == F_equal_to) { *code = F_access_not; + return F_none; } if (fl_string_compare(string, FL_status_string_access_owner, length, FL_status_string_access_owner_length) == F_equal_to) { *code = F_access_owner; + return F_none; } #endif // _di_F_status_access_ diff --git a/level_2/fll_status/c/status.h b/level_2/fll_status/c/status.h index 386afd3..2c566e3 100644 --- a/level_2/fll_status/c/status.h +++ b/level_2/fll_status/c/status.h @@ -41,6 +41,7 @@ extern "C" { * @return * F_none on success. * F_data_not if string is empty. + * * F_data (with error bit) if not found. * F_parameter (with error bit) if a parameter is invalid. *