[Spice-devel] [spice-common PATCH 3/3] ppc: Fix quic decode endianess

Lukas Venhoda lvenhoda at redhat.com
Thu Jun 18 10:50:28 PDT 2015


Converts all decoded words in quic from little endian to local
machine endianness.
---
 common/quic.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/common/quic.c b/common/quic.c
index 498b9cc..a9bd215 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -23,6 +23,8 @@
 #include <config.h>
 #endif

+#include <glib.h>
+
 #include "quic.h"
 #include "spice_common.h"
 #include "bitops.h"
@@ -477,7 +479,7 @@ static inline void flush(Encoder *encoder)
 static void __read_io_word(Encoder *encoder)
 {
     more_io_words(encoder);
-    encoder->io_next_word = *(encoder->io_now++);
+    encoder->io_next_word = GUINT32_FROM_LE(*(encoder->io_now++));
 }

 static void (*__read_io_word_ptr)(Encoder *encoder) = __read_io_word;
@@ -490,7 +492,7 @@ static inline void read_io_word(Encoder *encoder)
         return;
     }
     spice_assert(encoder->io_now < encoder->io_end);
-    encoder->io_next_word = *(encoder->io_now++);
+    encoder->io_next_word = GUINT32_FROM_LE(*(encoder->io_now++));
 }

 static inline void decode_eatbits(Encoder *encoder, int len)
@@ -764,7 +766,7 @@ static inline unsigned int decode_run(Encoder *encoder)

 static inline void init_decode_io(Encoder *encoder)
 {
-    encoder->io_next_word = encoder->io_word = *(encoder->io_now++);
+    encoder->io_next_word = encoder->io_word = GUINT32_FROM_LE(*(encoder->io_now++));
     encoder->io_available_bits = 0;
 }

--
2.4.3



More information about the Spice-devel mailing list