Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.2
-
None
-
8f1851013363ae22d311881abcb1186949068270
Description
/home/rutledge/dev/qt511/qtbase/src/plugins/platforms/xcb/qxcbimage.cpp: In function ‘QImage::Format {anonymous}::imageFormatForMasks(int, int, int, int)’: /home/rutledge/dev/qt511/qtbase/src/plugins/platforms/xcb/qxcbimage.cpp:72:26: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if (red_mask == 0xff000000 && blue_mask == 0xff00) ^ /home/rutledge/dev/qt511/qtbase/src/plugins/platforms/xcb/qxcbimage.cpp:93:26: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if (red_mask == 0xff000000 && blue_mask == 0xff00) ^
06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 68) #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 69) if (red_mask == 0xff && blue_mask == 0xff0000) 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 70) return QImage::Format_RGBA8888_Premultiplied; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 71) #else 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 72) if (red_mask == 0xff000000 && blue_mask == 0xff00) 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 73) return QImage::Format_RGBA8888_Premultiplied; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 74) #endif 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 75) if (red_mask == 0x3ff && blue_mask == 0x3ff00000) 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 76) return QImage::Format_A2BGR30_Premultiplied; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 77) if (red_mask == 0x3ff00000 && blue_mask == 0x3ff) 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 78) return QImage::Format_A2RGB30_Premultiplied; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 79) break; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 80) case 30: 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 81) if (red_mask == 0x3ff && blue_mask == 0x3ff00000) 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 82) return QImage::Format_BGR30; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 83) if (blue_mask == 0x3ff && red_mask == 0x3ff00000) 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 84) return QImage::Format_RGB30; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 85) break; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 86) case 24: 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 87) if (red_mask == 0xff0000 && blue_mask == 0xff) 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 88) return QImage::Format_RGB32; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 89) #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 90) if (red_mask == 0xff && blue_mask == 0xff0000) 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 91) return QImage::Format_RGBX8888; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 92) #else 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 93) if (red_mask == 0xff000000 && blue_mask == 0xff00) 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 94) return QImage::Format_RGBX8888; 06089a19 (Allan Sandfeld Jensen 2017-09-28 14:10:10 +0200 95) #endif
0xff000000 is too big for a signed 32-bit int, so we need some sort of cast, either to unsigned or to 64-bit. Then again, why does this function take them as signed ints?
Attachments
For Gerrit Dashboard: QTBUG-69923 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
236729,3 | Silence warning about comparing signed and unsigned | 5.11 | qt/qtbase | Status: MERGED | +2 | 0 |