Refactor string manipulations in wxPropertyGrid::ExpandEscapeSequence and CreateEscapeSequences.

Share wxString::clear() method to initialize empty destination string.
This commit is contained in:
Artur Wieczorek 2015-06-05 22:47:28 +02:00
parent efce9b2306
commit 3e3aaa33db

View File

@ -1736,18 +1736,17 @@ wxPoint wxPropertyGrid::GetGoodEditorDialogPosition( wxPGProperty* p,
wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& src_str )
{
dst_str.clear();
if ( src_str.empty() )
{
dst_str = src_str;
return src_str;
return dst_str;
}
bool prev_is_slash = false;
wxString::const_iterator i = src_str.begin();
dst_str.clear();
for ( ; i != src_str.end(); ++i )
{
wxUniChar a = *i;
@ -1795,17 +1794,16 @@ wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& sr
wxString& wxPropertyGrid::CreateEscapeSequences( wxString& dst_str, wxString& src_str )
{
dst_str.clear();
if ( src_str.empty() )
{
dst_str = src_str;
return src_str;
return dst_str;
}
wxString::const_iterator i = src_str.begin();
wxUniChar prev_a = wxS('\0');
dst_str.clear();
for ( ; i != src_str.end(); ++i )
{
wxChar a = *i;