-Werror,-Wunused-but-set-variable (Clang 13 trunk)

sLanguage and sTmpStrVal are unused since
c9611c5e64 "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>
This commit is contained in:
Stephan Bergmann 2021-06-03 14:13:33 +02:00
parent ac8d986655
commit 268f27f662

View file

@ -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;
}
}
}