diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/codecs/qsimplecodec.cpp | 3 | ||||
-rw-r--r-- | src/corelib/codecs/qutfcodec.cpp | 3 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 6 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 18 |
4 files changed, 10 insertions, 20 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) { diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 52fb8a2..cbdd32c 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -185,8 +185,7 @@ static QString languageToCode(QLocale::Language language) const unsigned char *c = language_code_list + 3*(uint(language)); - QString code; - code.resize(c[2] == 0 ? 2 : 3); + QString code(c[2] == 0 ? 2 : 3, Qt::Uninitialized); code[0] = ushort(c[0]); code[1] = ushort(c[1]); @@ -201,8 +200,7 @@ static QString countryToCode(QLocale::Country country) if (country == QLocale::AnyCountry) return QString(); - QString code; - code.resize(2); + QString code(2, Qt::Uninitialized); const unsigned char *c = country_code_list + 2*(uint(country)); code[0] = ushort(c[0]); code[1] = ushort(c[1]); diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 083253f..dba3d2a 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3849,8 +3849,7 @@ QString QString::fromUtf8(const char *str, int size) if (size < 0) size = qstrlen(str); - QString result; - result.resize(size); // worst case + QString result(size, Qt::Uninitialized); // worst case ushort *qch = result.d->data; uint uc = 0; uint min_uc = 0; @@ -3965,8 +3964,7 @@ QString QString::fromUcs4(const uint *unicode, int size) ++size; } - QString s; - s.resize(size*2); // worst case + QString s(size * 2, Qt::Uninitialized); // worst case ushort *uc = s.d->data; for (int i = 0; i < size; ++i) { uint u = unicode[i]; @@ -4029,8 +4027,7 @@ QString QString::simplified() const { if (d->size == 0) return *this; - QString result; - result.resize(d->size); + QString result(d->size, Qt::Uninitialized); const QChar *from = (const QChar*) d->data; const QChar *fromend = (const QChar*) from+d->size; int outc=0; @@ -4882,8 +4879,7 @@ QString QString::toLower() const c = QChar::surrogateToUcs4(*(p - 1), c); const QUnicodeTables::Properties *prop = qGetProp(c); if (prop->lowerCaseDiff || prop->lowerCaseSpecial) { - QString s; - s.resize(d->size); + QString s(d->size, Qt::Uninitialized); memcpy(s.d->data, d->data, (p - d->data)*sizeof(ushort)); ushort *pp = s.d->data + (p - d->data); while (p < e) { @@ -4974,8 +4970,7 @@ QString QString::toUpper() const c = QChar::surrogateToUcs4(*(p - 1), c); const QUnicodeTables::Properties *prop = qGetProp(c); if (prop->upperCaseDiff || prop->upperCaseSpecial) { - QString s; - s.resize(d->size); + QString s(d->size, Qt::Uninitialized); memcpy(s.d->data, d->data, (p - d->data)*sizeof(ushort)); ushort *pp = s.d->data + (p - d->data); while (p < e) { @@ -6272,8 +6267,7 @@ static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int f + d.locale_occurrences *qMax(abs_field_width, larg.length()); - QString result; - result.resize(result_len); + QString result(result_len, Qt::Uninitialized); QChar *result_buff = (QChar*) result.unicode(); QChar *rc = result_buff; |