[Spice-commits] 4 commits - common/lz.c common/lz_common.h common/quic.c configure.ac m4/spice-deps.m4

Christophe Fergau teuf at kemper.freedesktop.org
Thu Jul 2 08:02:49 PDT 2015


 common/lz.c        |    4 +---
 common/lz_common.h |    3 ++-
 common/quic.c      |   11 +++++++----
 configure.ac       |    4 ----
 m4/spice-deps.m4   |    5 +++++
 5 files changed, 15 insertions(+), 12 deletions(-)

New commits:
commit 2d054e0e6901a1cfbe396f30d9899da46ff533d9
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jun 30 11:38:20 2015 +0200

    m4: Add compat AS_VAR_APPEND for older autoconf
    
    This causes failures on EL6 otherwise as autoconf is too old there.

diff --git a/configure.ac b/configure.ac
index 3a8c0e5..4287f92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,10 +12,6 @@ AC_CONFIG_AUX_DIR([build-aux])
 # For automake >= 1.12
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 
-# For autoconf <= 2.63
-m4_ifndef([AS_VAR_APPEND],
-          AC_DEFUN([AS_VAR_APPEND], $1=$$1$2))
-
 # Checks for programs
 AM_INIT_AUTOMAKE([1.11 dist-xz no-dist-gzip tar-ustar foreign -Wall -Werror])
 AM_MAINTAINER_MODE
diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index df35a92..68dec42 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -1,3 +1,8 @@
+# For autoconf < 2.63
+m4_ifndef([AS_VAR_APPEND],
+          AC_DEFUN([AS_VAR_APPEND], $1=$$1$2))
+
+
 # SPICE_CHECK_SYSDEPS()
 # ---------------------
 # Checks for header files and library functions needed by spice-common.
commit 6183bbde2470cbf2c212d00d1c4b782f23dcd638
Author: Lukas Venhoda <lvenhoda at redhat.com>
Date:   Mon Jun 29 14:58:26 2015 +0200

    ppc: Fix quic magic endianess
    
    Runtime conversion from a string to uint32 is storing the magic with the same
    endianness on both LE and BE machines. This requires aditional byte swap
    when sending magic between LE/BE machines.
    
    Changing quic magic to a constant will ensure, that it will be always stored in
    native endianness, and the second byte swap won't be needed.

diff --git a/common/quic.c b/common/quic.c
index bbd0206..a9bd215 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -37,7 +37,8 @@
 //#define RLE_PRED_3
 #define QUIC_RGB
 
-#define QUIC_MAGIC (*(uint32_t *)"QUIC")
+/* ASCII "QUIC" */
+#define QUIC_MAGIC 0x43495551
 #define QUIC_VERSION_MAJOR 0U
 #define QUIC_VERSION_MINOR 1U
 #define QUIC_VERSION ((QUIC_VERSION_MAJOR << 16) | (QUIC_VERSION_MAJOR & 0xffff))
commit 5a7e5876e6ec718b4288850ea7f94dcd55bdf92c
Author: Lukas Venhoda <lvenhoda at redhat.com>
Date:   Mon Jun 29 14:58:25 2015 +0200

    ppc: Fix lz magic endianess
    
    Commit d39dfbfe changes lz magic to be always treated as LE when encoded.
    
    Runtime conversion from a string to uint32 is storing the magic with the same
    endianness on both LE and BE machines. This requires aditional byte swap
    when sending magic between LE/BE machines.
    
    Changing lz magic to a constant will ensure, that it will be always stored in
    native endianness, and the second byte swap won't be needed.
    
    This commit reverts d39dfbfe changes in lz.c while keeping the rest.
    They will be needed in future commit for quic.c

diff --git a/common/lz.c b/common/lz.c
index 2350152..d1c4033 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -47,8 +47,6 @@
 #include <config.h>
 #endif
 
-#include <glib.h>
-
 #include "spice_common.h"
 #include "lz.h"
 
@@ -539,7 +537,7 @@ int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_do
         encoder->usr->error(encoder->usr, "lz encoder reading image segments failed\n");
     }
 
-    encode_32(encoder, GUINT32_TO_LE(LZ_MAGIC));
+    encode_32(encoder, LZ_MAGIC);
     encode_32(encoder, LZ_VERSION);
     encode_32(encoder, type);
     encode_32(encoder, width);
diff --git a/common/lz_common.h b/common/lz_common.h
index 8d4861b..78df003 100644
--- a/common/lz_common.h
+++ b/common/lz_common.h
@@ -63,7 +63,8 @@ verify(SPICE_N_ELEMENTS(IS_IMAGE_TYPE_RGB) == (LZ_IMAGE_TYPE_A8 + 1));
 verify(SPICE_N_ELEMENTS(PLT_PIXELS_PER_BYTE) == (LZ_IMAGE_TYPE_PLT8 + 1));
 verify(SPICE_N_ELEMENTS(RGB_BYTES_PER_PIXEL) == (LZ_IMAGE_TYPE_A8 + 1));
 
-#define LZ_MAGIC (*(uint32_t *)"LZ  ")
+/* ASCII "LZ  " */
+#define LZ_MAGIC 0x20205a4c
 #define LZ_VERSION_MAJOR 1U
 #define LZ_VERSION_MINOR 1U
 #define LZ_VERSION ((LZ_VERSION_MAJOR << 16) | (LZ_VERSION_MINOR & 0xffff))
commit c04d4d55bc3373f42c70e7395cfdbd09e3d4c0d5
Author: Lukas Venhoda <lvenhoda at redhat.com>
Date:   Thu Jun 18 19:50:28 2015 +0200

    ppc: Fix quic decode endianess
    
    Converts all decoded words in quic from little endian to local
    machine endianness.

diff --git a/common/quic.c b/common/quic.c
index 16290d4..bbd0206 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"
@@ -476,7 +478,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;
@@ -489,7 +491,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)
@@ -763,7 +765,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;
 }
 


More information about the Spice-commits mailing list