mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-protocol
synced 2025-12-26 22:55:30 +00:00
macros: fix alignment issue reported by clang
char_device.c:131:52: warning: cast from 'uint8_t *'
(aka 'unsigned char *') to 'SpiceCharDeviceMsgToClientItem *'
(aka 'struct SpiceCharDeviceMsgToClientItem *')
increases required alignment from 1 to 8 [-Wcast-align]
SpiceCharDeviceMsgToClientItem *msg_item = SPICE_CONTAINEROF(item,
^~~~~~~~~~~~~~~~~~~~~~~
../spice-common/spice-protocol/spice/macros.h:142:6: note: expanded
from macro 'SPICE_CONTAINEROF'
((struct_type *)((uint8_t *)(ptr) - SPICE_OFFSETOF(struct_type, member)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
fa19ebb83f
commit
39be7a8fce
@ -140,7 +140,7 @@
|
||||
#endif
|
||||
|
||||
#define SPICE_CONTAINEROF(ptr, struct_type, member) \
|
||||
((struct_type *)((uint8_t *)(ptr) - SPICE_OFFSETOF(struct_type, member)))
|
||||
((struct_type *)(void *)((uint8_t *)(ptr) - SPICE_OFFSETOF(struct_type, member)))
|
||||
|
||||
#define SPICE_MEMBER_P(struct_p, struct_offset) \
|
||||
((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset)))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user