[Spice-commits] 2 commits - configure.ac spice/controller_prot.h spice/foreign_menu_prot.h

Christophe Fergau teuf at kemper.freedesktop.org
Mon Apr 18 07:42:47 PDT 2011


 configure.ac              |    4 ++--
 spice/controller_prot.h   |   18 +++++++-----------
 spice/foreign_menu_prot.h |   24 ++++++++++--------------
 3 files changed, 19 insertions(+), 27 deletions(-)

New commits:
commit b95f8e77a59c095b9c3e021ff4126414492b9fe4
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Mon Apr 18 12:48:41 2011 +0200

    protocol: set version number to 0.8.0
    
    spice-protocol 0.8.0 has been released, but for some reason the
    version number in the master branch was still at 0.6.3

diff --git a/configure.ac b/configure.ac
index 3ee346a..72278e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
 AC_PREREQ([2.57])
 
 m4_define([SPICE_MAJOR], 0)
-m4_define([SPICE_MINOR], 6)
-m4_define([SPICE_MICRO], 3)
+m4_define([SPICE_MINOR], 8)
+m4_define([SPICE_MICRO], 0)
 
 AC_INIT(spice-protocol, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-protocol)
 
commit 8adf6bcf9004eea147aeec9b19c6d1d5b7f9e5b4
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Mon Apr 11 12:56:26 2011 +0200

    protocol: use packed-start/end to pack structures
    
    spice-protocol comes with 2 headers to handle structure packing,
    but controller_prot.h and foreign_menu_prot were both using their
    own preprocessor definitions to handle packing. It's better to have
    structure packing macros centralized since how it's done varies
    between compilers, so it may need to change over time.

diff --git a/spice/controller_prot.h b/spice/controller_prot.h
index 697baa0..44d78e1 100644
--- a/spice/controller_prot.h
+++ b/spice/controller_prot.h
@@ -19,23 +19,19 @@
 #define _H_CONTROLLER_PROT
 
 #include <spice/types.h>
+#include <spice/start-packed.h>
 
 #define CONTROLLER_MAGIC      (*(uint32_t*)"CTRL")
 #define CONTROLLER_VERSION    1
 
-#ifdef __GNUC__
-#define ATTR_PACKED __attribute__ ((__packed__))
-#else
-#define ATTR_PACKED __declspec(align(1))
-#endif
 
-typedef struct ATTR_PACKED ControllerInitHeader {
+typedef struct SPICE_ATTR_PACKED ControllerInitHeader {
     uint32_t magic;
     uint32_t version;
     uint32_t size;
 } ControllerInitHeader;
 
-typedef struct ATTR_PACKED ControllerInit {
+typedef struct SPICE_ATTR_PACKED ControllerInit {
     ControllerInitHeader base;
     uint64_t credentials;
     uint32_t flags;
@@ -45,7 +41,7 @@ enum {
     CONTROLLER_FLAG_EXCLUSIVE = 1 << 0,
 };
 
-typedef struct ATTR_PACKED ControllerMsg {
+typedef struct SPICE_ATTR_PACKED ControllerMsg {
     uint32_t id;
     uint32_t size;
 } ControllerMsg;
@@ -88,12 +84,12 @@ enum {
     CONTROLLER_AUTO_DISPLAY_RES = 1 << 1,
 };
 
-typedef struct ATTR_PACKED ControllerValue {
+typedef struct SPICE_ATTR_PACKED ControllerValue {
     ControllerMsg base;
     uint32_t value;
 } ControllerValue;
 
-typedef struct ATTR_PACKED ControllerData {
+typedef struct SPICE_ATTR_PACKED ControllerData {
     ControllerMsg base;
     uint8_t data[0];
 } ControllerData;
@@ -112,6 +108,6 @@ enum {
 #define SPICE_MENU_INTERNAL_ID_BASE   0x1300
 #define SPICE_MENU_INTERNAL_ID_SHIFT  8
 
-#undef ATTR_PACKED
+#include <spice/end-packed.h>
 
 #endif
diff --git a/spice/foreign_menu_prot.h b/spice/foreign_menu_prot.h
index 8c22461..570fafb 100644
--- a/spice/foreign_menu_prot.h
+++ b/spice/foreign_menu_prot.h
@@ -18,28 +18,24 @@
 #ifndef _H_FOREIGN_MENU_PROT
 #define _H_FOREIGN_MENU_PROT
 
+#include <spice/start-packed.h>
+
 #define FOREIGN_MENU_MAGIC      (*(uint32_t*)"FRGM")
 #define FOREIGN_MENU_VERSION    1
 
-#ifdef __GNUC__
-#define ATTR_PACKED __attribute__ ((__packed__))
-#else
-#define ATTR_PACKED __declspec(align(1))
-#endif
-
-typedef struct ATTR_PACKED FrgMenuInitHeader {
+typedef struct SPICE_ATTR_PACKED FrgMenuInitHeader {
     uint32_t magic;
     uint32_t version;
     uint32_t size;
 } FrgMenuInitHeader;
 
-typedef struct ATTR_PACKED FrgMenuInit {
+typedef struct SPICE_ATTR_PACKED FrgMenuInit {
     FrgMenuInitHeader base;
     uint64_t credentials;
     uint8_t title[0]; //UTF8
 } FrgMenuInit;
 
-typedef struct ATTR_PACKED FrgMenuMsg {
+typedef struct SPICE_ATTR_PACKED FrgMenuMsg {
     uint32_t id;
     uint32_t size;
 } FrgMenuMsg;
@@ -58,7 +54,7 @@ enum {
     FOREIGN_MENU_APP_DEACTIVATED,
 };
 
-typedef struct ATTR_PACKED FrgMenuSetTitle {
+typedef struct SPICE_ATTR_PACKED FrgMenuSetTitle {
     FrgMenuMsg base;
     uint8_t string[0]; //UTF8
 } FrgMenuSetTitle;
@@ -71,7 +67,7 @@ enum {
 
 #define FOREIGN_MENU_INVALID_ID 0
 
-typedef struct ATTR_PACKED FrgMenuAddItem {
+typedef struct SPICE_ATTR_PACKED FrgMenuAddItem {
     FrgMenuMsg base;
     uint32_t id;
     uint32_t type;
@@ -79,7 +75,7 @@ typedef struct ATTR_PACKED FrgMenuAddItem {
     uint8_t string[0]; //UTF8
 } FrgMenuAddItem, FrgMenuModItem;
 
-typedef struct ATTR_PACKED FrgMenuRmItem {
+typedef struct SPICE_ATTR_PACKED FrgMenuRmItem {
     FrgMenuMsg base;
     uint32_t id;
 } FrgMenuRmItem;
@@ -93,7 +89,7 @@ enum {
     FOREIGN_MENU_EVENT_UNCHECKED
 };
 
-typedef struct ATTR_PACKED FrgMenuEvent {
+typedef struct SPICE_ATTR_PACKED FrgMenuEvent {
     FrgMenuMsg base;
     uint32_t id;
     uint32_t action; //FOREIGN_MENU_EVENT_?
@@ -102,6 +98,6 @@ typedef struct ATTR_PACKED FrgMenuEvent {
 typedef struct FrgMenuMsg FrgMenuActivate;
 typedef struct FrgMenuMsg FrgMenuDeactivate;
 
-#undef ATTR_PACKED
+#include <spice/end-packed.h>
 
 #endif


More information about the Spice-commits mailing list