[Libreoffice-commits] core.git: l10ntools/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 3 14:14:06 UTC 2021


 l10ntools/source/xmlparse.cxx |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

New commits:
commit 268f27f6623334b81762b068f842c944a7541f25
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jun 3 14:13:33 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jun 3 16:13:24 2021 +0200

    -Werror,-Wunused-but-set-variable (Clang 13 trunk)
    
    sLanguage and sTmpStrVal are unused since
    c9611c5e6465948de029e9c2fbd17e75ee07d31f "loplugin:unusedfields in
    l10ntools..sax".  Simplify the for loop now that it only checks for a single
    item, and expand the ID macro at its last remaining use.
    
    Change-Id: I3cf6692fc5a4efd58d0df1dbc24b3610916b2fd1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116665
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index 4bd58b1a49f6..b7bc613613e2 100644
--- a/l10ntools/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -38,7 +38,6 @@ using namespace std;
 using namespace osl;
 
 #define XML_LANG    "xml-lang"
-#define ID          "id"
 
 
 
@@ -343,7 +342,7 @@ void XMLFile::InsertL10NElement( XMLElement* pElement )
         {
             const OString sTempStr((*pElement->GetAttributeList())[ j ]->GetName());
             // Get the "id" Attribute
-            if (sTempStr == ID)
+            if (sTempStr == "id")
             {
                 sId = (*pElement->GetAttributeList())[ j ]->GetValue();
             }
@@ -449,24 +448,14 @@ void XMLFile::SearchL10NElements( XMLChildNode *pCur )
                 bool bInsert = true;
                 XMLElement *pElement = static_cast<XMLElement*>(pCur);
                 const OString sName(pElement->GetName().toAsciiLowerCase());
-                OString sLanguage("en-US");
-                OString sTmpStrVal;
                 if ( pElement->GetAttributeList())
                 {
                     for ( size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; ++j )
                     {
-                        const OString sTmpStr = (*pElement->GetAttributeList())[j]->GetName();
-                        if (sTmpStr == ID)
-                        {
-                            sTmpStrVal=(*pElement->GetAttributeList())[ j ]->GetValue();
-                        }
-                        if (sTmpStr == "localize")
+                        if ((*pElement->GetAttributeList())[j]->GetName() == "localize")
                         {
                             bInsert=false;
-                        }
-                        if (sTmpStr == XML_LANG) // Get the "xml-lang" Attribute
-                        {
-                            sLanguage=(*pElement->GetAttributeList())[ j ]->GetValue();
+                            break;
                         }
                     }
                 }


More information about the Libreoffice-commits mailing list