From: Kevin Day Date: Fri, 3 Dec 2021 23:58:53 +0000 (-0600) Subject: Bugfix: f_utf_unicode_string_from() is not functioning correctly. X-Git-Tag: 0.5.7~70 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=f945c59b4031307138a347416fe6a2befd5f1cec;p=fll 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". --- 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;