Fix format string in wxLog::LogLastRepeatIfNeeded().

We used a format string without any format specifiers in it in a call to
wxString::Printf() which always had a parameter resulting in an assert failure
about a mismatch between the string and parameter count.

Fix this by using a separate Printf() call for this case.

Closes #13613.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69678 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-11-05 11:23:51 +00:00
parent b059c519bf
commit 2371703475

View File

@@ -216,12 +216,24 @@ unsigned wxLog::LogLastRepeatIfNeeded()
{
wxString msg;
#if wxUSE_INTL
msg.Printf(wxPLURAL("The previous message repeated once.",
"The previous message repeated %lu times.",
gs_prevLog.numRepeated),
gs_prevLog.numRepeated);
if ( gs_prevLog.numRepeated == 1 )
{
// We use a separate message for this case as "repeated 1 time"
// looks somewhat strange.
msg = _("The previous message repeated once.");
}
else
{
// Notice that we still use wxPLURAL() to ensure that multiple
// numbers of times are correctly formatted, even though we never
// actually use the singular string.
msg.Printf(wxPLURAL("The previous message repeated %lu time.",
"The previous message repeated %lu times.",
gs_prevLog.numRepeated),
gs_prevLog.numRepeated);
}
#else
msg.Printf(wxS("The previous message was repeated %lu times."),
msg.Printf(wxS("The previous message was repeated %lu time(s)."),
gs_prevLog.numRepeated);
#endif
gs_prevLog.numRepeated = 0;