[Spice-devel] [PATCH spice-common] quic: Fix endianness encoding

Frediano Ziglio fziglio at redhat.com
Mon Jun 4 09:28:47 UTC 2018


The image is going to network and network protocol is little endian
so the numbers has to be little endian. Note that this is already done
during decoding.
Tested on a ppc64 machine.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 common/quic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/quic.c b/common/quic.c
index 1ec6baa..e31f789 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -393,7 +393,7 @@ static inline void write_io_word(Encoder *encoder)
     if (encoder->io_now == encoder->io_end) {
         more_io_words(encoder);
     }
-    *(encoder->io_now++) = encoder->io_word;
+    *(encoder->io_now++) = GUINT32_TO_LE(encoder->io_word);
 }
 
 static inline void encode(Encoder *encoder, unsigned int word, unsigned int len)
-- 
2.17.1



More information about the Spice-devel mailing list