qxmlstreamparser_p.h: fix -Wshadow in parse()

The name `prefix` is also used for a data member, and the very next
rule actually assigns to it, so using the same name in this huge
switch is actually impairing readability.

Fix by abbreviating the local variable.

This code predates the start of the public history.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-126219
Change-Id: Iece828a9303b5449397ac93e51f540bf890f7d08
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
(cherry picked from commit 2fda30053dcf13356d72f9a8116413d26bcb14a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-09-17 10:56:52 +02:00 committed by Qt Cherry-pick Bot
parent b1d325a9e0
commit 94dab5c628
2 changed files with 6 additions and 6 deletions

View File

@ -1115,8 +1115,8 @@ attribute_value_content ::= literal_content | char_ref | entity_ref_in_attribute
attribute ::= qname space_opt EQ space_opt attribute_value; attribute ::= qname space_opt EQ space_opt attribute_value;
/. /.
case $rule_number: { case $rule_number: {
XmlStringRef prefix = symPrefix(1); const XmlStringRef prfx = symPrefix(1);
if (prefix.isEmpty() && symString(1) == "xmlns"_L1 && namespaceProcessing) { if (prfx.isEmpty() && symString(1) == "xmlns"_L1 && namespaceProcessing) {
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
namespaceDeclaration.prefix.clear(); namespaceDeclaration.prefix.clear();
@ -1165,7 +1165,7 @@ attribute ::= qname space_opt EQ space_opt attribute_value;
attribute.value.pos = pos; attribute.value.pos = pos;
attribute.value.len = n; attribute.value.len = n;
} }
if (prefix == "xmlns"_L1 && namespaceProcessing) { if (prfx == "xmlns"_L1 && namespaceProcessing) {
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
XmlStringRef namespacePrefix = symString(attribute.key); XmlStringRef namespacePrefix = symString(attribute.key);
XmlStringRef namespaceUri = symString(attribute.value); XmlStringRef namespaceUri = symString(attribute.value);

View File

@ -714,8 +714,8 @@ bool QXmlStreamReaderPrivate::parse()
break; break;
case 229: { case 229: {
XmlStringRef prefix = symPrefix(1); const XmlStringRef prfx = symPrefix(1);
if (prefix.isEmpty() && symString(1) == "xmlns"_L1 && namespaceProcessing) { if (prfx.isEmpty() && symString(1) == "xmlns"_L1 && namespaceProcessing) {
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
namespaceDeclaration.prefix.clear(); namespaceDeclaration.prefix.clear();
@ -764,7 +764,7 @@ bool QXmlStreamReaderPrivate::parse()
attribute.value.pos = pos; attribute.value.pos = pos;
attribute.value.len = n; attribute.value.len = n;
} }
if (prefix == "xmlns"_L1 && namespaceProcessing) { if (prfx == "xmlns"_L1 && namespaceProcessing) {
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
XmlStringRef namespacePrefix = symString(attribute.key); XmlStringRef namespacePrefix = symString(attribute.key);
XmlStringRef namespaceUri = symString(attribute.value); XmlStringRef namespaceUri = symString(attribute.value);