From 49995ee35ff0b26e32303d77df619d3a2fbcb86b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 May 2011 16:19:01 +0200 Subject: Tests: Fix some compile warnings. As they are now compiled by default. --- tests/auto/modeltest/modeltest.cpp | 2 +- tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp | 2 +- .../tst_qabstracttextdocumentlayout.cpp | 2 +- tests/auto/qapplication/modal/main.cpp | 1 + tests/auto/qcssparser/tst_qcssparser.cpp | 2 +- tests/auto/qdir/tst_qdir.cpp | 1 + tests/auto/qfile/tst_qfile.cpp | 2 ++ tests/auto/qfuture/tst_qfuture.cpp | 1 + tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 3 ++- tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp | 8 ++++---- tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 3 ++- tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp | 1 + tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp | 4 ++-- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 8 ++++---- tests/auto/qhttp/tst_qhttp.cpp | 1 + .../auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp | 2 ++ tests/auto/qiodevice/tst_qiodevice.cpp | 2 +- tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp | 4 ++-- tests/auto/qlayout/tst_qlayout.cpp | 10 +++++----- .../tst_qnetworkaccessmanager_and_qprogressdialog.cpp | 8 +++++--- tests/auto/qpicture/tst_qpicture.cpp | 4 ++-- tests/auto/qprinter/tst_qprinter.cpp | 2 ++ tests/auto/qprocess/testGuiProcess/main.cpp | 1 + tests/auto/qprocess/testProcessSpacesArgs/main.cpp | 2 +- tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp | 2 +- tests/auto/qsql/tst_qsql.cpp | 6 +++--- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 10 +++++----- tests/auto/qsqlquery/tst_qsqlquery.cpp | 6 +++--- tests/auto/qsslsocket/tst_qsslsocket.cpp | 3 ++- tests/auto/qstatemachine/tst_qstatemachine.cpp | 2 ++ tests/auto/qstyle/tst_qstyle.cpp | 2 ++ tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 2 +- tests/auto/qtextdocumentlayout/tst_qtextdocumentlayout.cpp | 1 + tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp | 2 ++ tests/auto/qthreadstorage/tst_qthreadstorage.cpp | 2 +- tests/auto/qtreeview/tst_qtreeview.cpp | 4 ++-- tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp | 1 + tests/benchmarks/gui/painting/qtracebench/tst_qtracebench.cpp | 2 +- tests/benchmarks/gui/text/qtext/main.cpp | 2 ++ .../network/access/qnetworkreply/tst_qnetworkreply.cpp | 2 +- 40 files changed, 76 insertions(+), 49 deletions(-) (limited to 'tests') diff --git a/tests/auto/modeltest/modeltest.cpp b/tests/auto/modeltest/modeltest.cpp index ec1091abfa..f60f86d09c 100644 --- a/tests/auto/modeltest/modeltest.cpp +++ b/tests/auto/modeltest/modeltest.cpp @@ -470,7 +470,7 @@ void ModelTest::data() \sa rowsInserted() */ -void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end ) +void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int /* end */) { // Q_UNUSED(end); // qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString() diff --git a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp index f15244525d..3c202920d6 100644 --- a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp +++ b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp @@ -299,7 +299,7 @@ public: startTimer(2000); } - void timerEvent(QTimerEvent *event) + void timerEvent(QTimerEvent * /* event */) { // should not crash. (void)new QScrollArea(this); diff --git a/tests/auto/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp index 11730f277c..8dfa37fc39 100644 --- a/tests/auto/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp +++ b/tests/auto/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp @@ -90,7 +90,7 @@ public: QSizeF documentSize() const { return QSizeF(); } QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); } QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); } - void documentChanged(int from, int oldLength, int length) { + void documentChanged(int from, int /* oldLength */, int length) { ++changeEvents; QTextBlock last = document()->lastBlock(); diff --git a/tests/auto/qapplication/modal/main.cpp b/tests/auto/qapplication/modal/main.cpp index 2365991084..8ff6f330fd 100644 --- a/tests/auto/qapplication/modal/main.cpp +++ b/tests/auto/qapplication/modal/main.cpp @@ -49,5 +49,6 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QApplication::setAttribute(Qt::AA_NativeWindows); //QTBUG-15774 base *b = new base(); + Q_UNUSED(b); return app.exec(); } diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp index 86cca2daae..ddee2dd713 100644 --- a/tests/auto/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/qcssparser/tst_qcssparser.cpp @@ -148,7 +148,7 @@ void tst_QCssParser::scanner_data() } -static char *tokenName(QCss::TokenType t) +static const char *tokenName(QCss::TokenType t) { switch (t) { case QCss::NONE: return "NONE"; diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index bc5c6872ee..0843633bdc 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -974,6 +974,7 @@ void tst_QDir::cd() QDir d = startDir; bool notUsed = d.exists(); // make sure we cache this before so we can see if 'cd' fails to flush this + Q_UNUSED(notUsed); QCOMPARE(d.cd(cdDir), successExpected); if (successExpected) QCOMPARE(d.absolutePath(), newDir); diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 688a92d04b..a0db699c42 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -333,6 +333,8 @@ private: case OpenRFile: return openRFile(file, mode, handleFlags); #endif + case NumberOfFileTypes: + break; } return false; diff --git a/tests/auto/qfuture/tst_qfuture.cpp b/tests/auto/qfuture/tst_qfuture.cpp index 8afdf48fc3..26d96f0f81 100644 --- a/tests/auto/qfuture/tst_qfuture.cpp +++ b/tests/auto/qfuture/tst_qfuture.cpp @@ -1453,6 +1453,7 @@ void tst_QFuture::exceptions_QTBUG18149() try { MyClass m; + Q_UNUSED(m); throw 0; } catch (int) {} diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index f8bf7a1b3c..b55130965a 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -110,7 +110,7 @@ static void sendMousePress(QGraphicsScene *scene, const QPointF &point, Qt::Mous } static void sendMouseMove(QGraphicsScene *scene, const QPointF &point, - Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0) + Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons /* buttons */ = 0) { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove); event.setScenePos(point); @@ -794,6 +794,7 @@ void tst_QGraphicsItem::deleteChildItem() QGraphicsItem *child1 = new QGraphicsRectItem(rect); QGraphicsItem *child2 = new QGraphicsRectItem(rect); QGraphicsItem *child3 = new QGraphicsRectItem(rect); + Q_UNUSED(child3); delete child1; child2->setParentItem(0); delete child2; diff --git a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp index 29ea07460e..6f08a5dad1 100644 --- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp @@ -644,7 +644,7 @@ void AnimatedLayoutItem::setGeometry(const QRectF &geom) QGraphicsLayoutItem::setGeometry(geom); } -QSizeF AnimatedLayoutItem::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +QSizeF AnimatedLayoutItem::sizeHint(Qt::SizeHint which, const QSizeF & /* constraint */) const { switch (which) { case Qt::MinimumSize: @@ -760,7 +760,7 @@ private: QSet *m_destructedSet; }; -QSizeF CustomLayoutItem::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +QSizeF CustomLayoutItem::sizeHint(Qt::SizeHint which, const QSizeF & /* constraint */) const { switch (which) { case Qt::MinimumSize: @@ -800,7 +800,7 @@ private: QSet *m_destructedSet; }; -QSizeF CustomGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +QSizeF CustomGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF & /* constraint */) const { switch (which) { case Qt::MinimumSize: @@ -889,7 +889,7 @@ void updateParentWidget(QGraphicsWidget *item) } } -QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +QSizeF sizeHint(Qt::SizeHint /* which */, const QSizeF & /* constraint */) const { return QSizeF(50,50); } diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 8f8ac67d09..b3e4a88edf 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -299,7 +299,7 @@ void tst_QGraphicsLinearLayout::alignment() int i; bool addWidget = true; - for (i = 0; i < sizeof(alignmentsToTest)/sizeof(Qt::Alignment); ++i) { + for (size_t i = 0; i < sizeof(alignmentsToTest)/sizeof(Qt::Alignment); ++i) { QGraphicsLayoutItem *loutItem; Qt::Alignment align = alignmentsToTest[i]; if (!align && i > 0) @@ -1139,6 +1139,7 @@ void tst_QGraphicsLinearLayout::testStretch() { QGraphicsScene scene; QGraphicsView *view = new QGraphicsView(&scene); + Q_UNUSED(view); QGraphicsWidget *form = new QGraphicsWidget(0, Qt::Window); scene.addItem(form); diff --git a/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp b/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp index 5619766a71..93af2e0443 100644 --- a/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp +++ b/tests/auto/qgraphicsobject/tst_qgraphicsobject.cpp @@ -284,6 +284,7 @@ void tst_QGraphicsObject::deleted() bool item2_wasDeleted = false; DeleteTester *item1 = new DeleteTester(&item1_wasDeleted, &item1_parentWasDeleted); DeleteTester *item2 = new DeleteTester(&item2_wasDeleted, &item2_parentWasDeleted, item1); + Q_UNUSED(item2); delete item1; QVERIFY(!item1_wasDeleted); // destructor not called yet diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 80629c54cf..fe949742cd 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -290,7 +290,7 @@ public: { } - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + void paint(QPainter *painter, const QStyleOptionGraphicsItem * /* option */, QWidget * /* widget */) { painter->setBrush(brush); painter->drawRect(boundingRect()); @@ -348,7 +348,7 @@ void tst_QGraphicsSceneIndex::clear() int numPaints; protected: QRectF boundingRect() const { return QRectF(0, 0, 10, 10); } - void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + void paint(QPainter * /* painter */, const QStyleOptionGraphicsItem *, QWidget *) { ++numPaints; } }; diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index ca6b4d285e..2d02ec052f 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -4009,7 +4009,7 @@ public: m_viewHasIMEnabledInFocusInEvent = false; } - void focusInEvent(QFocusEvent *event) + void focusInEvent(QFocusEvent * /* event */) { QGraphicsView *view = scene()->views().first(); m_viewHasIMEnabledInFocusInEvent = view->testAttribute(Qt::WA_InputMethodEnabled); @@ -4403,7 +4403,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect() { public: CustomScene(const QRectF &rect) : QGraphicsScene(rect) { } - void drawBackground(QPainter *painter, const QRectF &rect) + void drawBackground(QPainter * /* painter */, const QRectF &rect) { lastBackgroundExposedRect = rect; } QRectF lastBackgroundExposedRect; }; @@ -4413,7 +4413,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect() public: CustomRectItem(const QRectF &rect) : QGraphicsRectItem(rect) { setFlag(QGraphicsItem::ItemUsesExtendedStyleOption); } - void paint(QPainter * painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) + void paint(QPainter * /* painter */, const QStyleOptionGraphicsItem *option, QWidget * /* widget */ = 0) { lastExposedRect = option->exposedRect; } QRectF lastExposedRect; }; @@ -4528,7 +4528,7 @@ public: setFlag(QGraphicsItem::ItemAcceptsInputMethod, true); } - QVariant inputMethodQuery(Qt::InputMethodQuery query) const + QVariant inputMethodQuery(Qt::InputMethodQuery) const { return mf; } diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp index 61123c297f..96346cc91a 100644 --- a/tests/auto/qhttp/tst_qhttp.cpp +++ b/tests/auto/qhttp/tst_qhttp.cpp @@ -772,6 +772,7 @@ void tst_QHttp::authorization() http.setUser(user, pass); http.setHost(host); int id = http.get(path); + Q_UNUSED(id); QTimer::singleShot(5000, &loop, SLOT(quit())); loop.exec(); diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index ba1f8c8cca..ea4fddcc5e 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -1000,6 +1000,7 @@ public: public Q_SLOTS: void finishedSlot() { QHttpNetworkReply *reply = (QHttpNetworkReply*) sender(); + Q_UNUSED(reply); receivedCount++; if (receivedCount == requestCount) @@ -1046,6 +1047,7 @@ public: public Q_SLOTS: void finishedSlot() { QHttpNetworkReply *reply = (QHttpNetworkReply*) sender(); + Q_UNUSED(reply); receivedCount++; if (receivedCount == requestCount) diff --git a/tests/auto/qiodevice/tst_qiodevice.cpp b/tests/auto/qiodevice/tst_qiodevice.cpp index 65ef9c65b3..804d0502f4 100644 --- a/tests/auto/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/qiodevice/tst_qiodevice.cpp @@ -570,7 +570,7 @@ public: } return maxlen; } - qint64 writeData(const char *data, qint64 maxlen) { + qint64 writeData(const char * /* data */, qint64 /* maxlen */) { return -1; } diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp index d91b068c5f..36c89a03fe 100644 --- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -2289,7 +2289,7 @@ void tst_QItemSelectionModel::QTBUG5671_layoutChangedWithAllSelected() struct MyFilterModel : public QSortFilterProxyModel { // Override sort filter proxy to remove even numbered rows. bool filtering; - virtual bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const + virtual bool filterAcceptsRow( int source_row, const QModelIndex& /* source_parent */) const { return !filtering || !( source_row & 1 ); } @@ -2373,7 +2373,7 @@ public: } public slots: - void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) + void selectionChanged(const QItemSelection & /* selected */, const QItemSelection &deselected) { foreach(const QModelIndex &index, deselected.indexes()) { QVERIFY(!m_itemSelectionModel->selection().contains(index)); diff --git a/tests/auto/qlayout/tst_qlayout.cpp b/tests/auto/qlayout/tst_qlayout.cpp index 2777c91e2b..f69a99c312 100644 --- a/tests/auto/qlayout/tst_qlayout.cpp +++ b/tests/auto/qlayout/tst_qlayout.cpp @@ -182,16 +182,16 @@ void tst_QLayout::smartMaxSize() int expectedIndex = 0; int regressionCount = 0; - for (int p = 0; p < sizeof(policies)/sizeof(QSizePolicy::Policy); ++p) { + for (size_t p = 0; p < sizeof(policies)/sizeof(QSizePolicy::Policy); ++p) { QSizePolicy sizePolicy; sizePolicy.setHorizontalPolicy(policies[p]); - for (int min = 0; min < sizeof(sizeCombinations)/sizeof(int); ++min) { + for (size_t min = 0; min < sizeof(sizeCombinations)/sizeof(int); ++min) { int minSize = sizeCombinations[min]; - for (int max = 0; max < sizeof(sizeCombinations)/sizeof(int); ++max) { + for (size_t max = 0; max < sizeof(sizeCombinations)/sizeof(int); ++max) { int maxSize = sizeCombinations[max]; - for (int sh = 0; sh < sizeof(sizeCombinations)/sizeof(int); ++sh) { + for (size_t sh = 0; sh < sizeof(sizeCombinations)/sizeof(int); ++sh) { int sizeHint = sizeCombinations[sh]; - for (int a = 0; a < sizeof(alignments)/sizeof(int); ++a) { + for (size_t a = 0; a < sizeof(alignments)/sizeof(int); ++a) { Qt::Alignment align = alignments[a]; QSize sz = qSmartMaxSize(QSize(sizeHint, 1), QSize(minSize, 1), QSize(maxSize, 1), sizePolicy, align); int width = sz.width(); diff --git a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp index f7c5ca151d..04bc410097 100644 --- a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp +++ b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp @@ -65,9 +65,9 @@ class DownloadCheckWidget : public QWidget { Q_OBJECT public: - DownloadCheckWidget(QWidget *parent = 0) : QWidget(parent) - , progressDlg(this), netmanager(this) - , lateReadyRead(true) + DownloadCheckWidget(QWidget *parent = 0) : + QWidget(parent), lateReadyRead(true), zeroCopy(false), + progressDlg(this), netmanager(this) { progressDlg.setRange(1, 100); QMetaObject::invokeMethod(this, "go", Qt::QueuedConnection); @@ -96,12 +96,14 @@ public slots: void dataReadProgress(qint64 done, qint64 total) { QNetworkReply *reply = qobject_cast(sender()); + Q_UNUSED(reply); progressDlg.setMaximum(total); progressDlg.setValue(done); } void dataReadyRead() { QNetworkReply *reply = qobject_cast(sender()); + Q_UNUSED(reply); lateReadyRead = true; } void finishedFromReply() diff --git a/tests/auto/qpicture/tst_qpicture.cpp b/tests/auto/qpicture/tst_qpicture.cpp index 10a5a83aa1..1e97502abf 100644 --- a/tests/auto/qpicture/tst_qpicture.cpp +++ b/tests/auto/qpicture/tst_qpicture.cpp @@ -81,7 +81,7 @@ void tst_QPicture::getSetCheck() // void QPictureIO::setPicture(const QPicture &) // const char * QPictureIO::format() // void QPictureIO::setFormat(const char *) - char *var2 = "PNG"; + const char var2[] = "PNG"; obj1.setFormat(var2); QCOMPARE(var2, obj1.format()); obj1.setFormat((char *)0); @@ -90,7 +90,7 @@ void tst_QPicture::getSetCheck() // const char * QPictureIO::parameters() // void QPictureIO::setParameters(const char *) - char *var3 = "Bogus data"; + const char var3[] = "Bogus data"; obj1.setParameters(var3); QCOMPARE(var3, obj1.parameters()); obj1.setParameters((char *)0); diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index 6da7597938..b1c4c4ee3c 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -406,6 +406,8 @@ void tst_QPrinter::testMargins() QFETCH(int, width); QFETCH(int, height); QFETCH(bool, fullpage); + Q_UNUSED(width); + Q_UNUSED(height); QPrinter printer; QPainter *painter = 0; printer.setOutputFileName("silly"); diff --git a/tests/auto/qprocess/testGuiProcess/main.cpp b/tests/auto/qprocess/testGuiProcess/main.cpp index 5550772dab..1df5dcf3e1 100644 --- a/tests/auto/qprocess/testGuiProcess/main.cpp +++ b/tests/auto/qprocess/testGuiProcess/main.cpp @@ -49,6 +49,7 @@ int main(int argc, char **argv) label.show(); int c; + Q_UNUSED(c); fgetc(stdin); // block until fed qDebug("Process is running"); diff --git a/tests/auto/qprocess/testProcessSpacesArgs/main.cpp b/tests/auto/qprocess/testProcessSpacesArgs/main.cpp index c6ea8cacd7..0652ddf0a2 100644 --- a/tests/auto/qprocess/testProcessSpacesArgs/main.cpp +++ b/tests/auto/qprocess/testProcessSpacesArgs/main.cpp @@ -62,7 +62,7 @@ int main(int argc, char ** argv) for (int i = 0; i < argc; ++i) { if (i) printf("|"); - printf(argv[i]); + printf("%s", argv[i]); } #endif return 0; diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 8e7f39335c..3250c0e9f0 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -3193,7 +3193,7 @@ public: } protected: - bool filterAcceptsColumn(int column, const QModelIndex &source_parent) const + bool filterAcceptsColumn(int column, const QModelIndex & /* source_parent */) const { return column % 2 != 0; } diff --git a/tests/auto/qsql/tst_qsql.cpp b/tests/auto/qsql/tst_qsql.cpp index fe8af9dd9c..7f3c63b510 100644 --- a/tests/auto/qsql/tst_qsql.cpp +++ b/tests/auto/qsql/tst_qsql.cpp @@ -140,7 +140,7 @@ void tst_QSql::basicDriverTest() continue; } - qDebug( qPrintable( QLatin1String( "Testing: " ) + tst_Databases::dbToString( db ) ) ); + qDebug("Testing: %s", qPrintable(tst_Databases::dbToString( db ))); QSqlRecord rInf = db.record( tableName ); QCOMPARE( rInf.count(), 2 ); @@ -230,8 +230,8 @@ void tst_QSql::openErrorRecovery() // force an open error if ( db.open( "dummy130977", "doesnt_exist" ) ) { - qDebug( qPrintable(QLatin1String("Promiscuous database server without access control - test skipped for ") + - tst_Databases::dbToString( db )) ); + qDebug("Promiscuous database server without access control - test skipped for %s", + qPrintable(tst_Databases::dbToString( db )) ); QVERIFY(1); continue; } diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 900eab7161..96ea3d95d7 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -212,7 +212,6 @@ private: // number of records to be inserted per testfunction static const int ITERATION_COUNT = 2; -static int pkey = 1; //helper class for database specific tests struct FieldDef { @@ -483,8 +482,9 @@ void tst_QSqlDatabase::tables() if (!q.exec("CREATE VIEW " + qtest_view + " as select * from " + qtest)) { - qDebug(QString("DBMS '%1' cannot handle VIEWs: %2").arg( - tst_Databases::dbToString(db)).arg(QString(tst_Databases::printError(q.lastError()))).toLatin1()); + qDebug("DBMS '%s' cannot handle VIEWs: %s", + qPrintable(tst_Databases::dbToString(db)), + qPrintable(tst_Databases::printError(q.lastError()))); views = false; } @@ -1080,7 +1080,7 @@ void tst_QSqlDatabase::transaction() q.clear(); // for SQLite which does not allow any references on rows that shall be rolled back if (!db.rollback()) { if (db.driverName().startsWith("QMYSQL")) { - qDebug("MySQL: " + tst_Databases::printError(db.lastError())); + qDebug("MySQL: %s", qPrintable(tst_Databases::printError(db.lastError()))); QSKIP("MySQL transaction failed ", SkipSingle); //non-fatal } else { QFAIL("Could not rollback transaction: " + tst_Databases::printError(db.lastError())); @@ -1861,7 +1861,7 @@ void tst_QSqlDatabase::oci_serverDetach() } } if(!db.open()) - qFatal(tst_Databases::printError(db.lastError(), db)); + qFatal("%s", qPrintable(tst_Databases::printError(db.lastError(), db))); } void tst_QSqlDatabase::oci_xmltypeSupport() diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index be2087dfc8..eb7ae9184e 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -1558,7 +1558,7 @@ void tst_QSqlQuery::transaction() if ( !q.exec( "rollback" ) ) { if ( db.driverName().startsWith( "QMYSQL" ) ) { - qDebug( "MySQL: " + tst_Databases::printError( q.lastError() ) ); + qDebug( "MySQL: %s", qPrintable(tst_Databases::printError( q.lastError() ) )); QSKIP( "MySQL transaction failed ", SkipSingle ); //non-fatal } else QFAIL( "Could not rollback transaction: " + tst_Databases::printError( q.lastError() ) ); @@ -1578,8 +1578,8 @@ void tst_QSqlQuery::transaction() QVERIFY_SQL( q2, exec( "select * from" + qtest + " where id = 42" ) ); if ( q2.next() ) - qDebug( QString( "DBMS '%1' doesn't support query based transactions with concurrent access" ).arg( - tst_Databases::dbToString( db ) ).toLatin1() ); + qDebug("DBMS '%s' doesn't support query based transactions with concurrent access", + qPrintable(tst_Databases::dbToString( db ))); QVERIFY_SQL( q, exec( "commit" ) ); diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 507af5ebd5..576f2f6f0d 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -1561,6 +1561,7 @@ protected: #else bool ret = server.waitForNewConnection(20000); #endif + Q_UNUSED(ret); // delayed start of encryption QTest::qSleep(100); @@ -1955,7 +1956,7 @@ void tst_QSslSocket::writeBigChunk() QByteArray data; data.resize(1024*1024*10); // 10 MB // init with garbage. needed so ssl cannot compress it in an efficient way. - for (int i = 0; i < data.size() / sizeof(int); i++) { + for (size_t i = 0; i < data.size() / sizeof(int); i++) { int r = qrand(); data.data()[i*sizeof(int)] = r; } diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 231cab03b2..56b0c9bf8a 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -4374,7 +4374,9 @@ void tst_QStateMachine::eventClassesExported() { // make sure this links QStateMachine::WrappedEvent *wrappedEvent = new QStateMachine::WrappedEvent(0, 0); + Q_UNUSED(wrappedEvent); QStateMachine::SignalEvent *signalEvent = new QStateMachine::SignalEvent(0, 0, QList()); + Q_UNUSED(signalEvent); } void tst_QStateMachine::stopInTransitionToFinalState() diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp index 0e66597d16..b844beb5a7 100644 --- a/tests/auto/qstyle/tst_qstyle.cpp +++ b/tests/auto/qstyle/tst_qstyle.cpp @@ -373,6 +373,8 @@ void tst_QStyle::testScrollBarSubControls(QStyle* style) #ifdef Q_OS_WINCE_WM if (qobject_cast(style) && qt_wince_is_smartphone()) QSKIP("SmartPhone doesn't have scrollbar subcontrols.", SkipAll); +#else + Q_UNUSED(style); #endif QScrollBar scrollBar; diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 2e664935be..8590ff2154 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -430,7 +430,7 @@ void tst_QTcpSocket::socketsConstructedBeforeEventLoop() earlyConstructedSockets->endPoints[1]->close(); } -void tst_QTcpSocket::earlySocketBytesSent(qint64 bytes) +void tst_QTcpSocket::earlySocketBytesSent(qint64 /* bytes */) { earlyBytesWrittenCount++; } diff --git a/tests/auto/qtextdocumentlayout/tst_qtextdocumentlayout.cpp b/tests/auto/qtextdocumentlayout/tst_qtextdocumentlayout.cpp index a7a9c056d2..0757e4f2da 100644 --- a/tests/auto/qtextdocumentlayout/tst_qtextdocumentlayout.cpp +++ b/tests/auto/qtextdocumentlayout/tst_qtextdocumentlayout.cpp @@ -260,6 +260,7 @@ void tst_QTextDocumentLayout::floatingTablePageBreak() QTextTableFormat tableFormat; tableFormat.setPosition(QTextFrameFormat::FloatLeft); QTextTable *table = cursor.insertTable(50, 1, tableFormat); + Q_UNUSED(table); // Make height of document 2/3 of the table, fitting the table into two pages QSizeF documentSize = doc->size(); diff --git a/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp b/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp index 6f1b092709..12f17a890b 100644 --- a/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp +++ b/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp @@ -1108,6 +1108,8 @@ void tst_QTextPieceTable::removeWithChildFrame() QTextFrame *frame = table->insertFrame(1, 6, ffmt); QTextFrame *childFrame = table->insertFrame(3, 5, ffmt); + Q_UNUSED(frame); + Q_UNUSED(childFrame); // used to give a failing assertion table->remove(2, 5); diff --git a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp index 2391c81b63..d3eea0cae2 100644 --- a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp @@ -320,7 +320,7 @@ public: static QBasicAtomicInt count; inline SPointer() { count.ref(); } inline ~SPointer() { count.deref(); } - inline SPointer(const SPointer &other) { count.ref(); } + inline SPointer(const SPointer & /* other */) { count.ref(); } }; QBasicAtomicInt SPointer::count = Q_BASIC_ATOMIC_INITIALIZER(0); diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 1f0c2cee7e..f03e07ab38 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -3800,7 +3800,7 @@ class Model_11466 : public QAbstractItemModel { Q_OBJECT public: - Model_11466(QObject *parent) : + Model_11466(QObject * /* parent */) : m_block(false) { // set up the model to have two top level items and a few others @@ -3817,7 +3817,7 @@ public: return 2; // two top level items } - int columnCount(const QModelIndex &parent) const + int columnCount(const QModelIndex & /* parent */) const { return 2; } diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp index 2d33825e5c..895d7bff63 100644 --- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp @@ -924,6 +924,7 @@ void tst_QPainter::fillPrimitives_helper(QPainter *p, PrimitiveType type, Primit case Primitive_Float_RectPath: QBENCHMARK { p->drawPath(s->f_path_rect); } break; case Primitive_Float_2RectPath: QBENCHMARK { p->drawPath(s->f_path_2rects); } break; case Primitive_Float_EllipsePath: QBENCHMARK { p->drawPath(s->f_path_ellipse); } break; + case Primitive_Last_Primitive: break; } } diff --git a/tests/benchmarks/gui/painting/qtracebench/tst_qtracebench.cpp b/tests/benchmarks/gui/painting/qtracebench/tst_qtracebench.cpp index e71cfc6413..58566fe6a2 100644 --- a/tests/benchmarks/gui/painting/qtracebench/tst_qtracebench.cpp +++ b/tests/benchmarks/gui/painting/qtracebench/tst_qtracebench.cpp @@ -149,7 +149,7 @@ void ReplayWidget::paintEvent(QPaintEvent *) } } -void ReplayWidget::resizeEvent(QResizeEvent *event) +void ReplayWidget::resizeEvent(QResizeEvent * /* event */) { visibleUpdates.clear(); diff --git a/tests/benchmarks/gui/text/qtext/main.cpp b/tests/benchmarks/gui/text/qtext/main.cpp index 01e8c46bd8..97abc93b44 100644 --- a/tests/benchmarks/gui/text/qtext/main.cpp +++ b/tests/benchmarks/gui/text/qtext/main.cpp @@ -411,6 +411,7 @@ void tst_QText::paintLayoutToPixmap_painterFill() void tst_QText::document() { QTextDocument *doc = new QTextDocument; + Q_UNUSED(doc) QBENCHMARK { QTextDocument *doc = new QTextDocument; @@ -453,6 +454,7 @@ void tst_QText::paintDocToPixmap_painterFill() void tst_QText::control() { QTextControl *control = new QTextControl(m_shortLorem); + Q_UNUSED(control); QBENCHMARK { QTextControl *control = new QTextControl; diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index 9a07aa4940..a96fa63b5a 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -501,7 +501,7 @@ void tst_qnetworkreply::echoPerformance() QByteArray data; data.resize(1024*1024*10); // 10 MB // init with garbage. needed so ssl cannot compress it in an efficient way. - for (int i = 0; i < data.size() / sizeof(int); i++) { + for (size_t i = 0; i < data.size() / sizeof(int); i++) { int r = qrand(); data.data()[i*sizeof(int)] = r; } -- cgit v1.2.3