diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-01-15 14:00:19 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-01-17 12:06:59 +0100 |
commit | 205f68f8ad866857ccac58799fa1ab932ee06773 (patch) | |
tree | eea1d7d3510adfc8a7c05ee66e882069bae50ec8 | |
parent | 1bbcad9e5e011dedd7706a10e221a6f442781df9 (diff) |
Fix assorted MSVC warnings in tests.
tst_collections.cpp
tst_collections.cpp(3138) : warning C4305: 'argument' : truncation from 'size_t' to 'bool'
tst_collections.cpp(3190) : see reference to function template instantiation 'void testContainerTypedefs<QVector<int>>(Container)' being compiled
with[Container=QVector<int>]
(repeated)
tst_qringbuffer.cpp(297) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
tst_qringbuffer.cpp(300) : warning C4309: '=' : truncation of constant value
tst_qringbuffer.cpp(306) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
tst_qrawfont.cpp(947) : warning C4309: 'argument' : truncation of constant value
tst_qsslsocket_onDemandCertificates_member.cpp(217) : warning C4189: 'rootCertLoadingAllowed' : local variable is initialized but not referenced
Change-Id: I6143d4ad121088a0d5bdd6dd2637eb3641a26096
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
10 files changed, 15 insertions, 16 deletions
diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index 1dfe01663f..78d3e9e2b8 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -3129,7 +3129,7 @@ void tst_Collections::qtimerList() QFAIL("QList preallocates too much memory"); } -#define QVERIFY_TYPE(Type) QVERIFY(sizeof(Type)) +#define QVERIFY_TYPE(Type) QVERIFY(sizeof(Type) > 0) template <typename Container> void testContainerTypedefs(Container container) diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp index d892125c87..33f1b25519 100644 --- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp +++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp @@ -294,16 +294,16 @@ void tst_QRingBuffer::readLine() char stringBuf[102]; stringBuf[101] = 0; // non-crash terminator QVERIFY(ringBuffer.readLine(stringBuf, sizeof(stringBuf) - 2) == ba1.size()); - QVERIFY(QByteArray(stringBuf, strlen(stringBuf)) == ba1); + QVERIFY(QByteArray(stringBuf, int(strlen(stringBuf))) == ba1); // check first empty string reading - stringBuf[0] = 0xFF; - QCOMPARE(ringBuffer.readLine(stringBuf, sizeof(stringBuf) - 2), ba2.size()); + stringBuf[0] = char(0xFF); + QCOMPARE(ringBuffer.readLine(stringBuf, int(sizeof(stringBuf)) - 2), ba2.size()); QVERIFY(stringBuf[0] == ba2[0]); - QVERIFY(ringBuffer.readLine(stringBuf, sizeof(stringBuf) - 2) == (ba3.size() + ba4.size() + QVERIFY(ringBuffer.readLine(stringBuf, int(sizeof(stringBuf)) - 2) == (ba3.size() + ba4.size() + ba2.size())); - QVERIFY(QByteArray(stringBuf, strlen(stringBuf)) == (ba3 + ba4 + ba2)); + QVERIFY(QByteArray(stringBuf, int(strlen(stringBuf))) == (ba3 + ba4 + ba2)); QVERIFY(ringBuffer.size() == 0); } diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index a03bf2ba4e..6bfec61363 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -37,9 +37,7 @@ #include <qfile.h> #include <qpainterpath.h> #include <qpen.h> - -#define _USE_MATH_DEFINES -#include <math.h> +#include <qmath.h> class tst_QPainterPath : public QObject { diff --git a/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp b/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp index f55260c572..3bccfb75f7 100644 --- a/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp +++ b/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp @@ -36,9 +36,7 @@ #include <qfile.h> #include <QPainterPathStroker> - -#define _USE_MATH_DEFINES -#include <math.h> +#include <qmath.h> class tst_QPainterPathStroker : public QObject { diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index bd4da12ea3..df7de2b3b7 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -944,7 +944,7 @@ void tst_QRawFont::rawFontFromInvalidData() QVERIFY(!font.isValid()); - invalidData.fill(255, 1024); + invalidData.fill(char(255), 1024); font.loadFromData(invalidData, 10, QFont::PreferDefaultHinting); QVERIFY(!font.isValid()); diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp index 94d7c3905c..7f4f2ed2ad 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp @@ -227,6 +227,7 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe bool works; #if defined (Q_OS_WIN) works = false; // on Windows, this won't work even though we use on demand loading + Q_UNUSED(rootCertLoadingAllowed) #else works = rootCertLoadingAllowed; #endif diff --git a/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp b/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp index bddffc2c6a..352968729e 100644 --- a/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp @@ -33,7 +33,7 @@ #include <stdio.h> -int main(int argc, char **argv) +int main(int, char **argv) { const char *msg = argv[1]; char buf[2]; diff --git a/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp b/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp index 0694003e0a..0d1014a6ff 100644 --- a/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp +++ b/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp @@ -130,7 +130,7 @@ void DownloadManager::proxyAuthenticationRequired(const QNetworkProxy &, QAuthen } #ifndef QT_NO_SSL -void DownloadManager::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors) +void DownloadManager::sslErrors(QNetworkReply *, const QList<QSslError> &errors) { qDebug() << "sslErrors"; foreach (const QSslError &error, errors) { diff --git a/tests/manual/qnetworkreply/main.cpp b/tests/manual/qnetworkreply/main.cpp index 9d199c3755..f91309502b 100644 --- a/tests/manual/qnetworkreply/main.cpp +++ b/tests/manual/qnetworkreply/main.cpp @@ -180,6 +180,8 @@ void tst_qnetworkreply::setSslConfiguration() QCOMPARE(rootCertLoadingAllowed, true); #elif defined(Q_OS_MAC) QCOMPARE(rootCertLoadingAllowed, false); +#else + Q_UNUSED(rootCertLoadingAllowed) #endif // other platforms: undecided (Windows: depends on the version) if (works) { QCOMPARE(reply->error(), QNetworkReply::NoError); diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp index 5c06a9a646..2981bb9bf1 100644 --- a/tests/manual/windowflags/controllerwindow.cpp +++ b/tests/manual/windowflags/controllerwindow.cpp @@ -102,7 +102,7 @@ ControllerWindow::ControllerWindow() : previewWidget(0) updatePreview(); } -bool ControllerWindow::eventFilter(QObject *o, QEvent *e) +bool ControllerWindow::eventFilter(QObject *, QEvent *e) { if (e->type() == QEvent::WindowStateChange) updateStateControl(); |