-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@redhat.com>
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index 4bd58b1..b7bc613 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;
}
}
}