diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-02-26 11:09:03 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-02-26 10:41:01 +0000 |
commit | 1ed9193c43fae147d9df56b144b9bcf18590ebe8 (patch) | |
tree | 2d76d1a5c50e714667b5c64ce9c92b2ff8e022b7 /tests | |
parent | 8a3f5d0b9c5a9a925431590cf8bbd99bbbed8cd3 (diff) |
tst_qpixmap: Fix warnings as shown by Qt Creator's Clang based code model.
Remove C-style casts and fix integer conversion issues.
Task-number: QTBUG-50804
Task-number: QTBUG-51124
Change-Id: I6e30a7e62f3f8d389d0b3d1ba81dad2df8417d04
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index f03da61..39a665a 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -97,18 +97,18 @@ void tst_QPixmap::toHBITMAP() QVERIFY(GetObject(bitmap, sizeof(BITMAP), &bitmapInfo)); - QCOMPARE(100, (int) bitmapInfo.bmWidth); - QCOMPARE(100, (int) bitmapInfo.bmHeight); + QCOMPARE(LONG(100), bitmapInfo.bmWidth); + QCOMPARE(LONG(100), bitmapInfo.bmHeight); const HDC displayDc = GetDC(0); const HDC bitmapDc = CreateCompatibleDC(displayDc); - const HBITMAP nullBitmap = (HBITMAP) SelectObject(bitmapDc, bitmap); + const HBITMAP nullBitmap = static_cast<HBITMAP>(SelectObject(bitmapDc, bitmap)); const COLORREF pixel = GetPixel(bitmapDc, 0, 0); - QCOMPARE((int)GetRValue(pixel), red); - QCOMPARE((int)GetGValue(pixel), green); - QCOMPARE((int)GetBValue(pixel), blue); + QCOMPARE(int(GetRValue(pixel)), red); + QCOMPARE(int(GetGValue(pixel)), green); + QCOMPARE(int(GetBValue(pixel)), blue); // Clean up SelectObject(bitmapDc, nullBitmap); @@ -266,7 +266,9 @@ void tst_QPixmap::fromHICON() const QString iconFileName = image + QStringLiteral(".ico"); QVERIFY2(QFileInfo(iconFileName).exists(), qPrintable(iconFileName)); - const HICON icon = (HICON)LoadImage(0, (wchar_t*)(iconFileName).utf16(), IMAGE_ICON, width, height, LR_LOADFROMFILE); + const HICON icon = + static_cast<HICON>(LoadImage(0, reinterpret_cast<const wchar_t *>(iconFileName.utf16()), + IMAGE_ICON, width, height, LR_LOADFROMFILE)); const QImage imageFromHICON = QtWin::fromHICON(icon).toImage(); DestroyIcon(icon); |