Pass string to ICU-wrapper as a QByteArray, not a QString

The definition of QtTimeZoneLocale::ucalTimeZoneDisplayName() said it
takes a QByteArray but the header-file's declaration said it takes a
QString. That was never going to end well.

Fixes: QTBUG-129896
Change-Id: I5c15f88370f2d15efe2055ff73388c22fdc4ef46
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 01219276fdd3c1b6c867e97f6b8337f46ac82e28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2024-10-10 13:06:08 +02:00 committed by Qt Cherry-pick Bot
parent ac6f080d16
commit a6b350acbc
2 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ namespace QtTimeZoneLocale {
#if QT_CONFIG(icu) #if QT_CONFIG(icu)
QString ucalTimeZoneDisplayName(UCalendar *ucal, QTimeZone::TimeType timeType, QString ucalTimeZoneDisplayName(UCalendar *ucal, QTimeZone::TimeType timeType,
QTimeZone::NameType nameType, QTimeZone::NameType nameType,
const QString &localeCode); const QByteArray &localeCode);
#else #else
// Define data types for QTZL_data_p.h // Define data types for QTZL_data_p.h

View File

@ -149,7 +149,7 @@ static QTimeZonePrivate::Data ucalTimeZoneTransition(UCalendar *m_ucal,
QTimeZone::TimeType timeType = dst == 0 ? QTimeZone::StandardTime : QTimeZone::DaylightTime; QTimeZone::TimeType timeType = dst == 0 ? QTimeZone::StandardTime : QTimeZone::DaylightTime;
using namespace QtTimeZoneLocale; using namespace QtTimeZoneLocale;
tran.abbreviation = ucalTimeZoneDisplayName(m_ucal, timeType, tran.abbreviation = ucalTimeZoneDisplayName(m_ucal, timeType,
QTimeZone::ShortName, QLocale().name()); QTimeZone::ShortName, QLocale().name().toUtf8());
return tran; return tran;
} }
#endif // U_ICU_VERSION_SHORT #endif // U_ICU_VERSION_SHORT
@ -258,7 +258,7 @@ QString QIcuTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
// Technically this may be suspect, if locale isn't QLocale(), since that's // Technically this may be suspect, if locale isn't QLocale(), since that's
// what we used when constructing m_ucal; does ICU cope with inconsistency ? // what we used when constructing m_ucal; does ICU cope with inconsistency ?
using namespace QtTimeZoneLocale; using namespace QtTimeZoneLocale;
return ucalTimeZoneDisplayName(m_ucal, timeType, nameType, locale.name()); return ucalTimeZoneDisplayName(m_ucal, timeType, nameType, locale.name().toUtf8());
} }
int QIcuTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const int QIcuTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const