Fix parsing of tzfile(5) files in QTimeZonePrivate
The leap second record sizes were not properly taken into account. The comments in the code were right, but not the code itself. Fortunately, on most Linux systems the leap seconds are not stored in the tzfiles, so we never ran into a parsing issue. Task-number: QTBUG-63205 Change-Id: I6e1fe42ae4b742a7b811fffd14e4a57f5d142f97 Reviewed-by: Maximilian Baumgartner Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
b0ffb332f2
commit
370f8ecaa9
@ -277,8 +277,9 @@ static void parseTzLeapSeconds(QDataStream &ds, int tzh_leapcnt, bool longTran)
|
||||
{
|
||||
// Parse tzh_leapcnt x pairs of leap seconds
|
||||
// We don't use leap seconds, so only read and don't store
|
||||
qint64 val;
|
||||
qint32 val;
|
||||
if (longTran) {
|
||||
// v2 file format, each entry is 12 bytes long
|
||||
qint64 time;
|
||||
for (int i = 0; i < tzh_leapcnt && ds.status() == QDataStream::Ok; ++i) {
|
||||
// Parse Leap Occurrence Time, 8 bytes
|
||||
@ -288,6 +289,7 @@ static void parseTzLeapSeconds(QDataStream &ds, int tzh_leapcnt, bool longTran)
|
||||
ds >> val;
|
||||
}
|
||||
} else {
|
||||
// v0 file format, each entry is 8 bytes long
|
||||
for (int i = 0; i < tzh_leapcnt && ds.status() == QDataStream::Ok; ++i) {
|
||||
// Parse Leap Occurrence Time, 4 bytes
|
||||
ds >> val;
|
||||
|
Loading…
Reference in New Issue
Block a user