summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-03-23 11:44:19 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-27 16:35:39 +0200
commit2c4845ce331e5dfaf5e106f74871ce16721a1358 (patch)
tree32bf5ee220e114e0bee7ab49fc79a3a287c0f121 /tests
parent0ee1b4a1dea8b587a5d39bfeb7e18c97f13dd877 (diff)
Fix some compiler warnings in tests.
- Unused variables - Deprecated conversion from const char * to char *. Change-Id: Iea0b9c4613ea74cead6d95ba12ad1028f531cbff Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp9
-rw-r--r--tests/auto/network/socket/qlocalsocket/example/server/main.cpp2
-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/tools/qmake/testcompiler.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp8
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp3
-rw-r--r--tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp2
8 files changed, 20 insertions, 14 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index f007d44262..4eabd61025 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -718,6 +718,11 @@ void tst_QString::acc_01()
}
}
+#ifdef Q_CC_GNU
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat-security"
+#endif
+
void tst_QString::isNull()
{
QString a;
@@ -728,6 +733,10 @@ void tst_QString::isNull()
QVERIFY(!a.isNull());
}
+#ifdef Q_CC_GNU
+# pragma GCC diagnostic pop
+#endif
+
void tst_QString::isEmpty()
{
QString a;
diff --git a/tests/auto/network/socket/qlocalsocket/example/server/main.cpp b/tests/auto/network/socket/qlocalsocket/example/server/main.cpp
index d066e4ef51..909bb6856f 100644
--- a/tests/auto/network/socket/qlocalsocket/example/server/main.cpp
+++ b/tests/auto/network/socket/qlocalsocket/example/server/main.cpp
@@ -72,7 +72,7 @@ public:
if (n == 0)
break;
qDebug() << "Read" << str;
- if ("exit" == str)
+ if (!qstrcmp(str, "exit"))
qApp->quit();
if (socket->write(str, 100) < 0) {
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/tools/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp
index 4e5dc26eac..3b77b1ec63 100644
--- a/tests/auto/tools/qmake/testcompiler.cpp
+++ b/tests/auto/tools/qmake/testcompiler.cpp
@@ -128,7 +128,7 @@ TestCompiler::~TestCompiler()
bool TestCompiler::errorOut()
{
- qDebug(qPrintable(testOutput_.join("\n")));
+ qDebug("%s", qPrintable(testOutput_.join(QStringLiteral("\n"))));
return false;
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp
index acb9155ca8..4f15f96cba 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp
@@ -287,17 +287,15 @@ void tst_QGraphicsLayoutItem::setMaximumSize()
void tst_QGraphicsLayoutItem::setMinimumSize_data()
{
QTest::addColumn<QSizeF>("size");
- QTest::addColumn<QSizeF>("outputSize");
- QTest::newRow("-1") << QSizeF(-1, -1) << QSizeF(0, 0);
- QTest::newRow("0") << QSizeF(0, 0) << QSizeF(0, 0);
- QTest::newRow("10") << QSizeF(10, 10) << QSizeF(10, 10);
+ QTest::newRow("-1") << QSizeF(-1, -1);
+ QTest::newRow("0") << QSizeF(0, 0);
+ QTest::newRow("10") << QSizeF(10, 10);
}
// void setMinimumSize(QSizeF const& size) public
void tst_QGraphicsLayoutItem::setMinimumSize()
{
QFETCH(QSizeF, size);
- QFETCH(QSizeF, outputSize);
SubQGraphicsLayoutItem layoutItem;
QSizeF oldSize = layoutItem.minimumSize();
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index be7c58f20b..c6c8131422 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -238,10 +238,9 @@ public:
openedEditor = new QWidget(parent);
return openedEditor;
}
- void destroyEditor(QWidget *editor, const QModelIndex &index) const
+ void destroyEditor(QWidget *editor, const QModelIndex &) const
{
calledVirtualDtor = true;
- // QAbstractItemDelegate::destroyEditor(editor,index);
editor->deleteLater();
}
diff --git a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp
index f93d979169..d8b193f5c8 100644
--- a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp
+++ b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp
@@ -118,9 +118,9 @@ class ServerAndClient : public QObject
public:
ServerAndClient(QEventLoop &ev) : success(false)
, eventLoop(ev)
- , isBody(false)
, bodyBytesRead(0)
, bodyLength(-1)
+ , isBody(false)
{
setObjectName("serverAndClient");
tcpServer = new QTcpServer(this);