[Spice-devel] [spice-common][PATCH 2/2] ppc: Fix quic magic endianess

Fabiano FidĂȘncio fidencio at redhat.com
Mon May 18 06:10:58 PDT 2015


---
 common/quic.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/quic.c b/common/quic.c
index 16290d4..0fbe6c5 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"
@@ -1277,7 +1279,7 @@ int quic_encode(QuicContext *quic, QuicImageType type, int width, int height,
     encoder->io_word = 0;
     encoder->io_available_bits = 32;
 
-    encode_32(encoder, QUIC_MAGIC);
+    encode_32(encoder, GUINT32_TO_LE(QUIC_MAGIC));
     encode_32(encoder, QUIC_VERSION);
     encode_32(encoder, type);
     encode_32(encoder, width);
@@ -1411,7 +1413,7 @@ int quic_decode_begin(QuicContext *quic, uint32_t *io_ptr, unsigned int num_io_w
 
     init_decode_io(encoder);
 
-    magic = encoder->io_word;
+    magic = GUINT32_FROM_LE(encoder->io_word);
     decode_eat32bits(encoder);
     if (magic != QUIC_MAGIC) {
         encoder->usr->warn(encoder->usr, "bad magic\n");
-- 
2.4.0



More information about the Spice-devel mailing list