SDL_utf8strlcpy: store trailing_bytes explicity as unsigned type.

This commit is contained in:
Ozkan Sezer 2021-12-18 14:01:02 +03:00
parent 507d4bcd68
commit 840339c49d
1 changed files with 2 additions and 2 deletions

View File

@ -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];