optimize wxStringOperationsUtf8::DecodeChar() for the ASCII case

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48321 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-08-22 09:24:56 +00:00
parent 7da48d4928
commit ac2d749e88
2 changed files with 10 additions and 2 deletions

View File

@@ -156,7 +156,15 @@ struct WXDLLIMPEXP_BASE wxStringOperationsUtf8
} }
// decodes single UTF-8 character from UTF-8 string // decodes single UTF-8 character from UTF-8 string
static wxUniChar DecodeChar(wxStringImpl::const_iterator i); static wxUniChar DecodeChar(wxStringImpl::const_iterator i)
{
if ( (unsigned char)*i < 0x80 )
return (int)*i;
return DecodeNonAsciiChar(i);
}
private:
static wxUniChar DecodeNonAsciiChar(wxStringImpl::const_iterator i);
}; };
#endif // wxUSE_UNICODE_UTF8 #endif // wxUSE_UNICODE_UTF8

View File

@@ -249,7 +249,7 @@ wxUniChar::Utf8CharBuffer wxUniChar::AsUTF8() const
} }
wxUniChar wxUniChar
wxStringOperationsUtf8::DecodeChar(wxStringImpl::const_iterator i) wxStringOperationsUtf8::DecodeNonAsciiChar(wxStringImpl::const_iterator i)
{ {
wxASSERT( IsValidUtf8LeadByte(*i) ); wxASSERT( IsValidUtf8LeadByte(*i) );