summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs/qutfcodec.cpp
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-06-18 15:01:09 (GMT)
committerhjk <qtc-committer@nokia.com>2009-06-19 06:39:38 (GMT)
commit9a5b40a011bd1b15a67d83564af55011761f8ad9 (patch)
treeba99ee4cccb04c1c19512995eb26edc7638aa6ba /src/corelib/codecs/qutfcodec.cpp
parentcce29e63108827f551c74221d0aafbbba891dd51 (diff)
downloadQt-9a5b40a011bd1b15a67d83564af55011761f8ad9.zip
Qt-9a5b40a011bd1b15a67d83564af55011761f8ad9.tar.gz
Qt-9a5b40a011bd1b15a67d83564af55011761f8ad9.tar.bz2
Small speedup of construction of uninitialized QByteArrays
Directly construct uninitialized QByteArrays of required size instead of default-constructing one and resizing it afterwards. Reviewed-by: mariusSO
Diffstat (limited to 'src/corelib/codecs/qutfcodec.cpp')
-rw-r--r--src/corelib/codecs/qutfcodec.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index fe826ad..abae6f7 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -471,8 +471,7 @@ QByteArray QUtf32Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt
endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BE : LE;
}
- QByteArray d;
- d.resize(length);
+ QByteArray d(length, Qt::Uninitialized);
char *data = d.data();
if (!state || !(state->flags & IgnoreHeader)) {
if (endian == BE) {