mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-24 19:15:40 +00:00
SDL_string.c (SDL_IntPrecisionAdjust): avoid MSVC generating a memset()
This commit is contained in:
parent
d2131ac165
commit
5342ae2bba
|
@ -1416,7 +1416,7 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str
|
||||||
static void
|
static void
|
||||||
SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info)
|
SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info)
|
||||||
{/* left-pad num with zeroes, if needed. */
|
{/* left-pad num with zeroes, if needed. */
|
||||||
size_t sz, pad, i;
|
size_t sz, pad;
|
||||||
|
|
||||||
if (!info || info->precision < 0)
|
if (!info || info->precision < 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1428,9 +1428,7 @@ SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info)
|
||||||
pad = (size_t)info->precision - sz;
|
pad = (size_t)info->precision - sz;
|
||||||
if (pad + sz + 1 <= maxlen) { /* otherwise ignore the precision */
|
if (pad + sz + 1 <= maxlen) { /* otherwise ignore the precision */
|
||||||
SDL_memmove(num + pad, num, sz + 1);
|
SDL_memmove(num + pad, num, sz + 1);
|
||||||
for(i = 0; i < pad; ++i) {
|
SDL_memset(num, '0', pad);
|
||||||
num[i] = '0';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info->precision = -1;/* so that SDL_PrintString() doesn't make a mess. */
|
info->precision = -1;/* so that SDL_PrintString() doesn't make a mess. */
|
||||||
|
|
Loading…
Reference in a new issue