l10ntools/source/cfgmerge.cxx  |   10 +++++-----
 l10ntools/source/helpmerge.cxx |   16 ++++++++--------
 l10ntools/source/lngex.cxx     |    2 +-
 l10ntools/source/lngmerge.cxx  |   10 +++++-----
 l10ntools/source/merge.cxx     |   10 +++++-----
 l10ntools/source/po.cxx        |    4 ++--
 l10ntools/source/propex.cxx    |    2 +-
 l10ntools/source/propmerge.cxx |    2 +-
 l10ntools/source/treemerge.cxx |    6 +++---
 l10ntools/source/xmlparse.cxx  |   34 +++++++++++++++++-----------------
 l10ntools/source/xrmmerge.cxx  |   28 ++++++++++++++--------------
 11 files changed, 62 insertions(+), 62 deletions(-)

New commits:
commit 2718e9c1d5779a23bd6587a7e0e55a0281b88745
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Sun Nov 19 20:41:10 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon Nov 20 07:28:07 2023 +0100

    Extended loplugin:ostr: l10ntools
    
    Change-Id: I6c46535568ac6c29784e9336198b51c79c9e3859
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159695
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index f07323ef7efd..9ed721aab651 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -52,7 +52,7 @@ FILE * init(int argc, char ** argv) {
     common::HandledArgs aArgs;
     if ( !common::handleArguments(argc, argv, aArgs) )
     {
-        common::writeUsage("cfgex","*.xcu");
+        common::writeUsage("cfgex"_ostr,"*.xcu"_ostr);
         std::exit(EXIT_FAILURE);
     }
     global::inputPathname = aArgs.m_sInputFile;
@@ -365,10 +365,10 @@ void CfgExport::WorkOnResourceEnd()
     if ( !bLocalize )
         return;
 
-    if ( pStackData->sText["en-US"].isEmpty() )
+    if ( pStackData->sText["en-US"_ostr].isEmpty() )
         return;
 
-    OString sXComment = pStackData->sText[OString("x-comment")];
+    OString sXComment = pStackData->sText["x-comment"_ostr];
     OString sLocalId = pStackData->sIdentifier;
     OString sGroupId;
     if ( aStack.size() == 1 ) {
@@ -380,11 +380,11 @@ void CfgExport::WorkOnResourceEnd()
     }
 
 
-    OString sText = pStackData->sText[ "en-US" ];
+    OString sText = pStackData->sText[ "en-US"_ostr ];
     sText = helper::UnQuotHTML( sText );
 
     common::writePoEntry(
-        "Cfgex", pOutputStream, sPath, pStackData->sResTyp,
+        "Cfgex"_ostr, pOutputStream, sPath, pStackData->sResTyp,
         sGroupId, sLocalId, sXComment, sText);
 }
 
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index abdc47d1c1d4..991309a5ee01 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -108,17 +108,17 @@ bool HelpParser::CreatePO(
         auto posm = aXMLStrHM->find(pos);
         LangHashMap* pElem = posm->second;
 
-        XMLElement* pXMLElement = (*pElem)[ "en-US" ];
+        XMLElement* pXMLElement = (*pElem)[ "en-US"_ostr ];
 
         if( pXMLElement != nullptr )
         {
             OString data(
                 pXMLElement->ToOString().
-                    replaceAll("\n",OString()).
-                    replaceAll("\t",OString()).trim());
+                    replaceAll("\n"_ostr,OString()).
+                    replaceAll("\t"_ostr,OString()).trim());
 
             common::writePoEntry(
-                "Helpex", aPoOutput, sHelpFile, rGsi1,
+                "Helpex"_ostr, aPoOutput, sHelpFile, rGsi1,
                 posm->first, OString(), OString(), data);
 
             pXMLElement=nullptr;
@@ -158,7 +158,7 @@ void HelpParser::MergeSingleFile( XMLFile* file , 
MergeDataFile* pMergeDataFile
     file->Extract();
 
     XMLHashMap* aXMLStrHM = file->GetStrings();
-    static ResData s_ResData("","");
+    static ResData s_ResData(""_ostr,""_ostr);
     s_ResData.sResTyp   = "help";
 
     std::vector<OString> order = file->getOrder();
@@ -190,7 +190,7 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const 
OString& sCur , ResDa
     if( sCur.equalsIgnoreAsciiCase("en-US") )
         return;
 
-    pXMLElement = (*aLangHM)[ "en-US" ];
+    pXMLElement = (*aLangHM)[ "en-US"_ostr ];
     if( pXMLElement == nullptr )
     {
         printf("Error: Can't find en-US entry\n");
@@ -202,10 +202,10 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , 
const OString& sCur , ResDa
     OString sSourceText(
     pXMLElement->ToOString().
         replaceAll(
-            "\n",
+            "\n"_ostr,
             OString()).
         replaceAll(
-            "\t",
+            "\t"_ostr,
             OString()));
     // re-add spaces to the beginning of translated string,
     // important for indentation of Basic code examples
diff --git a/l10ntools/source/lngex.cxx b/l10ntools/source/lngex.cxx
index 2d7c413ad1ed..69d49f885a1c 100644
--- a/l10ntools/source/lngex.cxx
+++ b/l10ntools/source/lngex.cxx
@@ -30,7 +30,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
     common::HandledArgs aArgs;
     if (!common::handleArguments(argc, argv, aArgs))
     {
-        common::writeUsage("ulfex", "*.ulf");
+        common::writeUsage("ulfex"_ostr, "*.ulf"_ostr);
         return 1;
     }
 
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index 176cf46b6285..98daf27a4f9f 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -116,7 +116,7 @@ void LngParser::CreatePO( const OString &rPOFile )
         else {
             WritePO( aPOStream , Text , sSource , sID );
         }
-        Text.erase("x-comment");
+        Text.erase("x-comment"_ostr);
     }
     aPOStream.close();
 }
@@ -126,8 +126,8 @@ void LngParser::WritePO(PoOfstream &aPOStream,
     const OString &rID)
 {
     common::writePoEntry(
-        "Ulfex", aPOStream, rActFileName, "LngText",
-        rID, OString(), rText_inout.count("x-comment") ? 
rText_inout["x-comment"] : OString(), rText_inout["en-US"]);
+        "Ulfex"_ostr, aPOStream, rActFileName, "LngText",
+        rID, OString(), rText_inout.count("x-comment"_ostr) ? 
rText_inout["x-comment"_ostr] : OString(), rText_inout["en-US"_ostr]);
 }
 
 bool LngParser::isNextGroup(OString &sGroup_out, std::string_view sLine_in)
