diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2011-07-27 17:20:13 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2011-09-20 16:08:30 +0200 |
commit | ff8c54d766a34c1a2dfa22707a2791e10e43c0be (patch) | |
tree | b505df930b3936325d72e1edd6cc25c0e4cf3c62 /common/marshaller.c | |
parent | 3c03489a272c7d4505fc6c6dd18b0074b4731808 (diff) | |
download | spice-ff8c54d766a34c1a2dfa22707a2791e10e43c0be.tar.gz spice-ff8c54d766a34c1a2dfa22707a2791e10e43c0be.tar.xz spice-ff8c54d766a34c1a2dfa22707a2791e10e43c0be.zip |
fix integer marshalling helpers on big endian
They were trying to convert the destination pointer to an integer before
trying to dereference it. The initial conversion was meant to be a cast
to a pointer of the right size, not to an integer.
Diffstat (limited to 'common/marshaller.c')
-rw-r--r-- | common/marshaller.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/common/marshaller.c b/common/marshaller.c index 73bee4bf..60cdacbb 100644 --- a/common/marshaller.c +++ b/common/marshaller.c @@ -27,12 +27,12 @@ #ifdef WORDS_BIGENDIAN #define write_int8(ptr,v) (*((int8_t *)(ptr)) = v) #define write_uint8(ptr,v) (*((uint8_t *)(ptr)) = v) -#define write_int16(ptr,v) (*((int16_t)(ptr)) = SPICE_BYTESWAP16((uint16_t)(v))) -#define write_uint16(ptr,v) (*((uint16_t)(ptr)) = SPICE_BYTESWAP16((uint16_t)(v))) -#define write_int32(ptr,v) (*((int32_t)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) -#define write_uint32(ptr,v) (*((uint32_t)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) -#define write_int64(ptr,v) (*((int64_t)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) -#define write_uint64(ptr,v) (*((uint64_t)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) +#define write_int16(ptr,v) (*((int16_t *)(ptr)) = SPICE_BYTESWAP16((uint16_t)(v))) +#define write_uint16(ptr,v) (*((uint16_t *)(ptr)) = SPICE_BYTESWAP16((uint16_t)(v))) +#define write_int32(ptr,v) (*((int32_t *)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) +#define write_uint32(ptr,v) (*((uint32_t *)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) +#define write_int64(ptr,v) (*((int64_t *)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) +#define write_uint64(ptr,v) (*((uint64_t *)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) #else #define write_int8(ptr,v) (*((int8_t *)(ptr)) = v) #define write_uint8(ptr,v) (*((uint8_t *)(ptr)) = v) |