summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-29 09:07:43 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-02 12:41:07 +0000
commit7c0884f2a2b02ed91ee49f79ef2fff27c2567c39 (patch)
tree64661ff40d4e36b6320c1bd2ff5d15d56a446875 /src/corelib/tools
parent30756f4626972d90e1b6e24f495260c1268c9181 (diff)
Windows code: Fix clang-tidy warnings about else after jumps
Replace by switch() where appropriate, remove else and unindent code or simplify the return value. Change-Id: Ie988b9068a9579ae5a899b3765e43aad480b564e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qlocale_win.cpp9
-rw-r--r--src/corelib/tools/qtimezoneprivate_win.cpp6
2 files changed, 7 insertions, 8 deletions
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index e1a61fa9d7..4f7b76a0d4 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -365,7 +365,7 @@ QVariant QSystemLocalePrivate::dayName(int day, QLocale::FormatType type)
if (type == QLocale::LongFormat)
return getLocaleInfo(long_day_map[day]);
- else if (type == QLocale::NarrowFormat)
+ if (type == QLocale::NarrowFormat)
return getLocaleInfo(narrow_day_map[day]);
return getLocaleInfo(short_day_map[day]);
}
@@ -386,7 +386,7 @@ QVariant QSystemLocalePrivate::monthName(int month, QLocale::FormatType type)
month -= 1;
if (month < 0 || month > 11)
- return QString();
+ return QString();
LCTYPE lctype = (type == QLocale::ShortFormat || type == QLocale::NarrowFormat)
? short_month_map[month] : long_month_map[month];
@@ -988,7 +988,7 @@ LCID qt_inIsoNametoLCID(const char *name)
// handle norwegian manually, the list above will fail
if (!strncmp(name, "nb", 2))
return 0x0414;
- else if (!strncmp(name, "nn", 2))
+ if (!strncmp(name, "nn", 2))
return 0x0814;
char n[64];
@@ -1099,8 +1099,7 @@ static QByteArray getWinLocaleName(LPWSTR id)
id = qstrtoll(result.data(), 0, 0, &ok);
if ( !ok || id == 0 || id < INT_MIN || id > INT_MAX )
return result;
- else
- return winLangCodeToIsoName( (int)id );
+ return winLangCodeToIsoName(int(id));
}
}
diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp
index ca7ea24fc5..1bf2366748 100644
--- a/src/corelib/tools/qtimezoneprivate_win.cpp
+++ b/src/corelib/tools/qtimezoneprivate_win.cpp
@@ -688,10 +688,10 @@ QString QWinTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
if (nameType == QTimeZone::OffsetName) {
const QWinTransitionRule &rule =
m_tranRules.at(ruleIndexForYear(m_tranRules, QDate::currentDate().year()));
+ int offset = rule.standardTimeBias;
if (timeType == QTimeZone::DaylightTime)
- return isoOffsetFormat((rule.standardTimeBias + rule.daylightTimeBias) * -60);
- else
- return isoOffsetFormat((rule.standardTimeBias) * -60);
+ offset += rule.daylightTimeBias;
+ return isoOffsetFormat(offset * -60);
}
switch (timeType) {