Use ranged for loops instead of QString::utf16
Task-number: QTBUG-98763 Change-Id: I27a854121a783e67afcc4f8634ea7c8c921430c2 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
18671b0491
commit
0edbf7f97d
@ -692,12 +692,8 @@ static QTtfTable generateName(const QList<QTtfNameRecord> &name)
|
|||||||
off += len;
|
off += len;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < name.size(); ++i) {
|
for (int i = 0; i < name.size(); ++i) {
|
||||||
const QString &n = name.at(i).value;
|
for (QChar ch : name.at(i).value)
|
||||||
const ushort *uc = n.utf16();
|
s << quint16(ch.unicode());
|
||||||
for (int i = 0; i < n.length(); ++i) {
|
|
||||||
s << quint16(*uc);
|
|
||||||
++uc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -274,14 +274,11 @@ QString QWindowsFontDatabaseBase::EmbeddedFont::changeFamilyName(const QString &
|
|||||||
|
|
||||||
// nameRecord now points to string data
|
// nameRecord now points to string data
|
||||||
quint16 *stringStorage = reinterpret_cast<quint16 *>(nameRecord);
|
quint16 *stringStorage = reinterpret_cast<quint16 *>(nameRecord);
|
||||||
const quint16 *sourceString = newFamilyName.utf16();
|
for (QChar ch : newFamilyName)
|
||||||
for (int i = 0; i < newFamilyName.size(); ++i)
|
*stringStorage++ = qbswap<quint16>(quint16(ch.unicode()));
|
||||||
stringStorage[i] = qbswap<quint16>(sourceString[i]);
|
|
||||||
stringStorage += newFamilyName.size();
|
|
||||||
|
|
||||||
sourceString = regularString.utf16();
|
for (QChar ch : regularString)
|
||||||
for (int i = 0; i < regularString.size(); ++i)
|
*stringStorage++ = qbswap<quint16>(quint16(ch.unicode()));
|
||||||
stringStorage[i] = qbswap<quint16>(sourceString[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 *p = reinterpret_cast<quint32 *>(newNameTable.data());
|
quint32 *p = reinterpret_cast<quint32 *>(newNameTable.data());
|
||||||
|
@ -1067,9 +1067,9 @@ static void qStreamNtlmString(QDataStream& ds, const QString& s, bool unicode)
|
|||||||
qStreamNtlmBuffer(ds, s.toLatin1());
|
qStreamNtlmBuffer(ds, s.toLatin1());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ushort *d = s.utf16();
|
|
||||||
for (int i = 0; i < s.length(); ++i)
|
for (QChar ch : s)
|
||||||
ds << d[i];
|
ds << quint16(ch.unicode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1210,11 +1210,10 @@ static QByteArray qNtlmPhase1()
|
|||||||
static QByteArray qStringAsUcs2Le(const QString& src)
|
static QByteArray qStringAsUcs2Le(const QString& src)
|
||||||
{
|
{
|
||||||
QByteArray rc(2*src.length(), 0);
|
QByteArray rc(2*src.length(), 0);
|
||||||
const unsigned short *s = src.utf16();
|
|
||||||
unsigned short *d = (unsigned short*)rc.data();
|
unsigned short *d = (unsigned short*)rc.data();
|
||||||
for (int i = 0; i < src.length(); ++i) {
|
for (QChar ch : src)
|
||||||
d[i] = qToLittleEndian(s[i]);
|
*d++ = qToLittleEndian(quint16(ch.unicode()));
|
||||||
}
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user