mirror of https://github.com/encounter/SDL.git
Fixed whitespace
This commit is contained in:
parent
2e801b1ae7
commit
bdafe1e049
|
@ -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 bytes = SDL_min(src_bytes, dst_bytes - 1);
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
unsigned char trailing_bytes = 0;
|
unsigned char trailing_bytes = 0;
|
||||||
if (bytes)
|
|
||||||
{
|
if (bytes) {
|
||||||
unsigned char c = (unsigned char)src[bytes - 1];
|
unsigned char c = (unsigned char)src[bytes - 1];
|
||||||
if (UTF8_IsLeadByte(c))
|
if (UTF8_IsLeadByte(c)) {
|
||||||
--bytes;
|
--bytes;
|
||||||
else if (UTF8_IsTrailingByte(c))
|
} else if (UTF8_IsTrailingByte(c)) {
|
||||||
{
|
for (i = bytes - 1; i != 0; --i) {
|
||||||
for (i = bytes - 1; i != 0; --i)
|
|
||||||
{
|
|
||||||
c = (unsigned char)src[i];
|
c = (unsigned char)src[i];
|
||||||
trailing_bytes = UTF8_TrailingBytes(c);
|
trailing_bytes = UTF8_TrailingBytes(c);
|
||||||
if (trailing_bytes)
|
if (trailing_bytes) {
|
||||||
{
|
|
||||||
if (bytes - i != trailing_bytes + 1)
|
if (bytes - i != trailing_bytes + 1)
|
||||||
bytes = i;
|
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);
|
SDL_memcpy(dst, src, bytes);
|
||||||
}
|
}
|
||||||
dst[bytes] = '\0';
|
dst[bytes] = '\0';
|
||||||
|
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue