Use proper encoding in UnescapeString() to speed up processing

Use the proper encoding to prevent extraneous conversion encoding conversion inside UnescapeString(). This change reduces the eeschema symbol library loading time (ubuntu and windows build) from 2700ms to 1700ms.

See merge request https://gitlab.com/kicad/code/kicad/merge_requests/70
This commit is contained in:
Alexander Stock 2020-01-20 10:51:20 +00:00 committed by Ian McInerney
parent 32674ef360
commit 974f84a5a6
1 changed files with 13 additions and 13 deletions

View File

@ -132,21 +132,21 @@ wxString UnescapeString( const wxString& aSource )
{
wxString converted = aSource;
converted.Replace( "{dblquote}", "\"" );
converted.Replace( "{quote}", "'" );
converted.Replace( "{lt}", "<" );
converted.Replace( "{gt}", ">" );
converted.Replace( "{backslash}", "\\" );
converted.Replace( "{slash}", "/" );
converted.Replace( "{bar}", "|" );
converted.Replace( "{colon}", ":" );
converted.Replace( "{space}", " " );
converted.Replace( "{dollar}", "$" );
converted.Replace( "{tab}", "\t" );
converted.Replace( "{return}", "\n" );
converted.Replace( wxS( "{dblquote}" ), wxS( "\"" ) );
converted.Replace( wxS( "{quote}" ), wxS( "'" ) );
converted.Replace( wxS( "{lt}" ), wxS( "<" ) );
converted.Replace( wxS( "{gt}" ), wxS( ">" ) );
converted.Replace( wxS( "{backslash}" ), wxS( "\\" ) );
converted.Replace( wxS( "{slash}" ), wxS( "/" ) );
converted.Replace( wxS( "{bar}" ), wxS( "|" ) );
converted.Replace( wxS( "{colon}" ), wxS( ":" ) );
converted.Replace( wxS( "{space}" ), wxS( " " ) );
converted.Replace( wxS( "{dollar}" ), wxS( "$" ) );
converted.Replace( wxS( "{tab}" ), wxS( "\t" ) );
converted.Replace( wxS( "{return}" ), wxS( "\n" ) );
// must be done last
converted.Replace( "{brace}", "{" );
converted.Replace( wxS( "{brace}" ), wxS( "{" ) );
return converted;
}