summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-12-15 10:57:09 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2017-04-18 12:56:01 +0000
commit5bc814ac69c805bdc5b88a1dbb576bd546855e28 (patch)
tree8bdf6a51fe5610a57a8b19cb49fe185983321683 /src
parent7243b7cbf276f99f8455811bdaaece5f62b4618d (diff)
QDateTimeParser: simplify switch by exploiting fall-through
Several cases all fell together; their code tested away one of them; so putting it last and falling through to it avoids the need to test. Change-Id: I0bf555710604a56faa61b60bfe5484d5c5a1ee6b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 1e1a9962f8..6a9d1fbc69 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -1461,15 +1461,13 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const
case MinuteSection:
case Hour24Section:
case Hour12Section:
- case YearSection:
case YearSection2Digits:
+ ret |= AllowPartial;
+ Q_FALLTHROUGH();
+ case YearSection:
ret |= Numeric;
- if (sn.type != YearSection) {
- ret |= AllowPartial;
- }
- if (sn.count != 1) {
+ if (sn.count != 1)
ret |= FixedWidth;
- }
break;
case MonthSection:
case DaySection: