Commit 840339c49db527f11313dc72086ce42fd4a53ad2

Ozkan Sezer 2021-12-18T14:01:02

SDL_utf8strlcpy: store trailing_bytes explicity as unsigned type.

diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c
index 7a894de..8f2aade 100644
--- a/src/stdlib/SDL_string.c
+++ b/src/stdlib/SDL_string.c
@@ -42,7 +42,7 @@
 #define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4)
 #define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF)
 
-static int UTF8_TrailingBytes(unsigned char c)
+static unsigned UTF8_TrailingBytes(unsigned char c)
 {
     if (c >= 0xC0 && c <= 0xDF)
         return 1;
@@ -638,7 +638,7 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_
     size_t src_bytes = SDL_strlen(src);
     size_t bytes = SDL_min(src_bytes, dst_bytes - 1);
     size_t i = 0;
-    char trailing_bytes = 0;
+    unsigned char trailing_bytes = 0;
     if (bytes)
     {
         unsigned char c = (unsigned char)src[bytes - 1];