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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: pgpWS35N5jzxQ.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]