Skip to content

Commit

Permalink
SDL_string.c (SDL_IntPrecisionAdjust): avoid MSVC generating a memset()
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Sep 26, 2018
1 parent d2131ac commit 5342ae2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/stdlib/SDL_string.c
Expand Up @@ -1416,7 +1416,7 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str
static void
SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info)
{/* left-pad num with zeroes, if needed. */
size_t sz, pad, i;
size_t sz, pad;

if (!info || info->precision < 0)
return;
Expand All @@ -1428,9 +1428,7 @@ SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info)
pad = (size_t)info->precision - sz;
if (pad + sz + 1 <= maxlen) { /* otherwise ignore the precision */
SDL_memmove(num + pad, num, sz + 1);
for(i = 0; i < pad; ++i) {
num[i] = '0';
}
SDL_memset(num, '0', pad);
}
}
info->precision = -1;/* so that SDL_PrintString() doesn't make a mess. */
Expand Down

0 comments on commit 5342ae2

Please sign in to comment.