[Spice-commits] 2 commits - src/channel-cursor.c src/spice-channel-priv.h src/spice-channel.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed May 31 14:03:35 UTC 2017


 src/channel-cursor.c     |    2 +-
 src/spice-channel-priv.h |    1 -
 src/spice-channel.c      |   17 +++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit c32c2c8866ce6e7b5f06feb95149c20963a0705e
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed May 31 09:37:42 2017 +0100

    Use cursor->data instead of row data
    
    data and cursor->data contains the same data (see the memcpy
    above) but data is not aligned to uint32_t and require also
    additional casts. Using cursor->data avoid these issues.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/channel-cursor.c b/src/channel-cursor.c
index cddba03..2610660 100644
--- a/src/channel-cursor.c
+++ b/src/channel-cursor.c
@@ -422,7 +422,7 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor)
         memcpy(cursor->data, data, size);
         for (i = 0; i < hdr->width * hdr->height; i++) {
             pix_mask = get_pix_mask(data, size, i);
-            if (pix_mask && *((guint32*)data + i) == 0xffffff) {
+            if (pix_mask && cursor->data[i] == 0xffffff) {
                 cursor->data[i] = get_pix_hack(i, hdr->width);
             } else {
                 cursor->data[i] |= (pix_mask ? 0 : 0xff000000);
commit d406f210e070616a7c63c2ca325e85fca0b16740
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed May 31 09:34:11 2017 +0100

    Remove link_msg from _SpiceChannelPrivate
    
    The field is used only to initialize a buffer allocated
    inside spice_channel_send_link
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/spice-channel-priv.h b/src/spice-channel-priv.h
index 50aca5c..7288920 100644
--- a/src/spice-channel-priv.h
+++ b/src/spice-channel-priv.h
@@ -125,7 +125,6 @@ struct _SpiceChannelPrivate {
     int                         channel_id;
     int                         channel_type;
     SpiceLinkHeader             link_hdr;
-    SpiceLinkMess               link_msg;
     SpiceLinkHeader             peer_hdr;
     SpiceLinkReply*             peer_msg;
     int                         peer_pos;
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 3b6231e..77ac9cd 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1313,9 +1313,10 @@ static void spice_channel_send_link(SpiceChannel *channel)
     SpiceChannelPrivate *c = channel->priv;
     uint8_t *buffer, *p;
     int protocol, i;
+    SpiceLinkMess link_msg;
 
     c->link_hdr.magic = SPICE_MAGIC;
-    c->link_hdr.size = sizeof(c->link_msg);
+    c->link_hdr.size = sizeof(link_msg);
 
     g_object_get(c->session, "protocol", &protocol, NULL);
     switch (protocol) {
@@ -1339,13 +1340,13 @@ static void spice_channel_send_link(SpiceChannel *channel)
     c->link_hdr.major_version = GUINT32_TO_LE(c->link_hdr.major_version);
     c->link_hdr.minor_version = GUINT32_TO_LE(c->link_hdr.minor_version);
 
-    c->link_msg.connection_id = GUINT32_TO_LE(spice_session_get_connection_id(c->session));
-    c->link_msg.channel_type  = c->channel_type;
-    c->link_msg.channel_id    = c->channel_id;
-    c->link_msg.caps_offset   = GUINT32_TO_LE(sizeof(c->link_msg));
+    link_msg.connection_id = GUINT32_TO_LE(spice_session_get_connection_id(c->session));
+    link_msg.channel_type  = c->channel_type;
+    link_msg.channel_id    = c->channel_id;
+    link_msg.caps_offset   = GUINT32_TO_LE(sizeof(link_msg));
 
-    c->link_msg.num_common_caps = GUINT32_TO_LE(c->common_caps->len);
-    c->link_msg.num_channel_caps = GUINT32_TO_LE(c->caps->len);
+    link_msg.num_common_caps = GUINT32_TO_LE(c->common_caps->len);
+    link_msg.num_channel_caps = GUINT32_TO_LE(c->caps->len);
     c->link_hdr.size += (c->common_caps->len + c->caps->len) * sizeof(uint32_t);
 
     buffer = g_malloc0(sizeof(c->link_hdr) + c->link_hdr.size);
@@ -1354,7 +1355,7 @@ static void spice_channel_send_link(SpiceChannel *channel)
     c->link_hdr.size = GUINT32_TO_LE(c->link_hdr.size);
 
     memcpy(p, &c->link_hdr, sizeof(c->link_hdr)); p += sizeof(c->link_hdr);
-    memcpy(p, &c->link_msg, sizeof(c->link_msg)); p += sizeof(c->link_msg);
+    memcpy(p, &link_msg, sizeof(link_msg)); p += sizeof(link_msg);
 
     for (i = 0; i < c->common_caps->len; i++) {
         *(uint32_t *)p = GUINT32_TO_LE(g_array_index(c->common_caps, uint32_t, i));


More information about the Spice-commits mailing list