From bdafe1e049bb939e50e7c61059ff5ed3c2bcc64c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 4 Mar 2022 11:01:55 -0800 Subject: [PATCH] Fixed whitespace --- src/stdlib/SDL_string.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index 695fccbc8..1f5a12016 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -641,19 +641,16 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_ size_t bytes = SDL_min(src_bytes, dst_bytes - 1); size_t i = 0; unsigned char trailing_bytes = 0; - if (bytes) - { + + if (bytes) { unsigned char c = (unsigned char)src[bytes - 1]; - if (UTF8_IsLeadByte(c)) + if (UTF8_IsLeadByte(c)) { --bytes; - else if (UTF8_IsTrailingByte(c)) - { - for (i = bytes - 1; i != 0; --i) - { + } else if (UTF8_IsTrailingByte(c)) { + for (i = bytes - 1; i != 0; --i) { c = (unsigned char)src[i]; trailing_bytes = UTF8_TrailingBytes(c); - if (trailing_bytes) - { + if (trailing_bytes) { if (bytes - i != trailing_bytes + 1) bytes = i; @@ -664,6 +661,7 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_ SDL_memcpy(dst, src, bytes); } dst[bytes] = '\0'; + return bytes; }