[Spice-devel] [PATCH v2] server: Fix conversions between QXLPHYSICAL and pointers

Francois Gouget fgouget at codeweavers.com
Mon Jan 11 09:11:55 PST 2016


On Mon, 11 Jan 2016, Frediano Ziglio wrote:
[...]
> > > @@ -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
> > 
> 
> The conversion pointer -> uint64_t on a 32 bit architecture generate
> a warning which with -Werror we use generate an error.
> Francois is attempting to fix 32 bit architecture build
> (for us, thanks Francois :) ).
> Probably is better to just convert to uintptr_t and put in a separate
> patch.

Do you mean it would be better to convert id to uintptr_t?
That would not work. id is part of a QXLReleaseInfo structure which is 
exchanged between the server and the client. So its fields cannot 
have a size that depends on the platform like uintptr_t does.

-- 
Francois Gouget <fgouget at codeweavers.com>


More information about the Spice-devel mailing list