From f945c59b4031307138a347416fe6a2befd5f1cec Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 3 Dec 2021 17:58:53 -0600 Subject: [PATCH] Bugfix: f_utf_unicode_string_from() is not functioning correctly. The code in this function is incomplete and incorrect. I have a feeling I got distracted and came back later to work on it, forgetting what I was doing. Use while loops rather than for loops for cases where the for loop would essentially have empty content. It is clear that I intended to test for both upper case and lower case U but I didn't actually test against lower case. The code is not incrementing after confirming there is a 'u' or 'U". --- level_0/f_utf/c/utf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/level_0/f_utf/c/utf.c b/level_0/f_utf/c/utf.c index e3d3158..d0cbef5 100644 --- a/level_0/f_utf/c/utf.c +++ b/level_0/f_utf/c/utf.c @@ -1806,15 +1806,15 @@ extern "C" { f_array_length_t i = 0; - for (; i < length; ++i) { - if (!string[i]) continue; - } // for + while (i < length && !string[i]) { + ++i; + } // while if (i < length) { - if (string[i] == f_string_ascii_U_s[0] || string[i] == f_string_ascii_U_s[0]) { - for (; i < length; ++i) { - if (!string[i]) continue; - } // for + if (string[i] == f_string_ascii_u_s[0] || string[i] == f_string_ascii_U_s[0]) { + do { + ++i; + } while (i < length && !string[i]); if (i < length && string[i] == f_string_ascii_plus_s[0]) { ++i; -- 1.8.3.1