don't do char*->wchar_t*>char* roundtrip in wxArgNormalizerUtf8<const char*> if current locale uses UTF-8

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45787 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-05-03 14:34:29 +00:00
parent 9d0e03774e
commit f461887a02

View File

@@ -238,8 +238,12 @@ struct wxArgNormalizerUtf8<const char*>
{ {
wxArgNormalizerUtf8(const char* s) wxArgNormalizerUtf8(const char* s)
{ {
// FIXME-UTF8: optimize this if current locale is UTF-8 one if ( wxLocaleIsUtf8 )
{
m_value = wxCharBuffer::CreateNonOwned(s);
}
else
{
// convert to widechar string first: // convert to widechar string first:
wxWCharBuffer buf(wxConvLibc.cMB2WC(s)); wxWCharBuffer buf(wxConvLibc.cMB2WC(s));
@@ -247,6 +251,7 @@ struct wxArgNormalizerUtf8<const char*>
if ( buf ) if ( buf )
m_value = wxConvUTF8.cWC2MB(buf); m_value = wxConvUTF8.cWC2MB(buf);
} }
}
}; };
// UTF-8 build needs conversion to wchar_t* too: // UTF-8 build needs conversion to wchar_t* too: