Module: wine Branch: master Commit: 1309e11ea1c5863616de7638731d00d6ab90b295 URL: https://source.winehq.org/git/wine.git/?a=commit;h=1309e11ea1c5863616de76387...
Author: Piotr Caban piotr@codeweavers.com Date: Sat Nov 2 14:39:23 2019 +0100
msvcrt: Improve printf %I format support.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/printf.h | 6 +++--- dlls/msvcrt/tests/printf.c | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h index 975977087d..20bd77e792 100644 --- a/dlls/msvcrt/printf.h +++ b/dlls/msvcrt/printf.h @@ -509,10 +509,10 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API p += 3; } else if(*(p+1)=='3' && *(p+2)=='2') p += 3; - else if(isdigit(*(p+1)) || !*(p+1)) - break; - else + else if(p[1] && strchr("diouxX", p[1])) flags.IntegerNative = *p++; + else + break; } else if(*p == 'w') flags.WideString = *p++; #if _MSVCR_VER >= 140 diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c index ac5c37a59c..d1fe292143 100644 --- a/dlls/msvcrt/tests/printf.c +++ b/dlls/msvcrt/tests/printf.c @@ -159,6 +159,8 @@ static void test_sprintf( void ) " 00000000000000000000000000000000000000000000000000000000000000000000000000000001", 0, INT_ARG, 1 }, { "%I", "I", 0, INT_ARG, 1 }, + { "%Iq", "Iq", 0, INT_ARG, 1 }, + { "%Ihd", "Ihd", 0, INT_ARG, 1 }, { "%I0d", "I0d", 0, INT_ARG, 1 }, { "%I64D", "D", 0, ULONGLONG_ARG, 0, -1 }, { "%zx", "1", "zx", TODO_FLAG | INT_ARG, 1 }, @@ -256,6 +258,7 @@ static void test_sprintf( void ) int i, x, r;
for (i=0; i<ARRAY_SIZE(tests); i++) { + memset(buffer, 'x', sizeof(buffer)); switch(tests[i].type & 0xff) { case NO_ARG: r = p_sprintf(buffer, tests[i].format);