summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qdatetimeparser.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-01-21 08:17:21 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-01-21 08:17:21 +0100
commit158a3a4159bdc5a49caecd63e021dacbc06cf23c (patch)
treec3ed9aee6cabd46e5e8615b3815b92d32857c4da /src/corelib/tools/qdatetimeparser.cpp
parent26ece94a68fb5ae680c5639716b06c4e1ae979a8 (diff)
parent7b2fb038ae4b8b9231ae989ad309b6eca107a858 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
Diffstat (limited to 'src/corelib/tools/qdatetimeparser.cpp')
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 5ba1ca61d1..ace663ae30 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -388,7 +388,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
++add;
if (status != quote) {
status = quote;
- } else if (newFormat.at(i - 1) != slash) {
+ } else if (i > 0 && newFormat.at(i - 1) != slash) {
status = zero;
}
} else if (status != quote) {
@@ -500,15 +500,15 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
}
if ((newDisplay & (AmPmSection|Hour12Section)) == Hour12Section) {
- const int max = newSectionNodes.size();
- for (int i=0; i<max; ++i) {
+ const int count = newSectionNodes.size();
+ for (int i = 0; i < count; ++i) {
SectionNode &node = newSectionNodes[i];
if (node.type == Hour12Section)
node.type = Hour24Section;
}
}
- if (index < newFormat.size()) {
+ if (index < max) {
appendSeparator(&newSeparators, newFormat, index, index - max, lastQuote);
} else {
newSeparators.append(QString());
@@ -771,8 +771,8 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
} else {
state = Intermediate;
}
- break; }
- // fall through
+ break;
+ } // else: fall through
case DaySection:
case YearSection:
case YearSection2Digits:
@@ -895,17 +895,17 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
QDTPDEBUG << "parse" << input;
{
- int year, month, day, hour12, hour, minute, second, msec, ampm, dayofweek, year2digits;
+ int year, month, day;
currentValue.date().getDate(&year, &month, &day);
- year2digits = year % 100;
- hour = currentValue.time().hour();
- hour12 = -1;
- minute = currentValue.time().minute();
- second = currentValue.time().second();
- msec = currentValue.time().msec();
- dayofweek = currentValue.date().dayOfWeek();
-
- ampm = -1;
+ int year2digits = year % 100;
+ int hour = currentValue.time().hour();
+ int hour12 = -1;
+ int minute = currentValue.time().minute();
+ int second = currentValue.time().second();
+ int msec = currentValue.time().msec();
+ int dayofweek = currentValue.date().dayOfWeek();
+
+ int ampm = -1;
Sections isSet = NoSection;
int num;
State tmpstate;