[Spice-commits] 4 commits - docs/manual README server/char-device.c server/event-loop.c server/red-channel.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 14 15:43:29 UTC 2018
README | 2 +-
docs/manual/manual.txt | 6 +++---
server/char-device.c | 4 ++--
server/event-loop.c | 7 ++++++-
server/red-channel.c | 19 ++++++++++++++-----
5 files changed, 26 insertions(+), 12 deletions(-)
New commits:
commit c0f1c65b30de690e94306bdadfabd957b8311b7d
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Sun May 6 12:07:09 2018 +0100
char-device: Avoid possible invalid function pointer cast
This is reported by GCC 8.0.1 (Fedora 28).
Instead of doing a possible invalid cast destroy and create the
queue again.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/char-device.c b/server/char-device.c
index 242d8782..aef6e887 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -835,8 +835,8 @@ void red_char_device_reset(RedCharDevice *dev)
spice_debug("send_queue_empty %d", g_queue_is_empty(dev_client->send_queue));
dev_client->num_send_tokens += g_queue_get_length(dev_client->send_queue);
- g_queue_foreach(dev_client->send_queue, (GFunc)red_pipe_item_unref, NULL);
- g_queue_clear(dev_client->send_queue);
+ g_queue_free_full(dev_client->send_queue, (GDestroyNotify)red_pipe_item_unref);
+ dev_client->send_queue = g_queue_new();
/* If device is reset, we must reset the tokens counters as well as we
* don't hold any data from client and upon agent's reconnection we send
commit ee3ca3472225f5f12c7f2accadb0983323664154
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Sun May 6 12:05:34 2018 +0100
red-channel: Avoid possible invalid function pointer type cast
Avoid casting function pointer with different argument providing
a proper utility instead.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-channel.c b/server/red-channel.c
index ad45fb52..1b38f04d 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -301,10 +301,19 @@ red_channel_init(RedChannel *self)
self->priv->client_cbs.migrate = red_channel_client_default_migrate;
}
+// utility to avoid possible invalid function cast
+static void
+red_channel_foreach_client(RedChannel *channel, void (*func)(RedChannelClient* client))
+{
+ RedChannelClient *client;
+ GLIST_FOREACH(channel->priv->clients, RedChannelClient, client) {
+ func(client);
+ }
+}
void red_channel_receive(RedChannel *channel)
{
- g_list_foreach(channel->priv->clients, (GFunc)red_channel_client_receive, NULL);
+ red_channel_foreach_client(channel, red_channel_client_receive);
}
void red_channel_add_client(RedChannel *channel, RedChannelClient *rcc)
@@ -403,13 +412,13 @@ void red_channel_destroy(RedChannel *channel)
// prevent future connection
reds_unregister_channel(channel->priv->reds, channel);
- g_list_foreach(channel->priv->clients, (GFunc)red_channel_client_destroy, NULL);
+ red_channel_foreach_client(channel, red_channel_client_destroy);
g_object_unref(channel);
}
void red_channel_send(RedChannel *channel)
{
- g_list_foreach(channel->priv->clients, (GFunc)red_channel_client_send, NULL);
+ red_channel_foreach_client(channel, red_channel_client_send);
}
void red_channel_push(RedChannel *channel)
@@ -418,7 +427,7 @@ void red_channel_push(RedChannel *channel)
return;
}
- g_list_foreach(channel->priv->clients, (GFunc)red_channel_client_push, NULL);
+ red_channel_foreach_client(channel, red_channel_client_push);
}
void red_channel_pipes_add(RedChannel *channel, RedPipeItem *item)
@@ -478,7 +487,7 @@ void red_channel_remove_client(RedChannel *channel, RedChannelClient *rcc)
void red_channel_disconnect(RedChannel *channel)
{
- g_list_foreach(channel->priv->clients, (GFunc)red_channel_client_disconnect, NULL);
+ red_channel_foreach_client(channel, red_channel_client_disconnect);
}
void red_channel_connect(RedChannel *channel, RedClient *client,
commit aac08a16425299c5b8c9d0e0c3af76c370307764
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Sun May 6 12:04:10 2018 +0100
event-loop: Avoid possible compiler warning
With GCC 8.0.1 (Fedora 28), cast to different function pointer
can lead to warnings, like:
event-loop.c: In function ‘watch_update_mask’:
event-loop.c:146:42: error: cast between incompatible function types from ‘gboolean (*)(GIOChannel *, GIOCondition, void *)’ {aka ‘int (*)(struct _GIOChannel *, enum <anonymous>, void *)’} to ‘gboolean (*)(void *)’ {aka ‘int (*)(void *)’} [-Werror=cast-function-type]
g_source_set_callback(watch->source, (GSourceFunc)watch_func, watch, NULL);
^
cc1: all warnings being treated as errors
As g_source_set_callback expect a function pointer which type
changes based on the type of source (so is expected) silent
the possible warning.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/event-loop.c b/server/event-loop.c
index 582782e1..413102e8 100644
--- a/server/event-loop.c
+++ b/server/event-loop.c
@@ -143,7 +143,12 @@ static void watch_update_mask(const SpiceCoreInterfaceInternal *iface,
return;
watch->source = g_io_create_watch(watch->channel, spice_event_to_giocondition(event_mask));
- g_source_set_callback(watch->source, (GSourceFunc)watch_func, watch, NULL);
+ /* g_source_set_callback() documentation says:
+ * "The exact type of func depends on the type of source; ie. you should
+ * not count on func being called with data as its first parameter."
+ * In this case it is a GIOFunc. First cast to GIOFunc to make sure it is the right type.
+ * The other casts silence the warning from gcc */
+ g_source_set_callback(watch->source, (GSourceFunc)(void*)(GIOFunc)watch_func, watch, NULL);
g_source_attach(watch->source, watch->context);
}
commit 6f195792542f5a6760bedf80ac5a18900ccd9ad6
Author: Snir Sheriber <ssheribe at redhat.com>
Date: Thu May 10 16:03:25 2018 +0300
docs: Update links in README and manual
Signed-off-by: Snir Sheriber <ssheribe at redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
diff --git a/README b/README
index 4aaf6a7c..f9a0c7fe 100644
--- a/README
+++ b/README
@@ -63,7 +63,7 @@ be reported to the OS vendors' own bug tracker first.
The latest SPICE code can be found in GIT at:
- https://cgit.freedesktop.org/spice/
+ https://gitlab.freedesktop.org/spice/
Licensing
---------
diff --git a/docs/manual/manual.txt b/docs/manual/manual.txt
index df3c17d7..40d080d9 100644
--- a/docs/manual/manual.txt
+++ b/docs/manual/manual.txt
@@ -1071,8 +1071,8 @@ required Spice components.
Client requirements
~~~~~~~~~~~~~~~~~~~
-See the http://cgit.freedesktop.org/spice/spice-gtk/tree/README[README
-file in spice-gtk] for the list of dependencies.
+See the https://gitlab.freedesktop.org/spice/spice-gtk/raw/master/README
+[README file in spice-gtk] for the list of dependencies.
Host requirements
~~~~~~~~~~~~~~~~~
@@ -1112,7 +1112,7 @@ export INST_ROOT="/opt/spice"; mkdir $INST_ROOT
export PKG_CONFIG_PATH=$INST_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH
cd $BUILD_ROOT
-git clone git://cgit.freedesktop.org/spice/spice
+git clone https://gitlab.freedesktop.org/spice/spice.git
cd $BUILD_ROOT/spice
./configure --prefix=$INST_ROOT
make
More information about the Spice-commits
mailing list