Add static casts needed for initializer lists on 32 bit platforms
This fixes build errors like these: src/corelib/time/qtimezonelocale.cpp:836:34: error: non-constant-expression cannot be narrowed from type 'Index' (aka 'unsigned int') to 'qsizetype' (aka 'int') in initializer list [-Wc++11-narrowing] 836 | best = { range.size, type, invalidIanaId, row.metaIdIndex }; | ^~~~~~~~~~ src/corelib/time/qtimezonelocale.cpp:836:34: note: insert an explicit cast to silence this issue 836 | best = { range.size, type, invalidIanaId, row.metaIdIndex }; | ^~~~~~~~~~ | static_cast<qsizetype>( ) src/corelib/time/qtimezonelocale.cpp:856:34: error: non-constant-expression cannot be narrowed from type 'Index' (aka 'unsigned int') to 'qsizetype' (aka 'int') in initializer list [-Wc++11-narrowing] 856 | best = { range.size, type, row.ianaIdIndex }; | ^~~~~~~~~~ src/corelib/time/qtimezonelocale.cpp:856:34: note: insert an explicit cast to silence this issue 856 | best = { range.size, type, row.ianaIdIndex }; | ^~~~~~~~~~ | static_cast<qsizetype>( ) Change-Id: Iacb130a8240c56a32d30486180c6900e2c2f526f Pick-to: 6.8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 80c73dc38b4a32189c58f641bfad2d32bc9428c5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f23fd8ddae
commit
d40e353821
@ -833,7 +833,7 @@ QTimeZonePrivate::findLongNamePrefix(QStringView text, const QLocale &locale,
|
||||
if (range.size > best.nameLength) {
|
||||
QStringView name = range.viewData(longMetaZoneNameTable);
|
||||
if (text.startsWith(name)) {
|
||||
best = { range.size, type, invalidIanaId, row.metaIdIndex };
|
||||
best = { static_cast<qsizetype>(range.size), type, invalidIanaId, row.metaIdIndex };
|
||||
if (best.nameLength >= text.size())
|
||||
break;
|
||||
}
|
||||
@ -853,7 +853,7 @@ QTimeZonePrivate::findLongNamePrefix(QStringView text, const QLocale &locale,
|
||||
bool gotZone = row.ianaIdIndex == best.ianaIdIndex
|
||||
|| QTimeZone::isTimeZoneIdAvailable(row.ianaId().toByteArray());
|
||||
if (text.startsWith(name) && gotZone)
|
||||
best = { range.size, type, row.ianaIdIndex };
|
||||
best = { static_cast<qsizetype>(range.size), type, row.ianaIdIndex };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user