From 443a8fe5510515e7d53a025841582faf4b8b1304 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 7 Mar 2022 21:12:18 -0600 Subject: [PATCH] Update: Avoid the generic 'char' and switch to the explicit 'unsigned char'. Operations against unsigned are generally safer than the signed equivalents. Using the generic 'char' may be different between compilers and expecations cannot be guaranteed. This could result in obscure security issues. Changing this to 'unsigned char' guarantees consistent behavior. There are problems with some standard libc functions that expect char. Explicitly cast to 'char' in these cases. --- level_0/f_account/c/account.c | 24 +++++++++---------- level_0/f_capability/c/capability.c | 4 ++-- level_0/f_color/c/color.c | 2 +- level_0/f_color/c/color/common.h | 2 +- level_0/f_console/c/console/common.h | 6 ++--- level_0/f_conversion/c/conversion.c | 20 ++++++++-------- level_0/f_conversion/c/conversion.h | 20 ++++++++-------- level_0/f_conversion/c/private-conversion.c | 10 ++++---- level_0/f_conversion/c/private-conversion.h | 2 +- level_0/f_directory/c/directory.c | 10 ++++---- level_0/f_file/c/file.c | 4 ++-- level_0/f_file/c/private-file.c | 6 ++--- level_0/f_file/c/private-file.h | 2 +- level_0/f_iki/c/private-iki.c | 2 +- level_0/f_iki/c/private-iki.h | 2 +- level_0/f_path/c/path.c | 2 +- level_0/f_print/c/print.c | 6 ++--- level_0/f_print/c/print.h | 6 ++--- level_0/f_print/c/print/private-to.c | 2 +- level_0/f_print/c/print/private-to.h | 2 +- level_0/f_print/c/print/to.c | 4 ++-- level_0/f_print/c/print/to.h | 4 ++-- level_0/f_print/c/private-print.c | 2 +- level_0/f_print/c/private-print.h | 4 ++-- level_0/f_string/c/private-string.c | 4 ++-- level_0/f_string/c/string/common.h | 6 ++--- level_0/f_string/c/string/dynamic.c | 4 ++-- level_0/f_string/c/string/dynamic.h | 4 ++-- level_0/f_type/c/type.h | 2 +- level_0/f_utf/c/utf/dynamic.c | 4 ++-- level_0/f_utf/c/utf/dynamic.h | 4 ++-- level_1/fl_control_group/c/control_group.c | 2 +- level_1/fl_directory/c/directory.c | 2 +- level_1/fl_directory/c/private-directory.c | 22 ++++++++--------- level_1/fl_environment/c/environment.c | 4 ++-- level_1/fl_fss/c/private-fss.c | 6 ++--- level_1/fl_print/c/private-print.c | 8 +++---- level_1/fl_string/c/string.c | 2 +- level_1/fl_utf/c/utf.c | 8 +++---- level_1/fl_utf/c/utf.h | 8 +++---- level_1/fl_utf_file/c/private-utf_file.c | 2 +- level_1/fl_utf_file/c/private-utf_file.h | 2 +- level_1/fl_utf_file/c/utf_file.c | 12 +++++----- level_2/fll_control_group/c/control_group.c | 2 +- level_2/fll_execute/c/execute.c | 14 +++++------ level_2/fll_execute/c/private-execute.c | 4 ++-- level_2/fll_file/c/private-file.c | 8 +++---- level_2/fll_iki/c/private-iki.c | 4 ++-- level_2/fll_iki/c/private-iki.h | 4 ++-- level_2/fll_print/c/print.c | 4 ++-- level_2/fll_print/c/print.h | 4 ++-- level_3/byte_dump/c/private-byte_dump.c | 28 +++++++++++----------- level_3/byte_dump/c/private-byte_dump.h | 4 ++-- level_3/controller/c/common/private-control.h | 4 ++-- level_3/controller/c/control/private-control.c | 23 ++++++++++++++---- level_3/controller/c/control/private-control.h | 4 ++-- .../controller/c/controller/private-controller.c | 4 ++-- level_3/controller/c/entry/private-entry.c | 8 +++---- level_3/controller/c/rule/private-rule.c | 10 ++++---- .../controller/c/thread/private-thread_control.c | 13 ++++++++++ level_3/controller/documents/packet.txt | 12 +++------- level_3/controller/specifications/packet.txt | 6 ++--- level_3/fake/c/private-build-library.c | 26 ++++++++++---------- level_3/fake/c/private-build-object.c | 4 ++-- level_3/fake/c/private-build-program.c | 8 +++---- level_3/fake/c/private-build-skeleton.c | 2 +- level_3/fake/c/private-build.c | 28 +++++++++++----------- level_3/fake/c/private-make-operate_process_type.c | 4 ++-- level_3/fake/c/private-make-operate_validate.c | 2 +- level_3/fake/c/private-skeleton.c | 10 ++++---- level_3/firewall/c/firewall.c | 4 ++-- level_3/utf8/c/private-utf8_binary.c | 2 +- level_3/utf8/c/private-utf8_codepoint.c | 4 ++-- 73 files changed, 265 insertions(+), 243 deletions(-) diff --git a/level_0/f_account/c/account.c b/level_0/f_account/c/account.c index 9d67cd3..13c6d3d 100644 --- a/level_0/f_account/c/account.c +++ b/level_0/f_account/c/account.c @@ -35,7 +35,7 @@ extern "C" { // Must be set to 0 to avoid problems due to the design of getpwuid()/getpwuid_r(). errno = 0; - char buffer[length]; + unsigned char buffer[length]; const int result = getpwuid_r(id, &password, buffer, length, &pointer); if (result) { @@ -63,7 +63,7 @@ extern "C" { length = F_account_pwd_length_fallback_second_d; - char buffer[F_account_pwd_length_fallback_second_d]; + unsigned char buffer[F_account_pwd_length_fallback_second_d]; const int result = getpwuid_r(id, &password, buffer, length, &pointer); @@ -116,7 +116,7 @@ extern "C" { // Must be set to 0 to avoid problems due to the design of getpwnam()/getpwnam_r(). errno = 0; - char buffer[length]; + unsigned char buffer[length]; const int result = getpwnam_r(name.string, &password, buffer, length, &pointer); if (result) { @@ -144,7 +144,7 @@ extern "C" { length = F_account_pwd_length_fallback_second_d; - char buffer[F_account_pwd_length_fallback_second_d]; + unsigned char buffer[F_account_pwd_length_fallback_second_d]; const int result = getpwnam_r(name.string, &password, buffer, length, &pointer); @@ -189,7 +189,7 @@ extern "C" { // Must be set to 0 to avoid problems due to the design of getgrnam()/getgrnam_r(). errno = 0; - char buffer[length]; + unsigned char buffer[length]; int result = getgrnam_r(name.string, &group_data, buffer, length, &pointer); if (result) { @@ -219,7 +219,7 @@ extern "C" { length = F_account_pwd_length_fallback_second_d; - char buffer[F_account_pwd_length_fallback_second_d]; + unsigned char buffer[F_account_pwd_length_fallback_second_d]; const int result = getgrnam_r(name.string, &group_data, buffer, length, &pointer); @@ -270,7 +270,7 @@ extern "C" { // Must be set to 0 to avoid problems due to the design of getpwuid()/getpwuid_r(). errno = 0; - char buffer[length]; + unsigned char buffer[length]; const int result = getgrgid_r(id, &group_data, buffer, length, &pointer); if (result) { @@ -308,7 +308,7 @@ extern "C" { length = F_account_pwd_length_fallback_second_d; - char buffer[F_account_pwd_length_fallback_second_d]; + unsigned char buffer[F_account_pwd_length_fallback_second_d]; const int result = getgrgid_r(id, &group_data, buffer, length, &pointer); @@ -363,7 +363,7 @@ extern "C" { // Must be set to 0 to avoid problems due to the design of getpwnam()/getpwnam_r(). errno = 0; - char buffer[length]; + unsigned char buffer[length]; const int result = getpwnam_r(name.string, &password, buffer, length, &pointer); if (result) { @@ -393,7 +393,7 @@ extern "C" { length = F_account_pwd_length_fallback_second_d; - char buffer[F_account_pwd_length_fallback_second_d]; + unsigned char buffer[F_account_pwd_length_fallback_second_d]; const int result = getpwnam_r(name.string, &password, buffer, length, &pointer); @@ -444,7 +444,7 @@ extern "C" { // Must be set to 0 to avoid problems due to the design of getpwuid()/getpwuid_r(). errno = 0; - char buffer[length]; + unsigned char buffer[length]; const int result = getpwuid_r(id, &password, buffer, length, &pointer); if (result) { @@ -482,7 +482,7 @@ extern "C" { length = F_account_pwd_length_fallback_second_d; - char buffer[F_account_pwd_length_fallback_second_d]; + unsigned char buffer[F_account_pwd_length_fallback_second_d]; const int result = getpwuid_r(id, &password, buffer, length, &pointer); diff --git a/level_0/f_capability/c/capability.c b/level_0/f_capability/c/capability.c index 6e8fa33..3c302b9 100644 --- a/level_0/f_capability/c/capability.c +++ b/level_0/f_capability/c/capability.c @@ -1048,7 +1048,7 @@ extern "C" { if (!name) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - char *result = cap_to_name(code); + unsigned char *result = cap_to_name(code); if (result) { const f_array_length_t length = strlen(result); @@ -1091,7 +1091,7 @@ extern "C" { ssize_t length = 0; - char *result = cap_to_text(capability, &length); + unsigned char *result = cap_to_text(capability, &length); if (result) { if (text->used + length + 1 > text->size) { diff --git a/level_0/f_color/c/color.c b/level_0/f_color/c/color.c index 6433c35..b79f05c 100644 --- a/level_0/f_color/c/color.c +++ b/level_0/f_color/c/color.c @@ -12,7 +12,7 @@ extern "C" { // Switch to the appropriate terminal color mode. { - char *environment = getenv(f_color_terminal_name_s.string); + unsigned char *environment = getenv(f_color_terminal_name_s.string); if (!environment || strncmp(environment, f_color_terminal_value_linux_s.string, f_color_terminal_value_linux_s.used) == 0) { macro_f_color_t_set_linux(context->list); diff --git a/level_0/f_color/c/color/common.h b/level_0/f_color/c/color/common.h index bd6361d..0337b7d 100644 --- a/level_0/f_color/c/color/common.h +++ b/level_0/f_color/c/color/common.h @@ -37,7 +37,7 @@ extern "C" { * - xterminal: X-Terminal color code set. */ #ifndef _di_f_color_code_t_ - typedef char f_color_code_t; + typedef unsigned char f_color_code_t; #define F_color_code_none_d 0 #define F_color_code_linux_d 1 diff --git a/level_0/f_console/c/console/common.h b/level_0/f_console/c/console/common.h index e1ced14..63fc650 100644 --- a/level_0/f_console/c/console/common.h +++ b/level_0/f_console/c/console/common.h @@ -262,9 +262,9 @@ extern "C" { */ #ifndef _di_f_console_parameter_t_ typedef struct { - const char *symbol_short; - const char *symbol_long; - const char *symbol_other; + const unsigned char *symbol_short; + const unsigned char *symbol_long; + const unsigned char *symbol_other; const uint8_t values_total; const uint8_t type; diff --git a/level_0/f_conversion/c/conversion.c b/level_0/f_conversion/c/conversion.c index 18d4312..1e5f664 100644 --- a/level_0/f_conversion/c/conversion.c +++ b/level_0/f_conversion/c/conversion.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_f_conversion_character_is_binary_ - f_status_t f_conversion_character_is_binary(const char character) { + f_status_t f_conversion_character_is_binary(const unsigned char character) { if (character == 0x30 || character == 0x31) { return F_true; @@ -17,7 +17,7 @@ extern "C" { #endif // _di_f_conversion_character_is_binary_ #ifndef _di_f_conversion_character_is_decimal_ - f_status_t f_conversion_character_is_decimal(const char character) { + f_status_t f_conversion_character_is_decimal(const unsigned char character) { if (character > 0x2f && character < 0x3a) { return F_true; @@ -28,7 +28,7 @@ extern "C" { #endif // _di_f_conversion_character_is_decimal_ #ifndef _di_f_conversion_character_is_duodecimal_ - f_status_t f_conversion_character_is_duodecimal(const char character) { + f_status_t f_conversion_character_is_duodecimal(const unsigned char character) { if (character > 0x2f && character < 0x3a) { return F_true; @@ -47,7 +47,7 @@ extern "C" { #endif // _di_f_conversion_character_is_duodecimal_ #ifndef _di_f_conversion_character_is_hexidecimal_ - f_status_t f_conversion_character_is_hexidecimal(const char character) { + f_status_t f_conversion_character_is_hexidecimal(const unsigned char character) { if (character > 0x2f && character < 0x3a) { return F_true; @@ -66,7 +66,7 @@ extern "C" { #endif // _di_f_conversion_character_is_hexidecimal_ #ifndef _di_f_conversion_character_is_octal_ - f_status_t f_conversion_character_is_octal(const char character) { + f_status_t f_conversion_character_is_octal(const unsigned char character) { if (character > 0x2f && character < 0x38) { return F_true; @@ -77,7 +77,7 @@ extern "C" { #endif // _di_f_conversion_character_is_octal_ #ifndef _di_f_conversion_character_to_binary_ - f_status_t f_conversion_character_to_binary(const char character, uint8_t * const number) { + f_status_t f_conversion_character_to_binary(const unsigned char character, uint8_t * const number) { #ifndef _di_level_0_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -95,7 +95,7 @@ extern "C" { #endif // _di_f_conversion_character_to_binary_ #ifndef _di_f_conversion_character_to_decimal_ - f_status_t f_conversion_character_to_decimal(const char character, uint8_t * const number) { + f_status_t f_conversion_character_to_decimal(const unsigned char character, uint8_t * const number) { #ifndef _di_level_0_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -111,7 +111,7 @@ extern "C" { #endif // _di_f_conversion_character_to_decimal_ #ifndef _di_f_conversion_character_to_duodecimal_ - f_status_t f_conversion_character_to_duodecimal(const char character, uint8_t * const number) { + f_status_t f_conversion_character_to_duodecimal(const unsigned char character, uint8_t * const number) { #ifndef _di_level_0_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -133,7 +133,7 @@ extern "C" { #endif // _di_f_conversion_character_to_duodecimal_ #ifndef _di_f_conversion_character_to_hexidecimal_ - f_status_t f_conversion_character_to_hexidecimal(const char character, uint8_t * const number) { + f_status_t f_conversion_character_to_hexidecimal(const unsigned char character, uint8_t * const number) { #ifndef _di_level_0_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -155,7 +155,7 @@ extern "C" { #endif // _di_f_conversion_character_to_hexidecimal_ #ifndef _di_f_conversion_character_to_octal_ - f_status_t f_conversion_character_to_octal(const char character, uint8_t * const number) { + f_status_t f_conversion_character_to_octal(const unsigned char character, uint8_t * const number) { #ifndef _di_level_0_parameter_checking_ if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_conversion/c/conversion.h b/level_0/f_conversion/c/conversion.h index d5764a8..69a8b7e 100644 --- a/level_0/f_conversion/c/conversion.h +++ b/level_0/f_conversion/c/conversion.h @@ -47,7 +47,7 @@ extern "C" { * F_false if character is not a binary. */ #ifndef _di_f_conversion_character_is_binary_ - extern f_status_t f_conversion_character_is_binary(const char character); + extern f_status_t f_conversion_character_is_binary(const unsigned char character); #endif // _di_f_conversion_character_is_binary_ /** @@ -65,7 +65,7 @@ extern "C" { * F_false if character is not a decimal. */ #ifndef _di_f_conversion_character_is_decimal_ - extern f_status_t f_conversion_character_is_decimal(const char character); + extern f_status_t f_conversion_character_is_decimal(const unsigned char character); #endif // _di_f_conversion_character_is_decimal_ /** @@ -85,7 +85,7 @@ extern "C" { * F_false if character is not a duodecimal. */ #ifndef _di_f_conversion_character_is_duodecimal_ - extern f_status_t f_conversion_character_is_duodecimal(const char character); + extern f_status_t f_conversion_character_is_duodecimal(const unsigned char character); #endif // _di_f_conversion_character_is_duodecimal_ /** @@ -109,7 +109,7 @@ extern "C" { * F_false if character is not a hexidecimal. */ #ifndef _di_f_conversion_character_is_hexidecimal_ - extern f_status_t f_conversion_character_is_hexidecimal(const char character); + extern f_status_t f_conversion_character_is_hexidecimal(const unsigned char character); #endif // _di_f_conversion_character_is_hexidecimal_ /** @@ -127,7 +127,7 @@ extern "C" { * F_false if character is not an octal. */ #ifndef _di_f_conversion_character_is_octal_ - extern f_status_t f_conversion_character_is_octal(const char character); + extern f_status_t f_conversion_character_is_octal(const unsigned char character); #endif // _di_f_conversion_character_is_octal_ /** @@ -146,7 +146,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_conversion_character_to_binary_ - extern f_status_t f_conversion_character_to_binary(const char character, uint8_t * const number); + extern f_status_t f_conversion_character_to_binary(const unsigned char character, uint8_t * const number); #endif // _di_f_conversion_character_to_binary_ /** @@ -165,7 +165,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_conversion_character_to_decimal_ - extern f_status_t f_conversion_character_to_decimal(const char character, uint8_t * const number); + extern f_status_t f_conversion_character_to_decimal(const unsigned char character, uint8_t * const number); #endif // _di_f_conversion_character_to_decimal_ /** @@ -184,7 +184,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_conversion_character_to_duodecimal_ - extern f_status_t f_conversion_character_to_duodecimal(const char character, uint8_t * const number); + extern f_status_t f_conversion_character_to_duodecimal(const unsigned char character, uint8_t * const number); #endif // _di_f_conversion_character_to_duodecimal_ /** @@ -203,7 +203,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_conversion_character_to_hexidecimal_ - extern f_status_t f_conversion_character_to_hexidecimal(const char character, uint8_t * const number); + extern f_status_t f_conversion_character_to_hexidecimal(const unsigned char character, uint8_t * const number); #endif // _di_f_conversion_character_to_hexidecimal_ /** @@ -222,7 +222,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_f_conversion_character_to_octal_ - extern f_status_t f_conversion_character_to_octal(const char character, uint8_t * const number); + extern f_status_t f_conversion_character_to_octal(const unsigned char character, uint8_t * const number); #endif // _di_f_conversion_character_to_octal_ /** diff --git a/level_0/f_conversion/c/private-conversion.c b/level_0/f_conversion/c/private-conversion.c index 4c216a4..3cbbe05 100644 --- a/level_0/f_conversion/c/private-conversion.c +++ b/level_0/f_conversion/c/private-conversion.c @@ -121,7 +121,7 @@ extern "C" { f_number_unsigned_t current = number; f_number_unsigned_t work = 0; - for (char c = 0; digits; --digits) { + for (unsigned char c = 0; digits; --digits) { work = current / power; current -= work * power; @@ -188,7 +188,7 @@ extern "C" { return F_status_set_error(F_output); } - char c = 0; + unsigned char c = 0; switch (data.base) { case 2: @@ -320,7 +320,7 @@ extern "C" { f_number_unsigned_t current = number; f_number_unsigned_t work = 0; - for (char c = 0; digits; --digits) { + for (unsigned char c = 0; digits; --digits) { work = current / power; current -= work * power; @@ -344,7 +344,7 @@ extern "C" { #endif // !defined(_di_f_conversion_number_signed_to_string_) || !defined(_di_f_conversion_number_unsigned_to_string_) #if !defined(_di_f_conversion_number_signed_to_string_) || !defined(_di_f_conversion_number_unsigned_to_string_) - void private_f_conversion_digit_to_string_pad(const f_conversion_data_t data, const char pad, int total, f_string_dynamic_t * const destination) { + void private_f_conversion_digit_to_string_pad(const f_conversion_data_t data, const unsigned char pad, int total, f_string_dynamic_t * const destination) { for (; total; --total) { destination->string[destination->used++] = pad; @@ -373,7 +373,7 @@ extern "C" { if (data.flag & F_conversion_data_flag_base_prepend_d) { destination->string[destination->used++] = f_string_ascii_0_s.string[0]; - char c = 0; + unsigned char c = 0; switch (data.base) { case 2: diff --git a/level_0/f_conversion/c/private-conversion.h b/level_0/f_conversion/c/private-conversion.h index 6257723..8eb99ec 100644 --- a/level_0/f_conversion/c/private-conversion.h +++ b/level_0/f_conversion/c/private-conversion.h @@ -213,7 +213,7 @@ extern "C" { * @see f_conversion_number_unsigned_to_string() */ #if !defined(_di_f_conversion_number_signed_to_string_) || !defined(_di_f_conversion_number_unsigned_to_string_) - extern void private_f_conversion_digit_to_string_pad(const f_conversion_data_t data, const char pad, int total, f_string_dynamic_t * const destination) F_attribute_visibility_internal_d; + extern void private_f_conversion_digit_to_string_pad(const f_conversion_data_t data, const unsigned char pad, int total, f_string_dynamic_t * const destination) F_attribute_visibility_internal_d; #endif // !defined(_di_f_conversion_number_signed_to_string_) || !defined(_di_f_conversion_number_unsigned_to_string_) /** diff --git a/level_0/f_directory/c/directory.c b/level_0/f_directory/c/directory.c index 1577728..f3ba1a8 100644 --- a/level_0/f_directory/c/directory.c +++ b/level_0/f_directory/c/directory.c @@ -188,7 +188,7 @@ extern "C" { // 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]); + f_memory_delete(size, sizeof(unsigned char *), (void **) & listing[i]); continue; } @@ -206,11 +206,11 @@ extern "C" { memcpy(names->array[names->used].string, listing[i]->d_name, size); names->array[names->used++].used = size; - f_memory_delete(size, sizeof(char *), (void **) & listing[i]); + f_memory_delete(size, sizeof(unsigned char *), (void **) & listing[i]); } // for for (; i < length; ++i) { - f_memory_delete(size, sizeof(char *), (void **) & listing[i]); + f_memory_delete(size, sizeof(unsigned char *), (void **) & listing[i]); } // for f_memory_delete(1, sizeof(struct dirent *), (void **) & listing); @@ -324,7 +324,7 @@ extern "C" { int result = 0; if (depth_max) { - result = nftw(path.string, private_f_directory_remove_recursively, depth_max, FTW_DEPTH | FTW_PHYS); + result = nftw((char *) path.string, private_f_directory_remove_recursively, depth_max, FTW_DEPTH | FTW_PHYS); if (result == 0 && !preserve) { result = remove(path.string); @@ -378,7 +378,7 @@ extern "C" { int result = 0; if (depth_max) { - result = nftw(path.string, custom, depth_max, FTW_DEPTH | FTW_PHYS); + result = nftw((char *) path.string, custom, depth_max, FTW_DEPTH | FTW_PHYS); if (result == 0 && !preserve) { result = remove(path.string); diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index e5a60ac..6d213d7 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -1392,7 +1392,7 @@ extern "C" { } // POSIX basename() modifies the path, so protect it (and add a terminating NULL). - char path_argument[path.used + 1]; + unsigned char path_argument[path.used + 1]; f_string_t path_to_name; memcpy(path_argument, path.string, path.used); @@ -1424,7 +1424,7 @@ extern "C" { } // POSIX dirname() modifies the path, so protect it (and add a terminating NULL). - char path_argument[path.used + 1]; + unsigned char path_argument[path.used + 1]; f_string_t path_to_name; memcpy(path_argument, path.string, path.used); diff --git a/level_0/f_file/c/private-file.c b/level_0/f_file/c/private-file.c index d7fe2c2..b1ced97 100644 --- a/level_0/f_file/c/private-file.c +++ b/level_0/f_file/c/private-file.c @@ -60,7 +60,7 @@ extern "C" { ssize_t size_read = 0; ssize_t size_write = 0; - char *buffer[size_block]; + unsigned char *buffer[size_block]; memset(buffer, 0, size_block); @@ -109,7 +109,7 @@ extern "C" { ssize_t size_read = 0; ssize_t size_write = 0; - char *buffer[size_block]; + unsigned char *buffer[size_block]; memset(buffer, 0, size_block); @@ -761,7 +761,7 @@ extern "C" { #endif // !defined(_di_f_file_stat_by_id_) || !defined(_di_f_file_size_by_id_) #if !defined(_di_f_file_stream_descriptor_) || !defined(_di_f_file_stream_open_) || !defined(_di_f_file_stream_reopen_) - const char *private_f_file_stream_open_mode_determine(const int flag) { + const unsigned char *private_f_file_stream_open_mode_determine(const int flag) { if (flag & F_file_flag_read_write_d) { if (flag & F_file_flag_truncate_d) { diff --git a/level_0/f_file/c/private-file.h b/level_0/f_file/c/private-file.h index adfd7d8..f9cc272 100644 --- a/level_0/f_file/c/private-file.h +++ b/level_0/f_file/c/private-file.h @@ -903,7 +903,7 @@ extern "C" { * @see f_file_stream_reopen() */ #if !defined(_di_f_file_stream_descriptor_) || !defined(_di_f_file_stream_open_) || !defined(_di_f_file_stream_reopen_) - extern const char *private_f_file_stream_open_mode_determine(const int flag) F_attribute_visibility_internal_d; + extern const unsigned char *private_f_file_stream_open_mode_determine(const int flag) F_attribute_visibility_internal_d; #endif // !defined(_di_f_file_stream_descriptor_) || !defined(_di_f_file_stream_open_) || !defined(_di_f_file_stream_reopen_) /** diff --git a/level_0/f_iki/c/private-iki.c b/level_0/f_iki/c/private-iki.c index 03a9e6c..a5b2daa 100644 --- a/level_0/f_iki/c/private-iki.c +++ b/level_0/f_iki/c/private-iki.c @@ -82,7 +82,7 @@ extern "C" { #endif // !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_decrease_by_) || !defined(_di_f_iki_datas_increase_) || !defined(_di_f_iki_datas_increase_by_) || !defined(_di_f_iki_datas_resize_) #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_t buffer, const f_array_length_t length, const char quote) { + f_status_t private_f_iki_content_partial_is(const f_string_t buffer, const f_array_length_t length, const unsigned char quote) { f_array_length_t delimits = 0; diff --git a/level_0/f_iki/c/private-iki.h b/level_0/f_iki/c/private-iki.h index 9632a56..c6b5653 100644 --- a/level_0/f_iki/c/private-iki.h +++ b/level_0/f_iki/c/private-iki.h @@ -92,7 +92,7 @@ extern "C" { * @see f_iki_content_partial_is() */ #if !defined(_di_f_iki_content_is_) || !defined(_di_f_iki_content_partial_is_) - extern f_status_t private_f_iki_content_partial_is(const f_string_t buffer, const f_array_length_t length, const char quote) F_attribute_visibility_internal_d; + extern f_status_t private_f_iki_content_partial_is(const f_string_t buffer, const f_array_length_t length, const unsigned char quote) F_attribute_visibility_internal_d; #endif // !defined(_di_f_iki_content_is_) || !defined(_di_f_iki_content_partial_is_) /** diff --git a/level_0/f_path/c/path.c b/level_0/f_path/c/path.c index 51bbd04..817ac54 100644 --- a/level_0/f_path/c/path.c +++ b/level_0/f_path/c/path.c @@ -55,7 +55,7 @@ extern "C" { if (!path) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - char buffer[F_path_length_max_d]; + unsigned char buffer[F_path_length_max_d]; if (!getcwd(buffer, F_path_length_max_d)) { if (errno == EACCES) return F_status_set_error(F_access_denied); diff --git a/level_0/f_print/c/print.c b/level_0/f_print/c/print.c index 5a19956..368dff0 100644 --- a/level_0/f_print/c/print.c +++ b/level_0/f_print/c/print.c @@ -20,7 +20,7 @@ extern "C" { #endif // _di_f_print_ #ifndef _di_f_print_character_ - f_status_t f_print_character(const char character, FILE * const output) { + f_status_t f_print_character(const unsigned char character, FILE * const output) { #ifndef _di_level_0_parameter_checking_ if (!output) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -34,7 +34,7 @@ extern "C" { #endif // _di_f_print_character_ #ifndef _di_f_print_character_safely_ - f_status_t f_print_character_safely(const char character, FILE * const output) { + f_status_t f_print_character_safely(const unsigned char character, FILE * const output) { #ifndef _di_level_0_parameter_checking_ if (!output) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -65,7 +65,7 @@ extern "C" { #endif // _di_f_print_character_safely_ #ifndef _di_f_print_character_safely_get_ - const f_string_static_t f_print_character_safely_get(const char character) { + const f_string_static_t f_print_character_safely_get(const unsigned char character) { return private_f_print_character_safely_get(character); } diff --git a/level_0/f_print/c/print.h b/level_0/f_print/c/print.h index 65268a2..4289d63 100644 --- a/level_0/f_print/c/print.h +++ b/level_0/f_print/c/print.h @@ -85,7 +85,7 @@ extern "C" { * @see fwrite_unlocked() */ #ifndef _di_f_print_character_ - extern f_status_t f_print_character(const char character, FILE * const output); + extern f_status_t f_print_character(const unsigned char character, FILE * const output); #endif // _di_f_print_character_ /** @@ -116,7 +116,7 @@ extern "C" { * @see fwrite_unlocked() */ #ifndef _di_f_print_character_safely_ - extern f_status_t f_print_character_safely(const char character, FILE * const output); + extern f_status_t f_print_character_safely(const unsigned char character, FILE * const output); #endif // _di_f_print_character_safely_ /** @@ -140,7 +140,7 @@ extern "C" { * A string with a non-zero used length is returned are NULL terminated (after the used length). */ #ifndef _di_f_print_character_safely_get_ - extern const f_string_static_t f_print_character_safely_get(const char character); + extern const f_string_static_t f_print_character_safely_get(const unsigned char character); #endif // _di_f_print_character_safely_get_ /** diff --git a/level_0/f_print/c/print/private-to.c b/level_0/f_print/c/print/private-to.c index fc4ed2a..6df7b81 100644 --- a/level_0/f_print/c/print/private-to.c +++ b/level_0/f_print/c/print/private-to.c @@ -65,7 +65,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { #endif // !defined(_di_f_print_to_) || !defined(_di_f_print_dynamic_to_) || !defined(_di_f_print_dynamic_partial_to_) #if !defined(_di_f_print_to_character_safely_) || !defined(_di_f_print_to_safely_) || !defined(_di_f_print_to_safely_dynamic_) || !defined(_di_f_print_to_safely_dynamic_partial_) || !defined(_di_f_print_to_safely_terminated_) || !defined(_di_f_print_to_except_safely_) || !defined(_di_f_print_to_except_dynamic_safely_) || !defined(_di_f_print_to_except_dynamic_partial_safely_) || !defined(_di_f_print_to_except_in_safely_) || !defined(_di_f_print_to_except_in_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_partial_safely_) - f_status_t private_f_print_to_character_safely(const char character, const int id) { + f_status_t private_f_print_to_character_safely(const unsigned char character, const int id) { if (character == 0x7f) { if (write(id, f_print_sequence_delete_s.string, f_print_sequence_delete_s.used) != -1) { diff --git a/level_0/f_print/c/print/private-to.h b/level_0/f_print/c/print/private-to.h index ec2f2a3..dc1570c 100644 --- a/level_0/f_print/c/print/private-to.h +++ b/level_0/f_print/c/print/private-to.h @@ -102,7 +102,7 @@ extern "C" { * @see f_print_to_except_in_dynamic_partial_safely() */ #if !defined(_di_f_print_to_character_safely_) || !defined(_di_f_print_to_safely_) || !defined(_di_f_print_to_safely_dynamic_) || !defined(_di_f_print_to_safely_dynamic_partial_) || !defined(_di_f_print_to_safely_terminated_) || !defined(_di_f_print_to_except_safely_) || !defined(_di_f_print_to_except_dynamic_safely_) || !defined(_di_f_print_to_except_dynamic_partial_safely_) || !defined(_di_f_print_to_except_in_safely_) || !defined(_di_f_print_to_except_in_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_partial_safely_) - extern f_status_t private_f_print_to_character_safely(const char character, const int id) F_attribute_visibility_internal_d; + extern f_status_t private_f_print_to_character_safely(const unsigned char character, const int id) F_attribute_visibility_internal_d; #endif // !defined(_di_f_print_to_character_safely_) || !defined(_di_f_print_to_safely_) || !defined(_di_f_print_to_safely_dynamic_) || !defined(_di_f_print_to_safely_dynamic_partial_) || !defined(_di_f_print_to_safely_terminated_) || !defined(_di_f_print_to_except_safely_) || !defined(_di_f_print_to_except_dynamic_safely_) || !defined(_di_f_print_to_except_dynamic_partial_safely_) || !defined(_di_f_print_to_except_in_safely_) || !defined(_di_f_print_to_except_in_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_partial_safely_) /** diff --git a/level_0/f_print/c/print/to.c b/level_0/f_print/c/print/to.c index c642899..acdb4c4 100644 --- a/level_0/f_print/c/print/to.c +++ b/level_0/f_print/c/print/to.c @@ -46,7 +46,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { #endif // _di_f_print_to_ #ifndef _di_f_print_to_character_ - f_status_t f_print_to_character(const char character, const int id) { + f_status_t f_print_to_character(const unsigned char character, const int id) { #ifndef _di_level_0_parameter_checking_ if (id == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -60,7 +60,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { #endif // _di_f_print_to_character_ #ifndef _di_f_print_to_character_safely_ - f_status_t f_print_to_character_safely(const char character, const int id) { + f_status_t f_print_to_character_safely(const unsigned char character, const int id) { #ifndef _di_level_0_parameter_checking_ if (id == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_print/c/print/to.h b/level_0/f_print/c/print/to.h index 01437ca..0ccb584 100644 --- a/level_0/f_print/c/print/to.h +++ b/level_0/f_print/c/print/to.h @@ -91,7 +91,7 @@ extern "C" { * @see write() */ #ifndef _di_f_print_to_character_ - extern f_status_t f_print_to_character(const char character, const int id); + extern f_status_t f_print_to_character(const unsigned char character, const int id); #endif // _di_f_print_to_character_ /** @@ -131,7 +131,7 @@ extern "C" { * @see write() */ #ifndef _di_f_print_to_character_safely_ - extern f_status_t f_print_to_character_safely(const char character, const int id); + extern f_status_t f_print_to_character_safely(const unsigned char character, const int id); #endif // _di_f_print_to_character_safely_ /** diff --git a/level_0/f_print/c/private-print.c b/level_0/f_print/c/private-print.c index 6bed169..cfaa971 100644 --- a/level_0/f_print/c/private-print.c +++ b/level_0/f_print/c/private-print.c @@ -39,7 +39,7 @@ extern "C" { #endif // !defined(_di_f_print_) || !defined(_di_f_print_dynamic_) || !defined(_di_f_print_dynamic_partial_) #if !defined(_di_f_print_character_safely_get_) || !defined(_di_f_print_dynamic_partial_safely_) || !defined(_di_f_print_dynamic_safely_) || !defined(_di_f_print_except_dynamic_partial_safely_) || !defined(_di_f_print_except_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_partial_safely_) || !defined(_di_f_print_except_in_safely_) || !defined(_di_f_print_except_safely_) || !defined(_di_f_print_safely_) || !defined(_di_f_print_safely_terminated_) || !defined(_di_f_print_to_dynamic_partial_safely_) || !defined(_di_f_print_to_dynamic_safely_) || !defined(_di_f_print_to_except_dynamic_partial_safely_) || !defined(_di_f_print_to_except_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_partial_safely_) || !defined(_di_f_print_to_except_in_safely_) || !defined(_di_f_print_to_except_safely_) || !defined(_di_f_print_to_safely_) - const f_string_static_t private_f_print_character_safely_get(const char character) { + const f_string_static_t private_f_print_character_safely_get(const unsigned char character) { if (character == 0x7f) { return f_print_sequence_delete_s; diff --git a/level_0/f_print/c/private-print.h b/level_0/f_print/c/private-print.h index a729d1c..d60dbe0 100644 --- a/level_0/f_print/c/private-print.h +++ b/level_0/f_print/c/private-print.h @@ -76,7 +76,7 @@ extern "C" { * @see f_print_except_in_dynamic_partial_safely() */ #if !defined(_di_f_print_character_safely_) || !defined(_di_f_print_safely_) || !defined(_di_f_print_safely_dynamic_) || !defined(_di_f_print_safely_dynamic_partial_) || !defined(_di_f_print_safely_terminated_) || !defined(_di_f_print_except_safely_) || !defined(_di_f_print_except_dynamic_safely_) || !defined(_di_f_print_except_dynamic_partial_safely_) || !defined(_di_f_print_except_in_safely_) || !defined(_di_f_print_except_in_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_partial_safely_) - extern f_status_t private_f_print_character_safely(const char character, FILE * const output) F_attribute_visibility_internal_d; + extern f_status_t private_f_print_character_safely(const unsigned char character, FILE * const output) F_attribute_visibility_internal_d; #endif // !defined(_di_f_print_character_safely_) || !defined(_di_f_print_safely_) || !defined(_di_f_print_safely_dynamic_) || !defined(_di_f_print_safely_dynamic_partial_) || !defined(_di_f_print_safely_terminated_) || !defined(_di_f_print_except_safely_) || !defined(_di_f_print_except_dynamic_safely_) || !defined(_di_f_print_except_dynamic_partial_safely_) || !defined(_di_f_print_except_in_safely_) || !defined(_di_f_print_except_in_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_partial_safely_) /** @@ -115,7 +115,7 @@ extern "C" { * @see f_print_to_safely() */ #if !defined(_di_f_print_character_safely_get_) || !defined(_di_f_print_dynamic_partial_safely_) || !defined(_di_f_print_dynamic_safely_) || !defined(_di_f_print_except_dynamic_partial_safely_) || !defined(_di_f_print_except_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_partial_safely_) || !defined(_di_f_print_except_in_safely_) || !defined(_di_f_print_except_safely_) || !defined(_di_f_print_safely_) || !defined(_di_f_print_safely_terminated_) || !defined(_di_f_print_to_dynamic_partial_safely_) || !defined(_di_f_print_to_dynamic_safely_) || !defined(_di_f_print_to_except_dynamic_partial_safely_) || !defined(_di_f_print_to_except_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_partial_safely_) || !defined(_di_f_print_to_except_in_safely_) || !defined(_di_f_print_to_except_safely_) || !defined(_di_f_print_to_safely_) - extern const f_string_static_t private_f_print_character_safely_get(const char character) F_attribute_visibility_internal_d; + extern const f_string_static_t private_f_print_character_safely_get(const unsigned char character) F_attribute_visibility_internal_d; #endif // !defined(_di_f_print_character_safely_get_) || !defined(_di_f_print_dynamic_partial_safely_) || !defined(_di_f_print_dynamic_safely_) || !defined(_di_f_print_except_dynamic_partial_safely_) || !defined(_di_f_print_except_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_safely_) || !defined(_di_f_print_except_in_dynamic_partial_safely_) || !defined(_di_f_print_except_in_safely_) || !defined(_di_f_print_except_safely_) || !defined(_di_f_print_safely_) || !defined(_di_f_print_safely_terminated_) || !defined(_di_f_print_to_dynamic_partial_safely_) || !defined(_di_f_print_to_dynamic_safely_) || !defined(_di_f_print_to_except_dynamic_partial_safely_) || !defined(_di_f_print_to_except_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_safely_) || !defined(_di_f_print_to_except_in_dynamic_partial_safely_) || !defined(_di_f_print_to_except_in_safely_) || !defined(_di_f_print_to_except_safely_) || !defined(_di_f_print_to_safely_) /** diff --git a/level_0/f_string/c/private-string.c b/level_0/f_string/c/private-string.c index 9d046b5..56b6bbe 100644 --- a/level_0/f_string/c/private-string.c +++ b/level_0/f_string/c/private-string.c @@ -75,7 +75,7 @@ extern "C" { #if !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_) || !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_) f_status_t private_f_string_dynamic_adjust(const f_array_length_t length, f_string_dynamic_t * const dynamic) { - f_status_t status = f_memory_adjust(dynamic->size, length, sizeof(char), (void **) & dynamic->string); + f_status_t status = f_memory_adjust(dynamic->size, length, sizeof(unsigned char), (void **) & dynamic->string); if (F_status_is_error_not(status)) { dynamic->size = length; @@ -107,7 +107,7 @@ extern "C" { #if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_) f_status_t private_f_string_dynamic_resize(const f_array_length_t length, f_string_dynamic_t * const dynamic) { - const f_status_t status = f_memory_resize(dynamic->size, length, sizeof(char), (void **) & dynamic->string); + const f_status_t status = f_memory_resize(dynamic->size, length, sizeof(unsigned char), (void **) & dynamic->string); if (F_status_is_error_not(status)) { dynamic->size = length; diff --git a/level_0/f_string/c/string/common.h b/level_0/f_string/c/string/common.h index 05f9433..ecee027 100644 --- a/level_0/f_string/c/string/common.h +++ b/level_0/f_string/c/string/common.h @@ -21,7 +21,7 @@ extern "C" { * therefore this gets defined here. */ #ifdef _en_BUG_strnlen_ - extern size_t strnlen(const char * const string, size_t max_length); + extern size_t strnlen(const unsigned char * const string, size_t max_length); #endif // _en_BUG_strnlen_ /** @@ -36,7 +36,7 @@ extern "C" { * F_string_t_size_d is provided to help safely navigate this. */ #ifndef _di_f_string_t_ - typedef char *f_string_t; + typedef unsigned char *f_string_t; #define f_string_t_initialize 0 @@ -67,7 +67,7 @@ extern "C" { * When "f_string_constant_t * xxx" is passed to a function, then "xxx" can be changed. */ #ifndef _di_f_string_constant_t_ - typedef const char *f_string_constant_t; + typedef const unsigned char *f_string_constant_t; #define f_string_constant_t_initialize 0 diff --git a/level_0/f_string/c/string/dynamic.c b/level_0/f_string/c/string/dynamic.c index 2a1eed1..1b48d8c 100644 --- a/level_0/f_string/c/string/dynamic.c +++ b/level_0/f_string/c/string/dynamic.c @@ -795,7 +795,7 @@ extern "C" { #endif // _di_f_string_dynamic_seek_line_ #ifndef _di_f_string_dynamic_seek_line_to_ - f_status_t f_string_dynamic_seek_line_to(const f_string_static_t buffer, const char seek_to_this, f_string_range_t * const range) { + f_status_t f_string_dynamic_seek_line_to(const f_string_static_t buffer, const unsigned char seek_to_this, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -818,7 +818,7 @@ extern "C" { #endif // _di_f_string_dynamic_seek_line_to_ #ifndef _di_f_string_dynamic_seek_to_ - f_status_t f_string_dynamic_seek_to(const f_string_static_t buffer, const char seek_to_this, f_string_range_t * const range) { + f_status_t f_string_dynamic_seek_to(const f_string_static_t buffer, const unsigned char seek_to_this, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_string/c/string/dynamic.h b/level_0/f_string/c/string/dynamic.h index 86ff8b1..51366f2 100644 --- a/level_0/f_string/c/string/dynamic.h +++ b/level_0/f_string/c/string/dynamic.h @@ -913,7 +913,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_seek_line_to_ - extern f_status_t f_string_dynamic_seek_line_to(const f_string_static_t buffer, const char seek_to_this, f_string_range_t * const range); + extern f_status_t f_string_dynamic_seek_line_to(const f_string_static_t buffer, const unsigned char seek_to_this, f_string_range_t * const range); #endif // _di_f_string_dynamic_seek_line_to_ /** @@ -939,7 +939,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_string_dynamic_seek_to_ - extern f_status_t f_string_dynamic_seek_to(const f_string_static_t buffer, const char seek_to_this, f_string_range_t * const range); + extern f_status_t f_string_dynamic_seek_to(const f_string_static_t buffer, const unsigned char seek_to_this, f_string_range_t * const range); #endif // _di_f_string_dynamic_seek_to_ /** diff --git a/level_0/f_type/c/type.h b/level_0/f_type/c/type.h index 4db4cec..4b5652a 100644 --- a/level_0/f_type/c/type.h +++ b/level_0/f_type/c/type.h @@ -1174,7 +1174,7 @@ extern "C" { */ #ifndef _di_f_fll_id_t_ typedef struct { - char name[64]; + unsigned char name[64]; uint16_t type; uint8_t used; diff --git a/level_0/f_utf/c/utf/dynamic.c b/level_0/f_utf/c/utf/dynamic.c index c856ccb..6aecfa3 100644 --- a/level_0/f_utf/c/utf/dynamic.c +++ b/level_0/f_utf/c/utf/dynamic.c @@ -774,7 +774,7 @@ extern "C" { #endif // _di_f_utf_string_dynamic_seek_line_ #ifndef _di_f_utf_string_dynamic_seek_line_to_ - f_status_t f_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, const char seek_to_this, f_string_range_t *range) { + f_status_t f_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, const unsigned char seek_to_this, f_string_range_t *range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -801,7 +801,7 @@ extern "C" { #endif // _di_f_utf_string_dynamic_seek_line_to_ #ifndef _di_f_utf_string_dynamic_seek_to_ - f_status_t f_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, const char seek_to_this, f_string_range_t *range) { + f_status_t f_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, const unsigned char seek_to_this, f_string_range_t *range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_utf/c/utf/dynamic.h b/level_0/f_utf/c/utf/dynamic.h index 87d7c5a..3fcd11c 100644 --- a/level_0/f_utf/c/utf/dynamic.h +++ b/level_0/f_utf/c/utf/dynamic.h @@ -947,7 +947,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_utf_string_dynamic_seek_line_to_ - extern f_status_t f_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, const char seek_to_this, f_string_range_t *range); + extern f_status_t f_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, const unsigned char seek_to_this, f_string_range_t *range); #endif // _di_f_utf_string_dynamic_seek_line_to_ /** @@ -974,7 +974,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_utf_string_dynamic_seek_to_ - extern f_status_t f_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, const char seek_to_this, f_string_range_t *range); + extern f_status_t f_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, const unsigned char seek_to_this, f_string_range_t *range); #endif // _di_f_utf_string_dynamic_seek_to_ /** diff --git a/level_1/fl_control_group/c/control_group.c b/level_1/fl_control_group/c/control_group.c index 7995358..787132d 100644 --- a/level_1/fl_control_group/c/control_group.c +++ b/level_1/fl_control_group/c/control_group.c @@ -31,7 +31,7 @@ extern "C" { path.used = control_group.path.used + control_group.groups.array[i].used + F_control_group_path_system_suffix_s_length; - char path_string[path.used + 1]; + unsigned char path_string[path.used + 1]; path.string = path_string; if (control_group.path.used) { diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index 61ea13f..9cdefcd 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -27,7 +27,7 @@ extern "C" { f_array_length_t at_path = 0; f_string_static_t tree = f_string_static_t_initialize; - char tree_string[path.used + 1]; + unsigned char tree_string[path.used + 1]; tree.string = tree_string; tree.used = path.used; tree_string[path.used] = 0; diff --git a/level_1/fl_directory/c/private-directory.c b/level_1/fl_directory/c/private-directory.c index 49bc07c..7a3e817 100644 --- a/level_1/fl_directory/c/private-directory.c +++ b/level_1/fl_directory/c/private-directory.c @@ -58,8 +58,8 @@ extern "C" { destination_sub.used = destination.used + listing.directory.array[i].used + 1; destination_sub.size = destination_sub.used; - char path_source_sub[source_sub.used + 1]; - char path_destination_sub[destination_sub.used + 1]; + unsigned char path_source_sub[source_sub.used + 1]; + unsigned char path_destination_sub[destination_sub.used + 1]; memcpy(path_source_sub, source.string, source.used); memcpy(path_source_sub + source.used + 1, listing.directory.array[i].string, listing.directory.array[i].used); @@ -146,8 +146,8 @@ extern "C" { path_source.used = source.used + file.used + 2; path_destination.used = destination.used + file.used + 2; - char path_source_string[path_source.used]; - char path_destination_string[path_destination.used]; + unsigned char path_source_string[path_source.used]; + unsigned char path_destination_string[path_destination.used]; path_source.string = path_source_string; path_destination.string = path_destination_string; @@ -283,8 +283,8 @@ extern "C" { destination_sub.used = destination.used + listing.directory.array[i].used + 1; destination_sub.size = destination_sub.used; - char path_source_sub[source_sub.used + 1]; - char path_destination_sub[destination_sub.used + 1]; + unsigned char path_source_sub[source_sub.used + 1]; + unsigned char path_destination_sub[destination_sub.used + 1]; memcpy(path_source_sub, source.string, source.used); memcpy(path_source_sub + source.used + 1, listing.directory.array[i].string, listing.directory.array[i].used); @@ -358,8 +358,8 @@ extern "C" { path_source.used = source.used + file.used + 2; path_destination.used = destination.used + file.used + 2; - char path_source_string[path_source.used]; - char path_destination_string[path_destination.used]; + unsigned char path_source_string[path_source.used]; + unsigned char path_destination_string[path_destination.used]; path_source.string = path_source_string; path_destination.string = path_destination_string; @@ -502,7 +502,7 @@ extern "C" { // There is no reason to include "." and ".." in the directory listing. if (!strncmp(name_directory.string, "..", 3) || !strncmp(name_directory.string, ".", 2)) { - f_memory_resize(1, 0, sizeof(char *), (void **) & entity[i]); + f_memory_resize(1, 0, sizeof(unsigned char *), (void **) & entity[i]); continue; } @@ -552,13 +552,13 @@ extern "C" { memcpy(names->array[names->used].string, name_directory.string, name_directory.used); names->array[names->used++].used = name_directory.used; - f_memory_resize(1, 0, sizeof(char *), (void **) & entity[i]); + f_memory_resize(1, 0, sizeof(unsigned char *), (void **) & entity[i]); } // for closedir(parent); for (; i < length; ++i) { - f_memory_resize(1, 0, sizeof(char *), (void **) & entity[i]); + f_memory_resize(1, 0, sizeof(unsigned char *), (void **) & entity[i]); } // for f_memory_resize(1, 0, sizeof(struct dirent *), (void **) & entity); diff --git a/level_1/fl_environment/c/environment.c b/level_1/fl_environment/c/environment.c index 9fbb80d..7e860ad 100644 --- a/level_1/fl_environment/c/environment.c +++ b/level_1/fl_environment/c/environment.c @@ -122,7 +122,7 @@ extern "C" { paths->array[paths->used].used = 0; if (total) { - char buffer[total + 1]; + unsigned char buffer[total + 1]; for (j = first, k = 0; j < i; ++j) { @@ -200,7 +200,7 @@ extern "C" { paths->array[paths->used].used = 0; if (total) { - char buffer[total]; + unsigned char buffer[total]; for (j = 0, k = 0; j < total; ++j) { diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index ef3a366..f440191 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -14,7 +14,7 @@ extern "C" { f_array_length_t i = 0; uint8_t width = 0; - const char quote_char = quoted == f_fss_quote_type_double_e ? f_string_ascii_quote_double_s.string[0] : f_string_ascii_quote_single_s.string[0]; + const unsigned char quote_char = quoted == f_fss_quote_type_double_e ? f_string_ascii_quote_double_s.string[0] : f_string_ascii_quote_single_s.string[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) { @@ -328,7 +328,7 @@ extern "C" { } // Handle quoted support. - char quote_found = 0; + unsigned char quote_found = 0; if (quoted) { *quoted = 0; @@ -869,7 +869,7 @@ extern "C" { f_array_length_t item_total = 0; f_array_length_t i = 0; - const char quote_char = quoted == f_fss_quote_type_double_e ? f_string_ascii_quote_double_s.string[0] : f_string_ascii_quote_single_s.string[0]; + const unsigned char quote_char = quoted == f_fss_quote_type_double_e ? f_string_ascii_quote_double_s.string[0] : f_string_ascii_quote_single_s.string[0]; // Use placeholders for potential quote and potential delimited quote to avoid doing things such as memmove(). destination->string[destination->used++] = f_fss_delimit_placeholder_s.string[0]; diff --git a/level_1/fl_print/c/private-print.c b/level_1/fl_print/c/private-print.c index 373145f..31884ab 100644 --- a/level_1/fl_print/c/private-print.c +++ b/level_1/fl_print/c/private-print.c @@ -231,7 +231,7 @@ extern "C" { } else if (*string < 0x56) { if (*string == f_string_ascii_C_s.string[0]) { - char value[1] = { (char) va_arg(apl, int) }; + unsigned char value[1] = { (unsigned char) va_arg(apl, int) }; *status = f_print_safely(value, 1, stream); @@ -627,7 +627,7 @@ extern "C" { } else if (*string < 0x72) { if (*string == f_string_ascii_c_s.string[0]) { - const char value = (char) va_arg(apl, uint32_t); + const unsigned char value = (unsigned char) va_arg(apl, uint32_t); if (!fputc_unlocked(value, stream)) { *status = F_status_set_error(F_output); @@ -1082,8 +1082,8 @@ extern "C" { } else if (type == f_print_format_type_double_32_e || type == f_print_format_type_double_64_e) { unsigned int f = 0; - char format[33]; - char buffer[129]; + unsigned char format[33]; + unsigned char buffer[129]; memset(format, 0, 33); memset(buffer, 0, 129); diff --git a/level_1/fl_string/c/string.c b/level_1/fl_string/c/string.c index 89f9d64..58fae93 100644 --- a/level_1/fl_string/c/string.c +++ b/level_1/fl_string/c/string.c @@ -874,7 +874,7 @@ extern "C" { { f_array_length_t j = 0; - char number[5] = { 0, 0, 0, 0, 0 }; + unsigned char number[5] = { 0, 0, 0, 0, 0 }; for (++range->start; range->start <= range->stop && j < 4; ++range->start, ++j) { diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index 40d60ed..bbd4b9d 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -92,7 +92,7 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_rip_nulless_ #ifndef _di_fl_utf_string_dynamic_seek_line_to_char_ - f_status_t fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_static_t buffer, f_string_range_t * const range, const char seek_to_this) { + f_status_t fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_static_t buffer, f_string_range_t * const range, const unsigned char seek_to_this) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); @@ -225,7 +225,7 @@ extern "C" { #endif // _di_fl_utf_string_dynamic_seek_line_until_graph_non_ #ifndef _di_fl_utf_string_dynamic_seek_to_char_ - f_status_t fl_utf_string_dynamic_seek_to_char(const f_utf_string_static_t buffer, f_string_range_t * const range, const char seek_to_this) { + f_status_t fl_utf_string_dynamic_seek_to_char(const f_utf_string_static_t buffer, f_string_range_t * const range, const unsigned char seek_to_this) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); if (buffer.used <= range->start) return F_status_set_error(F_parameter); @@ -321,7 +321,7 @@ extern "C" { #endif // _di_fl_utf_string_rip_nulless_ #ifndef _di_fl_utf_string_seek_line_to_char_ - f_status_t fl_utf_string_seek_line_to_char(const f_utf_string_t string, f_string_range_t * const range, const char seek_to_this) { + f_status_t fl_utf_string_seek_line_to_char(const f_utf_string_t string, f_string_range_t * const range, const unsigned char seek_to_this) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ @@ -438,7 +438,7 @@ extern "C" { #endif // _di_fl_utf_string_seek_line_until_graph_non_ #ifndef _di_fl_utf_string_seek_to_char_ - f_status_t fl_utf_string_seek_to_char(const f_utf_string_t string, f_string_range_t * const range, const char seek_to_this) { + f_status_t fl_utf_string_seek_to_char(const f_utf_string_t string, f_string_range_t * const range, const unsigned char seek_to_this) { #ifndef _di_level_1_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ diff --git a/level_1/fl_utf/c/utf.h b/level_1/fl_utf/c/utf.h index eb149f3..0f22552 100644 --- a/level_1/fl_utf/c/utf.h +++ b/level_1/fl_utf/c/utf.h @@ -268,7 +268,7 @@ extern "C" { * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_dynamic_seek_line_to_char_ - extern f_status_t fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_static_t buffer, f_string_range_t * const range, const char seek_to_this); + extern f_status_t fl_utf_string_dynamic_seek_line_to_char(const f_utf_string_static_t buffer, f_string_range_t * const range, const unsigned char seek_to_this); #endif // _di_fl_utf_string_dynamic_seek_line_to_char_ /** @@ -350,7 +350,7 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_utf_string_dynamic_seek_to_char_ - extern f_status_t fl_utf_string_dynamic_seek_to_char(const f_utf_string_static_t buffer, f_string_range_t * const range, const char seek_to_this); + extern f_status_t fl_utf_string_dynamic_seek_to_char(const f_utf_string_static_t buffer, f_string_range_t * const range, const unsigned char seek_to_this); #endif // _di_fl_utf_string_dynamic_seek_to_char_ /** @@ -432,7 +432,7 @@ extern "C" { * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_seek_line_to_char_ - extern f_status_t fl_utf_string_seek_line_to_char(const f_utf_string_t string, f_string_range_t * const range, const char seek_to_this); + extern f_status_t fl_utf_string_seek_line_to_char(const f_utf_string_t string, f_string_range_t * const range, const unsigned char seek_to_this); #endif // _di_fl_utf_string_seek_line_to_char_ /** @@ -517,7 +517,7 @@ extern "C" { * F_utf (with error bit) if a character in the buffer is an invalid UTF-8 character. */ #ifndef _di_fl_utf_string_seek_to_character_ - extern f_status_t fl_utf_string_seek_to_char(const f_utf_string_t string, f_string_range_t * const range, const char seek_to_this); + extern f_status_t fl_utf_string_seek_to_char(const f_utf_string_t string, f_string_range_t * const range, const unsigned char seek_to_this); #endif // _di_fl_utf_string__seek_to_character_ #ifdef __cplusplus 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 61cf080..f8e7bc2 100644 --- a/level_1/fl_utf_file/c/private-utf_file.c +++ b/level_1/fl_utf_file/c/private-utf_file.c @@ -6,7 +6,7 @@ extern "C" { #endif #if !defined(_di_fl_utf_file_read_) || !defined(_di_fl_utf_file_read_until_) || !defined(_di_fl_utf_file_read_range_) - void private_fl_utf_file_process_read_buffer(const f_string_t buffer_read, const ssize_t size_read, f_utf_string_dynamic_t * const buffer, char buffer_char[], uint8_t * const width, int8_t * const width_last) { + void private_fl_utf_file_process_read_buffer(const f_string_t buffer_read, const ssize_t size_read, f_utf_string_dynamic_t * const buffer, unsigned char buffer_char[], uint8_t * const width, int8_t * const width_last) { uint8_t increment_by = 0; 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 6cff4c4..b835dd5 100644 --- a/level_1/fl_utf_file/c/private-utf_file.h +++ b/level_1/fl_utf_file/c/private-utf_file.h @@ -40,7 +40,7 @@ extern "C" { * @see fl_utf_file_read_until() */ #if !defined(_di_fl_utf_file_read_) || !defined(_di_fl_utf_file_read_until_) || !defined(_di_fl_utf_file_read_range_) - void private_fl_utf_file_process_read_buffer(const f_string_t buffer_read, const ssize_t size_read, f_utf_string_dynamic_t * const buffer, char buffer_char[], uint8_t * const width, int8_t * const width_last) F_attribute_visibility_internal_d; + extern void private_fl_utf_file_process_read_buffer(const f_string_t buffer_read, const ssize_t size_read, f_utf_string_dynamic_t * const buffer, unsigned char buffer_char[], uint8_t * const width, int8_t * const width_last) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_utf_file_read_) || !defined(_di_fl_utf_file_read_until_) || !defined(_di_fl_utf_file_read_range_) /** diff --git a/level_1/fl_utf_file/c/utf_file.c b/level_1/fl_utf_file/c/utf_file.c index c8c7344..abfd14e 100644 --- a/level_1/fl_utf_file/c/utf_file.c +++ b/level_1/fl_utf_file/c/utf_file.c @@ -25,8 +25,8 @@ extern "C" { uint8_t width = 0; int8_t width_last = -1; - char buffer_read[file.size_read]; - char buffer_char[4] = { 0, 0, 0, 0 }; + unsigned char buffer_read[file.size_read]; + unsigned char buffer_char[4] = { 0, 0, 0, 0 }; memset(&buffer_read, 0, sizeof(file.size_read)); @@ -85,8 +85,8 @@ extern "C" { uint8_t width = 0; int8_t width_last = -1; - char buffer_read[file.size_read]; - char buffer_char[4] = { 0, 0, 0, 0 }; + unsigned char buffer_read[file.size_read]; + unsigned char buffer_char[4] = { 0, 0, 0, 0 }; memset(&buffer_read, 0, sizeof(file.size_read)); @@ -156,8 +156,8 @@ extern "C" { buffer_size = total; } - char buffer_read[buffer_size]; - char buffer_char[4] = { 0, 0, 0, 0 }; + unsigned char buffer_read[buffer_size]; + unsigned char buffer_char[4] = { 0, 0, 0, 0 }; memset(&buffer_read, 0, sizeof(buffer_size)); diff --git a/level_2/fll_control_group/c/control_group.c b/level_2/fll_control_group/c/control_group.c index 51a8af6..6a5b9fe 100644 --- a/level_2/fll_control_group/c/control_group.c +++ b/level_2/fll_control_group/c/control_group.c @@ -26,7 +26,7 @@ extern "C" { path.used = control_group.path.used + control_group.groups.array[i].used; - char path_string[path.used + 1]; + unsigned char path_string[path.used + 1]; path.string = path_string; if (control_group.path.used) { diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index ffa6ce4..8b781bf 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -91,7 +91,7 @@ extern "C" { program_name.used = program.used ? program.used : arguments.array[0].used; } - char program_name_string[program_name.used + 1]; + unsigned char program_name_string[program_name.used + 1]; program_name.string = program_name_string; private_fll_execute_path_arguments_fixate(program.used ? program : arguments.array[0], arguments, last_slash, !program.used, program_name, fixed_arguments); @@ -187,7 +187,7 @@ extern "C" { } } - char program_path[found->used + 1]; + unsigned char program_path[found->used + 1]; program_path[found->used] = 0; memcpy(&program_path, found->string, found->used); @@ -204,7 +204,7 @@ extern "C" { } // for } - code = execv(program_path, fixed_arguments); + code = execv(program_path, (char **) fixed_arguments); } else { if (environment) { @@ -216,10 +216,10 @@ extern "C" { } if (last_slash) { - code = execv(program.used ? program.string : arguments.array[0].string, fixed_arguments); + code = execv(program.used ? program.string : arguments.array[0].string, (char **) fixed_arguments); } else { - code = execvp(program.used ? program.string : arguments.array[0].string, fixed_arguments); + code = execvp(program.used ? program.string : arguments.array[0].string, (char **) fixed_arguments); } } @@ -287,7 +287,7 @@ extern "C" { program_name.used = program.used ? program.used : arguments.array[0].used; } - char program_name_string[program_name.used + 1]; + unsigned char program_name_string[program_name.used + 1]; program_name.string = program_name_string; private_fll_execute_path_arguments_fixate(program.used ? program : arguments.array[0], arguments, last_slash, !program.used, program_name, fixed_arguments); @@ -379,7 +379,7 @@ extern "C" { } } - char program_path[found->used + 1]; + unsigned char program_path[found->used + 1]; program_path[found->used] = 0; memcpy(&program_path, found->string, found->used); diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 2d82aa2..8235e1f 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -332,7 +332,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - int code = direct ? execv(program.string, fixed_arguments) : execvp(program.string, fixed_arguments); + int code = direct ? execv(program.string, (char **) fixed_arguments) : execvp(program.string, (char **) fixed_arguments); if (code == -1) { if (errno == EACCES) code = F_execute_access; @@ -518,7 +518,7 @@ extern "C" { if (F_status_is_error(status)) return status; } - int code = direct ? execv(program.string, fixed_arguments) : execvp(program.string, fixed_arguments); + int code = direct ? execv(program.string, (char **) fixed_arguments) : execvp(program.string, (char **) fixed_arguments); // Close the write pipe for the child when done. close(descriptors[0]); diff --git a/level_2/fll_file/c/private-file.c b/level_2/fll_file/c/private-file.c index e11231f..6fba958 100644 --- a/level_2/fll_file/c/private-file.c +++ b/level_2/fll_file/c/private-file.c @@ -50,7 +50,7 @@ extern "C" { path_sub.used = path.used + list[i]->array[j].used + 1; - char path_sub_string[path_sub.used + 1]; + unsigned char path_sub_string[path_sub.used + 1]; path_sub.string = path_sub_string; memcpy(path_sub.string, path.string, path.used); @@ -74,7 +74,7 @@ extern "C" { path_sub.used = path.used + listing.directory.array[i].used + 1; - char path_sub_string[path_sub.used + 1]; + unsigned char path_sub_string[path_sub.used + 1]; path_sub.string = path_sub_string; memcpy(path_sub.string, path.string, path.used); @@ -152,7 +152,7 @@ extern "C" { path_sub.used = path.used + list[i]->array[j].used + 1; - char path_sub_string[path_sub.used + 1]; + unsigned char path_sub_string[path_sub.used + 1]; path_sub.string = path_sub_string; memcpy(path_sub.string, path.string, path.used); @@ -175,7 +175,7 @@ extern "C" { path_sub.used = path.used + listing.directory.array[i].used + 1; - char path_sub_string[path_sub.used + 1]; + unsigned char path_sub_string[path_sub.used + 1]; path_sub.string = path_sub_string; memcpy(path_sub.string, path.string, path.used); diff --git a/level_2/fll_iki/c/private-iki.c b/level_2/fll_iki/c/private-iki.c index cfb85bb..b3ee5e8 100644 --- a/level_2/fll_iki/c/private-iki.c +++ b/level_2/fll_iki/c/private-iki.c @@ -6,7 +6,7 @@ extern "C" { #endif #if !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) - f_status_t private_fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const char quote, f_string_dynamic_t * const escaped) { + f_status_t private_fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const unsigned char quote, f_string_dynamic_t * const escaped) { f_status_t status = F_none; @@ -71,7 +71,7 @@ extern "C" { #endif // !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) #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 char quote, f_string_dynamic_t * const unescaped) { + f_status_t private_fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const unsigned char quote, f_string_dynamic_t * const unescaped) { f_status_t status = F_none; diff --git a/level_2/fll_iki/c/private-iki.h b/level_2/fll_iki/c/private-iki.h index 142752c..3a060a4 100644 --- a/level_2/fll_iki/c/private-iki.h +++ b/level_2/fll_iki/c/private-iki.h @@ -40,7 +40,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_increase_by(). */ #if !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) - extern f_status_t private_fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const char quote, f_string_dynamic_t * const escaped) F_attribute_visibility_internal_d; + extern f_status_t private_fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const unsigned char quote, f_string_dynamic_t * const escaped) F_attribute_visibility_internal_d; #endif // !defined(_di_fll_iki_content_escape_) || !defined(_di_fll_iki_content_partial_escape_) /** @@ -69,7 +69,7 @@ extern "C" { * Errors (with error bit) from: f_string_dynamic_increase_by(). */ #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 char quote, f_string_dynamic_t * const unescaped) F_attribute_visibility_internal_d; + extern f_status_t private_fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const unsigned char quote, f_string_dynamic_t * const unescaped) F_attribute_visibility_internal_d; #endif // !defined(_di_fll_iki_content_unescape_) || !defined(_di_fll_iki_content_partial_unescape_) #ifdef __cplusplus diff --git a/level_2/fll_print/c/print.c b/level_2/fll_print/c/print.c index aba71c8..90af010 100644 --- a/level_2/fll_print/c/print.c +++ b/level_2/fll_print/c/print.c @@ -18,7 +18,7 @@ extern "C" { #endif // _di_fll_print_ #ifndef _di_fll_print_character_ - f_status_t fll_print_character(const char character, FILE * const output) { + f_status_t fll_print_character(const unsigned char character, FILE * const output) { flockfile(output); @@ -31,7 +31,7 @@ extern "C" { #endif // _di_fll_print_character_ #ifndef _di_fll_print_character_safely_ - f_status_t fll_print_character_safely(const char character, FILE * const output) { + f_status_t fll_print_character_safely(const unsigned char character, FILE * const output) { flockfile(output); diff --git a/level_2/fll_print/c/print.h b/level_2/fll_print/c/print.h index c8b598d..d1e467d 100644 --- a/level_2/fll_print/c/print.h +++ b/level_2/fll_print/c/print.h @@ -72,7 +72,7 @@ extern "C" { * @see f_print_character() */ #ifndef _di_fll_print_character_ - extern f_status_t fll_print_character(const char character, FILE * const output); + extern f_status_t fll_print_character(const unsigned char character, FILE * const output); #endif // _di_fll_print_character_ /** @@ -94,7 +94,7 @@ extern "C" { * @see f_print_character_safely() */ #ifndef _di_fll_print_character_safely_ - extern f_status_t fll_print_character_safely(const char character, FILE * const output); + extern f_status_t fll_print_character_safely(const unsigned char character, FILE * const output); #endif // _di_fll_print_character_safely_ /** diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index a412af1..4ee0803 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -12,9 +12,9 @@ extern "C" { f_status_t status = F_none; uint64_t position = 0; - char byte = 0; + unsigned char byte = 0; + unsigned char offset = 0; int byte_get = 0; - uint8_t offset = 0; int8_t width_utf = -1; int8_t width_current = 0; @@ -41,9 +41,9 @@ extern "C" { byte_get = fseek(file.stream, main->first, SEEK_SET); } else { - char skip[main->first]; + unsigned char skip[main->first]; - byte_get = fread(skip, sizeof(char), main->first, file.stream); + byte_get = fread(skip, sizeof(unsigned char), main->first, file.stream); } } @@ -53,8 +53,8 @@ extern "C" { characters.size = main->width; // Record when a character is invalid. - char invalid[main->width]; - memset(&invalid, 0, sizeof(char) * main->width); + unsigned char invalid[main->width]; + memset(&invalid, 0, sizeof(unsigned char) * main->width); if (byte_get >= 0) { for (uint16_t signal_check = 0; ; ) { @@ -71,7 +71,7 @@ extern "C" { if (byte_get < 0) break; - byte = (char) byte_get; + byte = (unsigned char) byte_get; // Storing the next character is designated by width_utf == -1. if (width_utf == -1) { @@ -82,7 +82,7 @@ extern "C" { if (character_reset) { characters.used = 0; character_reset = F_false; - memset(&invalid, 0, sizeof(uint8_t) * main->width); + memset(&invalid, 0, sizeof(unsigned char) * main->width); } character_current = characters.used++; @@ -304,9 +304,9 @@ extern "C" { #endif // _di_byte_dump_file_ #ifndef _di_byte_dump_print_character_fragment_ - bool byte_dump_print_character_fragment(byte_dump_main_t * const main, const f_utf_string_static_t characters, const char invalid[], const uint8_t width_utf, const char byte_current, byte_dump_previous_t *previous, byte_dump_cell_t *cell, uint8_t *offset) { + bool byte_dump_print_character_fragment(byte_dump_main_t * const main, const f_utf_string_static_t characters, const unsigned char invalid[], const uint8_t width_utf, const unsigned char byte_current, byte_dump_previous_t *previous, byte_dump_cell_t *cell, unsigned char *offset) { - char byte = 0; + unsigned char byte = 0; bool reset = F_false; @@ -329,7 +329,7 @@ extern "C" { fl_print_format("%[%016_UL%] ", main->output.to.stream, main->context.set.notable, cell->row, main->context.set.notable); if (*offset) { - uint8_t offset_to_print = *offset; + unsigned char offset_to_print = *offset; // Pad the buffer with spaces to hide any skipped bytes (skipped via --first). while (offset_to_print && cell->column < main->width) { @@ -565,14 +565,14 @@ extern "C" { #endif // _di_byte_dump_print_character_fragment_ #ifndef _di_byte_dump_print_text_ - void byte_dump_print_text(byte_dump_main_t * const main, const f_utf_string_static_t characters, const char invalid[], byte_dump_previous_t *previous, uint8_t *offset) { + void byte_dump_print_text(byte_dump_main_t * const main, const f_utf_string_static_t characters, const unsigned char invalid[], byte_dump_previous_t *previous, unsigned char *offset) { + unsigned char c = 0; uint8_t at = 0; - uint8_t c = 0; uint8_t width_utf = 0; bool print = F_true; - char byte[5] = { 0, 0, 0, 0, 0 }; + unsigned char byte[5] = { 0, 0, 0, 0, 0 }; fl_print_format(" %[%r%] ", main->output.to.stream, main->context.set.notable, byte_dump_character_wall_s, main->context.set.notable); diff --git a/level_3/byte_dump/c/private-byte_dump.h b/level_3/byte_dump/c/private-byte_dump.h index c0dc156..bd9722c 100644 --- a/level_3/byte_dump/c/private-byte_dump.h +++ b/level_3/byte_dump/c/private-byte_dump.h @@ -71,7 +71,7 @@ extern "C" { * @see byte_dump_print_text() */ #ifndef _di_byte_dump_print_character_fragment_ - extern bool byte_dump_print_character_fragment(byte_dump_main_t * const main, const f_utf_string_static_t characters, const char invalid[], const uint8_t width_utf, const char byte_current, byte_dump_previous_t *previous, byte_dump_cell_t *cell, uint8_t *offset) F_attribute_visibility_internal_d; + extern bool byte_dump_print_character_fragment(byte_dump_main_t * const main, const f_utf_string_static_t characters, const unsigned char invalid[], const uint8_t width_utf, const unsigned char byte_current, byte_dump_previous_t *previous, byte_dump_cell_t *cell, unsigned char *offset) F_attribute_visibility_internal_d; #endif // _di_byte_dump_print_character_fragment_ /** @@ -93,7 +93,7 @@ extern "C" { * Will be reduced to 0 once used. */ #ifndef _di_byte_dump_print_text_ - extern void byte_dump_print_text(byte_dump_main_t * const main, const f_utf_string_static_t characters, const char invalid[], byte_dump_previous_t *previous, uint8_t *offset) F_attribute_visibility_internal_d; + extern void byte_dump_print_text(byte_dump_main_t * const main, const f_utf_string_static_t characters, const unsigned char invalid[], byte_dump_previous_t *previous, unsigned char *offset) F_attribute_visibility_internal_d; #endif // _di_byte_dump_print_text_ #ifdef __cplusplus diff --git a/level_3/controller/c/common/private-control.h b/level_3/controller/c/common/private-control.h index e083498..7314f39 100644 --- a/level_3/controller/c/common/private-control.h +++ b/level_3/controller/c/common/private-control.h @@ -111,8 +111,8 @@ extern "C" { * - endian_big: Designate that the packet is in big endian order (when not set then packet is in little endian order). */ #ifndef _di_controller_control_packet_flag_ - #define controller_control_packet_flag_binary_d 0x1 - #define controller_control_packet_flag_endian_big_d 0x2 + #define controller_control_packet_flag_binary_d 0x10000000 + #define controller_control_packet_flag_endian_big_d 0x01000000 #endif // _di_controller_control_packet_flag_ /** diff --git a/level_3/controller/c/control/private-control.c b/level_3/controller/c/control/private-control.c index 080d614..d7fb7bf 100644 --- a/level_3/controller/c/control/private-control.c +++ b/level_3/controller/c/control/private-control.c @@ -16,7 +16,11 @@ extern "C" { control->client.id = -1; }*/ + printf("\nDEBUG: begin client accept, addr=%ul, server id = %i, client id = %i\n", control->client, control->server.id, control->client.id); + fll_print_format("\nDEBUG: begin client accept, addr=%ul, server id = %i, client id = %i\n", stdout, control->client, control->server.id, control->client.id); + f_status_t status = f_socket_accept(&control->client, control->server.id); + printf("\nDEBUG: client accept, at 1, status = %d\n", F_status_set_fine(status)); if (F_status_is_error(status)) { f_socket_disconnect(&control->client, f_socket_close_fast_e); @@ -31,7 +35,7 @@ extern "C" { control->input.used = 0; control->output.used = 0; - char buffer[controller_control_default_socket_buffer_d + 1]; + unsigned char buffer[controller_control_default_socket_buffer_d + 1]; size_t length = 0; memset(buffer, 0, controller_control_default_socket_buffer_d + 1); @@ -39,6 +43,7 @@ extern "C" { // Pre-process the packet header. control->client.size_read = controller_control_default_socket_header_d; status = f_socket_read(&control->client, f_socket_flag_peek_d, buffer, &length); + printf("\nDEBUG: client accept, at 2, status = %d\n", F_status_set_fine(status)); if (F_status_is_error(status)) { f_socket_disconnect(&control->client, f_socket_close_fast_e); @@ -50,6 +55,7 @@ extern "C" { if (!length) { status = controller_control_respond_error_string(global, control, F_empty, "Received packet is empty."); + printf("\nDEBUG: client accept, at 3, status = %d\n", F_status_set_fine(status)); f_socket_disconnect(&control->client, f_socket_close_fast_e); @@ -60,6 +66,7 @@ extern "C" { if (length < controller_control_default_socket_header_d) { status = controller_control_respond_error_string(global, control, F_too_large, "Received packet is too small."); + printf("\nDEBUG: client accept, at 4, status = %d\n", F_status_set_fine(status)); f_socket_disconnect(&control->client, f_socket_close_fast_e); @@ -70,6 +77,7 @@ extern "C" { if (length > controller_control_default_socket_buffer_max_d) { status = controller_control_respond_error_string(global, control, F_too_large, "Received packet is too large."); + printf("\nDEBUG: client accept, at 5, status = %d\n", F_status_set_fine(status)); f_socket_disconnect(&control->client, f_socket_close_fast_e); @@ -78,11 +86,13 @@ extern "C" { return F_valid_not; } + // @todo rewrite based on control_payload_build(), but need to pre-process what is needed for the payload. const uint8_t packet_flag = controller_control_packet_header_flag(buffer); const uint32_t packet_length = controller_control_packet_header_length(packet_flag & controller_control_packet_flag_endian_big_d, buffer); if (packet_flag & controller_control_packet_flag_binary_d) { status = controller_control_respond_error_string(global, control, F_supported_not, "Binary is not a currently supported packet mode."); + printf("\nDEBUG: client accept, at 6, status = %d\n", F_status_set_fine(status)); f_socket_disconnect(&control->client, f_socket_close_fast_e); @@ -111,6 +121,7 @@ extern "C" { do { status = f_socket_read(&control->client, 0, &control->input, &total); + printf("\nDEBUG: client accept, at 7, status = %d\n", F_status_set_fine(status)); if (F_status_is_error(status)) { controller_control_respond_error_string(global, control, F_status_set_fine(status), "Failure while reading from control->client socket."); @@ -132,6 +143,7 @@ extern "C" { } // @todo process the data. + fll_print_format("\nDEBUG: received packet: '%q'\n", stdout, control->input); // @todo send any responses. @@ -200,13 +212,13 @@ extern "C" { #endif // _di_controller_control_configure_server_ #ifndef _di_controller_control_packet_header_flag_ - uint8_t controller_control_packet_header_flag(const char buffer[]) { - return (uint8_t) ((buffer[0] & 0x8) ? controller_control_packet_flag_binary_d : 0) | ((buffer[0] & 0x4) ? controller_control_packet_flag_endian_big_d : 0); + uint8_t controller_control_packet_header_flag(const unsigned char buffer[]) { + return (uint8_t) (((buffer[0] & 0x8) ? controller_control_packet_flag_binary_d : 0) | ((buffer[0] & 0x4) ? controller_control_packet_flag_endian_big_d : 0)); } #endif // _di_controller_control_packet_header_flag_ #ifndef _di_controller_control_packet_header_length_ - uint32_t controller_control_packet_header_length(const bool is_big, const char buffer[]) { + uint32_t controller_control_packet_header_length(const bool is_big, const unsigned char buffer[]) { register uint32_t length = (((buffer[0] & 0x3f) << 26) | (buffer[1] << 18) | (buffer[2] << 10) | (buffer[3] << 2) | ((buffer[4] & 0xc0) >> 6)); @@ -292,6 +304,7 @@ extern "C" { control->output.used = 0; control->cache_3.used = 0; + printf("\nDEBUG: controller_control_respond_error(), at start\n"); { const f_conversion_data_t data_conversion = macro_f_conversion_data_t_initialize(10, 0, 1); @@ -310,6 +323,8 @@ extern "C" { if (F_status_is_error(status2)) return status2; } + printf("\nDEBUG: controller_control_respond_error(), before write\n"); + return f_socket_write(&control->client, 0, control->output.string, 0); } #endif // _di_controller_control_respond_error_ diff --git a/level_3/controller/c/control/private-control.h b/level_3/controller/c/control/private-control.h index 5158763..6d029c3 100644 --- a/level_3/controller/c/control/private-control.h +++ b/level_3/controller/c/control/private-control.h @@ -82,7 +82,7 @@ extern "C" { * The 8-bit number representing the flags. */ #ifndef _di_controller_control_packet_header_flag_ - extern uint8_t controller_control_packet_header_flag(const char buffer[]) F_attribute_visibility_internal_d; + extern uint8_t controller_control_packet_header_flag(const unsigned char buffer[]) F_attribute_visibility_internal_d; #endif // _di_controller_control_packet_header_flag_ /** @@ -100,7 +100,7 @@ extern "C" { * The 32-bit number representing the length. */ #ifndef _di_controller_control_packet_header_length_ - extern uint32_t controller_control_packet_header_length(const bool is_big, const char buffer[]) F_attribute_visibility_internal_d; + extern uint32_t controller_control_packet_header_length(const bool is_big, const unsigned char buffer[]) F_attribute_visibility_internal_d; #endif // _di_controller_control_packet_header_length_ /** diff --git a/level_3/controller/c/controller/private-controller.c b/level_3/controller/c/controller/private-controller.c index a826a22..2f1667b 100644 --- a/level_3/controller/c/controller/private-controller.c +++ b/level_3/controller/c/controller/private-controller.c @@ -74,7 +74,7 @@ extern "C" { path.used = cache->action.name_file.used; } - char path_string[path.used + 1]; + unsigned char path_string[path.used + 1]; path.string = path_string; if (global.setting->path_setting.used) { @@ -368,7 +368,7 @@ extern "C" { f_array_length_t length = destination->used - setting->path_current.used; if (length) { - char temporary[--length]; + unsigned char temporary[--length]; temporary[length] = 0; memcpy(temporary, destination->string + setting->path_current.used + 1, length); diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index 9c19868..82c8f41 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -1192,7 +1192,7 @@ extern "C" { } const f_array_length_t id_rule_length = entry_action->parameters.array[0].used + entry_action->parameters.array[1].used + 1; - char id_rule_name[id_rule_length + 1]; + unsigned char id_rule_name[id_rule_length + 1]; const f_string_static_t alias_rule = macro_f_string_static_t_initialize2(id_rule_name, id_rule_length); memcpy(id_rule_name, entry_action->parameters.array[0].string, entry_action->parameters.array[0].used); @@ -1251,9 +1251,9 @@ extern "C" { const f_array_length_t cache_name_item_used = cache->action.name_item.used; const f_array_length_t cache_name_file_used = cache->action.name_file.used; - char cache_name_action[cache_name_action_used]; - char cache_name_item[cache_name_item_used]; - char cache_name_file[cache_name_file_used]; + unsigned char cache_name_action[cache_name_action_used]; + unsigned char cache_name_item[cache_name_item_used]; + unsigned char cache_name_file[cache_name_file_used]; memcpy(cache_name_action, cache->action.name_action.string, cache->action.name_action.used); memcpy(cache_name_item, cache->action.name_item.string, cache->action.name_item.used); diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index a9de5c5..6ad3ddf 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -2059,7 +2059,7 @@ extern "C" { f_string_static_t buffer = f_string_static_t_initialize; buffer.used = (content.stop - content.start) + 1; - char buffer_string[buffer.used + 1]; + unsigned char buffer_string[buffer.used + 1]; memcpy(buffer_string, source.string + content.start, buffer.used); buffer_string[buffer.used] = 0; @@ -2243,7 +2243,7 @@ extern "C" { f_string_static_t buffer = f_string_static_t_initialize; buffer.used = options[i].used + controller_parameter_map_option_s.used; - char buffer_string[buffer.used]; + unsigned char buffer_string[buffer.used]; buffer.string = buffer_string; memcpy(buffer_string, options[i].string, options[i].used); @@ -2269,7 +2269,7 @@ extern "C" { f_string_static_t buffer = f_string_static_t_initialize; buffer.used = options[i].used + controller_parameter_map_value_s.used; - char buffer_string[buffer.used]; + unsigned char buffer_string[buffer.used]; buffer.string = buffer_string; memcpy(buffer_string, options[i].string, options[i].used); @@ -2881,7 +2881,7 @@ extern "C" { f_string_static_t alias_other_buffer = f_string_static_t_initialize; alias_other_buffer.used = global.setting->rules.array[id_rule].alias.used; - char alias_other_buffer_string[alias_other_buffer.used + 1]; + unsigned char alias_other_buffer_string[alias_other_buffer.used + 1]; alias_other_buffer.string = alias_other_buffer_string; memcpy(alias_other_buffer_string, global.setting->rules.array[id_rule].alias.string, alias_other_buffer.used); @@ -4004,7 +4004,7 @@ extern "C" { const f_array_length_t line_item = cache->action.line_item; const f_array_length_t length_name_item = cache->action.name_item.used; - char name_item[length_name_item]; + unsigned char name_item[length_name_item]; name_item[length_name_item] = 0; memcpy(name_item, cache->action.name_item.string, length_name_item); diff --git a/level_3/controller/c/thread/private-thread_control.c b/level_3/controller/c/thread/private-thread_control.c index 8a2098a..284a66f 100644 --- a/level_3/controller/c/thread/private-thread_control.c +++ b/level_3/controller/c/thread/private-thread_control.c @@ -24,6 +24,7 @@ extern "C" { controller_control_t *control = &global->setting->control; do { + fll_print_format("\nDEBUG: Control Thread Main Loop, server id = %il.\n", stdout, control->server.id); // Remove any overly large buffers. if (control->cache_1.size > controller_control_default_socket_cache_d) { @@ -54,6 +55,8 @@ extern "C" { status = f_socket_listen(&control->server, controller_control_default_socket_backlog_d); + fll_print_format("\nDEBUG: Listen returned, status = %ui.\n", stdout, status); + if (F_status_is_error(status)) { controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_socket_listen", F_true); @@ -70,14 +73,20 @@ extern "C" { status = controller_control_accept(global, control); if (status == F_child) break; + fll_print_format("\nDEBUG: Accept returned, status = %ui.\n", stdout, F_status_set_fine(status)); + if (F_status_is_error(status)) { controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "controller_control_accept", F_true); } status = F_none; + fll_print_format("\nDEBUG: End of loop.\n", stdout); + } while (global->thread->enabled == controller_thread_enabled_e); + fll_print_format("\nDEBUG: Out of loop.\n", stdout); + if (status == F_child) { // A forked child process should deallocate memory on exit. @@ -86,8 +95,12 @@ extern "C" { controller_thread_delete_simple(global->thread); controller_setting_delete_simple(global->setting); controller_main_delete(global->main); + + fll_print_format("\nDEBUG: child exit, all data should be deleted.\n", stdout); } + fll_print_format("\nDEBUG: cache should be deleted, final exit.\n", stdout); + return 0; } #endif // _di_controller_thread_control_ diff --git a/level_3/controller/documents/packet.txt b/level_3/controller/documents/packet.txt index f015680..3e89851 100644 --- a/level_3/controller/documents/packet.txt +++ b/level_3/controller/documents/packet.txt @@ -18,18 +18,12 @@ Packet Documentation: The size block\: The size block represents the size of the entire packet (the control block, the size blocks, and the payload block). - This number is an 32-bit unsigned integer. - The size block may contain up to 4 32-bit unsigned integers. - If the size is less than the max value of a 32-bit integer (4294967295), then the remaining 32-bit unsigned integers may be omitted. + This number is a single 32-bit unsigned integer. - Example size that is less than 2^32-1\: + Example packet structure\: [ control block ] [ size block ] [ payload block ] [ 0b10000000 ] [ 0b00000000 0b00000000 0b00000100 0b11010010 ] [ size: 1229 (1234 - 5) ] - Example size that is less than 2^64-1\: - [ control block ] [ size block ] [ size block ] [ payload block ] - [ 0b10000000 ] [ 0b11111111 0b11111111 0b11111111 0b11111111 ] [ 0b00000000 0b00000000 0b00000000 0b11001000 ] [ size: 4294967486 (4294967495 - 9) ] - The payload block\: This block is represented by the FSS-000e payload specification and its structure ad use is described in the next sections. @@ -71,5 +65,5 @@ Packet Documentation: The error payload is intended to communicate some sort of failure. The error payload is only sent in response to some request (and not in response to another response). The control (the client) is not expected to send error payloads and the controller (the service) should send an error in response to an error payload or ignore it entirely. - The "status" from the "header" designates the status code. + The "status" from the "header" designates the status code as either a status code name string or a status code number (where a number may have error and warning bits). The "payload" will contain a NULL terminated string representing the message used to describe the error. diff --git a/level_3/controller/specifications/packet.txt b/level_3/controller/specifications/packet.txt index b388ae0..25ade85 100644 --- a/level_3/controller/specifications/packet.txt +++ b/level_3/controller/specifications/packet.txt @@ -9,18 +9,18 @@ Entry Specification: Packet Structure\: Packet is grouped into the following blocks\: - control: A single 1-byte block representing contol codes. - - size: A set of 1 to 4 4-byte blocks representing the size of the entire packet. + - size: A single 4-byte block representing the size of the entire packet, including the contol block. The "header" Object contains the following FSS-0001 Extended Objects (depending on "type")\: - action: A valid action type: "freeze", "kill", "pause", "reboot", "reload", "rerun", "restart", "resume", "shutdown", "start", "stop", or "thaw". - length: A positive whole number inclusively between 0 and 4294965248 representing the length of the "payload". - - status: The string name representing an FSS status code, such as F_none or F_failure. + - status: The status code name or number representing an FSS status code, such as F_none, F_failure, or 200 (where a number may have error and warning bits). - type: The packet type that is one of "error" and "controller". When there are multiple Objects of the same name inside the "header"\: - action: The order represents the order in which the actions are performed. - length: There may only be one length Object, all others after the first are ignored. - - status: The first represents the status and all other represent additional statuses. + - status: A status for each action, in the same order as the order of the action. - type: The first represent the type and all others represents a sub-type. There are different headers and payload properties based on the "type". diff --git a/level_3/fake/c/private-build-library.c b/level_3/fake/c/private-build-library.c index db7a0af..3e10c57 100644 --- a/level_3/fake/c/private-build-library.c +++ b/level_3/fake/c/private-build-library.c @@ -83,11 +83,11 @@ extern "C" { } } - char parameter_file_name_string[parameter_file_name.used + 1]; - char parameter_file_name_major_string[parameter_file_name_major.used + 1]; - char parameter_file_name_minor_string[parameter_file_name_minor.used + 1]; - char parameter_file_name_micro_string[parameter_file_name_micro.used + 1]; - char parameter_file_name_nano_string[parameter_file_name_nano.used + 1]; + unsigned char parameter_file_name_string[parameter_file_name.used + 1]; + unsigned char parameter_file_name_major_string[parameter_file_name_major.used + 1]; + unsigned char parameter_file_name_minor_string[parameter_file_name_minor.used + 1]; + unsigned char parameter_file_name_micro_string[parameter_file_name_micro.used + 1]; + unsigned char parameter_file_name_nano_string[parameter_file_name_nano.used + 1]; parameter_file_name.string = parameter_file_name_string; parameter_file_name_major.string = parameter_file_name_major_string; @@ -245,8 +245,8 @@ extern "C" { parameter_linker.used += parameter_file_name_nano.used; } - char parameter_file_path_string[parameter_file_path.used + 1]; - char parameter_linker_string[parameter_linker.used + 1]; + unsigned char parameter_file_path_string[parameter_file_path.used + 1]; + unsigned char parameter_linker_string[parameter_linker.used + 1]; parameter_file_path.string = parameter_file_path_string; parameter_linker.string = parameter_linker_string; @@ -322,7 +322,7 @@ extern "C" { f_string_static_t parameter_file_path = f_string_static_t_initialize; parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name.used; - char parameter_file_path_string[parameter_file_path.used + 1]; + unsigned char parameter_file_path_string[parameter_file_path.used + 1]; parameter_file_path.string = parameter_file_path_string; parameter_file_path_string[parameter_file_path.used] = 0; @@ -353,7 +353,7 @@ extern "C" { { parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_major.used; - char parameter_file_path_string[parameter_file_path.used + 1]; + unsigned char parameter_file_path_string[parameter_file_path.used + 1]; parameter_file_path.string = parameter_file_path_string; parameter_file_path_string[parameter_file_path.used] = 0; @@ -382,7 +382,7 @@ extern "C" { { parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_minor.used; - char parameter_file_path_string[parameter_file_path.used + 1]; + unsigned char parameter_file_path_string[parameter_file_path.used + 1]; parameter_file_path.string = parameter_file_path_string; parameter_file_path_string[parameter_file_path.used] = 0; @@ -410,7 +410,7 @@ extern "C" { if (data_build->setting.version_file != fake_build_version_type_micro_e && parameter_file_name_micro.used) { parameter_file_path.used = main->path_build_libraries_shared.used + parameter_file_name_micro.used; - char parameter_file_path_string[parameter_file_path.used + 1]; + unsigned char parameter_file_path_string[parameter_file_path.used + 1]; parameter_file_path.string = parameter_file_path_string; parameter_file_path_string[parameter_file_path.used] = 0; @@ -472,7 +472,7 @@ extern "C" { destination.used = main->path_build_libraries_static.used + fake_build_parameter_library_name_prefix_s.used; destination.used += data_build->setting.build_name.used + fake_build_parameter_library_name_suffix_static_s.used; - char destination_string[destination.used + 1]; + unsigned char destination_string[destination.used + 1]; destination.string = destination_string; destination_string[destination.used] = 0; destination.used = 0; @@ -546,7 +546,7 @@ extern "C" { source.used = main->path_build_objects.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; } - char source_string[source.used + 1]; + unsigned char source_string[source.used + 1]; source.string = source_string; source_string[source.used] = 0; diff --git a/level_3/fake/c/private-build-object.c b/level_3/fake/c/private-build-object.c index 5dd5575..394e541 100644 --- a/level_3/fake/c/private-build-object.c +++ b/level_3/fake/c/private-build-object.c @@ -47,7 +47,7 @@ extern "C" { f_string_static_t parameter_file_name_path = f_string_static_t_initialize; parameter_file_name_path.used = main->path_build_objects_shared.used + data_build->setting.build_name.used + fake_build_parameter_object_name_suffix_s.used; - char parameter_file_name_path_string[parameter_file_name_path.used + 1]; + unsigned char parameter_file_name_path_string[parameter_file_name_path.used + 1]; parameter_file_name_path.string = parameter_file_name_path_string; parameter_file_name_path_string[parameter_file_name_path.used] = 0; @@ -118,7 +118,7 @@ extern "C" { f_string_static_t parameter_file_name_path = f_string_static_t_initialize; parameter_file_name_path.used = main->path_build_objects_static.used + data_build->setting.build_name.used + fake_build_parameter_object_name_suffix_s.used; - char parameter_file_name_path_string[parameter_file_name_path.used + 1]; + unsigned char parameter_file_name_path_string[parameter_file_name_path.used + 1]; parameter_file_name_path.string = parameter_file_name_path_string; parameter_file_name_path_string[parameter_file_name_path.used] = 0; diff --git a/level_3/fake/c/private-build-program.c b/level_3/fake/c/private-build-program.c index 40493a3..04088b4 100644 --- a/level_3/fake/c/private-build-program.c +++ b/level_3/fake/c/private-build-program.c @@ -57,7 +57,7 @@ extern "C" { f_string_static_t parameter_file_name_path = f_string_static_t_initialize; parameter_file_name_path.used = main->path_build_programs_shared.used + data_build->setting.build_name.used; - char parameter_file_name_path_string[parameter_file_name_path.used + 1]; + unsigned char parameter_file_name_path_string[parameter_file_name_path.used + 1]; parameter_file_name_path.string = parameter_file_name_path_string; parameter_file_name_path_string[parameter_file_name_path.used] = 0; @@ -83,7 +83,7 @@ extern "C" { f_string_static_t link_project_library = f_string_static_t_initialize; link_project_library.used = fake_build_parameter_library_link_file_s.used + data_build->setting.build_name.used; - char link_project_library_string[link_project_library.used + 1]; + unsigned char link_project_library_string[link_project_library.used + 1]; link_project_library.string = link_project_library_string; link_project_library_string[link_project_library.used] = 0; @@ -151,7 +151,7 @@ extern "C" { f_string_static_t source_library = f_string_static_t_initialize; source_library.used = main->path_build_libraries_static.used + fake_build_parameter_library_name_prefix_s.used + data_build->setting.build_name.used + fake_build_parameter_library_name_suffix_static_s.used; - char source_library_string[source_library.used + 1]; + unsigned char source_library_string[source_library.used + 1]; source_library.string = source_library_string; source_library_string[source_library.used] = 0; source_library.used = 0; @@ -174,7 +174,7 @@ extern "C" { f_string_static_t parameter_file_name_path = f_string_static_t_initialize; parameter_file_name_path.used = main->path_build_programs_static.used + data_build->setting.build_name.used; - char parameter_file_name_path_string[parameter_file_name_path.used + 1]; + unsigned char parameter_file_name_path_string[parameter_file_name_path.used + 1]; parameter_file_name_path.string = parameter_file_name_path_string; parameter_file_name_path_string[parameter_file_name_path.used] = 0; diff --git a/level_3/fake/c/private-build-skeleton.c b/level_3/fake/c/private-build-skeleton.c index 0e9e3b5..9746224 100644 --- a/level_3/fake/c/private-build-skeleton.c +++ b/level_3/fake/c/private-build-skeleton.c @@ -18,7 +18,7 @@ extern "C" { f_string_static_t path_headers = f_string_static_t_initialize; path_headers.used = main->path_build_includes.used + data_build->setting.path_headers.used; - char path_headers_string[path_headers.used + 1]; + unsigned char path_headers_string[path_headers.used + 1]; path_headers.string = path_headers_string; if (data_build->setting.path_headers.used) { diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 8191bc9..e631b7f 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -31,7 +31,7 @@ extern "C" { { f_array_length_t build_libraries_length = fake_build_parameter_library_link_path_s.used + main->path_build_libraries_shared.used; - char build_libraries[build_libraries_length + 1]; + unsigned char build_libraries[build_libraries_length + 1]; memcpy(build_libraries, fake_build_parameter_library_link_path_s.string, fake_build_parameter_library_link_path_s.used); @@ -46,7 +46,7 @@ extern "C" { f_array_length_t build_includes_length = fake_build_parameter_library_include_s.used + main->path_build_includes.used; - char build_includes[build_includes_length + 1]; + unsigned char build_includes[build_includes_length + 1]; memcpy(build_includes, fake_build_parameter_library_include_s.string, fake_build_parameter_library_include_s.used); memcpy(build_includes + fake_build_parameter_library_include_s.used, main->path_build_includes.string, main->path_build_includes.used); @@ -71,7 +71,7 @@ extern "C" { if (F_status_is_error_not(*status)) { buffer.used = fake_build_parameter_library_include_s.used + main->path_work_includes.used; - char buffer_string[buffer.used + 1]; + unsigned char buffer_string[buffer.used + 1]; buffer.string = buffer_string; buffer_string[buffer.used] = 0; @@ -84,7 +84,7 @@ extern "C" { if (data_build->setting.search_shared && (is_shared || !data_build->setting.search_exclusive) && F_status_is_error_not(*status)) { buffer.used = fake_build_parameter_library_link_path_s.used + main->path_work_libraries_shared.used; - char buffer_string[buffer.used + 1]; + unsigned char buffer_string[buffer.used + 1]; buffer.string = buffer_string; buffer_string[buffer.used] = 0; @@ -97,7 +97,7 @@ extern "C" { if (data_build->setting.search_static && (!is_shared || !data_build->setting.search_exclusive) && F_status_is_error_not(*status)) { buffer.used = fake_build_parameter_library_link_path_s.used + main->path_work_libraries_static.used; - char buffer_string[buffer.used + 1]; + unsigned char buffer_string[buffer.used + 1]; buffer.string = buffer_string; buffer_string[buffer.used] = 0; @@ -557,7 +557,7 @@ extern "C" { f_string_static_t argument = f_string_static_t_initialize; argument.used = f_console_symbol_short_disable_s.used + f_console_standard_short_dark_s.used; - char argument_string[argument.used + 1]; + unsigned char argument_string[argument.used + 1]; argument.string = argument_string; argument_string[argument.used] = 0; @@ -581,7 +581,7 @@ extern "C" { f_string_static_t argument = f_string_static_t_initialize; argument.used = f_console_symbol_short_disable_s.used + f_console_standard_short_quiet_s.used; - char argument_string[argument.used + 1]; + unsigned char argument_string[argument.used + 1]; argument.string = argument_string; argument_string[argument.used] = 0; @@ -786,7 +786,7 @@ extern "C" { source.used = path->used + sources[i]->array[j].used; - char source_string[source.used + 1]; + unsigned char source_string[source.used + 1]; source.string = source_string; source_string[source.used] = 0; @@ -853,7 +853,7 @@ extern "C" { fake_build_path_source_length(main, &data_build, &data_build.setting.path_sources, &source); - char source_string[source.used + fake_path_part_script_s.used + 1]; + unsigned char source_string[source.used + fake_path_part_script_s.used + 1]; source.string = source_string; fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source); @@ -871,7 +871,7 @@ extern "C" { fake_build_path_source_length(main, &data_build, &data_build.setting.path_sources, &source); - char source_string[source.used + 1]; + unsigned char source_string[source.used + 1]; source.string = source_string; fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source); @@ -879,7 +879,7 @@ extern "C" { f_string_static_t path_headers = f_string_static_t_initialize; path_headers.used = main->path_build_includes.used + data_build.setting.path_headers.used; - char path_headers_string[path_headers.used + 1]; + unsigned char path_headers_string[path_headers.used + 1]; path_headers.string = path_headers_string; memcpy(path_headers_string, main->path_build_includes.string, main->path_build_includes.used); @@ -924,7 +924,7 @@ extern "C" { fake_build_path_source_length(main, &data_build, &data_build.setting.path_sources, &source); - char source_string[source.used + fake_path_part_script_s.used + 1]; + unsigned char source_string[source.used + fake_path_part_script_s.used + 1]; source.string = source_string; fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source); @@ -1026,7 +1026,7 @@ extern "C" { fake_build_path_source_length(main, data_build, &data_build->setting.path_sources, &source); - char source_string[source.used + sources[i]->array[j].used + 1]; + unsigned char source_string[source.used + sources[i]->array[j].used + 1]; source.string = source_string; fake_build_path_source_string(main, data_build, &data_build->setting.path_sources, &source); @@ -1060,7 +1060,7 @@ extern "C" { source.used += generic->used; } - char source_string[source.used + 1]; + unsigned char source_string[source.used + 1]; source.string = source_string; fake_build_path_source_string(main, data_build, &data_build->setting.path_sources_object, &source); diff --git a/level_3/fake/c/private-make-operate_process_type.c b/level_3/fake/c/private-make-operate_process_type.c index c110548..8c65dd1 100644 --- a/level_3/fake/c/private-make-operate_process_type.c +++ b/level_3/fake/c/private-make-operate_process_type.c @@ -65,7 +65,7 @@ extern "C" { destination.used += arguments.array[i].used + 1; } - char destination_string[destination.used + 1]; + unsigned char destination_string[destination.used + 1]; destination.string = destination_string; destination_string[destination.used] = 0; @@ -1056,7 +1056,7 @@ extern "C" { destination.used += arguments.array[i].used + 1; } - char destination_string[destination.used + 1]; + unsigned char destination_string[destination.used + 1]; destination.string = destination_string; destination_string[destination.used] = 0; diff --git a/level_3/fake/c/private-make-operate_validate.c b/level_3/fake/c/private-make-operate_validate.c index 60132f5..fdcb0f5 100644 --- a/level_3/fake/c/private-make-operate_validate.c +++ b/level_3/fake/c/private-make-operate_validate.c @@ -82,7 +82,7 @@ extern "C" { f_string_static_t path_file = f_string_static_t_initialize; path_file.used = data_make->main->path_data_build.used + arguments.array[0].used; - char path_file_string[path_file.used + 1]; + unsigned char path_file_string[path_file.used + 1]; path_file.string = path_file_string; path_file_string[path_file.used] = 0; diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index d4c9ee9..f72364d 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -36,11 +36,11 @@ extern "C" { fake_skeleton_path_source_length(main, &fake_path_part_cpp_s, &sources_cpp); fake_skeleton_path_source_length(main, &fake_path_part_script_s, &sources_script); - char sources_string[sources.used + 1]; - char sources_bash_string[sources_bash.used + 1]; - char sources_c_string[sources_c.used + 1]; - char sources_cpp_string[sources_cpp.used + 1]; - char sources_script_string[sources_script.used + 1]; + unsigned char sources_string[sources.used + 1]; + unsigned char sources_bash_string[sources_bash.used + 1]; + unsigned char sources_c_string[sources_c.used + 1]; + unsigned char sources_cpp_string[sources_cpp.used + 1]; + unsigned char sources_script_string[sources_script.used + 1]; sources.string = sources_string; sources_bash.string = sources_bash_string; diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 1449cda..a7c4e56 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -397,7 +397,7 @@ extern "C" { f_string_static_t path_file_other = f_string_static_t_initialize; path_file_other.used = firewall_network_path_s.used + firewall_file_other_s.used; - char path_file_other_string[path_file_other.used + 1]; + unsigned char path_file_other_string[path_file_other.used + 1]; path_file_other.string = path_file_other_string; path_file_other_string[path_file_other.used] = 0; @@ -518,7 +518,7 @@ extern "C" { f_string_static_t path_file_first = f_string_static_t_initialize; path_file_first.used = firewall_network_path_s.used + firewall_file_first_s.used; - char path_file_first_string[path_file_first.used + 1]; + unsigned char path_file_first_string[path_file_first.used + 1]; path_file_first.string = path_file_first_string; path_file_first_string[path_file_first.used] = 0; diff --git a/level_3/utf8/c/private-utf8_binary.c b/level_3/utf8/c/private-utf8_binary.c index 5a09803..6a2d0d0 100644 --- a/level_3/utf8/c/private-utf8_binary.c +++ b/level_3/utf8/c/private-utf8_binary.c @@ -73,7 +73,7 @@ extern "C" { f_array_length_t i = 0; f_array_length_t j = 0; - char block_character[4] = { 0, 0, 0, 0 }; + unsigned char block_character[4] = { 0, 0, 0, 0 }; f_string_static_t character = macro_f_string_static_t_initialize2(block_character, 4); do { diff --git a/level_3/utf8/c/private-utf8_codepoint.c b/level_3/utf8/c/private-utf8_codepoint.c index 6dae00f..ecca9f2 100644 --- a/level_3/utf8/c/private-utf8_codepoint.c +++ b/level_3/utf8/c/private-utf8_codepoint.c @@ -53,7 +53,7 @@ extern "C" { } else if (data->main->parameters.array[utf8_parameter_verify_e].result == f_console_result_none_e) { if (data->mode & utf8_mode_to_binary_d) { - char byte[5] = { 0, 0, 0, 0, 0 }; + unsigned char byte[5] = { 0, 0, 0, 0, 0 }; f_string_static_t character = macro_f_string_static_t_initialize2(byte, 5); status = f_utf_unicode_from(codepoint, 4, &character.string); @@ -209,7 +209,7 @@ extern "C" { f_array_length_t i = 0; f_array_length_t j = 0; - char block[4] = { 0, 0, 0, 0 }; + unsigned char block[4] = { 0, 0, 0, 0 }; f_string_static_t character = macro_f_string_static_t_initialize2(block, 4); do { -- 1.8.3.1