[Spice-devel] [PATCH v2 3/6] ppc: Fixing endianness for channel messages

Christophe Fergeau cfergeau at redhat.com
Tue Feb 10 01:15:01 PST 2015


This is a modified version of a patch initially from
Erlon R. Cruz <erlon.cruz at br.flextronics.com>
---
 server/red_channel.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/server/red_channel.c b/server/red_channel.c
index eb2419c..6dc9bf1 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -121,47 +121,47 @@ static void red_channel_client_unref(RedChannelClient *rcc);
 
 static uint32_t full_header_get_msg_size(SpiceDataHeaderOpaque *header)
 {
-    return ((SpiceDataHeader *)header->data)->size;
+    return GUINT32_FROM_LE(((SpiceDataHeader *)header->data)->size);
 }
 
 static uint32_t mini_header_get_msg_size(SpiceDataHeaderOpaque *header)
 {
-    return ((SpiceMiniDataHeader *)header->data)->size;
+    return GUINT32_FROM_LE(((SpiceMiniDataHeader *)header->data)->size);
 }
 
 static uint16_t full_header_get_msg_type(SpiceDataHeaderOpaque *header)
 {
-    return ((SpiceDataHeader *)header->data)->type;
+    return GUINT16_FROM_LE(((SpiceDataHeader *)header->data)->type);
 }
 
 static uint16_t mini_header_get_msg_type(SpiceDataHeaderOpaque *header)
 {
-    return ((SpiceMiniDataHeader *)header->data)->type;
+    return GUINT16_FROM_LE(((SpiceMiniDataHeader *)header->data)->type);
 }
 
 static void full_header_set_msg_type(SpiceDataHeaderOpaque *header, uint16_t type)
 {
-    ((SpiceDataHeader *)header->data)->type = type;
+    ((SpiceDataHeader *)header->data)->type = GUINT16_TO_LE(type);
 }
 
 static void mini_header_set_msg_type(SpiceDataHeaderOpaque *header, uint16_t type)
 {
-    ((SpiceMiniDataHeader *)header->data)->type = type;
+    ((SpiceMiniDataHeader *)header->data)->type = GUINT16_TO_LE(type);
 }
 
 static void full_header_set_msg_size(SpiceDataHeaderOpaque *header, uint32_t size)
 {
-    ((SpiceDataHeader *)header->data)->size = size;
+    ((SpiceDataHeader *)header->data)->size = GUINT32_TO_LE(size);
 }
 
 static void mini_header_set_msg_size(SpiceDataHeaderOpaque *header, uint32_t size)
 {
-    ((SpiceMiniDataHeader *)header->data)->size = size;
+    ((SpiceMiniDataHeader *)header->data)->size = GUINT32_TO_LE(size);
 }
 
 static void full_header_set_msg_serial(SpiceDataHeaderOpaque *header, uint64_t serial)
 {
-    ((SpiceDataHeader *)header->data)->serial = serial;
+    ((SpiceDataHeader *)header->data)->serial = GUINT64_TO_LE(serial);
 }
 
 static void mini_header_set_msg_serial(SpiceDataHeaderOpaque *header, uint64_t serial)
@@ -171,7 +171,7 @@ static void mini_header_set_msg_serial(SpiceDataHeaderOpaque *header, uint64_t s
 
 static void full_header_set_msg_sub_list(SpiceDataHeaderOpaque *header, uint32_t sub_list)
 {
-    ((SpiceDataHeader *)header->data)->sub_list = sub_list;
+    ((SpiceDataHeader *)header->data)->sub_list = GUINT32_TO_LE(sub_list);
 }
 
 static void mini_header_set_msg_sub_list(SpiceDataHeaderOpaque *header, uint32_t sub_list)
-- 
2.1.0



More information about the Spice-devel mailing list