[Spice-commits] 2 commits - src/spice-channel.c src/spice-channel-priv.h
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 20 17:27:40 UTC 2018
src/spice-channel-priv.h | 1 -
src/spice-channel.c | 12 +++++-------
2 files changed, 5 insertions(+), 8 deletions(-)
New commits:
commit e80398942e00f0d94e7b405cd5d0f69232c633ae
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Nov 20 12:13:36 2018 +0000
spice-channel: Use unsigned for num_caps
It's just a sum of 2 unsigned numbers
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/src/spice-channel.c b/src/spice-channel.c
index dc3e295..1b3578c 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1896,7 +1896,8 @@ static void store_caps(const uint8_t *caps_src, uint32_t ncaps,
static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
{
SpiceChannelPrivate *c;
- int rc, num_caps;
+ int rc;
+ uint32_t num_caps;
uint32_t num_channel_caps, num_common_caps;
uint8_t *caps_src;
SpiceChannelEvent event = SPICE_CHANNEL_ERROR_LINK;
@@ -1931,7 +1932,7 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
num_common_caps = GUINT32_FROM_LE(c->peer_msg->num_common_caps);
num_caps = num_channel_caps + num_common_caps;
- CHANNEL_DEBUG(channel, "%s: %d caps", __FUNCTION__, num_caps);
+ CHANNEL_DEBUG(channel, "%s: %u caps", __FUNCTION__, num_caps);
/* see original spice/client code: */
/* g_return_if_fail(c->peer_msg + c->peer_msg->caps_offset * sizeof(uint32_t) > c->peer_msg + c->peer_hdr.size); */
commit e9aa24d73071046ee4d8ed13d628f325ead90b5b
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Nov 20 12:12:52 2018 +0000
spice-channel: Remove useless peer_pos
With coroutine the spice_channel_recv_link_msg function reads the
entire message, no reason to store partial position.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/src/spice-channel-priv.h b/src/spice-channel-priv.h
index 091c116..5984ca5 100644
--- a/src/spice-channel-priv.h
+++ b/src/spice-channel-priv.h
@@ -129,7 +129,6 @@ struct _SpiceChannelPrivate {
SpiceLinkHeader link_hdr;
SpiceLinkHeader peer_hdr;
SpiceLinkReply* peer_msg;
- int peer_pos;
int message_ack_window;
int message_ack_count;
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 2aa0826..dc3e295 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1906,10 +1906,8 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
c = channel->priv;
- rc = spice_channel_read(channel, (uint8_t*)c->peer_msg + c->peer_pos,
- c->peer_hdr.size - c->peer_pos);
- c->peer_pos += rc;
- if (c->peer_pos != c->peer_hdr.size) {
+ rc = spice_channel_read(channel, (uint8_t*)c->peer_msg, c->peer_hdr.size);
+ if (rc != c->peer_hdr.size) {
g_critical("%s: %s: incomplete link reply (%d/%u)",
c->name, __FUNCTION__, rc, c->peer_hdr.size);
goto error;
@@ -2821,7 +2819,6 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
c->auth_needs_password = FALSE;
g_clear_pointer(&c->peer_msg, g_free);
- c->peer_pos = 0;
g_mutex_lock(&c->xmit_queue_lock);
c->xmit_queue_blocked = TRUE; /* Disallow queuing new messages */
More information about the Spice-commits
mailing list