From a227ea5bd5af50ac6f874ecf764858a43c53cada Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 10 Dec 2018 15:18:07 +0100 Subject: [PATCH] Fix warnings building with --std=c++11 and gcc 8 Silence warnings about signed constants being shifted out of int range. Change-Id: I5dc397de71f4de09e54ce3cbc0f8e3a1cf977b03 Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.h | 2 +- src/opengl/qgl.cpp | 2 +- .../fontdatabases/freetype/qfontengine_ft.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index ae1869f89e..9d1ce51da5 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -96,7 +96,7 @@ class Q_CORE_EXPORT QDebug void setVerbosity(int v) { if (context.version > 1) { - flags &= ~(VerbosityMask << VerbosityShift); + flags &= ~(uint(VerbosityMask) << VerbosityShift); flags |= (v & VerbosityMask) << VerbosityShift; } } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index a5556ccee3..ba4a1dcaa1 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -157,7 +157,7 @@ class QGLDefaultOverlayFormat: public QGLFormat public: inline QGLDefaultOverlayFormat() { - setOption(QGL::FormatOption(0xffff << 16)); // turn off all options + setOption(QGL::FormatOption(0xffffU << 16)); // turn off all options setOption(QGL::DirectRendering); setPlane(1); } diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 7b4f6aa107..04a5026395 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -591,7 +591,7 @@ static void convertRGBToARGB_helper(const uchar *src, uint *dst, int width, int uchar green = src[x + 1]; uchar blue = src[x + 1 + offs]; LcdFilter::filterPixel(red, green, blue); - *dd++ = (0xFF << 24) | (red << 16) | (green << 8) | blue; + *dd++ = (0xFFU << 24) | (red << 16) | (green << 8) | blue; } dst += width; src += src_pitch; @@ -616,7 +616,7 @@ static void convertRGBToARGB_V_helper(const uchar *src, uint *dst, int width, in uchar green = src[x + src_pitch]; uchar blue = src[x + src_pitch + offs]; LcdFilter::filterPixel(red, green, blue); - *dst++ = (0XFF << 24) | (red << 16) | (green << 8) | blue; + *dst++ = (0XFFU << 24) | (red << 16) | (green << 8) | blue; } src += 3*src_pitch; } @@ -637,7 +637,7 @@ static inline void convertGRAYToARGB(const uchar *src, uint *dst, int width, int const uchar * const e = p + width; while (p < e) { uchar gray = *p++; - *dst++ = (0xFF << 24) | (gray << 16) | (gray << 8) | gray; + *dst++ = (0xFFU << 24) | (gray << 16) | (gray << 8) | gray; } src += src_pitch; }