QDateTimeParser::parse(): improve readability
A switch (was inconsistent about whether enum members need casts and) made it less obvious, rather than more, what was going on; so changed it to a nested if. Change-Id: I9af322d9dd17aa08cac5003eff2c8eaa73b50d45 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
b2c0e5af18
commit
ee22fe13cd
@ -977,22 +977,17 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
|
|||||||
|
|
||||||
if (state != Invalid) {
|
if (state != Invalid) {
|
||||||
if (parserType != QVariant::Time) {
|
if (parserType != QVariant::Time) {
|
||||||
if (year % 100 != year2digits) {
|
if (year % 100 != year2digits && (isSet & YearSection2Digits)) {
|
||||||
switch (isSet & (YearSection2Digits|YearSection)) {
|
if (!(isSet & YearSection)) {
|
||||||
case YearSection2Digits:
|
|
||||||
year = (year / 100) * 100;
|
year = (year / 100) * 100;
|
||||||
year += year2digits;
|
year += year2digits;
|
||||||
break;
|
} else {
|
||||||
case ((uint)YearSection2Digits|(uint)YearSection): {
|
|
||||||
conflicts = true;
|
conflicts = true;
|
||||||
const SectionNode &sn = sectionNode(currentSectionIndex);
|
const SectionNode &sn = sectionNode(currentSectionIndex);
|
||||||
if (sn.type == YearSection2Digits) {
|
if (sn.type == YearSection2Digits) {
|
||||||
year = (year / 100) * 100;
|
year = (year / 100) * 100;
|
||||||
year += year2digits;
|
year += year2digits;
|
||||||
}
|
}
|
||||||
break; }
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user