[Spice-devel] [PATCH 2/7] spice-ppc: Fixing endianess for channel startup negotiation

Christophe Fergeau cfergeau at redhat.com
Wed Aug 8 02:37:59 PDT 2012


On Wed, Aug 08, 2012 at 08:45:06AM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> >      header.magic = SPICE_MAGIC;
> >      header.size = sizeof(ack);
> > -    header.major_version = SPICE_VERSION_MAJOR;
> > -    header.minor_version = SPICE_VERSION_MINOR;
> > +    header.major_version = htole32(SPICE_VERSION_MAJOR);
> > +    header.minor_version = htole32(SPICE_VERSION_MINOR);
> 
> Why you don't swap magic & size too?
> 
> > +    header.size += (channel_caps->num_common_caps + channel_caps->num_caps) * sizeof(uint32_t);
> 
> > +    header.size = htole32(header.size);
> 
> Ah, this explains it for the size.

Imo things would be more readable with a header_size local variable which
accumulates the size in native endian, and then we'd have
header.size = htole32(header_size)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120808/f016e986/attachment.pgp>


More information about the Spice-devel mailing list