Fix built-in wxPrintf() for repeated positional parameters

Allow wxPrintf("%1$s %1$s", "foo") to work.

Take into account the possibility that the number of format specifiers
and the number of actual arguments can be different.

Closes #9367.
This commit is contained in:
Vadim Zeitlin
2017-11-25 11:02:52 +01:00
parent dd8155980b
commit 471a771382
3 changed files with 36 additions and 10 deletions

View File

@@ -139,7 +139,7 @@ static int wxDoVsnprintf(CharType *buf, size_t lenMax,
// finally, process each conversion specifier with its own argument
const CharType *toparse = format;
for (i=0; i < parser.nargs; i++)
for (i=0; i < parser.nspecs; i++)
{
wxPrintfConvSpec<CharType>& spec = parser.specs[i];