mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
use plain ushort array in QString streaming operator
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e88a79d7fd
commit
b8947a6ab4
1 changed files with 2 additions and 2 deletions
|
@ -6840,13 +6840,13 @@ QDataStream &operator<<(QDataStream &out, const QString &str)
|
|||
if ((out.byteOrder() == QDataStream::BigEndian) == (QSysInfo::ByteOrder == QSysInfo::BigEndian)) {
|
||||
out.writeBytes(reinterpret_cast<const char *>(str.unicode()), sizeof(QChar) * str.length());
|
||||
} else {
|
||||
QVarLengthArray<ushort> buffer(str.length());
|
||||
ushort buffer[str.length()];
|
||||
const ushort *data = reinterpret_cast<const ushort *>(str.constData());
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
buffer[i] = qbswap(*data);
|
||||
++data;
|
||||
}
|
||||
out.writeBytes(reinterpret_cast<const char *>(buffer.data()), sizeof(ushort) * buffer.size());
|
||||
out.writeBytes(reinterpret_cast<const char *>(buffer), sizeof(ushort) * str.length());
|
||||
}
|
||||
} else {
|
||||
// write null marker
|
||||
|
|
Loading…
Add table
Reference in a new issue