Fix handling of asterisks in wxPrintf() implementation.
Count the number of asterisks before modifying the string we use to do this, otherwise we were off by one for the format specifications containing two of them. This really fixes the handling of asterisks (used for width/precision) in wxPrintf() format string, it wasn't done correctly by r60120 but now VsnprintfTestCase::Asterisk() test does pass. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -831,9 +831,13 @@ struct wxPrintfConvSpecParser
|
||||
// special handling for specifications including asterisks: we need
|
||||
// to reserve an extra slot (or two if asterisks were used for both
|
||||
// width and precision) in specs array in this case
|
||||
for ( const char *f = strchr(spec->m_szFlags, '*');
|
||||
f;
|
||||
f = strchr(f + 1, '*') )
|
||||
if ( const char *f = strchr(spec->m_szFlags, '*') )
|
||||
{
|
||||
unsigned numAsterisks = 1;
|
||||
if ( strchr(++f, '*') )
|
||||
numAsterisks++;
|
||||
|
||||
for ( unsigned n = 0; n < numAsterisks; n++ )
|
||||
{
|
||||
if ( nargs++ == wxMAX_SVNPRINTF_ARGUMENTS )
|
||||
break;
|
||||
@@ -867,6 +871,8 @@ struct wxPrintfConvSpecParser
|
||||
|
||||
spec = &specs[nargs];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check if this is a positional or normal argument
|
||||
if ( spec->m_pos > 0 )
|
||||
|
Reference in New Issue
Block a user