[Commits] SDL: SDL_vsnprintf: %.* and %* now parse precision and width. (...

libsdl.org revision control commits-owner at libsdl.org
Wed Sep 26 00:43:33 PDT 2018


details:   https://hg.libsdl.org/SDL/rev/4cbf7e663cb2
changeset: 12226:4cbf7e663cb2
user:      Ozkan Sezer <sezeroz at gmail.com>
date:      Wed Sep 26 10:38:40 2018 +0300
description:
SDL_vsnprintf:  %.* and %* now parse precision and width. (bug #4263.)

diffstat:

 src/stdlib/SDL_string.c |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diffs (22 lines):

diff -r 18445c9fc2f3 -r 4cbf7e663cb2 src/stdlib/SDL_string.c
--- a/src/stdlib/SDL_string.c	Tue Sep 25 20:11:52 2018 -0700
+++ b/src/stdlib/SDL_string.c	Wed Sep 26 10:38:40 2018 +0300
@@ -1593,11 +1593,18 @@
             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;
                 }


More information about the commits mailing list