include: Avoid overflow (warning) in RGBA_MAKE.
Gerald Pfeifer
gerald at pfeifer.com
Mon Sep 5 16:20:54 CDT 2016
If the fourth parameter (named a) in RGBA_MAKE is an int,
shifting it by 24 will result in a "potential overflow"
warning by GCC 6 and later.
Properly casting to unsigned avoids this.
Gerald
Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
---
include/d3dtypes.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/d3dtypes.h b/include/d3dtypes.h
index 75aee55..908b2ce 100644
--- a/include/d3dtypes.h
+++ b/include/d3dtypes.h
@@ -53,7 +53,7 @@ typedef LONG D3DFIXED;
#define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff)
#define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff)
#define RGBA_GETBLUE(rgb) ((rgb) & 0xff)
-#define RGBA_MAKE(r, g, b, a) ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
+#define RGBA_MAKE(r, g, b, a) ((D3DCOLOR) (((unsigned)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
#define D3DRGB(r, g, b) \
(0xff000000 | ( ((LONG)((r) * 255)) << 16) | (((LONG)((g) * 255)) << 8) | (LONG)((b) * 255))
--
2.9.2
More information about the wine-patches
mailing list