From: Paul Gofman pgofman@codeweavers.com
--- dlls/shlwapi/tests/string.c | 5 +++++ dlls/shlwapi/wsprintf.c | 4 ++++ 2 files changed, 9 insertions(+)
diff --git a/dlls/shlwapi/tests/string.c b/dlls/shlwapi/tests/string.c index 6ff1fa75c7e..80811ab9683 100644 --- a/dlls/shlwapi/tests/string.c +++ b/dlls/shlwapi/tests/string.c @@ -1773,6 +1773,11 @@ static void test_printf_format(void) { "%I64llu", sizeof(ULONG64), "10", NULL, 10 }, { "%I64s", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)"str", L"str" }, { "%q%u", sizeof(ULONG), "q10", NULL, 10 }, + { "%u% ", sizeof(ULONG), "10", NULL, 10 }, + { "% ll u", 0, " u", NULL, 10 }, + { "% llu", sizeof(ULONG64), "10", NULL, 10 }, + { "%# llx", sizeof(ULONG64), "0xa", NULL, 10 }, + { "% #llx", sizeof(ULONG64), "0xa", NULL, 10 }, }; WCHAR ws[256], expectedw[256], specw[256]; unsigned int i, j; diff --git a/dlls/shlwapi/wsprintf.c b/dlls/shlwapi/wsprintf.c index 771c130be70..b4113d2d563 100644 --- a/dlls/shlwapi/wsprintf.c +++ b/dlls/shlwapi/wsprintf.c @@ -90,11 +90,13 @@ static INT WPRINTF_ParseFormatA( LPCSTR format, WPRINTF_FORMAT *res ) { LPCSTR p = format;
+ while (*p == ' ') ++p; res->flags = 0; res->width = 0; res->precision = 0; if (*p == '-') { res->flags |= WPRINTF_LEFTALIGN; p++; } if (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; } + while (*p == ' ') ++p; if (*p == '0') { res->flags |= WPRINTF_ZEROPAD; p++; } while ((*p >= '0') && (*p <= '9')) /* width field */ { @@ -185,11 +187,13 @@ static INT WPRINTF_ParseFormatW( LPCWSTR format, WPRINTF_FORMAT *res ) { LPCWSTR p = format;
+ while (*p == ' ') ++p; res->flags = 0; res->width = 0; res->precision = 0; if (*p == '-') { res->flags |= WPRINTF_LEFTALIGN; p++; } if (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; } + while (*p == ' ') ++p; if (*p == '0') { res->flags |= WPRINTF_ZEROPAD; p++; } while ((*p >= '0') && (*p <= '9')) /* width field */ {