From: Václav Slavík Date: Thu, 3 May 2007 14:34:29 +0000 (+0000) Subject: don't do char*->wchar_t*>char* roundtrip in wxArgNormalizerUtf8 if curre... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f461887a024900f2a99539954be6dacf6247d047?ds=inline don't do char*->wchar_t*>char* roundtrip in wxArgNormalizerUtf8 if current locale uses UTF-8 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45787 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/strvararg.h b/include/wx/strvararg.h index 16273f47a6..82f0039b08 100644 --- a/include/wx/strvararg.h +++ b/include/wx/strvararg.h @@ -238,14 +238,19 @@ struct wxArgNormalizerUtf8 { wxArgNormalizerUtf8(const char* s) { - // FIXME-UTF8: optimize this if current locale is UTF-8 one - - // convert to widechar string first: - wxWCharBuffer buf(wxConvLibc.cMB2WC(s)); - - // then to UTF-8: - if ( buf ) - m_value = wxConvUTF8.cWC2MB(buf); + if ( wxLocaleIsUtf8 ) + { + m_value = wxCharBuffer::CreateNonOwned(s); + } + else + { + // convert to widechar string first: + wxWCharBuffer buf(wxConvLibc.cMB2WC(s)); + + // then to UTF-8: + if ( buf ) + m_value = wxConvUTF8.cWC2MB(buf); + } } };