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;
|
||||
}
|
||||
for (int i = 0; i < name.size(); ++i) {
|
||||
const QString &n = name.at(i).value;
|
||||
const ushort *uc = n.utf16();
|
||||
for (int i = 0; i < n.length(); ++i) {
|
||||
s << quint16(*uc);
|
||||
++uc;
|
||||
}
|
||||
for (QChar ch : name.at(i).value)
|
||||
s << quint16(ch.unicode());
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
@ -274,14 +274,11 @@ QString QWindowsFontDatabaseBase::EmbeddedFont::changeFamilyName(const QString &
|
||||
|
||||
// nameRecord now points to string data
|
||||
quint16 *stringStorage = reinterpret_cast<quint16 *>(nameRecord);
|
||||
const quint16 *sourceString = newFamilyName.utf16();
|
||||
for (int i = 0; i < newFamilyName.size(); ++i)
|
||||
stringStorage[i] = qbswap<quint16>(sourceString[i]);
|
||||
stringStorage += newFamilyName.size();
|
||||
for (QChar ch : newFamilyName)
|
||||
*stringStorage++ = qbswap<quint16>(quint16(ch.unicode()));
|
||||
|
||||
sourceString = regularString.utf16();
|
||||
for (int i = 0; i < regularString.size(); ++i)
|
||||
stringStorage[i] = qbswap<quint16>(sourceString[i]);
|
||||
for (QChar ch : regularString)
|
||||
*stringStorage++ = qbswap<quint16>(quint16(ch.unicode()));
|
||||
}
|
||||
|
||||
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());
|
||||
return;
|
||||
}
|
||||
const ushort *d = s.utf16();
|
||||
for (int i = 0; i < s.length(); ++i)
|
||||
ds << d[i];
|
||||
|
||||
for (QChar ch : s)
|
||||
ds << quint16(ch.unicode());
|
||||
}
|
||||
|
||||
|
||||
@ -1210,11 +1210,10 @@ static QByteArray qNtlmPhase1()
|
||||
static QByteArray qStringAsUcs2Le(const QString& src)
|
||||
{
|
||||
QByteArray rc(2*src.length(), 0);
|
||||
const unsigned short *s = src.utf16();
|
||||
unsigned short *d = (unsigned short*)rc.data();
|
||||
for (int i = 0; i < src.length(); ++i) {
|
||||
d[i] = qToLittleEndian(s[i]);
|
||||
}
|
||||
for (QChar ch : src)
|
||||
*d++ = qToLittleEndian(quint16(ch.unicode()));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user