[Spice-devel] [spice-server PATCH v2 08/10] unaligned type with spice_marshaller_reserve_space

Victor Toso victortoso at redhat.com
Fri Aug 14 09:24:29 PDT 2015


---
 server/char_device.c | 6 ++++--
 server/red_worker.c  | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/server/char_device.c b/server/char_device.c
index 54357f0..27681d3 100644
--- a/server/char_device.c
+++ b/server/char_device.c
@@ -920,8 +920,10 @@ void spice_char_device_state_migrate_data_marshall(SpiceCharDeviceState *dev,
     spice_marshaller_add_uint8(m, 1); /* connected */
     spice_marshaller_add_uint32(m, client_state->num_client_tokens);
     spice_marshaller_add_uint32(m, client_state->num_send_tokens);
-    write_to_dev_size_ptr = (uint32_t *)spice_marshaller_reserve_space(m, sizeof(uint32_t));
-    write_to_dev_tokens_ptr = (uint32_t *)spice_marshaller_reserve_space(m, sizeof(uint32_t));
+    write_to_dev_size_ptr = SPICE_UNALIGNED_CAST(uint32_t,
+            spice_marshaller_reserve_space(m, sizeof(uint32_t)));
+    write_to_dev_tokens_ptr = SPICE_UNALIGNED_CAST(uint32_t,
+            spice_marshaller_reserve_space(m, sizeof(uint32_t)));
     *write_to_dev_size_ptr = 0;
     *write_to_dev_tokens_ptr = 0;
 
diff --git a/server/red_worker.c b/server/red_worker.c
index 1655bbe..dd731f5 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -8700,7 +8700,8 @@ static void display_channel_marshall_migrate_data_surfaces(DisplayChannelClient
     uint32_t *num_surfaces_created;
     uint32_t i;
 
-    num_surfaces_created = (uint32_t *)spice_marshaller_reserve_space(m2, sizeof(uint32_t));
+    num_surfaces_created = SPICE_UNALIGNED_CAST(uint32_t,
+            spice_marshaller_reserve_space(m2, sizeof(uint32_t)));
     *num_surfaces_created = 0;
     for (i = 0; i < NUM_SURFACES; i++) {
         SpiceRect lossy_rect;
-- 
2.4.3



More information about the Spice-devel mailing list