diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-01-29 15:44:12 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-02-01 13:13:43 (GMT) |
commit | e0fda52fde32458c4a42f04bd62b5e37f14c4bfd (patch) | |
tree | df8154a8878f767c87a5cae8ad9d1dc4e17ebffd /tools/linguist/shared | |
parent | 45591e13862963fb29c13e0c5bfe39330883c579 (diff) | |
download | Qt-e0fda52fde32458c4a42f04bd62b5e37f14c4bfd.zip Qt-e0fda52fde32458c4a42f04bd62b5e37f14c4bfd.tar.gz Qt-e0fda52fde32458c4a42f04bd62b5e37f14c4bfd.tar.bz2 |
optimization: get rid of QString::fromUtf16() usage
QString::fromUtf16() is slow - it does a BOM check and optionally byte
swapping, which is utterly pointless when converting internal data
structures which are raw utf16 in host byte order anyway. so replace
it with QString::fromRawData() (for short-lived strings) or
QString(const QChar *, int) (otherwise) if possible.
Reviewed-by: axis
Reviewed-by: mariusSO
Reviewed-by: Bill King
Diffstat (limited to 'tools/linguist/shared')
-rw-r--r-- | tools/linguist/shared/qm.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 8118576..de1284f 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -594,7 +594,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) return false; } m += 4; - QString str = QString::fromUtf16((const ushort *)m, len/2); + QString str = QString((const QChar *)m, len/2); if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) { for (int i = 0; i < str.length(); ++i) str[i] = QChar((str.at(i).unicode() >> 8) + |