mirror of
https://github.com/yawut/SDL.git
synced 2026-07-06 19:54:20 -05:00
SDL_vsnprintf: %.* and %* now parse precision and width. (bug #4263.)
This commit is contained in:
parent
00aad31722
commit
5ca98d3506
|
|
@ -1593,11 +1593,18 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt,
|
|||
if (*fmt >= '0' && *fmt <= '9') {
|
||||
info.width = SDL_strtol(fmt, (char **)&fmt, 0);
|
||||
}
|
||||
else if (*fmt == '*') {
|
||||
++fmt;
|
||||
info.width = va_arg(ap, int);
|
||||
}
|
||||
|
||||
if (*fmt == '.') {
|
||||
++fmt;
|
||||
if (*fmt >= '0' && *fmt <= '9') {
|
||||
info.precision = SDL_strtol(fmt, (char **)&fmt, 0);
|
||||
} else if (*fmt == '*') {
|
||||
++fmt;
|
||||
info.precision = va_arg(ap, int);
|
||||
} else {
|
||||
info.precision = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user