summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-06-18 09:40:39 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2020-06-24 23:39:09 +0200
commit9eb78ce0faee6d5cba61d662c36e5c59876dc6cc (patch)
tree3645fbd8bbfb4b1aaa74c219d15ebe22bac53fb4
parentd630478f7a257013e2b7e392e4a727d8612320be (diff)
downloadqtbase-9eb78ce0faee6d5cba61d662c36e5c59876dc6cc.tar.gz
Deprecate QByteArray's methods taking QString
Change-Id: I5aba5a91f288173c2d4f1bd3538191757abd3202 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/corelib/text/qbytearray.cpp20
-rw-r--r--src/corelib/text/qbytearray.h48
-rw-r--r--src/corelib/text/qstring.h7
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp2
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp4
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp5
-rw-r--r--tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp2
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp5
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp2
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp4
-rw-r--r--tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp2
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp2
-rw-r--r--tests/auto/tools/rcc/tst_rcc.cpp2
-rw-r--r--tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp2
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp4
-rw-r--r--tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp2
16 files changed, 81 insertions, 32 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index 3da643dc8b..87ca977d91 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -1642,6 +1642,7 @@ void QByteArray::chop(int n)
/*! \fn QByteArray &QByteArray::operator+=(const QString &str)
\overload
+ \obsolete
Appends the string \a str onto the end of this byte array and
returns a reference to this byte array. The Unicode data is
@@ -2003,6 +2004,7 @@ QByteArray &QByteArray::append(const QByteArray &ba)
/*! \fn QByteArray &QByteArray::append(const QString &str)
\overload
+ \obsolete
Appends the string \a str to this byte array. The Unicode data is
converted into 8-bit characters using QString::toUtf8().
@@ -2127,6 +2129,7 @@ QByteArray &QByteArray::insert(int i, const QByteArray &ba)
\fn QByteArray &QByteArray::insert(int i, const QString &str)
\overload
+ \obsolete
Inserts the string \a str at index position \a i in the byte
array. The Unicode data is converted into 8-bit characters using
@@ -2476,6 +2479,7 @@ QByteArray &QByteArray::replace(const char *before, int bsize, const char *after
/*! \fn QByteArray &QByteArray::replace(const QString &before, const QByteArray &after)
\overload
+ \obsolete
Replaces every occurrence of the string \a before with the byte
array \a after. The Unicode data is converted into 8-bit
@@ -2489,6 +2493,7 @@ QByteArray &QByteArray::replace(const char *before, int bsize, const char *after
/*! \fn QByteArray &QByteArray::replace(const QString &before, const char *after)
\overload
+ \obsolete
Replaces every occurrence of the string \a before with the string
\a after.
@@ -2519,6 +2524,7 @@ QByteArray &QByteArray::replace(char before, const QByteArray &after)
/*! \fn QByteArray &QByteArray::replace(char before, const QString &after)
\overload
+ \obsolete
Replaces every occurrence of the character \a before with the
string \a after. The Unicode data is converted into 8-bit
@@ -2657,6 +2663,7 @@ int QByteArray::indexOf(const QByteArray &ba, int from) const
/*! \fn int QByteArray::indexOf(const QString &str, int from) const
\overload
+ \obsolete
Returns the index position of the first occurrence of the string
\a str in the byte array, searching forward from index position
@@ -2781,6 +2788,7 @@ int QByteArray::lastIndexOf(const QByteArray &ba, int from) const
/*! \fn int QByteArray::lastIndexOf(const QString &str, int from) const
\overload
+ \obsolete
Returns the index position of the last occurrence of the string \a
str in the byte array, searching backward from index position \a
@@ -3326,6 +3334,8 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba)
/*! \fn bool QByteArray::operator==(const QString &str) const
+ \obsolete
+
Returns \c true if this byte array is equal to string \a str;
otherwise returns \c false.
@@ -3343,6 +3353,8 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba)
/*! \fn bool QByteArray::operator!=(const QString &str) const
+ \obsolete
+
Returns \c true if this byte array is not equal to string \a str;
otherwise returns \c false.
@@ -3360,6 +3372,8 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba)
/*! \fn bool QByteArray::operator<(const QString &str) const
+ \obsolete
+
Returns \c true if this byte array is lexically less than string \a
str; otherwise returns \c false.
@@ -3377,6 +3391,8 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba)
/*! \fn bool QByteArray::operator>(const QString &str) const
+ \obsolete
+
Returns \c true if this byte array is lexically greater than string
\a str; otherwise returns \c false.
@@ -3394,6 +3410,8 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba)
/*! \fn bool QByteArray::operator<=(const QString &str) const
+ \obsolete
+
Returns \c true if this byte array is lexically less than or equal
to string \a str; otherwise returns \c false.
@@ -3411,6 +3429,8 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba)
/*! \fn bool QByteArray::operator>=(const QString &str) const
+ \obsolete
+
Returns \c true if this byte array is greater than or equal to string
\a str; otherwise returns \c false.
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index 2b7d298313..bb4d22e8ca 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -334,24 +334,38 @@ 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;
+#if !defined(QT_NO_CAST_TO_ASCII) && QT_DEPRECATED_SINCE(5, 15)
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ QByteArray &append(const QString &s);
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ QByteArray &insert(int i, const QString &s);
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ QByteArray &replace(const QString &before, const char *after);
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ QByteArray &replace(char c, const QString &after);
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ QByteArray &replace(const QString &before, const QByteArray &after);
+
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ QByteArray &operator+=(const QString &s);
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ int indexOf(const QString &s, int from = 0) const;
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ 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;
+#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) && QT_DEPRECATED_SINCE(5, 15)
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ inline bool operator==(const QString &s2) const;
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ inline bool operator!=(const QString &s2) const;
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ inline bool operator<(const QString &s2) const;
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ inline bool operator>(const QString &s2) const;
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ inline bool operator<=(const QString &s2) const;
+ QT_DEPRECATED_VERSION_X_5_15("Use QString's toUtf8(), toLatin1() or toLocal8Bit()")
+ inline bool operator>=(const QString &s2) const;
#endif
short toShort(bool *ok = nullptr, int base = 10) const;
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index f446c35e40..5cfae878cc 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -1483,6 +1483,7 @@ 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; }
+#if QT_DEPRECATED_SINCE(5, 15)
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
@@ -1495,9 +1496,11 @@ 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 // QT_DEPRECATED_SINCE(5, 15)
+
#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
-#ifndef QT_NO_CAST_TO_ASCII
+#if !defined(QT_NO_CAST_TO_ASCII) && QT_DEPRECATED_SINCE(5, 15)
inline QByteArray &QByteArray::append(const QString &s)
{ return append(s.toUtf8()); }
inline QByteArray &QByteArray::insert(int i, const QString &s)
@@ -1514,7 +1517,7 @@ 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
+#endif // !defined(QT_NO_CAST_TO_ASCII) && QT_DEPRECATED_SINCE(5, 15)
#if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER)
inline const QString operator+(const QString &s1, const QString &s2)
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 57bab115bb..59a01c81aa 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -2932,8 +2932,10 @@ 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);
+#if QT_DEPRECATED_SINCE(5, 15)
testVariant(QByteArray("Hello World!"), QString("@ByteArray(Hello World!)"), toString);
testVariant(QByteArray("@Hello World!"), QString("@ByteArray(@Hello World!)"), toString);
+#endif
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 86c61cba12..556018edff 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -1440,11 +1440,11 @@ void tst_QVariant::checkDataStream()
QVERIFY(!QMetaType::isRegistered(typeId));
QByteArray errorMessage("Trying to construct an instance of an invalid type, type id: ");
- errorMessage.append(QString::number(typeId, 10));
+ errorMessage.append(QString::number(typeId, 10).toUtf8());
QTest::ignoreMessage(QtWarningMsg, errorMessage.constData());
QByteArray settingsHex("000000");
- settingsHex.append(QString::number(typeId, 16));
+ settingsHex.append(QString::number(typeId, 16).toUtf8());
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 4f2afe3295..e8e578ac25 100644
--- a/tests/auto/corelib/text/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp
@@ -5327,6 +5327,9 @@ void tst_QString::operator_smaller()
QVERIFY(QString("b") >= QByteArray("a"));
QVERIFY(QString("b") > QByteArray("a"));
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QVERIFY(QByteArray("a") < QString("b"));
QVERIFY(QByteArray("a") <= QString("b"));
QVERIFY(QByteArray("a") <= QString("a"));
@@ -5334,6 +5337,8 @@ void tst_QString::operator_smaller()
QVERIFY(QByteArray("a") >= QString("a"));
QVERIFY(QByteArray("b") >= QString("a"));
QVERIFY(QByteArray("b") > QString("a"));
+QT_WARNING_POP
+#endif
QVERIFY(QLatin1String("a") < QString("b"));
QVERIFY(QLatin1String("a") <= QString("b"));
diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
index 35546c2968..63d6635130 100644
--- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
+++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
@@ -232,7 +232,9 @@ private Q_SLOTS:
void compare_QByteArray_QStringRef_data() { compare_data(); }
void compare_QByteArray_QStringRef() { compare_impl<QByteArray, QStringRef>(); }
void compare_QByteArray_QString_data() { compare_data(); }
+#if QT_DEPRECATED_SINCE(5, 15)
void compare_QByteArray_QString() { compare_impl<QByteArray, QString>(); }
+#endif
void compare_QByteArray_QLatin1String_data() { compare_data(); }
void compare_QByteArray_QLatin1String() { compare_impl<QByteArray, QLatin1String>(); }
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 ac7f439248..1b93249d74 100644
--- a/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp
@@ -358,11 +358,14 @@ void runScenario()
QByteArray ba2 = withZero;
ba2 += ba2 P withZero;
QCOMPARE(ba2, QByteArray(withZero + withZero + withZero));
-#ifndef QT_NO_CAST_TO_ASCII
+#if !defined(QT_NO_CAST_TO_ASCII) && QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
ba = UTF8_LITERAL;
ba2 = (ba += QLatin1String(LITERAL) + QString::fromUtf8(UTF8_LITERAL));
QCOMPARE(ba2, ba);
QCOMPARE(ba, QByteArray(UTF8_LITERAL LITERAL UTF8_LITERAL));
+QT_WARNING_POP
#endif
}
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index fe998c7d92..d5c5752f95 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -454,7 +454,7 @@ void tst_QImage::formatHandlersInput()
bool formatSupported = false;
for (QList<QByteArray>::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 a603b2d879..cc17c9f05b 100644
--- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
@@ -455,7 +455,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 84090c22ca..95b759edc2 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -735,7 +735,7 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
QByteArray &actual = actualOutputs[0];
#ifndef Q_OS_WIN
// Remove digits of times to match the expected file.
- 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 0b8a84028f..bfcb40451e 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 6ee8b4e93b..762c8de70b 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp
+++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp
@@ -323,7 +323,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
@@ -643,7 +643,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());