@@ -220,7 +220,7 @@ void LngParser::Merge(
                                 mvLines[ nPos ] = sLang
                                     + " = \""
                                     // escape quotes, unescape double escaped 
quotes fdo#56648
-                                    + 
sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\"")
+                                    + 
sNewText.replaceAll("\""_ostr,"\\\""_ostr).replaceAll("\\\\\""_ostr,"\\\""_ostr)
                                     + "\"";
                                 Text[ sLang ] = sNewText;
                             }
@@ -255,7 +255,7 @@ void LngParser::Merge(
                         const OString sLine { sCur
                             + " = \""
                             // escape quotes, unescape double escaped quotes 
fdo#56648
-                            + 
sNewText.replaceAll("\"","\\\"").replaceAll("\\\\\"","\\\"")
+                            + 
sNewText.replaceAll("\""_ostr,"\\\""_ostr).replaceAll("\\\\\""_ostr,"\\\""_ostr)
                             + "\"" };
 
                         nLastLangPos++;
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index 2ad9d8261fb8..dbf45432ef94 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -70,7 +70,7 @@ ResData::ResData( OString _sGId )
     :
     sGId(std::move( _sGId ))
 {
-    sGId = sGId.replaceAll("\r", OString());
+    sGId = sGId.replaceAll("\r"_ostr, OString());
 }
 
 ResData::ResData( OString _sGId, OString _sFilename)
@@ -78,7 +78,7 @@ ResData::ResData( OString _sGId, OString _sFilename)
     sGId(std::move( _sGId )),
     sFilename(std::move( _sFilename ))
 {
-    sGId = sGId.replaceAll("\r", OString());
+    sGId = sGId.replaceAll("\r"_ostr, OString());
 }
 
 
@@ -102,7 +102,7 @@ namespace
     {
         //DOUBLE VERTICAL LINE instead of || because the translations make 
their
         //way into action_names under gtk3 where || is illegal
-        return u8"\u2016";
+        return u8"\u2016"_ostr;
     }
 }
 
