Kaydet (Commit) 070ea7fa authored tarafından Matteo Casalin's avatar Matteo Casalin

Use optimized OString concatenation

Change-Id: Iaefacf4a57398d0e88b4de7552af11832db3e881
Reviewed-on: https://gerrit.libreoffice.org/68178
Tested-by: Jenkins
Reviewed-by: 's avatarMatteo Casalin <matteo.casalin@yahoo.com>
üst 1e155925
...@@ -209,9 +209,7 @@ void LngParser::Merge( ...@@ -209,9 +209,7 @@ void LngParser::Merge(
{ {
sLang = sLang.trim(); sLang = sLang.trim();
OString sSearch( ";" ); OString sSearch{ ";" + sLang + ";" };
sSearch += sLang;
sSearch += ";";
if ( sLanguagesDone.indexOf( sSearch ) != -1 ) { if ( sLanguagesDone.indexOf( sSearch ) != -1 ) {
mvLines.erase( mvLines.begin() + nPos ); mvLines.erase( mvLines.begin() + nPos );
...@@ -226,14 +224,11 @@ void LngParser::Merge( ...@@ -226,14 +224,11 @@ void LngParser::Merge(
continue; continue;
if ( !sNewText.isEmpty()) { if ( !sNewText.isEmpty()) {
OString & rLine = mvLines[ nPos ]; mvLines[ nPos ] = sLang
+ " = \""
OString sText1( sLang ); // escape quotes, unescape double escaped quotes fdo#56648
sText1 += " = \""; + sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\"")
// escape quotes, unescape double escaped quotes fdo#56648 + "\"";
sText1 += sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\"");
sText1 += "\"";
rLine = sText1;
Text[ sLang ] = sNewText; Text[ sLang ] = sNewText;
} }
} }
...@@ -264,12 +259,11 @@ void LngParser::Merge( ...@@ -264,12 +259,11 @@ void LngParser::Merge(
continue; continue;
if ( !sNewText.isEmpty() && sCur != "x-comment") if ( !sNewText.isEmpty() && sCur != "x-comment")
{ {
OString sLine; const OString sLine { sCur
sLine += sCur; + " = \""
sLine += " = \""; // escape quotes, unescape double escaped quotes fdo#56648
// escape quotes, unescape double escaped quotes fdo#56648 + sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\"")
sLine += sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\""); + "\"" };
sLine += "\"";
nLastLangPos++; nLastLangPos++;
nPos++; nPos++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment