Rename QLocalePrivate's m_data_offset to m_index

Change-Id: I1d27e6e57893c2f96df40746e1280fc8428e9ec1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This commit is contained in:
Edward Welbourne 2020-10-13 16:38:03 +02:00
parent cc33b977ff
commit 902a5a1ff4
2 changed files with 7 additions and 6 deletions

View File

@ -2700,7 +2700,7 @@ QString QCalendarBackend::monthName(const QLocale &locale, int month, int,
QLocale::FormatType format) const QLocale::FormatType format) const
{ {
Q_ASSERT(month >= 1 && month <= maximumMonthsInYear()); Q_ASSERT(month >= 1 && month <= maximumMonthsInYear());
return rawMonthName(localeMonthIndexData()[locale.d->m_data_offset], return rawMonthName(localeMonthIndexData()[locale.d->m_index],
localeMonthData(), month, format); localeMonthData(), month, format);
} }
@ -2726,7 +2726,7 @@ QString QCalendarBackend::standaloneMonthName(const QLocale &locale, int month,
QLocale::FormatType format) const QLocale::FormatType format) const
{ {
Q_ASSERT(month >= 1 && month <= maximumMonthsInYear()); Q_ASSERT(month >= 1 && month <= maximumMonthsInYear());
return rawStandaloneMonthName(localeMonthIndexData()[locale.d->m_data_offset], return rawStandaloneMonthName(localeMonthIndexData()[locale.d->m_index],
localeMonthData(), month, format); localeMonthData(), month, format);
} }

View File

@ -395,13 +395,13 @@ class Q_CORE_EXPORT QLocalePrivate // A POD type
{ {
public: public:
static QLocalePrivate *create( static QLocalePrivate *create(
const QLocaleData *data, const uint data_offset, const QLocaleData *data, const uint index,
QLocale::NumberOptions numberOptions = QLocale::DefaultNumberOptions) QLocale::NumberOptions numberOptions = QLocale::DefaultNumberOptions)
{ {
auto *retval = new QLocalePrivate; auto *retval = new QLocalePrivate;
retval->m_data = data; retval->m_data = data;
retval->ref.storeRelaxed(0); retval->ref.storeRelaxed(0);
retval->m_data_offset = data_offset; retval->m_index = index;
retval->m_numberOptions = numberOptions; retval->m_numberOptions = numberOptions;
return retval; return retval;
} }
@ -430,9 +430,10 @@ public:
QLocale::MeasurementSystem measurementSystem() const; QLocale::MeasurementSystem measurementSystem() const;
// System locale has an m_data all its own; all others have m_data = locale_data + m_index
const QLocaleData *m_data; const QLocaleData *m_data;
QBasicAtomicInt ref; QBasicAtomicInt ref;
uint m_data_offset; uint m_index;
QLocale::NumberOptions m_numberOptions; QLocale::NumberOptions m_numberOptions;
}; };
@ -445,7 +446,7 @@ inline QLocalePrivate *QSharedDataPointer<QLocalePrivate>::clone()
{ {
// cannot use QLocalePrivate's copy constructor // cannot use QLocalePrivate's copy constructor
// since it is deleted in C++11 // since it is deleted in C++11
return QLocalePrivate::create(d->m_data, d->m_data_offset, d->m_numberOptions); return QLocalePrivate::create(d->m_data, d->m_index, d->m_numberOptions);
} }
inline char QLocaleData::numericToCLocale(QStringView in) const inline char QLocaleData::numericToCLocale(QStringView in) const