<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 8 Jun 2017, at 12:21, Frediano Ziglio <<a href="mailto:fziglio@redhat.com" class="">fziglio@redhat.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="">From: Christophe de Dinechin <<a href="mailto:dinechin@redhat.com" class="">dinechin@redhat.com</a>><br class=""><br class="">Signed-off-by: Christophe de Dinechin <<a href="mailto:dinechin@redhat.com" class="">dinechin@redhat.com</a>><br class="">---<br class="">src/channel-cursor.c |  6 ++++--<br class="">src/spice-channel.c  | 14 ++++++++------<br class="">2 files changed, 12 insertions(+), 8 deletions(-)<br class=""><br class="">diff --git a/src/channel-cursor.c b/src/channel-cursor.c<br class="">index 80d2410..4faaa95 100644<br class="">--- a/src/channel-cursor.c<br class="">+++ b/src/channel-cursor.c<br class="">@@ -385,6 +385,7 @@ static display_cursor *set_cursor(SpiceChannel *channel,<br class="">SpiceCursor *scursor)<br class="">    const guint8* data;<br class="">    guint8 *rgba;<br class="">    guint8 val;<br class="">+    gint palette[16];<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I know that pix is gint too but I think uint32_t is safer.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></div></blockquote><div><br class=""></div><div>Will do. But rather guint32, and the change the other variables too for consistency.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="">    CHANNEL_DEBUG(channel, "%s: flags %x, size %u", __FUNCTION__,<br class="">                  scursor->flags, scursor->data_size);<br class="">@@ -433,7 +434,7 @@ static display_cursor *set_cursor(SpiceChannel *channel,<br class="">SpiceCursor *scursor)<br class="">        size /= 2u;<br class="">        for (i = 0; i < hdr->width * hdr->height; i++) {<br class="">            pix_mask = get_pix_mask(data, size, i);<br class="">-            pix = *(SPICE_ALIGNED_CAST(guint16 *, data) + i);<br class="">+            pix = *(SPICE_UNALIGNED_CAST(guint16 *, data) + i);<br class="">            if (pix_mask && pix == 0x7fff) {<br class="">                cursor->data[i] = get_pix_hack(i, hdr->width);<br class="">            } else {<br class="">@@ -444,10 +445,11 @@ static display_cursor *set_cursor(SpiceChannel<br class="">*channel, SpiceCursor *scursor)<br class="">        break;<br class="">    case SPICE_CURSOR_TYPE_COLOR4:<br class="">        size = ((unsigned int)(SPICE_ALIGN(hdr->width, 2) / 2)) *<br class="">        hdr->height;<br class="">+        memcpy(palette, data + size, sizeof(palette));<br class="">        for (i = 0; i < hdr->width * hdr->height; i++) {<br class="">            pix_mask = get_pix_mask(data, size + (sizeof(uint32_t) << 4),<br class="">            i);<br class="">            int idx = (i & 1) ? (data[i >> 1] & 0x0f) : ((data[i >> 1] &<br class="">            0xf0) >> 4);<br class="">-            pix = *(SPICE_UNALIGNED_CAST(uint32_t *, (data + size)) + idx);<br class="">+            pix = palette[idx];<br class="">            if (pix_mask && pix == 0xffffff) {<br class="">                cursor->data[i] = get_pix_hack(i, hdr->width);<br class="">            } else {<br class="">diff --git a/src/spice-channel.c b/src/spice-channel.c<br class="">index 3b6d839..b196a26 100644<br class="">--- a/src/spice-channel.c<br class="">+++ b/src/spice-channel.c<br class="">@@ -1931,18 +1931,20 @@ static gboolean<br class="">spice_channel_recv_link_msg(SpiceChannel *channel)<br class="">    /* g_return_if_fail(c->peer_msg + c->peer_msg->caps_offset *<br class="">    sizeof(uint32_t) > c->peer_msg + c->peer_hdr.size); */<br class=""><br class="">    caps_src = (uint8_t *)c->peer_msg +<br class="">    GUINT32_FROM_LE(c->peer_msg->caps_offset);<br class="">-    caps = SPICE_UNALIGNED_CAST(uint32_t *, caps_src);<br class="">-<br class="">    g_array_set_size(c->remote_common_caps, num_common_caps);<br class="">+    caps = &g_array_index(c->remote_common_caps, uint32_t, 0);<br class="">+    memcpy(caps, caps_src, num_common_caps * sizeof(uint32_t));<br class="">    for (i = 0; i < num_common_caps; i++, caps++) {<br class="">-        g_array_index(c->remote_common_caps, uint32_t, i) =<br class="">GUINT32_FROM_LE(*caps);<br class="">-        CHANNEL_DEBUG(channel, "got common caps %d:0x%X", i,<br class="">GUINT32_FROM_LE(*caps));<br class="">+        *caps = GUINT32_FROM_LE(*caps);<br class="">+        CHANNEL_DEBUG(channel, "got common caps %d:0x%X", i, *caps);<br class="">    }<br class=""><br class="">    g_array_set_size(c->remote_caps, num_channel_caps);<br class="">+    caps_src += num_common_caps * sizeof(uint32_t);<br class="">+    memcpy(caps, caps_src, num_channel_caps * sizeof(uint32_t));<br class="">    for (i = 0; i < num_channel_caps; i++, caps++) {<br class="">-        g_array_index(c->remote_caps, uint32_t, i) = GUINT32_FROM_LE(*caps);<br class="">-        CHANNEL_DEBUG(channel, "got channel caps %d:0x%X", i,<br class="">GUINT32_FROM_LE(*caps));<br class="">+        *caps = GUINT32_FROM_LE(*caps);<br class="">+        CHANNEL_DEBUG(channel, "got channel caps %d:0x%X", i, *caps);<br class="">    }<br class=""><br class="">    if (!spice_channel_test_common_capability(channel,<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Like these changes but should be merged with the other patch having a single</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">fix for these hunks.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></div></blockquote><div><br class=""></div><div>Coming up.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Frediano</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Spice-devel mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:Spice-devel@lists.freedesktop.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">Spice-devel@lists.freedesktop.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.freedesktop.org/mailman/listinfo/spice-devel</a></div></div></blockquote></div><br class=""></body></html>