[Spice-devel] [PATCH v2] server: Fix conversions between QXLPHYSICAL and pointers
Christophe Fergeau
cfergeau at redhat.com
Mon Jan 11 08:32:02 PST 2016
Hey,
On Mon, Jan 11, 2016 at 03:13:42PM +0100, Francois Gouget wrote:
> This avoids compilation errors with -Werror on 32 bit systems.
>
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
> server/red-replay-qxl.c | 95 +++++++++++++++++++++++++------------------------
> 1 file changed, 49 insertions(+), 46 deletions(-)
>
> diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
> index 66acf1e..e172d84 100644
> --- a/server/red-replay-qxl.c
> +++ b/server/red-replay-qxl.c
> @@ -31,6 +31,9 @@
> #include "red-replay-qxl.h"
> #include <glib.h>
>
> +#define QXLPHYSICAL_FROM_PTR(ptr) ((QXLPHYSICAL)(intptr_t)(ptr))
> +#define QXLPHYSICAL_TO_PTR(ptrtype, phy) ((ptrtype)(intptr_t)(phy))
'ptrtype' still does not seem to bring much compared to:
#define QXLPHYSICAL_TO_PTR(phy) ((void*)(intptr_t)(phy))
Or am I missing something?
> @@ -1155,8 +1158,8 @@ SPICE_GNUC_VISIBLE QXLCommandExt* spice_replay_next_cmd(SpiceReplay *replay,
> case QXL_CMD_DRAW:
> case QXL_CMD_UPDATE:
> case QXL_CMD_SURFACE:
> - info = (QXLReleaseInfo *)cmd->cmd.data;
> - info->id = (uint64_t)cmd;
> + info = QXLPHYSICAL_TO_PTR(QXLReleaseInfo*, cmd->cmd.data);
> + info->id = (uint64_t)(uintptr_t)cmd;
Is the addition of that (uintptr_t) cast mandatory here? (not really
important, just curious).
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20160111/20728dc9/attachment.sig>
More information about the Spice-devel
mailing list