summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/testlib/selftests')
-rw-r--r--tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp2
-rw-r--r--tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp6
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp7
3 files changed, 8 insertions, 7 deletions
diff --git a/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp b/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp
index 91b14e5051..f32a5e7cd5 100644
--- a/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp
+++ b/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp
@@ -76,7 +76,7 @@ private slots:
int main()
{
- char *argv[] = {"appName", "slotName"};
+ char *argv[] = { const_cast<char *>("appName"), const_cast<char *>("slotName") };
int argc = 2;
tst_TestA testA;
diff --git a/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp b/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp
index 20bfc2228a..73de6df5f3 100644
--- a/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp
+++ b/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp
@@ -65,7 +65,7 @@ void tst_StrCmp::compareCharStars() const
QCOMPARE(str1, "foo");
QCOMPARE(str1, str1);
- char *str2 = "foo";
+ char *str2 = const_cast<char *>("foo");
QCOMPARE("foo", str2);
QCOMPARE(str2, "foo");
QCOMPARE(str2, str2);
@@ -88,8 +88,8 @@ void tst_StrCmp::compareByteArray() const
QCOMPARE(ba.constData(), "bar");
QCOMPARE(ba.constData(), "foo");
- char *bar = "bar";
- char *foo = "foo";
+ char *bar = const_cast<char *>("bar");
+ char *foo = const_cast<char *>("foo");
QEXPECT_FAIL("", "Next test should fail", Continue);
QCOMPARE(ba.data(), bar);
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index 97458abfbf..26ccd826ca 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -135,7 +135,7 @@ static QList<QByteArray> splitLines(QByteArray ba)
if (index == -1) {
continue;
}
- int end = line.indexOf('"', index + strlen(markers[j][0]));
+ const int end = line.indexOf('"', index + int(strlen(markers[j][0])));
if (end == -1) {
continue;
}
@@ -686,11 +686,12 @@ QString extractXmlAttribute(const QString &line, const char *attribute)
int index = line.indexOf(attribute);
if (index == -1)
return QString();
- int end = line.indexOf('"', index + strlen(attribute));
+ const int attributeLength = int(strlen(attribute));
+ const int end = line.indexOf('"', index + attributeLength);
if (end == -1)
return QString();
- QString result = line.mid(index + strlen(attribute), end - index - strlen(attribute));
+ const QString result = line.mid(index + attributeLength, end - index - attributeLength);
if (result.isEmpty())
return ""; // ensure empty but not null
return result;