[ wxwindows-Patches-1538348 ] '%%' not parsed correctly by wxString::Format()

SourceForge.net noreply at sourceforge.net
Thu Aug 10 15:11:19 PDT 2006


Patches item #1538348, was opened at 2006-08-10 15:11
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1538348&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Common
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Hank Schultz (whschultz)
Assigned to: Nobody/Anonymous (nobody)
Summary: '%%' not parsed correctly by wxString::Format()

Initial Comment:
The following line causes a crash on wxMac:

    return wxString::Format( wxT("<table width='100%%' cellspacing='0' 
cellpadding='0'><tr>")
							 wxT("<td width='%u' 
valign='center'>%s</td>")
							 wxT("<td valign='center'>%s</
td></tr></table>"),
							 GetOperatorColWidth() + 10/
*spacing*/,
							 left.c_str(),
							 right.c_str() );



I stepped through the crash and found that the '%%' was being 
interpreted as a placeholder.  The first '%' was ignored within 
wxPrintfConvSpec::Parse(), but the second is accepted as %c.  As a 
result, wxVsnprintf_() expects four arguments, though it only has 
three.  I'm not sure why, but the code that caused this crash works 
correctly on wxMSW, but it crashes on wxMac.  This could be a CVS 
revision issue, though, as the PC has a much older revision (a few 
weeks old).


The patch fixes wxVsnprintf_() to look for '%%', though 
wxPrintfConvSpec::Parse() may also need to be patched to not accept 
"%' c" as if it were "%c."  Of course, if that's the standard, then the 
wxVsnprintf_() fix is the correct fix.


And before I forget again, I'm using Unicode.


Thanks!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1538348&group_id=9863




More information about the wx-dev mailing list