[Spice-devel] [PATCH spice-server] tests: Avoid cast from integer of wrong size

Frediano Ziglio fziglio at redhat.com
Fri Jan 5 12:12:01 UTC 2018


These cast causes warnings if a 32 bit target is used.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/tests/replay.c            | 2 +-
 server/tests/test-display-base.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/tests/replay.c b/server/tests/replay.c
index e459ca26..0ceb7271 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -225,7 +225,7 @@ static void end_replay(void)
 
 static void release_resource(QXLInstance *qin, struct QXLReleaseInfoExt release_info)
 {
-    spice_replay_free_cmd(replay, (QXLCommandExt *)release_info.info->id);
+    spice_replay_free_cmd(replay, (QXLCommandExt *)(uintptr_t)release_info.info->id);
 }
 
 static int get_cursor_command(QXLInstance *qin, struct QXLCommandExt *ext)
diff --git a/server/tests/test-display-base.c b/server/tests/test-display-base.c
index 2677eb42..220c1fd8 100644
--- a/server/tests/test-display-base.c
+++ b/server/tests/test-display-base.c
@@ -64,7 +64,7 @@ static void test_spice_destroy_update(SimpleSpiceUpdate *update)
         return;
     }
     if (update->drawable.clip.type != SPICE_CLIP_TYPE_NONE) {
-        uint8_t *ptr = (uint8_t*)update->drawable.clip.data;
+        uint8_t *ptr = (uint8_t*)(uintptr_t)update->drawable.clip.data;
         g_free(ptr);
     }
     g_free(update->bitmap);
@@ -401,7 +401,7 @@ static void create_primary_surface(Test *test, uint32_t width,
     surface.flags      = 0;
     surface.type       = 0;    /* unused by red_worker */
     surface.position   = 0;    /* unused by red_worker */
-    surface.mem        = (uint64_t)&test->primary_surface;
+    surface.mem        = (uintptr_t)&test->primary_surface;
     surface.group_id   = MEM_SLOT_GROUP_ID;
 
     test->width = width;
-- 
2.14.3



More information about the Spice-devel mailing list