From 875a40be138fa450ac09535de032d41024c56b51 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Apr 2016 18:12:31 +0200 Subject: [PATCH] Fix wxString::ToStdString(wxMBConv) to compile in ANSI build 70ddab243e220bdd630af9aaae9d10efc57b1eb7 broke compilation without Unicode as mb_str() doesn't return a buffer in this case. See #17461. --- include/wx/string.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/wx/string.h b/include/wx/string.h index 90783fbd0b..7eb6f4938c 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -1241,10 +1241,12 @@ public: // wxStringImpl is std::string in the encoding we want #define wxStringToStdStringRetType const std::string& const std::string& ToStdString() const { return m_impl; } - std::string ToStdString(const wxMBConv& conv) const + std::string ToStdString(const wxMBConv& WXUNUSED(conv)) const { - wxScopedCharBuffer buf(mb_str(conv)); - return std::string(buf.data(), buf.length()); + // No conversions are done when not using Unicode as everything is + // supposed to be in 7 bit ASCII anyhow, this method is provided just + // for compatibility with the Unicode build. + return ToStdString(); } #else // wxStringImpl is either not std::string or needs conversion