Skip to content

Commit cd40157

Browse files
author
Paul Gofman
committed
shlwapi: Skip duplicate '#' in WPRINTF_ParseFormat().
CW-Bug-Id: #24355
1 parent af037f3 commit cd40157

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

dlls/shlwapi/tests/string.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,8 @@ static void test_printf_format(void)
17141714
{ "%hhu", sizeof(ULONG), "10", NULL, 10 },
17151715
{ "%hwu", sizeof(ULONG), "10", NULL, 10 },
17161716
{ "%whu", sizeof(ULONG), "10", NULL, 10 },
1717+
{ "%##lhllwlx", sizeof(ULONG64), "0x1000000010", NULL, 0x1000000010 },
1718+
{ "%##lhlwlx", sizeof(ULONG), "0x10", NULL, 0x1000000010 },
17171719
{ "%04lhlwllx", sizeof(ULONG64), "1000000010", NULL, 0x1000000010 },
17181720
{ "%s", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)"str", L"str" },
17191721
{ "%S", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" },

dlls/shlwapi/wsprintf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static INT WPRINTF_ParseFormatA( LPCSTR format, WPRINTF_FORMAT *res )
9595
res->width = 0;
9696
res->precision = 0;
9797
if (*p == '-') { res->flags |= WPRINTF_LEFTALIGN; p++; }
98-
if (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; }
98+
while (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; }
9999
while (*p == ' ') ++p;
100100
if (*p == '0') { res->flags |= WPRINTF_ZEROPAD; p++; }
101101
while ((*p >= '0') && (*p <= '9')) /* width field */
@@ -192,7 +192,7 @@ static INT WPRINTF_ParseFormatW( LPCWSTR format, WPRINTF_FORMAT *res )
192192
res->width = 0;
193193
res->precision = 0;
194194
if (*p == '-') { res->flags |= WPRINTF_LEFTALIGN; p++; }
195-
if (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; }
195+
while (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; }
196196
while (*p == ' ') ++p;
197197
if (*p == '0') { res->flags |= WPRINTF_ZEROPAD; p++; }
198198
while ((*p >= '0') && (*p <= '9')) /* width field */

0 commit comments

Comments
 (0)