diff --git a/docs/changes.txt b/docs/changes.txt index 7fd8d7de54..e6b20ccd1c 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -207,6 +207,7 @@ wxMSW: - Return correct OS version under Windows 8.1 and later. - Fix crash in wxD2DContext when using non-MSVC compiler (iwbnwif). - Notify shell about the changes done by wxMimeTypesManager (Maarten Bent). +- Fix wxPrintf() and friends when using MinGW with ANSI stdio option. wxOSX/Cocoa: diff --git a/src/common/strvararg.cpp b/src/common/strvararg.cpp index 0196e06ee9..d4550dbfd1 100644 --- a/src/common/strvararg.cpp +++ b/src/common/strvararg.cpp @@ -410,7 +410,13 @@ private: size_t m_nCopied; }; -#if defined(__WINDOWS__) && !defined(__CYGWIN__) +// Distinguish between the traditional Windows (and MSVC) behaviour and Cygwin +// (which is always Unix-like) and MinGW which can use either depending on the +// "ANSI stdio" option value (which is normally set to either 0 or 1, but test +// for it in a way which works even if it's not defined at all, just in case). +#if defined(__WINDOWS__) && \ + !defined(__CYGWIN__) && \ + (!defined(__MINGW32__) || (__USE_MINGW_ANSI_STDIO +0 == 0)) // on Windows, we should use %s and %c regardless of the build: class wxPrintfFormatConverterWchar : public wxFormatConverterBase