summaryrefslogtreecommitdiff
path: root/socket
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2018-05-26 15:58:21 +0000
committerOlivier CrĂȘte <olivier.crete@collabora.com>2018-06-12 16:57:03 +0200
commit23b5926885683987ac8706dddd8cbc195ba40d18 (patch)
treeab490e59e5bd29a0619243d77267e3d0f63253dc /socket
parenta353ab3beb5182857f24b9bf8771da2fa3f8c79a (diff)
downloadlibnice-23b5926885683987ac8706dddd8cbc195ba40d18.tar.gz
Fix cast-function-type warning introduced in GCC 8
This is new warning introduced with GCC 8. This is being fixed by using appropriate function, like g_queue_free_full/g_list_free_full or by casting to GCallback before casting to the target function signature. Closes: #46
Diffstat (limited to 'socket')
-rw-r--r--socket/socket-priv.h2
-rw-r--r--socket/socket.c7
-rw-r--r--socket/tcp-bsd.c6
-rw-r--r--socket/udp-turn.c13
4 files changed, 11 insertions, 17 deletions
diff --git a/socket/socket-priv.h b/socket/socket-priv.h
index 10286e3..6e9f3f5 100644
--- a/socket/socket-priv.h
+++ b/socket/socket-priv.h
@@ -75,7 +75,7 @@ void nice_socket_queue_send (GQueue *send_queue, const NiceAddress *to,
void nice_socket_queue_send_with_callback (GQueue *send_queue,
const NiceOutputMessage *message, gsize message_offset, gsize message_len,
gboolean head, GSocket *gsock, GSource **io_source, GMainContext *context,
- GSourceFunc cb, gpointer user_data);
+ GSocketSourceFunc cb, gpointer user_data);
/**
* nice_socket_flush_send_queue:
diff --git a/socket/socket.c b/socket/socket.c
index 08ae31a..684e88b 100644
--- a/socket/socket.c
+++ b/socket/socket.c
@@ -340,7 +340,7 @@ nice_socket_queue_send (GQueue *send_queue, const NiceAddress *to,
void nice_socket_queue_send_with_callback (GQueue *send_queue,
const NiceOutputMessage *message, gsize message_offset, gsize message_len,
gboolean head, GSocket *gsock, GSource **io_source, GMainContext *context,
- GSourceFunc cb, gpointer user_data)
+ GSocketSourceFunc cb, gpointer user_data)
{
NiceSocketQueuedSend *tbs;
guint j;
@@ -360,7 +360,7 @@ void nice_socket_queue_send_with_callback (GQueue *send_queue,
if (io_source && gsock && context && cb && *io_source == NULL) {
*io_source = g_socket_create_source(gsock, G_IO_OUT, NULL);
- g_source_set_callback (*io_source, (GSourceFunc) cb, user_data, NULL);
+ g_source_set_callback (*io_source, (GSourceFunc) G_CALLBACK (cb), user_data, NULL);
g_source_attach (*io_source, context);
}
@@ -450,6 +450,5 @@ gboolean nice_socket_flush_send_queue_to_socket (GSocket *gsock,
void
nice_socket_free_send_queue (GQueue *send_queue)
{
- g_queue_foreach (send_queue, (GFunc) nice_socket_free_queued_send, NULL);
- g_queue_clear (send_queue);
+ g_queue_free_full (send_queue, (GDestroyNotify) nice_socket_free_queued_send);
}
diff --git a/socket/tcp-bsd.c b/socket/tcp-bsd.c
index 3e5f5a8..285d323 100644
--- a/socket/tcp-bsd.c
+++ b/socket/tcp-bsd.c
@@ -312,7 +312,7 @@ socket_send_message (NiceSocket *sock,
/* Queue the message and send it later. */
nice_socket_queue_send_with_callback (&priv->send_queue,
message, 0, message_len, FALSE, sock->fileno, &priv->io_source,
- priv->context, (GSourceFunc) socket_send_more, sock);
+ priv->context, socket_send_more, sock);
ret = message_len;
}
@@ -321,7 +321,7 @@ socket_send_message (NiceSocket *sock,
/* Partial send. */
nice_socket_queue_send_with_callback (&priv->send_queue,
message, ret, message_len, TRUE, sock->fileno, &priv->io_source,
- priv->context, (GSourceFunc) socket_send_more, sock);
+ priv->context, socket_send_more, sock);
ret = message_len;
}
} else {
@@ -330,7 +330,7 @@ socket_send_message (NiceSocket *sock,
/* Queue the message and send it later. */
nice_socket_queue_send_with_callback (&priv->send_queue,
message, 0, message_len, FALSE, sock->fileno, &priv->io_source,
- priv->context, (GSourceFunc) socket_send_more, sock);
+ priv->context, socket_send_more, sock);
ret = message_len;
} else {
/* non reliable send, so we shouldn't queue the message */
diff --git a/socket/udp-turn.c b/socket/udp-turn.c
index 190a9ea..c6bd803 100644
--- a/socket/udp-turn.c
+++ b/socket/udp-turn.c
@@ -274,9 +274,7 @@ socket_close (NiceSocket *sock)
}
g_list_free (priv->channels);
- g_list_foreach (priv->pending_bindings, (GFunc) nice_address_free,
- NULL);
- g_list_free (priv->pending_bindings);
+ g_list_free_full (priv->pending_bindings, (GDestroyNotify) nice_address_free);
if (priv->tick_source_channel_bind != NULL) {
g_source_destroy (priv->tick_source_channel_bind);
@@ -305,8 +303,7 @@ socket_close (NiceSocket *sock)
g_queue_free (priv->send_requests);
priv_clear_permissions (priv);
- g_list_foreach (priv->sent_permissions, (GFunc) nice_address_free, NULL);
- g_list_free (priv->sent_permissions);
+ g_list_free_full (priv->sent_permissions, (GDestroyNotify) nice_address_free);
g_hash_table_destroy (priv->send_data_queues);
if (priv->permission_timeout_source) {
@@ -320,8 +317,7 @@ socket_close (NiceSocket *sock)
g_free (priv->current_binding);
g_free (priv->current_binding_msg);
- g_list_foreach (priv->pending_permissions, (GFunc) g_free, NULL);
- g_list_free(priv->pending_permissions);
+ g_list_free_full (priv->pending_permissions, g_free);
g_free (priv->username);
g_free (priv->password);
g_free (priv->cached_realm);
@@ -546,8 +542,7 @@ priv_remove_sent_permission_for_peer (UdpTurnPriv *priv, const NiceAddress *peer
static void
priv_clear_permissions (UdpTurnPriv *priv)
{
- g_list_foreach (priv->permissions, (GFunc) nice_address_free, NULL);
- g_list_free (priv->permissions);
+ g_list_free_full (priv->permissions, (GDestroyNotify) nice_address_free);
priv->permissions = NULL;
}