[Spice-devel] [PATCH spice-server] reds: Remove possible alignment warning using Clang
Frediano Ziglio
fziglio at redhat.com
Mon Jun 18 09:38:53 UTC 2018
Although capabilities inside link message are handled as arrays
of 4 bytes unsigned integers we don't need capabilities to be
aligned to 4 bytes just to call g_memdup so use a pointer to
uint8_t instead.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/reds.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/reds.c b/server/reds.c
index 935448d8..66a221c3 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1758,7 +1758,7 @@ static void
red_channel_capabilities_init_from_link_message(RedChannelCapabilities *caps,
const SpiceLinkMess *link_mess)
{
- const uint32_t *raw_caps = (uint32_t *)((uint8_t *)link_mess + link_mess->caps_offset);
+ const uint8_t *raw_caps = (const uint8_t *)link_mess + link_mess->caps_offset;
caps->num_common_caps = link_mess->num_common_caps;
caps->common_caps = NULL;
@@ -1769,7 +1769,7 @@ red_channel_capabilities_init_from_link_message(RedChannelCapabilities *caps,
caps->num_caps = link_mess->num_channel_caps;
caps->caps = NULL;
if (link_mess->num_channel_caps) {
- caps->caps = g_memdup(raw_caps + link_mess->num_common_caps,
+ caps->caps = g_memdup(raw_caps + link_mess->num_common_caps * sizeof(uint32_t),
link_mess->num_channel_caps * sizeof(uint32_t));
}
}
--
2.17.1
More information about the Spice-devel
mailing list