Be more permissive when validating format string arguments.

Previously, the code would assert if the caller passed too many
arguments to wxPrintf() or other printf-like functions. But that can
happen legitimately in translations: in some languages such as Hebrew,
using "1" (i.e. "%d") in the singular feels unnatural and it's better to
use the word "one" and left the variadic argument unused.

Relax the check not to assert in this case. This is consistent with the
standard library and other implementations. Notice that gettext's msgfmt
doesn't complain about this case either in the specific case of singular
forms.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2014-02-27 15:23:43 +00:00
parent 194e8b5011
commit 9f430ab6a6
2 changed files with 16 additions and 2 deletions

View File

@@ -155,6 +155,11 @@ public:
// a char* string is also a pointer and an integer is also a char.
enum ArgumentType
{
#if wxABI_VERSION >= 30001
Arg_Unused = 0, // not used at all; the value of 0 is chosen to
// conveniently pass wxASSERT_ARG_TYPE's check
#endif
Arg_Char = 0x0001, // character as char %c
Arg_Pointer = 0x0002, // %p
Arg_String = 0x0004 | Arg_Pointer, // any form of string (%s and %p too)