Add some more reserves for string funcs
This commit is contained in:
parent
ca5049b6bc
commit
2df80c6473
|
@ -50,6 +50,8 @@ wxString ConvertToNewOverbarNotation( const wxString& aOldStr )
|
||||||
if( aOldStr == "~" )
|
if( aOldStr == "~" )
|
||||||
return aOldStr;
|
return aOldStr;
|
||||||
|
|
||||||
|
newStr.reserve( aOldStr.length() );
|
||||||
|
|
||||||
for( wxString::const_iterator chIt = aOldStr.begin(); chIt != aOldStr.end(); ++chIt )
|
for( wxString::const_iterator chIt = aOldStr.begin(); chIt != aOldStr.end(); ++chIt )
|
||||||
{
|
{
|
||||||
if( *chIt == '~' )
|
if( *chIt == '~' )
|
||||||
|
@ -327,6 +329,8 @@ wxString TitleCaps( const wxString& aString )
|
||||||
|
|
||||||
wxStringSplit( aString, words, ' ' );
|
wxStringSplit( aString, words, ' ' );
|
||||||
|
|
||||||
|
result.reserve( aString.length() );
|
||||||
|
|
||||||
for( const wxString& word : words )
|
for( const wxString& word : words )
|
||||||
{
|
{
|
||||||
if( !result.IsEmpty() )
|
if( !result.IsEmpty() )
|
||||||
|
@ -445,6 +449,8 @@ std::string EscapedUTF8( const wxString& aString )
|
||||||
|
|
||||||
std::string ret;
|
std::string ret;
|
||||||
|
|
||||||
|
ret.reserve( utf8.length() + 2 );
|
||||||
|
|
||||||
ret += '"';
|
ret += '"';
|
||||||
|
|
||||||
for( std::string::const_iterator it = utf8.begin(); it!=utf8.end(); ++it )
|
for( std::string::const_iterator it = utf8.begin(); it!=utf8.end(); ++it )
|
||||||
|
@ -476,6 +482,8 @@ wxString EscapeHTML( const wxString& aString )
|
||||||
{
|
{
|
||||||
wxString converted;
|
wxString converted;
|
||||||
|
|
||||||
|
converted.reserve( aString.length() );
|
||||||
|
|
||||||
for( wxUniChar c : aString )
|
for( wxUniChar c : aString )
|
||||||
{
|
{
|
||||||
if( c == '\"' )
|
if( c == '\"' )
|
||||||
|
|
Loading…
Reference in New Issue