Fix some compiler warnings in benchmark tests.

main.cpp(332) : warning C4307: '*' : integral constant overflow
tst_qpainter.cpp(1293) : warning C4305: '+=' : truncation from 'double' to 'float'
tst_qpainter.cpp(1474) : warning C4305: '+=' : truncation from 'double' to 'float'
tst_qtbench.cpp(155) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
main.cpp(68) : warning C4189: 'fontHeight' : local variable is initialized but not referenced

Change-Id: If6aadd50df7c5cf7d0f33791c9247730a47ddd27
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Friedemann Kleint 2014-07-10 09:40:51 +02:00
parent a55b01e038
commit eb66916082
4 changed files with 9 additions and 4 deletions

View File

@ -48,7 +48,11 @@ class tst_QDateTime : public QObject
{
Q_OBJECT
enum {
enum
#if defined(Q_COMPILER_CLASS_ENUM) || (defined(Q_CC_MSVC) && _MSC_VER >= 1700)
: qint64
#endif
{
SECS_PER_DAY = 86400,
MSECS_PER_DAY = 86400000,
JULIAN_DAY_1950 = 2433283,

View File

@ -1290,7 +1290,7 @@ void tst_QPainter::drawScaledAntialiasedRoundedRect_data()
{
QTest::addColumn<float>("scale");
for (float i = 0; i < 3; i += .1)
for (float i = 0; i < 3; i += .1f)
QTest::newRow(QString(QLatin1String("scale=%1")).arg(i).toLatin1()) << i;
}
@ -1471,7 +1471,7 @@ void tst_QPainter::drawScaledBorderPixmapRoundedRect_data()
QTest::addColumn<float>("scale");
QTest::addColumn<int>("imageType");
for (float i = 0; i < 3; i += .1)
for (float i = 0; i < 3; i += .1f)
QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB32_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB32_Premultiplied;
//for (float i = 0; i < 3; i += .1)
// QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied;

View File

@ -152,7 +152,7 @@ private slots:
QString makeString(int length)
{
const char chars[] = "abcd efgh ijkl mnop qrst uvwx yz!$. ABCD 1234";
int len = strlen(chars);
const int len = int(strlen(chars));
QString ret;
for (int j = 0; j < length; j++) {

View File

@ -66,6 +66,7 @@ private:
void tst_QFontMetrics::testQFontMetrics( const QFontMetrics &fm )
{
int fontHeight = fm.height();
Q_UNUSED(fontHeight)
}
void tst_QFontMetrics::fontmetrics_create()