[spice-common PATCH v1 8/12] marshaller: return void* to reserve_space function

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

 



besides clang yelling about alignment below, we do guarantee reserved
space of size_t so returning void* should be okay.

char_device.c:923:29: error: cast from 'uint8_t *' (aka 'unsigned char *')
to 'uint32_t *' (aka 'unsigned int *') increases required alignment
from 1 to 4 [-Werror,-Wcast-align]

write_to_dev_size_ptr = (uint32_t *)spice_marshaller_reserve_space(m, sizeof(uint32_t));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 common/marshaller.c | 2 +-
 common/marshaller.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/marshaller.c b/common/marshaller.c
index bd012d7..53c1c1c 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -238,7 +238,7 @@ static size_t remaining_buffer_size(SpiceMarshallerData *d)
     return MARSHALLER_BUFFER_SIZE - d->current_buffer_position;
 }
 
-uint8_t *spice_marshaller_reserve_space(SpiceMarshaller *m, size_t size)
+void *spice_marshaller_reserve_space(SpiceMarshaller *m, size_t size)
 {
     MarshallerItem *item;
     SpiceMarshallerData *d;
diff --git a/common/marshaller.h b/common/marshaller.h
index e19c0f6..1f43bba 100644
--- a/common/marshaller.h
+++ b/common/marshaller.h
@@ -34,7 +34,7 @@ typedef void (*spice_marshaller_item_free_func)(uint8_t *data, void *opaque);
 SpiceMarshaller *spice_marshaller_new(void);
 void spice_marshaller_reset(SpiceMarshaller *m);
 void spice_marshaller_destroy(SpiceMarshaller *m);
-uint8_t *spice_marshaller_reserve_space(SpiceMarshaller *m, size_t size);
+void *spice_marshaller_reserve_space(SpiceMarshaller *m, size_t size);
 void spice_marshaller_unreserve_space(SpiceMarshaller *m, size_t size);
 uint8_t *spice_marshaller_add(SpiceMarshaller *m, const uint8_t *data, size_t size);
 uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, uint8_t *data, size_t size);
-- 
2.4.3

_______________________________________________
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]