Port QMetaObject away from QStringRef
Task-number: QTBUG-84319 Change-Id: I905c2e1780a2ec42b1d189494bd5399e124df354 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
7b05e5df18
commit
957b999683
@ -2800,7 +2800,7 @@ int QMetaEnum::keysToValue(const char *keys, bool *ok) const
|
|||||||
if (ok != nullptr)
|
if (ok != nullptr)
|
||||||
*ok = true;
|
*ok = true;
|
||||||
const QString keysString = QString::fromLatin1(keys);
|
const QString keysString = QString::fromLatin1(keys);
|
||||||
const QVector<QStringRef> splitKeys = keysString.splitRef(QLatin1Char('|'));
|
const auto splitKeys = QStringView{keysString}.split(QLatin1Char('|'));
|
||||||
if (splitKeys.isEmpty())
|
if (splitKeys.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
// ### TODO write proper code: do not allocate memory, so we can go nothrow
|
// ### TODO write proper code: do not allocate memory, so we can go nothrow
|
||||||
@ -2808,8 +2808,8 @@ int QMetaEnum::keysToValue(const char *keys, bool *ok) const
|
|||||||
const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2;
|
const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2;
|
||||||
int count = mobj->d.data[handle + offset];
|
int count = mobj->d.data[handle + offset];
|
||||||
int data = mobj->d.data[handle + offset + 1];
|
int data = mobj->d.data[handle + offset + 1];
|
||||||
for (const QStringRef &untrimmed : splitKeys) {
|
for (QStringView untrimmed : splitKeys) {
|
||||||
const QStringRef trimmed = untrimmed.trimmed();
|
const QStringView trimmed = untrimmed.trimmed();
|
||||||
QByteArray qualified_key = trimmed.toLatin1();
|
QByteArray qualified_key = trimmed.toLatin1();
|
||||||
const char *key = qualified_key.constData();
|
const char *key = qualified_key.constData();
|
||||||
uint scope = 0;
|
uint scope = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user