@@ -219,10 +219,10 @@ MergeDataFile::MergeDataFile(
             if( bFirstLang && bWithQtz &&
                 sEnableReleaseBuild != "TRUE" )
             {
-                aLanguageSet.insert("qtz");
+                aLanguageSet.insert("qtz"_ostr);
                 InsertEntry(
                     aActPo.getResourceType(), aActPo.getGroupId(),
-                    aActPo.getLocalId(), "qtz",
+                    aActPo.getLocalId(), "qtz"_ostr,
                     sExText, sExQHText,
                     sExTitle, aActPo.getSourceFile(),
                     false, bCaseSensitive );
diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index e075d52b0bd5..fc0b5bbfbf7a 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -83,7 +83,7 @@ namespace
     OString lcl_GenMsgString(std::string_view rString)
     {
         if ( rString.empty() )
-            return "\"\"";
+            return "\"\""_ostr;
 
         OString sResult =
             "\"" +
@@ -131,7 +131,7 @@ void GenPoEntry::writeToFile(std::ofstream& rOFStream) const
     if ( !m_sExtractCom.isEmpty() )
         rOFStream
             << "#. "
-            << m_sExtractCom.toString().replaceAll("\n","\n#. ") << std::endl;
+            << m_sExtractCom.toString().replaceAll("\n"_ostr,"\n#. "_ostr) << 
std::endl;
     for(const auto& rReference : m_sReferences)
         rOFStream << "#: " << rReference << std::endl;
     if ( m_bFuzzy )
diff --git a/l10ntools/source/propex.cxx b/l10ntools/source/propex.cxx
index 32d2e3d3c52e..9d62dd688414 100644
--- a/l10ntools/source/propex.cxx
+++ b/l10ntools/source/propex.cxx
@@ -17,7 +17,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
     common::HandledArgs aArgs;
     if( !common::handleArguments(argc, argv, aArgs) )
     {
-        common::writeUsage("propex","*.properties");
+        common::writeUsage("propex"_ostr,"*.properties"_ostr);
         return 1;
     }
 
diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx
index 99c2885ce5a3..7237acec4662 100644
--- a/l10ntools/source/propmerge.cxx
+++ b/l10ntools/source/propmerge.cxx
@@ -148,7 +148,7 @@ void PropParser::Extract( const OString& rPOFile )
             OString sText = lcl_ConvertToUTF8( 
OString(o3tl::trim(sLine.subView( nEqualSign + 1 ))) );
 
             common::writePoEntry(
-                "Propex", aPOStream, m_sSource, "property",
+                "Propex"_ostr, aPOStream, m_sSource, "property",
                 OString(sID), OString(), OString(), sText);
         }
     }
diff --git a/l10ntools/source/treemerge.cxx b/l10ntools/source/treemerge.cxx
index 860c85b38598..f6af92791662 100644
--- a/l10ntools/source/treemerge.cxx
+++ b/l10ntools/source/treemerge.cxx
@@ -44,7 +44,7 @@ namespace
                     xmlGetProp(pCurrent, reinterpret_cast<const 
xmlChar*>("title"));
 
                 common::writePoEntry(
-                    "Treex", rPOStream, pSource->name, 
helper::xmlStrToOString( pNodeName ),
+                    "Treex"_ostr, rPOStream, pSource->name, 
helper::xmlStrToOString( pNodeName ),
                     helper::xmlStrToOString( pID ), OString(), OString(), 
helper::xmlStrToOString( pText ));
 
                 xmlFree( pID );
@@ -114,8 +114,8 @@ namespace
                         xmlNodeListGetString(pXhpFile, pXhpNode->children, 1);
                     OString sNewTitle =
                         helper::xmlStrToOString( sTitle ).
-                            replaceAll("$[officename]","%PRODUCTNAME").
-                                
replaceAll("$[officeversion]","%PRODUCTVERSION");
+                            
replaceAll("$[officename]"_ostr,"%PRODUCTNAME"_ostr).
+                                
replaceAll("$[officeversion]"_ostr,"%PRODUCTVERSION"_ostr);
                     xmlChar *xmlString = xmlEncodeSpecialChars(nullptr,
                         reinterpret_cast<const xmlChar*>( sNewTitle.getStr() 
));
                     xmlNodeSetContent( pReturn, xmlString);
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index 51186ac5c623..e79b538ed324 100644
--- a/l10ntools/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -306,22 +306,22 @@ XMLFile::XMLFile( OString _sFileName ) // the file name, 
empty if created from m
     : XMLParentNode( nullptr )
     , m_sFileName(std::move( _sFileName ))
 {
-    m_aNodes_localize.emplace( OString("bookmark") , true );
-    m_aNodes_localize.emplace( OString("variable") , true );
-    m_aNodes_localize.emplace( OString("paragraph") , true );
-    m_aNodes_localize.emplace( OString("h1") , true );
-    m_aNodes_localize.emplace( OString("h2") , true );
-    m_aNodes_localize.emplace( OString("h3") , true );
-    m_aNodes_localize.emplace( OString("h4") , true );
-    m_aNodes_localize.emplace( OString("h5") , true );
-    m_aNodes_localize.emplace( OString("h6") , true );
-    m_aNodes_localize.emplace( OString("note") , true );
-    m_aNodes_localize.emplace( OString("tip") , true );
-    m_aNodes_localize.emplace( OString("warning") , true );
-    m_aNodes_localize.emplace( OString("alt") , true );
-    m_aNodes_localize.emplace( OString("caption") , true );
-    m_aNodes_localize.emplace( OString("title") , true );
-    m_aNodes_localize.emplace( OString("link") , true );
+    m_aNodes_localize.emplace( "bookmark"_ostr , true );
+    m_aNodes_localize.emplace( "variable"_ostr , true );
+    m_aNodes_localize.emplace( "paragraph"_ostr , true );
+    m_aNodes_localize.emplace( "h1"_ostr , true );
+    m_aNodes_localize.emplace( "h2"_ostr , true );
+    m_aNodes_localize.emplace( "h3"_ostr , true );
+    m_aNodes_localize.emplace( "h4"_ostr , true );
+    m_aNodes_localize.emplace( "h5"_ostr , true );
+    m_aNodes_localize.emplace( "h6"_ostr , true );
+    m_aNodes_localize.emplace( "note"_ostr , true );
+    m_aNodes_localize.emplace( "tip"_ostr , true );
+    m_aNodes_localize.emplace( "warning"_ostr , true );
+    m_aNodes_localize.emplace( "alt"_ostr , true );
+    m_aNodes_localize.emplace( "caption"_ostr , true );
+    m_aNodes_localize.emplace( "title"_ostr , true );
+    m_aNodes_localize.emplace( "link"_ostr , true );
 }
 
 void XMLFile::Extract()
@@ -332,7 +332,7 @@ void XMLFile::Extract()
 
 void XMLFile::InsertL10NElement( XMLElement* pElement )
 {
-    OString sId, sLanguage("en-US");
+    OString sId, sLanguage("en-US"_ostr);
     LangHashMap* pElem;
 
     if( pElement->GetAttributeList() != nullptr )
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index e48348bdb5b7..f69b039a44c5 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -66,7 +66,7 @@ extern bool GetOutputFile( int argc, char* argv[])
     else
     {
         // command line is not valid
-        common::writeUsage("xrmex","*.xrm/*.xml");
+        common::writeUsage("xrmex"_ostr,"*.xrm/*.xml"_ostr);
         return false;
     }
 }
@@ -167,8 +167,8 @@ void XRMResParser::Execute( int nToken, char * pToken )
 
         case XRM_TEXT_END: {
                 sCurrentCloseTag = rToken;
-                sResourceType = OString ( "readmeitem" );
-                sLangAttribute = OString ( "xml:lang" );
+                sResourceType = "readmeitem"_ostr;
+                sLangAttribute = "xml:lang"_ostr;
                 WorkOnText( sCurrentOpenTag, sCurrentText );
                 Output( sCurrentText );
                 EndOfText( sCurrentOpenTag, sCurrentCloseTag );
@@ -190,7 +190,7 @@ void XRMResParser::Execute( int nToken, char * pToken )
 
         case DESC_TEXT_START:{
                 if (bDisplayName) {
-                    sGID = OString("dispname");
+                    sGID = "dispname"_ostr;
                     bText = true;
                     sCurrentText = OString();
                     sCurrentOpenTag = rToken;
@@ -202,8 +202,8 @@ void XRMResParser::Execute( int nToken, char * pToken )
         case DESC_TEXT_END: {
                 if (bDisplayName) {
                     sCurrentCloseTag = rToken;
-                    sResourceType = OString ( "description" );
-                    sLangAttribute = OString ( "lang" );
+                    sResourceType = "description"_ostr;
+                    sLangAttribute = "lang"_ostr;
                     WorkOnText( sCurrentOpenTag, sCurrentText );
                     Output( sCurrentText );
                     EndOfText( sCurrentOpenTag, sCurrentCloseTag );
@@ -226,9 +226,9 @@ void XRMResParser::Execute( int nToken, char * pToken )
 
         case DESC_EXTENSION_DESCRIPTION_SRC: {
                 if (bExtensionDescription) {
-                    sGID = OString("extdesc");
-                    sResourceType = OString ( "description" );
-                    sLangAttribute = OString ( "lang" );
+                    sGID = "extdesc"_ostr;
+                    sResourceType = "description"_ostr;
+                    sLangAttribute = "lang"_ostr;
                     sCurrentOpenTag = rToken;
                     sCurrentText  = OString();
                     Output( rToken );
@@ -297,7 +297,7 @@ void XRMResExport::WorkOnDesc(
     const OString &rOpenTag,
     OString &rText )
 {
-    const OString sDescFileName{ sInputFileName.replaceAll("description.xml", 
OString())
+    const OString sDescFileName{ 
sInputFileName.replaceAll("description.xml"_ostr, OString())
         + GetAttribute( rOpenTag, "xlink:href" ) };
     std::ifstream file (sDescFileName.getStr(), 
std::ios::in|std::ios::binary|std::ios::ate);
     if (file.is_open()) {
@@ -332,11 +332,11 @@ void XRMResExport::EndOfText(
 {
     if ( pResData )
     {
-        OString sAct = pResData->sText["en-US"];
+        OString sAct = pResData->sText["en-US"_ostr];
 
         if( !sAct.isEmpty() )
             common::writePoEntry(
-                "Xrmex", pOutputStream, sPath, sResourceType,
+                "Xrmex"_ostr, pOutputStream, sPath, sResourceType,
                 pResData->sGId, OString(), OString(), sAct );
     }
     pResData.reset();
@@ -396,10 +396,10 @@ void XRMResMerge::WorkOnDesc(
                     sAdditionalLine = sAdditionalLine.replaceFirst(
                         sSearch, sReplace);
 
-                    sSearch = OString("xlink:href=\"");
+                    sSearch = "xlink:href=\""_ostr;
                     sReplace = sSearch;
 
-                    const OString sLocDescFilename = 
sDescFilename.replaceFirst( "en-US", sCur);
+                    const OString sLocDescFilename = 
sDescFilename.replaceFirst( "en-US"_ostr, sCur);
 
                     sSearch += sDescFilename;
                     sReplace += sLocDescFilename;

Reply via email to