QTimeZonePrivate: avoid unnecessary allocations
... by replacing QString::split() with QString::splitRef() and using the new overloaded functions: - QLocalePrivate::languageToCode(QStringRef) - QLocalePrivate::languageToCode(const QChar*, int) Change-Id: I2884bdc6d3e27963ce121d659a5e092b10b4ef8c Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
3200653546
commit
f8192405ef
@ -84,7 +84,7 @@ static QTzTimeZoneHash loadTzTimeZones()
|
||||
// Comment lines are prefixed with a #
|
||||
if (!line.isEmpty() && line.at(0) != '#') {
|
||||
// Data rows are tab-separated columns Region, Coordinates, ID, Optional Comments
|
||||
const QStringList parts = line.split('\t');
|
||||
const auto parts = line.splitRef(QLatin1Char('\t'));
|
||||
QTzTimeZone zone;
|
||||
zone.country = QLocalePrivate::codeToCountry(parts.at(0));
|
||||
if (parts.size() > 3)
|
||||
|
@ -391,7 +391,7 @@ static QLocale::Country userCountry()
|
||||
const GEOID id = GetUserGeoID(GEOCLASS_NATION);
|
||||
wchar_t code[3];
|
||||
const int size = GetGeoInfo(id, GEO_ISO2, code, 3, 0);
|
||||
return (size == 3) ? QLocalePrivate::codeToCountry(QString::fromWCharArray(code))
|
||||
return (size == 3) ? QLocalePrivate::codeToCountry(reinterpret_cast<const QChar*>(code), size)
|
||||
: QLocale::AnyCountry;
|
||||
#endif // Q_OS_WINCE
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user