[Spice-devel] [PATCH spice 2/2] client-x11: Fix building with gcc-4.7

Hans de Goede hdegoede at redhat.com
Fri Jan 13 06:28:16 PST 2012


Without this change gcc says:
x11/res.cpp:31:1: error: narrowing conversion of ‘(((unsigned int)_alt_image.<anonymous struct>::width) * 4u)’ from ‘unsigned int’ to ‘int’ inside { } is ill-formed in C++11 [-Werror=narrowing]
x11/res.cpp:61:1: error: narrowing conversion of ‘_red_icon.<anonymous struct>::width’ from ‘const uint32_t {aka const unsigned int}’ to ‘int’ inside { } is ill-formed in C++11 [-Werror=narrowing]
x11/res.cpp:61:1: error: narrowing conversion of ‘_red_icon.<anonymous struct>::height’ from ‘const uint32_t {aka const unsigned int}’ to ‘int’ inside { } is ill-formed in C++11 [-Werror=narrowing]
cc1plus: all warnings being treated as errors

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 client/x11/images/alt_image.c |    4 ++--
 client/x11/images/red_icon.c  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/client/x11/images/alt_image.c b/client/x11/images/alt_image.c
index 7968339..e11cf1f 100644
--- a/client/x11/images/alt_image.c
+++ b/client/x11/images/alt_image.c
@@ -1,6 +1,6 @@
 static const struct {
-	uint32_t width;
-	uint32_t height;
+	int width;
+	int height;
 	uint8_t pixel_data[17496];
 } _alt_image = { 81, 54, {
 		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
diff --git a/client/x11/images/red_icon.c b/client/x11/images/red_icon.c
index ce1a7d4..143d4e2 100644
--- a/client/x11/images/red_icon.c
+++ b/client/x11/images/red_icon.c
@@ -1,6 +1,6 @@
 static const struct {
-    uint32_t width;
-    uint32_t height;
+    int width;
+    int height;
     uint8_t pixmap[4096];
     uint8_t mask[128];
 } _red_icon = { 32, 32, {
-- 
1.7.7.4



More information about the Spice-devel mailing list