[PATCH] Make sure g_object_new receive the correct data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



g_object_new is a variadic function which take property values.
As compiler cannot check if these property values are correct
make sure they are using casts.
This actully fix a crash in reds.c for 32 bit architectures.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/main-dispatcher.c | 2 +-
 server/reds.c            | 4 ++--
 server/smartcard.c       | 4 ++--
 server/spicevmc.c        | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/server/main-dispatcher.c b/server/main-dispatcher.c
index bc0de24..93de440 100644
--- a/server/main-dispatcher.c
+++ b/server/main-dispatcher.c
@@ -292,7 +292,7 @@ MainDispatcher* main_dispatcher_new(RedsState *reds, SpiceCoreInterfaceInternal
     MainDispatcher *self = g_object_new(TYPE_MAIN_DISPATCHER,
                                         "spice-server", reds,
                                         "core-interface", core,
-                                        "max-message-type", MAIN_DISPATCHER_NUM_MESSAGES,
+                                        "max-message-type", (guint) MAIN_DISPATCHER_NUM_MESSAGES,
                                         NULL);
     return self;
 }
diff --git a/server/reds.c b/server/reds.c
index 4fd1d35..5ec73b7 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -4379,8 +4379,8 @@ static RedCharDeviceVDIPort *red_char_device_vdi_port_new(RedsState *reds)
 {
     return g_object_new(RED_TYPE_CHAR_DEVICE_VDIPORT,
                         "spice-server", reds,
-                        "client-tokens-interval", REDS_TOKENS_TO_SEND,
-                        "self-tokens", REDS_NUM_INTERNAL_AGENT_MESSAGES,
+                        "client-tokens-interval", (guint64) REDS_TOKENS_TO_SEND,
+                        "self-tokens", (guint64) REDS_NUM_INTERNAL_AGENT_MESSAGES,
                         "opaque", reds,
                         NULL);
 }
diff --git a/server/smartcard.c b/server/smartcard.c
index 872aa1d..9b1b3d6 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -261,8 +261,8 @@ static RedCharDeviceSmartcard *smartcard_device_new(RedsState *reds, SpiceCharDe
     char_dev = g_object_new(RED_TYPE_CHAR_DEVICE_SMARTCARD,
                             "sin", sin,
                             "spice-server", reds,
-                            "client-tokens-interval", 0ULL,
-                            "self-tokens", ~0ULL,
+                            "client-tokens-interval", (guint64) 0ULL,
+                            "self-tokens", (guint64) ~0ULL,
                             NULL);
 
     g_object_set(char_dev, "opaque", char_dev, NULL);
diff --git a/server/spicevmc.c b/server/spicevmc.c
index b662d94..a863e39 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -580,8 +580,8 @@ red_char_device_spicevmc_new(SpiceCharDeviceInstance *sin,
     return g_object_new(RED_TYPE_CHAR_DEVICE_SPICEVMC,
                         "sin", sin,
                         "spice-server", reds,
-                        "client-tokens-interval", 0ULL,
-                        "self-tokens", ~0ULL,
+                        "client-tokens-interval", (guint64) 0ULL,
+                        "self-tokens", (guint64) ~0ULL,
                         "opaque", opaque,
                         NULL);
 }
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]