From b069dda4da2196efc95e0799f8ea3196dcb35689 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 11 Apr 2025 17:45:59 +0200 Subject: [PATCH] Tidy up some QTimeZone code and comments Correct a member comment in LocaleMetaZoneLongNames. Remove a superfluous else in QUtcTimeZonePrivate::displayName(). Add a TODO comment to QUtcTimeZonePrivate::isTimeZoneIdAvailable(). Pick-to: 6.8 Change-Id: Iddc144a267ca8fb33a6577e8d671ef3da53ca525 Reviewed-by: Ivan Solovev Reviewed-by: Thiago Macieira (cherry picked from commit 7983b9bd9a56cdb6c8ec6c0ae907329eabde39fc) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/time/qtimezonelocale_p.h | 2 +- src/corelib/time/qtimezoneprivate.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/time/qtimezonelocale_p.h b/src/corelib/time/qtimezonelocale_p.h index 586207345b6..97c4159b3f6 100644 --- a/src/corelib/time/qtimezonelocale_p.h +++ b/src/corelib/time/qtimezonelocale_p.h @@ -154,7 +154,7 @@ struct LocaleZoneNames struct LocaleMetaZoneLongNames { quint16 localeIndex; // Index in locale data tables - quint16 metaIdIndex; // metaZoneTable[metaZoneKey - 1].metaIdIndex + quint16 metaIdIndex; // As for MetaZoneData metaZoneTable[]. timeTypeRange(long) #define forEachField(X) forEachNameType(X, long) // Long localized names (length zero for unspecified) for the diff --git a/src/corelib/time/qtimezoneprivate.cpp b/src/corelib/time/qtimezoneprivate.cpp index 13a24db870e..491fba84e3b 100644 --- a/src/corelib/time/qtimezoneprivate.cpp +++ b/src/corelib/time/qtimezoneprivate.cpp @@ -1084,7 +1084,7 @@ QString QUtcTimeZonePrivate::displayName(QTimeZone::TimeType timeType, Q_UNUSED(locale); if (nameType == QTimeZone::ShortName) return m_abbreviation; - else if (nameType == QTimeZone::OffsetName) + if (nameType == QTimeZone::OffsetName) return isoOffsetFormat(m_offsetFromUtc); return m_name; } @@ -1112,6 +1112,7 @@ QByteArray QUtcTimeZonePrivate::systemTimeZoneId() const return utcQByteArray(); } +// TODO: port to QByteArrayView bool QUtcTimeZonePrivate::isTimeZoneIdAvailable(const QByteArray &ianaId) const { // Only the zone IDs supplied by CLDR and recognized by constructor.