Re: [spice-common PATCH 1/3 v2] ppc: Fix lz magic endianess

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK.


On Mon, Jun 29, 2015 at 02:58:25PM +0200, Lukas Venhoda wrote:
> 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
> ---
> Changes since v1:
>  - Improved commit log
> 
> I didn't revert the patch, because I still need glib.h, but in different file.
> ---
>  common/lz.c        | 4 +---
>  common/lz_common.h | 3 ++-
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> 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))
> --
> 2.4.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: pgp6vsXWtPimS.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]