summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-02-23 18:02:19 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-03-20 07:35:14 +0100
commite99fafa6d18fb56036b2c5d739b7c0a5dd915d41 (patch)
tree0a5d5ffd8efb22767681f3779e5909e0cb15f327 /l10ntools
parentdfb2feca54147e1939b3a38f841aad566751a479 (diff)
Reduce OString operations
Change-Id: I13291ca27574d3536e55d8207a0b13b2694385be Reviewed-on: https://gerrit.libreoffice.org/69233 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/cfgmerge.cxx41
1 files changed, 10 insertions, 31 deletions
diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index 0c1167da1a3b..755359b1fa24 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -259,10 +259,7 @@ void CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken )
}
else
{
- OString sError( "Misplaced close tag: " );
- sError += sToken;
- sError += " in file ";
- sError += global::inputPathname;
+ const OString sError{ "Misplaced close tag: " + sToken + " in file " + global::inputPathname };
yyerror(sError.getStr());
std::exit(EXIT_FAILURE);
}
@@ -470,34 +467,16 @@ void CfgMerge::WorkOnResourceEnd()
if (
( !sCur.equalsIgnoreAsciiCase("en-US") ) && !sContent.isEmpty())
{
-
- OString sText = helper::QuotHTML( sContent);
-
- OString sAdditionalLine( "\t" );
-
OString sTextTag = pStackData->sTextTag;
- OString sTemp = sTextTag.copy( sTextTag.indexOf( "xml:lang=" ));
-
- sal_Int32 n = 0;
- OString sSearch = sTemp.getToken(0, '"', n);
- sSearch += "\"";
- sSearch += sTemp.getToken(0, '"', n);
- sSearch += "\"";
-
- OString sReplace = sTemp.getToken(0, '"');
- sReplace += "\"";
- sReplace += sCur;
- sReplace += "\"";
-
- sTextTag = sTextTag.replaceFirst(sSearch, sReplace);
-
- sAdditionalLine += sTextTag;
- sAdditionalLine += sText;
- sAdditionalLine += pStackData->sEndTextTag;
-
- sAdditionalLine += "\n";
- sAdditionalLine += sLastWhitespace;
-
+ const sal_Int32 nLangAttributeStart{ sTextTag.indexOf( "xml:lang=" ) };
+ const sal_Int32 nLangStart{ sTextTag.indexOf( '"', nLangAttributeStart )+1 };
+ const sal_Int32 nLangEnd{ sTextTag.indexOf( '"', nLangStart ) };
+ OString sAdditionalLine{ "\t"
+ + sTextTag.replaceAt(nLangStart, nLangEnd-nLangStart, sCur)
+ + helper::QuotHTML(sContent)
+ + pStackData->sEndTextTag
+ + "\n"
+ + sLastWhitespace };
Output( sAdditionalLine );
}
}