diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2024-04-10 16:21:49 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2024-04-19 13:56:36 +0200 |
commit | 24f5e48fba15ef1954f8c552db961b9141269c98 (patch) | |
tree | ef316927e3d301731a33e55aa0f349dabc7324e6 /src/corelib/time/qtimezoneprivate_p.h | |
parent | 9d242afbd01bef6f5f0455100dc8299980ae08ca (diff) |
Apply NSDMI to some internal datetime and timezone types
Although parsedRfcDateTime's clients never read utcOffset unless date
and time are valid, and never set them to anything valid without also
setting utcOffset, let's not leave it uninitialized by default.
The TZ file digester didn't actually set QTzTimeZoneCacheEntry except
when setting it to true, so let's make sure it's properly initialized
to false. The m_preZoneRule was initialized to all-zeros in one branch
of its construction, so set it to that by default so that its default
constructor leaves no member uninitialized.
These types are only constructed in parsers anyway, so the minor cost
of setting fields to zero is dwarfed by string manipulations.
Task-number: QTBUG-122619
Change-Id: I6c57fc6d33c379af3f7c6de80c4ca47e431f9d92
Reviewed-by: Mate Barany <mate.barany@qt.io>
Diffstat (limited to 'src/corelib/time/qtimezoneprivate_p.h')
-rw-r--r-- | src/corelib/time/qtimezoneprivate_p.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/time/qtimezoneprivate_p.h b/src/corelib/time/qtimezoneprivate_p.h index 3aa3658c14..53da9693ca 100644 --- a/src/corelib/time/qtimezoneprivate_p.h +++ b/src/corelib/time/qtimezoneprivate_p.h @@ -254,9 +254,9 @@ struct QTzTransitionTime Q_DECLARE_TYPEINFO(QTzTransitionTime, Q_PRIMITIVE_TYPE); struct QTzTransitionRule { - int stdOffset; - int dstOffset; - quint8 abbreviationIndex; + int stdOffset = 0; + int dstOffset = 0; + quint8 abbreviationIndex = 0; }; Q_DECLARE_TYPEINFO(QTzTransitionRule, Q_PRIMITIVE_TYPE); constexpr inline bool operator==(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) noexcept @@ -273,7 +273,7 @@ struct QTzTimeZoneCacheEntry QList<QByteArray> m_abbreviations; QByteArray m_posixRule; QTzTransitionRule m_preZoneRule; - bool m_hasDst; + bool m_hasDst = false; }; class Q_AUTOTEST_EXPORT QTzTimeZonePrivate final : public QTimeZonePrivate |