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>
This commit is contained in:
Friedemann Kleint 2015-01-15 14:00:19 +01:00
parent 1bbcad9e5e
commit 205f68f8ad
10 changed files with 15 additions and 16 deletions

View File

@ -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)

View File

@ -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);
}

View File

@ -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
{

View File

@ -36,9 +36,7 @@
#include <qfile.h>
#include <QPainterPathStroker>
#define _USE_MATH_DEFINES
#include <math.h>
#include <qmath.h>
class tst_QPainterPathStroker : public QObject
{

View File

@ -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());

View File

@ -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

View File

@ -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];

View File

@ -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) {

View File

@ -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);

View File

@ -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();