]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix vararg type checking to accept ints for %c.
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 3 Jul 2010 14:24:12 +0000 (14:24 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 3 Jul 2010 14:24:12 +0000 (14:24 +0000)
It's perfectly legitimate to format int values as %c, so don't assert in
this case.

Fixes #12192.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64798 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/strvararg.h
tests/strings/vararg.cpp

index 933c452f6ceef594a844e4336386336968614866..db91346e675b0f576c30fb691e9185b5413ecb49 100644 (file)
@@ -160,7 +160,7 @@ public:
         Arg_Pointer     = 0x0002,    // %p
         Arg_String      = 0x0004 | Arg_Pointer, // any form of string (%s and %p too)
 
-        Arg_Int         = 0x0008,
+        Arg_Int         = 0x0008 | Arg_Char, // (ints can be used with %c)
 #if SIZEOF_INT == SIZEOF_LONG
         Arg_LongInt     = Arg_Int,
 #else
index 5e165d5f1637759ca9dc5c6d57650849bfc8cdb5..f778fec4be0a007e0b95e46c1d27b2e6f7634ec0 100644 (file)
@@ -215,4 +215,8 @@ void VarArgTestCase::ArgsValidation()
     VarArgTestCase& somePOD = *this;
     WX_ASSERT_FAILS_WITH_ASSERT( wxString::Format("%s", somePOD) );
 #endif
+
+    // %c should accept integers too
+    wxString::Format("%c", 80);
+    wxString::Format("%c", wxChar(80) + wxChar(1));
 }