[Spice-commits] 2 commits - common/marshaller.c

Christophe Fergau teuf at kemper.freedesktop.org
Thu Jul 28 02:34:44 PDT 2011


 common/marshaller.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 048b003468ab7fc5f4c48886cb5941814c484b7c
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Jul 27 17:20:13 2011 +0200

    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.

diff --git a/common/marshaller.c b/common/marshaller.c
index 31a5669..1446df8 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -28,12 +28,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)
commit 830410e3bee3c0e410af07e833d76ecdf96a8f12
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Jul 27 17:02:39 2011 +0200

    fix typo in big endian code path
    
    uint63_t should be uint64_t

diff --git a/common/marshaller.c b/common/marshaller.c
index 2d62cd8..31a5669 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -32,8 +32,8 @@
 #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((uint63_t)(v)))
-#define write_uint64(ptr,v) (*((uint64_t)(ptr)) = SPICE_BYTESWAP64((uint63_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)


More information about the Spice-commits mailing list