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_tz.cpp | |
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_tz.cpp')
-rw-r--r-- | src/corelib/time/qtimezoneprivate_tz.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp index b6a7d1418c..c046dd881d 100644 --- a/src/corelib/time/qtimezoneprivate_tz.cpp +++ b/src/corelib/time/qtimezoneprivate_tz.cpp @@ -884,8 +884,6 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId) // TODO: is typeList[0] always the "before zones" data ? It seems to be ... if (typeList.size()) ret.m_preZoneRule = { typeList.at(0).tz_gmtoff, 0, typeList.at(0).tz_abbrind }; - else - ret.m_preZoneRule = { 0, 0, 0 }; // Offsets are stored as total offset, want to know separate UTC and DST offsets // so find the first non-dst transition to use as base UTC Offset |