From 5bc814ac69c805bdc5b88a1dbb576bd546855e28 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 15 Dec 2016 10:57:09 +0100 Subject: [PATCH] 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 --- src/corelib/tools/qdatetimeparser.cpp | 10 ++++------ 1 file 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: