summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-06-18 14:02:00 (GMT)
committerhjk <qtc-committer@nokia.com>2009-06-18 14:29:53 (GMT)
commite356eed2fa3d8e62085d6bd72caba9d11c40bacf (patch)
tree4411d57e71015f65fbdc631680271caefb8a0c3e /src/corelib/codecs
parentd7005487b789e2bc5a1400148b4f317142a381ac (diff)
downloadQt-e356eed2fa3d8e62085d6bd72caba9d11c40bacf.zip
Qt-e356eed2fa3d8e62085d6bd72caba9d11c40bacf.tar.gz
Qt-e356eed2fa3d8e62085d6bd72caba9d11c40bacf.tar.bz2
Don't initialize data that will be overwritten immediately.
Reviewed-by: mariusSO
Diffstat (limited to 'src/corelib/codecs')
-rw-r--r--src/corelib/codecs/qsimplecodec.cpp3
-rw-r--r--src/corelib/codecs/qutfcodec.cpp3
2 files changed, 2 insertions, 4 deletions
diff --git a/src/corelib/codecs/qsimplecodec.cpp b/src/corelib/codecs/qsimplecodec.cpp
index 7a62d4e..aa7521d 100644
--- a/src/corelib/codecs/qsimplecodec.cpp
+++ b/src/corelib/codecs/qsimplecodec.cpp
@@ -653,8 +653,7 @@ QString QSimpleTextCodec::convertToUnicode(const char* chars, int len, Converter
const unsigned char * c = (const unsigned char *)chars;
- QString r;
- r.resize(len);
+ QString r(len, Qt::Uninitialized);
QChar* uc = r.data();
for (int i = 0; i < len; i++) {
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index 12575f9..fe826ad 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -351,8 +351,7 @@ QString QUtf16Codec::convertToUnicode(const char *chars, int len, ConverterState
if (headerdone && endian == Detect)
endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BE : LE;
- QString result;
- result.resize(len); // worst case
+ QString result(len, Qt::Uninitialized); // worst case
QChar *qch = (QChar *)result.unicode();
while (len--) {
if (half) {