X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0f895b0cf5c0ab0f6da406efe7adbff14fd10456..bf2c43c76e2819be443ab1d830ab68d9569d66b1:/src/common/strvararg.cpp?ds=inline diff --git a/src/common/strvararg.cpp b/src/common/strvararg.cpp index 0e1b1592af..9112bbf8f9 100644 --- a/src/common/strvararg.cpp +++ b/src/common/strvararg.cpp @@ -3,7 +3,6 @@ // Purpose: macros for implementing type-safe vararg passing of strings // Author: Vaclav Slavik // Created: 2007-02-19 -// RCS-ID: $Id$ // Copyright: (c) 2007 REA Elektronik GmbH // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -161,6 +160,19 @@ public: { if ( CopyFmtChar(*format++) == wxT('%') ) { +#if wxUSE_PRINTF_POS_PARAMS + if ( *format >= '0' && *format <= '9' ) + { + SkipDigits(&format); + if ( *format == '$' ) + { + // It was a positional argument specification. + CopyFmtChar(*format++); + } + //else: it was a width specification, nothing else to do. + } +#endif // wxUSE_PRINTF_POS_PARAMS + // skip any flags while ( IsFlagChar(*format) ) CopyFmtChar(*format++); @@ -375,7 +387,7 @@ private: size_t m_nCopied; }; -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) && !defined(__CYGWIN__) // on Windows, we should use %s and %c regardless of the build: class wxPrintfFormatConverterWchar : public wxFormatConverterBase @@ -422,6 +434,8 @@ class wxPrintfFormatConverterWchar : public wxFormatConverterBase }; #endif // !wxUSE_UTF8_LOCALE_ONLY +#endif // __WINDOWS__/!__WINDOWS__ + #if wxUSE_UNICODE_UTF8 class wxPrintfFormatConverterUtf8 : public wxFormatConverterBase { @@ -445,8 +459,6 @@ class wxPrintfFormatConverterUtf8 : public wxFormatConverterBase }; #endif // wxUSE_UNICODE_UTF8 -#endif // __WINDOWS__/!__WINDOWS__ - #if !wxUSE_UNICODE // FIXME-UTF8: remove class wxPrintfFormatConverterANSI : public wxFormatConverterBase { @@ -642,6 +654,9 @@ wxFormatString::ArgumentType DoGetArgumentType(const CharType *format, wxPrintfConvSpecParser parser(format); + wxCHECK_MSG( n <= parser.nargs, wxFormatString::Arg_Unknown, + "more arguments than format string specifiers?" ); + wxCHECK_MSG( parser.pspec[n-1] != NULL, wxFormatString::Arg_Unknown, "requested argument not found - invalid format string?" );