[Spice-commits] common/lz.c common/quic.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Thu Jun 15 11:49:09 UTC 2017
common/lz.c | 21 +++++----------------
common/quic.c | 24 +++++++-----------------
2 files changed, 12 insertions(+), 33 deletions(-)
New commits:
commit 765652da1d37b7cd05799418fd1a37792ac621a6
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Thu Jun 15 12:47:36 2017 +0100
Use SPICE_ATTR_PACKED instead of custom ATTR_PACKED
Reuse {start,end}-packed headers to specify packed structure.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/common/lz.c b/common/lz.c
index 2589223..28f450b 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -382,30 +382,23 @@ void lz_destroy(LzContext *lz)
#endif
-#ifdef __GNUC__
-#define ATTR_PACKED __attribute__ ((__packed__))
-#else
-#define ATTR_PACKED
-#pragma pack(push)
-#pragma pack(1)
-#endif
-
+#include <spice/start-packed.h>
/* the palette images will be treated as one byte pixels. Their width should be transformed
accordingly.
*/
-typedef struct ATTR_PACKED one_byte_pixel_t {
+typedef struct SPICE_ATTR_PACKED one_byte_pixel_t {
uint8_t a;
} one_byte_pixel_t;
-typedef struct ATTR_PACKED rgb32_pixel_t {
+typedef struct SPICE_ATTR_PACKED rgb32_pixel_t {
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t pad;
} rgb32_pixel_t;
-typedef struct ATTR_PACKED rgb24_pixel_t {
+typedef struct SPICE_ATTR_PACKED rgb24_pixel_t {
uint8_t b;
uint8_t g;
uint8_t r;
@@ -413,11 +406,7 @@ typedef struct ATTR_PACKED rgb24_pixel_t {
typedef uint16_t rgb16_pixel_t;
-#ifndef __GNUC__
-#pragma pack(pop)
-#endif
-
-#undef ATTR_PACKED
+#include <spice/end-packed.h>
#define MAX_COPY 32
diff --git a/common/quic.c b/common/quic.c
index 5b00d65..98ac319 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -741,39 +741,33 @@ static inline void init_decode_io(Encoder *encoder)
encoder->io_available_bits = 0;
}
-#ifdef __GNUC__
-#define ATTR_PACKED __attribute__ ((__packed__))
-#else
-#define ATTR_PACKED
-#pragma pack(push)
-#pragma pack(1)
-#endif
+#include <spice/start-packed.h>
-typedef struct ATTR_PACKED one_byte_pixel_t {
+typedef struct SPICE_ATTR_PACKED one_byte_pixel_t {
BYTE a;
} one_byte_t;
-typedef struct ATTR_PACKED three_bytes_pixel_t {
+typedef struct SPICE_ATTR_PACKED three_bytes_pixel_t {
BYTE a;
BYTE b;
BYTE c;
} three_bytes_t;
-typedef struct ATTR_PACKED four_bytes_pixel_t {
+typedef struct SPICE_ATTR_PACKED four_bytes_pixel_t {
BYTE a;
BYTE b;
BYTE c;
BYTE d;
} four_bytes_t;
-typedef struct ATTR_PACKED rgb32_pixel_t {
+typedef struct SPICE_ATTR_PACKED rgb32_pixel_t {
BYTE b;
BYTE g;
BYTE r;
BYTE pad;
} rgb32_pixel_t;
-typedef struct ATTR_PACKED rgb24_pixel_t {
+typedef struct SPICE_ATTR_PACKED rgb24_pixel_t {
BYTE b;
BYTE g;
BYTE r;
@@ -781,11 +775,7 @@ typedef struct ATTR_PACKED rgb24_pixel_t {
typedef uint16_t rgb16_pixel_t;
-#ifndef __GNUC__
-#pragma pack(pop)
-#endif
-
-#undef ATTR_PACKED
+#include <spice/end-packed.h>
#define ONE_BYTE
#include "quic_tmpl.c"
More information about the Spice-commits
mailing list