From ce868ffb7c36b1109ac0554da4a853c62ce54037 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 9 Sep 2021 18:28:28 +0200 Subject: [PATCH] Remove trailing zero rows from qtimezoneprivate_data_p.h's tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They are not needed. Iterations over the table track their sizes. The size-of-table constants just needed their -1s removed. Incidentally use std::size() rather than sizeof(array)/sizeof(element). Change-Id: Ie20eef9f6f5786d93c10b830a87e006d3c5bcc1a Reviewed-by: Ievgenii Meshcheriakov Reviewed-by: MÃ¥rten Nordheim --- src/corelib/time/qtimezoneprivate.cpp | 7 +++---- src/corelib/time/qtimezoneprivate_data_p.h | 5 +---- util/locale_database/cldr2qtimezone.py | 5 +---- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/corelib/time/qtimezoneprivate.cpp b/src/corelib/time/qtimezoneprivate.cpp index b089bdf1914..52ca8a07dd0 100644 --- a/src/corelib/time/qtimezoneprivate.cpp +++ b/src/corelib/time/qtimezoneprivate.cpp @@ -55,10 +55,9 @@ QT_BEGIN_NAMESPACE Static utilities for looking up Windows ID tables */ -static const int windowsDataTableSize = sizeof(windowsDataTable) / sizeof(QWindowsData) - 1; -static const int zoneDataTableSize = sizeof(zoneDataTable) / sizeof(QZoneData) - 1; -static const int utcDataTableSize = sizeof(utcDataTable) / sizeof(QUtcData) - 1; - +static const qsizetype windowsDataTableSize = std::size(windowsDataTable); +static const qsizetype zoneDataTableSize = std::size(zoneDataTable); +static const qsizetype utcDataTableSize = std::size(utcDataTable); static const QZoneData *zoneData(quint16 index) { diff --git a/src/corelib/time/qtimezoneprivate_data_p.h b/src/corelib/time/qtimezoneprivate_data_p.h index 4965ceb02c3..29e72382f0c 100644 --- a/src/corelib/time/qtimezoneprivate_data_p.h +++ b/src/corelib/time/qtimezoneprivate_data_p.h @@ -115,7 +115,7 @@ struct QUtcData { // GENERATED PART STARTS HERE /* - This part of the file was generated on 2021-07-26 from the + This part of the file was generated on 2021-09-09 from the Common Locale Data Repository v39 file supplemental/windowsZones.xml http://www.unicode.org/cldr/ @@ -493,7 +493,6 @@ static const QZoneData zoneDataTable[] = { { 136, 182, 7221 }, // West Pacific Standard Time / Papua New Guinea { 137, 193, 7242 }, // Yakutsk Standard Time / Russia { 138, 41, 7269 }, // Yukon Standard Time / Canada - { 0, 0, 0 } // Trailing zeroes }; // Windows ID Key, Windows ID Index, IANA ID Index, UTC Offset @@ -636,7 +635,6 @@ static const QWindowsData windowsDataTable[] = { { 136, 3124, 7221, 36000 }, // West Pacific Standard Time { 137, 3151, 7752, 32400 }, // Yakutsk Standard Time { 138, 3173, 7765,-25200 }, // Yukon Standard Time - { 0, 0, 0, 0 } // Trailing zeroes }; // IANA ID Index, UTC Offset @@ -681,7 +679,6 @@ static const QUtcData utcDataTable[] = { { 8148, 43200 }, // UTC+12:00 { 8158, 46800 }, // UTC+13:00 { 8168, 50400 }, // UTC+14:00 - { 0, 0 } // Trailing zeroes }; static const char windowsIdData[] = { diff --git a/util/locale_database/cldr2qtimezone.py b/util/locale_database/cldr2qtimezone.py index dec350fa8ed..d0d48df6fe2 100755 --- a/util/locale_database/cldr2qtimezone.py +++ b/util/locale_database/cldr2qtimezone.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ############################################################################# ## -## Copyright (C) 2020 The Qt Company Ltd. +## Copyright (C) 2021 The Qt Company Ltd. ## Contact: https://www.qt.io/licensing/ ## ## This file is part of the test suite of the Qt Toolkit. @@ -299,7 +299,6 @@ class ZoneIdWriter (SourceFileEditor): data['windowsKey'], data['territoryId'], ianaIdData.append(data['ianaList']), data['windowsId'], data['territory'])) - out(' { 0, 0, 0 } // Trailing zeroes\n') out('};\n\n') # Write Windows ID key table @@ -311,7 +310,6 @@ class ZoneIdWriter (SourceFileEditor): windowsIdData.append(pair[0]), ianaIdData.append(defaults[index]), pair[1], pair[0])) - out(' { 0, 0, 0, 0 } // Trailing zeroes\n') out('};\n\n') # Write UTC ID key table @@ -320,7 +318,6 @@ class ZoneIdWriter (SourceFileEditor): for pair in utcIdList: out(' {{ {:6d},{:6d} }}, // {}\n'.format( ianaIdData.append(pair[0]), pair[1], pair[0])) - out(' { 0, 0 } // Trailing zeroes\n') out('};\n') return windowsIdData, ianaIdData