From d7ccd8cb4565c8643b158891c9de3187c1586dc9 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Wed, 17 Jun 2020 22:53:53 +0200 Subject: Remove QByteArray's methods taking QString and their uses [ChangeLog][QtCore][QByteArray] Remove method overloads taking QString as argument, all of which were equivalent to passing the toUtf8() of the string instead. Change-Id: I9251733a9b3711153b2faddbbc907672a7cba190 Reviewed-by: Edward Welbourne Reviewed-by: Lars Knoll --- src/corelib/text/qbytearray.cpp | 196 --------------------- src/corelib/text/qbytearray.h | 20 --- src/corelib/text/qstring.h | 31 ---- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 2 - .../auto/corelib/kernel/qvariant/tst_qvariant.cpp | 2 +- tests/auto/corelib/text/qstring/tst_qstring.cpp | 8 - .../qstringapisymmetry/tst_qstringapisymmetry.cpp | 1 - .../qstringbuilder1/stringbuilder.cpp | 6 - tests/auto/gui/image/qimage/tst_qimage.cpp | 2 +- .../gui/image/qimagereader/tst_qimagereader.cpp | 4 +- .../network/kernel/qhostinfo/tst_qhostinfo.cpp | 2 +- tests/auto/testlib/selftests/tst_selftests.cpp | 2 +- tests/auto/tools/rcc/tst_rcc.cpp | 2 +- .../sax/qxmlinputsource/tst_qxmlinputsource.cpp | 2 +- .../io/qdiriterator/qfilesystemiterator.cpp | 4 +- .../tst_qnetworkreply_from_cache.cpp | 2 +- 16 files changed, 11 insertions(+), 275 deletions(-) diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 621f2820f0..265c1fbf72 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -902,16 +902,6 @@ QByteArray qUncompress(const uchar* data, int nbytes) This issue does not apply to \l{QString}s since they represent characters using Unicode. - \section2 QString matching and insertion - - Some methods search for the content of a QString or insert a copy of it in a - QByteArray; these invariably use the UTF-8 encoding of the QString, making - them equivalent to passing \c str.toUtf8(), in place of the string \c str, - to the matching method taking a QByteArray. The overloads taking QString can - be disabled by defining \c QT_NO_CAST_TO_ASCII and \c QT_NO_CAST_FROM_ASCII, - to help catch places where unintended operations between QByteArray and - QString may cause bugs. - \sa QString, QBitArray */ @@ -1535,19 +1525,6 @@ void QByteArray::chop(int n) \sa append(), prepend() */ -/*! \fn QByteArray &QByteArray::operator+=(const QString &str) - - \overload - - Appends the UTF-8 encoding of \a str onto the end of this byte array and - returns a reference to this byte array. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \fn QByteArray &QByteArray::operator+=(const char *str) \overload @@ -1854,18 +1831,6 @@ QByteArray &QByteArray::append(const QByteArray &ba) return *this; } -/*! \fn QByteArray &QByteArray::append(const QString &str) - - \overload - - Appends the UTF-8 encoding of \a str to this byte array. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \overload @@ -1979,21 +1944,6 @@ QByteArray &QByteArray::insert(int i, const QByteArray &ba) return qbytearray_insert(this, i, copy.constData(), copy.size()); } -/*! - \fn QByteArray &QByteArray::insert(int i, const QString &str) - - \overload - - Inserts the UTF-8 encoding of \a str at index position \a i in the byte - array. If \a i is greater than size(), the array is first extended using - resize(). - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \overload @@ -2316,26 +2266,6 @@ QByteArray &QByteArray::replace(const char *before, int bsize, const char *after string \a after. */ -/*! \fn QByteArray &QByteArray::replace(const QString &before, const QByteArray &after) - - \overload - - Replaces every occurrence of the UTF-8 encoding of \a before with the byte - array \a after. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - -/*! \fn QByteArray &QByteArray::replace(const QString &before, const char *after) - \overload - - Replaces every occurrence of the UTF-8 encoding of \a before with the - '\\0'-terminated string \a after. -*/ - /*! \fn QByteArray &QByteArray::replace(const char *before, const char *after) \overload @@ -2357,19 +2287,6 @@ QByteArray &QByteArray::replace(char before, const QByteArray &after) return replace(b, 1, after.constData(), after.size()); } -/*! \fn QByteArray &QByteArray::replace(char before, const QString &after) - - \overload - - Replaces every occurrence of the byte \a before with the UTF-8 encoding of - \a after. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \fn QByteArray &QByteArray::replace(char before, const char *after) \overload @@ -2493,20 +2410,6 @@ int QByteArray::indexOf(const QByteArray &ba, int from) const return static_cast(qFindByteArray(data(), size(), from, ba.data(), ol)); } -/*! \fn int QByteArray::indexOf(const QString &str, int from) const - - \overload - - Returns the index position of the first occurrence of the UTF-8 encoding of - \a str in the byte array, searching forward from index position \a - from. Returns -1 if \a str could not be found. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \fn int QByteArray::indexOf(const char *str, int from) const \overload @@ -2614,21 +2517,6 @@ int QByteArray::lastIndexOf(const QByteArray &ba, int from) const return lastIndexOfHelper(data(), size(), ba.data(), ol, from); } -/*! \fn int QByteArray::lastIndexOf(const QString &str, int from) const - - \overload - - Returns the index position of the last occurrence of the UTF-8 encoding of - \a str in the byte array, searching backward from index position \a from. If - \a from is -1 (the default), the search starts at the last byte (at index - size() - 1). Returns -1 if \a str could not be found. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \fn int QByteArray::lastIndexOf(const char *str, int from) const \overload @@ -3199,90 +3087,6 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba) } #endif // QT_NO_DATASTREAM -/*! \fn bool QByteArray::operator==(const QString &str) const - - Returns \c true if this byte array is equal to the UTF-8 encoding of \a str; - otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator!=(const QString &str) const - - Returns \c true if this byte array is not equal to the UTF-8 encoding of \a - str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator<(const QString &str) const - - Returns \c true if this byte array is lexically less than the UTF-8 encoding - of \a str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator>(const QString &str) const - - Returns \c true if this byte array is lexically greater than the UTF-8 - encoding of \a str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator<=(const QString &str) const - - Returns \c true if this byte array is lexically less than or equal to the - UTF-8 encoding of \a str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator>=(const QString &str) const - - Returns \c true if this byte array is greater than or equal to the UTF-8 - encoding of \a str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - /*! \fn bool operator==(const QByteArray &a1, const QByteArray &a2) \relates QByteArray diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 4de7f4ad56..5cbcecb956 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -322,26 +322,6 @@ public: Q_REQUIRED_RESULT QByteArray repeated(int times) const; -#ifndef QT_NO_CAST_TO_ASCII - QT_ASCII_CAST_WARN QByteArray &append(const QString &s); - QT_ASCII_CAST_WARN QByteArray &insert(int i, const QString &s); - QT_ASCII_CAST_WARN QByteArray &replace(const QString &before, const char *after); - QT_ASCII_CAST_WARN QByteArray &replace(char c, const QString &after); - QT_ASCII_CAST_WARN QByteArray &replace(const QString &before, const QByteArray &after); - - QT_ASCII_CAST_WARN QByteArray &operator+=(const QString &s); - QT_ASCII_CAST_WARN int indexOf(const QString &s, int from = 0) const; - QT_ASCII_CAST_WARN int lastIndexOf(const QString &s, int from = -1) const; -#endif -#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) - inline QT_ASCII_CAST_WARN bool operator==(const QString &s2) const; - inline QT_ASCII_CAST_WARN bool operator!=(const QString &s2) const; - inline QT_ASCII_CAST_WARN bool operator<(const QString &s2) const; - inline QT_ASCII_CAST_WARN bool operator>(const QString &s2) const; - inline QT_ASCII_CAST_WARN bool operator<=(const QString &s2) const; - inline QT_ASCII_CAST_WARN bool operator>=(const QString &s2) const; -#endif - short toShort(bool *ok = nullptr, int base = 10) const; ushort toUShort(bool *ok = nullptr, int base = 10) const; int toInt(bool *ok = nullptr, int base = 10) const; diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index b77c6134d5..199650be0b 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -1274,39 +1274,8 @@ inline QT_ASCII_CAST_WARN bool QString::operator<=(const QByteArray &s) const inline QT_ASCII_CAST_WARN bool QString::operator>=(const QByteArray &s) const { return QString::compare_helper(constData(), size(), s.constData(), s.size()) >= 0; } -inline bool QByteArray::operator==(const QString &s) const -{ return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) == 0; } -inline bool QByteArray::operator!=(const QString &s) const -{ return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) != 0; } -inline bool QByteArray::operator<(const QString &s) const -{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) > 0; } -inline bool QByteArray::operator>(const QString &s) const -{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) < 0; } -inline bool QByteArray::operator<=(const QString &s) const -{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) >= 0; } -inline bool QByteArray::operator>=(const QString &s) const -{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) <= 0; } #endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) -#ifndef QT_NO_CAST_TO_ASCII -inline QByteArray &QByteArray::append(const QString &s) -{ return append(s.toUtf8()); } -inline QByteArray &QByteArray::insert(int i, const QString &s) -{ return insert(i, s.toUtf8()); } -inline QByteArray &QByteArray::replace(char c, const QString &after) -{ return replace(c, after.toUtf8()); } -inline QByteArray &QByteArray::replace(const QString &before, const char *after) -{ return replace(before.toUtf8(), after); } -inline QByteArray &QByteArray::replace(const QString &before, const QByteArray &after) -{ return replace(before.toUtf8(), after); } -inline QByteArray &QByteArray::operator+=(const QString &s) -{ return operator+=(s.toUtf8()); } -inline int QByteArray::indexOf(const QString &s, int from) const -{ return indexOf(s.toUtf8(), from); } -inline int QByteArray::lastIndexOf(const QString &s, int from) const -{ return lastIndexOf(s.toUtf8(), from); } -#endif // QT_NO_CAST_TO_ASCII - #if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER) inline const QString operator+(const QString &s1, const QString &s2) { QString t(s1); t += s2; return t; } diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index d5f2da06d2..ae1506e848 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -2816,8 +2816,6 @@ void tst_QSettings::testEscapes() testVariant(QString("Hello, World!"), QString("Hello, World!"), toString); testVariant(QString("@Hello World!"), QString("@@Hello World!"), toString); testVariant(QString("@@Hello World!"), QString("@@@Hello World!"), toString); - testVariant(QByteArray("Hello World!"), QString("@ByteArray(Hello World!)"), toString); - testVariant(QByteArray("@Hello World!"), QString("@ByteArray(@Hello World!)"), toString); testVariant(QVariant(100), QString("100"), toString); testVariant(QStringList() << "ene" << "due" << "rike", QString::fromLatin1("@Variant(\x0\x0\x0\xb\x0\x0\x0\x3\x0\x0\x0\x6\x0\x65\x0n\x0\x65\x0\x0\x0\x6\x0\x64\x0u\x0\x65\x0\x0\x0\x8\x0r\x0i\x0k\x0\x65)", 50), toStringList); testVariant(QRect(1, 2, 3, 4), QString("@Rect(1 2 3 4)"), toRect); diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index fdd39cb0a4..c9a60c44e6 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -1404,7 +1404,7 @@ void tst_QVariant::checkDataStream() QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type")); QByteArray settingsHex("000000"); - settingsHex.append(QString::number(typeId, 16)); + settingsHex.append(QByteArray::number(typeId, 16)); settingsHex.append("ffffffffff"); const QByteArray settings = QByteArray::fromHex(settingsHex); QDataStream in(settings); diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 61f775f4d8..81a08eb59e 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -5226,14 +5226,6 @@ void tst_QString::operator_smaller() QVERIFY(QString("b") >= QByteArray("a")); QVERIFY(QString("b") > QByteArray("a")); - QVERIFY(QByteArray("a") < QString("b")); - QVERIFY(QByteArray("a") <= QString("b")); - QVERIFY(QByteArray("a") <= QString("a")); - QVERIFY(QByteArray("a") == QString("a")); - QVERIFY(QByteArray("a") >= QString("a")); - QVERIFY(QByteArray("b") >= QString("a")); - QVERIFY(QByteArray("b") > QString("a")); - QVERIFY(QLatin1String("a") < QString("b")); QVERIFY(QLatin1String("a") <= QString("b")); QVERIFY(QLatin1String("a") <= QString("a")); diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp index a870597ef2..d363c01f68 100644 --- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -233,7 +233,6 @@ private Q_SLOTS: void compare_QByteArray_QStringRef_data() { compare_data(); } void compare_QByteArray_QStringRef() { compare_impl(); } void compare_QByteArray_QString_data() { compare_data(); } - void compare_QByteArray_QString() { compare_impl(); } void compare_QByteArray_QLatin1String_data() { compare_data(); } void compare_QByteArray_QLatin1String() { compare_impl(); } void compare_QByteArray_QByteArray_data() { compare_data(); } diff --git a/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp index e31708ad72..5903c7066b 100644 --- a/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp @@ -358,12 +358,6 @@ void runScenario() QByteArray ba2 = withZero; ba2 += ba2 P withZero; QCOMPARE(ba2, QByteArray(withZero + withZero + withZero)); -#ifndef QT_NO_CAST_TO_ASCII - ba = UTF8_LITERAL; - ba2 = (ba += QLatin1String(LITERAL) + QString::fromUtf8(UTF8_LITERAL)); - QCOMPARE(ba2, ba); - QCOMPARE(ba, QByteArray(UTF8_LITERAL LITERAL UTF8_LITERAL)); -#endif } } diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 38b3d28901..f9e94d826c 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -452,7 +452,7 @@ void tst_QImage::formatHandlersInput() bool formatSupported = false; for (QList::Iterator it = formats.begin(); it != formats.end(); ++it) { - if (*it == testFormat.toLower()) { + if (*it == testFormat.toLower().toUtf8()) { formatSupported = true; break; } diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 6001829854..bea7d610b8 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -1803,7 +1803,7 @@ static QByteArray msgIgnoreFormatAndExtensionFail(const QString &sourceFileName, QByteArray result = "Failure for '"; result += sourceFileName.toLocal8Bit(); result += "' as '"; - result += targetFileName; + result += targetFileName.toLocal8Bit(); result += "', detected as: '"; result += detectedFormat.toLocal8Bit(); result += '\''; @@ -1825,7 +1825,7 @@ void tst_QImageReader::testIgnoresFormatAndExtension() tempPath += QLatin1Char('/'); foreach (const QByteArray &f, formats) { - if (f == extension) + if (f == extension.toLocal8Bit()) continue; QFile tmp(tempPath + name + QLatin1Char('_') + expected + QLatin1Char('.') + f); diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index c4364aeb4e..835e279ac3 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -433,7 +433,7 @@ static QStringList reverseLookupHelper(const QString &ip) name = line.mid(line.lastIndexOf(" ")).trimmed(); } else if (line.startsWith(addressMarkerWin)) { QByteArray address = line.mid(addressMarkerWin.length()).trimmed(); - if (address == ip) { + if (address == ip.toUtf8()) { results << name; } } diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index b4294e6a09..6659525fec 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -804,7 +804,7 @@ QByteArray sanitizeOutput(const QString &test, const QByteArray &output) if (test == "crashes") { #if !defined(Q_OS_WIN) // Remove digits of times - const QLatin1String timePattern("Function time:"); + const QByteArray timePattern("Function time:"); int timePos = actual.indexOf(timePattern); if (timePos >= 0) { timePos += timePattern.size(); diff --git a/tests/auto/tools/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp index 9388b63d0f..a4dbbfb657 100644 --- a/tests/auto/tools/rcc/tst_rcc.cpp +++ b/tests/auto/tools/rcc/tst_rcc.cpp @@ -152,7 +152,7 @@ static QString doCompare(const QStringList &actual, const QStringList &expected, if (expectedLine != actual.at(i)) { qDebug() << "LINES" << (i + 1) << "DIFFER"; ba.append( - "\n<<<<<< actual\n" + actual.at(i) + "\n======\n" + expectedLine + "\n<<<<<< actual\n" + actual.at(i).toUtf8() + "\n======\n" + expectedLine.toUtf8() + "\n>>>>>> expected\n" ); } diff --git a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp index afdcc825d8..8b437103de 100644 --- a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp +++ b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp @@ -175,7 +175,7 @@ private slots: if (isBody) { - body.append(line); + body.append(line.toUtf8()); bodyBytesRead += line.length(); } else if (line == "\r\n") diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp index 21018920f7..10b1b90ce2 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp @@ -318,7 +318,7 @@ bool QFileSystemIteratorPrivate::advanceHelper() if (m_entry->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { QByteArray ba = m_dirPaths.top(); ba += '\\'; - ba += QString::fromWCharArray(m_entry->cFileName); + ba += QString::fromWCharArray(m_entry->cFileName).toUtf8(); pushSubDirectory(ba); } #else @@ -638,7 +638,7 @@ QString QFileSystemIterator::filePath() const else if (d->m_entry) { ba += '/'; #ifdef Q_OS_WIN - ba += QString::fromWCharArray(d->m_entry->cFileName); + ba += QString::fromWCharArray(d->m_entry->cFileName).toUtf8(); #else ba += d->m_entry->d_name; #endif diff --git a/tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp b/tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp index 4dc4cecbf7..ff8e49a9a8 100644 --- a/tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp +++ b/tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp @@ -148,7 +148,7 @@ tst_qnetworkreply_from_cache::tst_qnetworkreply_from_cache() void tst_qnetworkreply_from_cache::timeReadAll(const QString &headers, const QByteArray &data) { QByteArray reply; - reply.append(headers); + reply.append(headers.toUtf8()); reply.append(data); m_replyData.reserve(data.size()); -- cgit v1.2.3