Avoid shadowing a name (and use the outer variable an extra time)
QDateTimeParser::parseFormat()'s top-level scope has a const int max; this was shadowed by a short-lived max in an inner scope; and the outer scope's max could be re-used one more time after that to save re-evaluating the same unchanged expression it held. Change-Id: I9f07452bb0b4e5ff4bcf6396d42d1419de6276fa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
This commit is contained in:
parent
aa196457da
commit
57e024cc81
@ -494,15 +494,15 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((newDisplay & (AmPmSection|Hour12Section)) == Hour12Section) {
|
if ((newDisplay & (AmPmSection|Hour12Section)) == Hour12Section) {
|
||||||
const int max = newSectionNodes.size();
|
const int count = newSectionNodes.size();
|
||||||
for (int i=0; i<max; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
SectionNode &node = newSectionNodes[i];
|
SectionNode &node = newSectionNodes[i];
|
||||||
if (node.type == Hour12Section)
|
if (node.type == Hour12Section)
|
||||||
node.type = Hour24Section;
|
node.type = Hour24Section;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < newFormat.size()) {
|
if (index < max) {
|
||||||
appendSeparator(&newSeparators, newFormat, index, index - max, lastQuote);
|
appendSeparator(&newSeparators, newFormat, index, index - max, lastQuote);
|
||||||
} else {
|
} else {
|
||||||
newSeparators.append(QString());
|
newSeparators.append(QString());
|
||||||
|
Loading…
Reference in New Issue
Block a user