mirror of https://github.com/encounter/SDL.git
stdlib: SDL_snprintf now adds decimal places for ("%f", 0.0).
This patch was from @Markvy (thanks!). Fixes #4795.
This commit is contained in:
parent
2008f2a8a6
commit
3acb172531
|
@ -1636,7 +1636,6 @@ SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg)
|
|||
{
|
||||
size_t length = 0;
|
||||
|
||||
if (arg) {
|
||||
/* This isn't especially accurate, but hey, it's easy. :) */
|
||||
unsigned long value;
|
||||
|
||||
|
@ -1671,18 +1670,6 @@ SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg)
|
|||
mult *= 10;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (length < maxlen) {
|
||||
text[length] = '0';
|
||||
}
|
||||
++length;
|
||||
if (info->force_type) {
|
||||
if (length < maxlen) {
|
||||
text[length] = '.';
|
||||
}
|
||||
++length;
|
||||
}
|
||||
}
|
||||
|
||||
if (info->width > 0 && (size_t)info->width > length) {
|
||||
const char fill = info->pad_zeroes ? '0' : ' ';
|
||||
|
|
Loading…
Reference in New Issue