From 840339c49db527f11313dc72086ce42fd4a53ad2 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 18 Dec 2021 14:01:02 +0300
Subject: [PATCH] SDL_utf8strlcpy: store trailing_bytes explicity as unsigned
type.
---
src/stdlib/SDL_string.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c
index 7a894ded459..8f2aadec759 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];