From 4dc7a1185e604e391535dfd7d87c548d88d53014 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 14 Apr 2022 20:10:17 -0500 Subject: [PATCH] Bugfix: Unicode characters are not printing correctly. At some point it seems that I accidentally mass converted all of the macro_f_utf_byte_width() and similar to macro_f_utf_char_t_width(). This broke the printing logic. The f_print is handling normal characters and not f_utf_char_t. --- level_0/f_print/c/print.c | 6 +++--- level_0/f_print/c/print/private-to.c | 16 ++++++++-------- level_0/f_print/c/print/to.c | 2 +- level_0/f_print/c/private-print.c | 18 +++++++++--------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/level_0/f_print/c/print.c b/level_0/f_print/c/print.c index 49bd6c3..825b7e1 100644 --- a/level_0/f_print/c/print.c +++ b/level_0/f_print/c/print.c @@ -44,12 +44,12 @@ extern "C" { return F_none; } } - else if (macro_f_utf_char_t_width_is(character) == 1) { + else if (macro_f_utf_byte_width_is(character) == 1) { if (fwrite_unlocked(f_print_sequence_unknown_s.string, 1, f_print_sequence_unknown_s.used, output) == f_print_sequence_unknown_s.used) { return F_none; } } - else if (macro_f_utf_char_t_width_is(character) > 1 || character > 0x1f) { + else if (macro_f_utf_byte_width_is(character) > 1 || character > 0x1f) { if (fwrite_unlocked(&character, 1, 1, output)) { return F_utf; } @@ -659,7 +659,7 @@ extern "C" { for (register f_array_length_t i = 0; string[i]; ) { safe.used = 0; - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); if (width > 1) { if (string[i + 1]) { diff --git a/level_0/f_print/c/print/private-to.c b/level_0/f_print/c/print/private-to.c index ca5da00..990ac65 100644 --- a/level_0/f_print/c/print/private-to.c +++ b/level_0/f_print/c/print/private-to.c @@ -72,12 +72,12 @@ static inline f_status_t private_inline_f_print_to_error(void) { return F_none; } } - else if (macro_f_utf_char_t_width_is(character) == 1) { + else if (macro_f_utf_byte_width_is(character) == 1) { if (write(id, f_print_sequence_unknown_s.string, f_print_sequence_unknown_s.used) != -1) { return F_none; } } - else if (macro_f_utf_char_t_width_is(character) > 1 || character > 0x1f) { + else if (macro_f_utf_byte_width_is(character) > 1 || character > 0x1f) { if (write(id, &character, 1) != -1) { return F_none; } @@ -216,7 +216,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { } if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -292,7 +292,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { } if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -553,7 +553,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { } if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -659,7 +659,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { } if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -777,7 +777,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { while (i < length) { if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -844,7 +844,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { while (i < length) { if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } diff --git a/level_0/f_print/c/print/to.c b/level_0/f_print/c/print/to.c index 45f93d4..264ded3 100644 --- a/level_0/f_print/c/print/to.c +++ b/level_0/f_print/c/print/to.c @@ -516,7 +516,7 @@ static inline f_status_t private_inline_f_print_to_error(void) { for (register f_array_length_t i = 0; string[i]; ) { safe = f_string_empty_s; - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); if (width > 1) { if (string[i + 1]) { diff --git a/level_0/f_print/c/private-print.c b/level_0/f_print/c/private-print.c index 8cb5c09..cf153c2 100644 --- a/level_0/f_print/c/private-print.c +++ b/level_0/f_print/c/private-print.c @@ -55,11 +55,11 @@ extern "C" { return f_print_sequence_delete_s; } - if (macro_f_utf_char_t_width_is(character) == 1) { + if (macro_f_utf_byte_width_is(character) == 1) { return f_print_sequence_unknown_s; } - if (macro_f_utf_char_t_width_is(character) > 1 || character > 0x1f) { + if (macro_f_utf_byte_width_is(character) > 1 || character > 0x1f) { return f_string_empty_s; } @@ -403,7 +403,7 @@ extern "C" { } if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -555,7 +555,7 @@ extern "C" { } if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -761,7 +761,7 @@ extern "C" { } if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -871,7 +871,7 @@ extern "C" { } if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -1027,7 +1027,7 @@ extern "C" { while (i < length) { if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -1125,7 +1125,7 @@ extern "C" { while (i < length) { if (string[i]) { - width = macro_f_utf_char_t_width(string[i]); + width = macro_f_utf_byte_width(string[i]); safe = private_f_print_safely_get(string + i, width); } @@ -1227,7 +1227,7 @@ extern "C" { return f_print_sequence_delete_s; } - if (macro_f_utf_char_t_width_is(character[0])) { + if (macro_f_utf_byte_width_is(character[0])) { if (f_utf_is_valid(character, width_max) != F_true || f_utf_is_control(character, width_max)) { return f_print_sequence_unknown_s; } -- 1.8.3.1