Fix handling of strings in wxPrintf() when using recent MinGW

MinGW-w64 (and apparently TDM too) defaults to using ANSI stdio functions
nowadays, which interpret format specifiers such as "%s" and "%c" in wide
string functions in the standard-conforming way, i.e. still expecting the
arguments of "char*" type, and not "wchar_t*" as MSVC and older MinGW did.
This commit is contained in:
Vadim Zeitlin
2016-02-10 15:22:51 +01:00
parent caf63a14cb
commit 06458cb89f
2 changed files with 8 additions and 1 deletions

View File

@@ -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:

View File

@@ -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<wchar_t>