[Spice-commits] 2 commits - server/tests

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Jan 9 16:53:54 UTC 2018


 server/tests/replay.c            |    2 +-
 server/tests/test-channel.c      |    6 +++---
 server/tests/test-display-base.c |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit e26cbdb175383246391f9bdc4e62d5339f71350c
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Jan 5 11:47:47 2018 +0000

    tests: Avoid cast from integer of wrong size
    
    These cast causes warnings if a 32 bit target is used.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

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;
commit ddf3b836bb7a03a5e7b07a78656a3e6053018737
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Jan 5 11:46:26 2018 +0000

    test-channel: Use correct endianness for ack message
    
    Network fields should be encoded as little endian.
    This was discovered using an emulated MIPS machine.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/tests/test-channel.c b/server/tests/test-channel.c
index fb3db389..455711eb 100644
--- a/server/tests/test-channel.c
+++ b/server/tests/test-channel.c
@@ -189,9 +189,9 @@ static void send_ack_sync(int socket, uint32_t generation)
         uint32_t generation;
     } msg;
     SPICE_VERIFY(sizeof(msg) == 12);
-    msg.type = SPICE_MSGC_ACK_SYNC;
-    msg.len = sizeof(generation);
-    msg.generation = generation;
+    msg.type = GUINT16_TO_LE(SPICE_MSGC_ACK_SYNC);
+    msg.len = GUINT32_TO_LE(sizeof(generation));
+    msg.generation = GUINT32_TO_LE(generation);
 
     g_assert_cmpint(write(socket, &msg.type, 10), ==, 10);
 }


More information about the Spice-commits mailing list