[Spice-devel] [spice-gtk PATCH 1/2] ppc: Fix header endianess

Lukas Venhoda lvenhoda at redhat.com
Thu Jun 18 10:51:17 PDT 2015


From: Fabiano FidĂȘncio <fidencio at redhat.com>

---
 src/spice-channel.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/spice-channel.c b/src/spice-channel.c
index c67e0aa..e247ba5 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -372,9 +372,9 @@ static inline void spice_header_set_msg_type(uint8_t *header, gboolean is_mini_h
                                              uint16_t type)
 {
     if (is_mini_header) {
-        ((SpiceMiniDataHeader *)header)->type = type;
+        ((SpiceMiniDataHeader *)header)->type = GUINT16_TO_LE(type);
     } else {
-        ((SpiceDataHeader *)header)->type = type;
+        ((SpiceDataHeader *)header)->type = GUINT16_TO_LE(type);
     }
 }

@@ -382,9 +382,9 @@ static inline void spice_header_set_msg_size(uint8_t *header, gboolean is_mini_h
                                              uint32_t size)
 {
     if (is_mini_header) {
-        ((SpiceMiniDataHeader *)header)->size = size;
+        ((SpiceMiniDataHeader *)header)->size = GUINT32_TO_LE(size);
     } else {
-        ((SpiceDataHeader *)header)->size = size;
+        ((SpiceDataHeader *)header)->size = GUINT32_TO_LE(size);
     }
 }

@@ -392,9 +392,9 @@ G_GNUC_INTERNAL
 uint16_t spice_header_get_msg_type(uint8_t *header, gboolean is_mini_header)
 {
     if (is_mini_header) {
-        return ((SpiceMiniDataHeader *)header)->type;
+        return GUINT16_FROM_LE(((SpiceMiniDataHeader *)header)->type);
     } else {
-        return ((SpiceDataHeader *)header)->type;
+        return GUINT16_FROM_LE(((SpiceDataHeader *)header)->type);
     }
 }

@@ -402,9 +402,9 @@ G_GNUC_INTERNAL
 uint32_t spice_header_get_msg_size(uint8_t *header, gboolean is_mini_header)
 {
     if (is_mini_header) {
-        return ((SpiceMiniDataHeader *)header)->size;
+        return GUINT32_FROM_LE(((SpiceMiniDataHeader *)header)->size);
     } else {
-        return ((SpiceDataHeader *)header)->size;
+        return GUINT32_FROM_LE(((SpiceDataHeader *)header)->size);
     }
 }

@@ -417,7 +417,7 @@ static inline void spice_header_set_msg_serial(uint8_t *header, gboolean is_mini
                                                uint64_t serial)
 {
     if (!is_mini_header) {
-        ((SpiceDataHeader *)header)->serial = serial;
+        ((SpiceDataHeader *)header)->serial = GUINT64_TO_LE(serial);
     }
 }

@@ -456,7 +456,7 @@ static inline uint32_t spice_header_get_msg_sub_list(uint8_t *header, gboolean i
     if (is_mini_header) {
         return 0;
     } else {
-        return ((SpiceDataHeader *)header)->sub_list;
+        return GUINT32_FROM_LE(((SpiceDataHeader *)header)->sub_list);
     }
 }

--
2.4.3



More information about the Spice-devel mailing list