[Spice-devel] [PATCH 1/3] protocol: Add macros to help convert QXLPHYSICAL to/from pointers

Francois Gouget fgouget at codeweavers.com
Mon Dec 28 02:06:37 PST 2015


On 32 bit systems the QXLPHYSICAL integer size deos not match the size
of a pointer so special care must be taken in the conversions to avoid
compiler errors with -Werror.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 spice/qxl_dev.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
index 9e753c4..01cfe81 100644
--- a/spice/qxl_dev.h
+++ b/spice/qxl_dev.h
@@ -101,8 +101,10 @@ enum {
     QXL_IO_RANGE_SIZE
 };
 
-typedef uint64_t QXLPHYSICAL;
 typedef int32_t QXLFIXED; //fixed 28.4
+typedef uint64_t QXLPHYSICAL;
+#define PTR_TO_QXLPHYSICAL(ptr) ((QXLPHYSICAL)(intptr_t)ptr)
+#define QXLPHYSICAL_TO_PTR(ptrtype, phy) ((ptrtype)(intptr_t)phy)
 
 typedef struct SPICE_ATTR_PACKED QXLPointFix {
     QXLFIXED x;
-- 
2.6.4


More information about the Spice-devel mailing list