This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository terminology.

View the commit online.

commit 896f50d1e00057fd585efdc2e4a8f4c3a20cf48b
Author: Boris Faure <[email protected]>
AuthorDate: Sun Aug 16 18:18:16 2026 +0200

    tytest: use utf8_to_codepoints from previous commit
---
 src/bin/tytest_common.c | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/src/bin/tytest_common.c b/src/bin/tytest_common.c
index 766e12c6..dbedaf64 100644
--- a/src/bin/tytest_common.c
+++ b/src/bin/tytest_common.c
@@ -12,6 +12,7 @@
 #include "termptyops.h"
 #include "termiointernals.h"
 #include "tytest_common.h"
+#include "utf8.h"
 #if defined(BINARY_TYTEST)
 #include "colors.h"
 #include "tytest.h"
@@ -486,7 +487,7 @@ tytest_common_main_loop(void)
      {
         char buf[4097];
         Eina_Unicode codepoint[4097];
-        int i, j;
+        int i, j, consumed;
         char *rbuf = buf;
         int len = sizeof(buf) - 1;
 
@@ -511,37 +512,10 @@ tytest_common_main_loop(void)
 
         buf[len] = 0;
         // convert UTF8 to codepoint integers
-        j = 0;
-        for (i = 0; i < len;)
-          {
-             int g = 0, prev_i = i;
-
-             if (buf[i])
-               {
-                  g = eina_unicode_utf8_next_get(buf, &i);
-                  if ((0xdc80 <= g) && (g <= 0xdcff) &&
-                      (len - prev_i) <= (int)sizeof(_ty.oldbuf))
-                    {
-                       int k;
-                       for (k = 0;
-                            (k < (int)sizeof(_ty.oldbuf)) &&
-                            (k < (len - prev_i));
-                            k++)
-                         {
-                            _ty.oldbuf[k] = buf[prev_i+k];
-                         }
-                       DBG("failure at %d/%d/%d", prev_i, i, len);
-                       break;
-                    }
-               }
-             else
-               {
-                  g = 0;
-                  i++;
-               }
-             codepoint[j] = g;
-             j++;
-          }
+        j = utf8_to_codepoints(buf, len, codepoint, &consumed);
+        /* Retain a multibyte sequence cut in half by the read boundary. */
+        for (i = 0; (i < len - consumed) && (i < (int)sizeof(_ty.oldbuf)); i++)
+          _ty.oldbuf[i] = buf[consumed + i];
         codepoint[j] = 0;
         termpty_handle_buf(&_ty, codepoint, j);
      }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to