From 7c0884f2a2b02ed91ee49f79ef2fff27c2567c39 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Aug 2018 09:07:43 +0200 Subject: 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 Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale_win.cpp | 9 ++++----- src/corelib/tools/qtimezoneprivate_win.cpp | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src/corelib/tools') 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) { -- cgit v1.2.3