Commit 23b59268 authored by Nicolas Dufresne's avatar Nicolas Dufresne Committed by Olivier Crête

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
parent a353ab3b
...@@ -2933,8 +2933,7 @@ nice_agent_gather_candidates ( ...@@ -2933,8 +2933,7 @@ nice_agent_gather_candidates (
} }
} }
g_list_foreach (addresses, (GFunc) g_free, NULL); g_list_free_full (addresses, (GDestroyNotify) g_free);
g_list_free (addresses);
} else { } else {
for (i = agent->local_addresses; i; i = i->next) { for (i = agent->local_addresses; i; i = i->next) {
NiceAddress *addr = i->data; NiceAddress *addr = i->data;
...@@ -4449,7 +4448,8 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent, ...@@ -4449,7 +4448,8 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent,
if (cancellable != NULL) { if (cancellable != NULL) {
cancellable_source = g_cancellable_source_new (cancellable); cancellable_source = g_cancellable_source_new (cancellable);
g_source_set_callback (cancellable_source, g_source_set_callback (cancellable_source,
(GSourceFunc) nice_agent_recv_cancelled_cb, &child_error, NULL); (GSourceFunc) G_CALLBACK (nice_agent_recv_cancelled_cb), &child_error,
NULL);
g_source_attach (cancellable_source, context); g_source_attach (cancellable_source, context);
} }
......
...@@ -115,7 +115,7 @@ socket_source_attach (SocketSource *socket_source, GMainContext *context) ...@@ -115,7 +115,7 @@ socket_source_attach (SocketSource *socket_source, GMainContext *context)
/* Create a source. */ /* Create a source. */
source = g_socket_create_source (socket_source->socket->fileno, source = g_socket_create_source (socket_source->socket->fileno,
G_IO_IN, NULL); G_IO_IN, NULL);
g_source_set_callback (source, (GSourceFunc) component_io_cb, g_source_set_callback (source, (GSourceFunc) G_CALLBACK (component_io_cb),
socket_source, NULL); socket_source, NULL);
/* Add the source. */ /* Add the source. */
...@@ -1300,7 +1300,7 @@ component_source_dispatch (GSource *source, GSourceFunc callback, ...@@ -1300,7 +1300,7 @@ component_source_dispatch (GSource *source, GSourceFunc callback,
gpointer user_data) gpointer user_data)
{ {
ComponentSource *component_source = (ComponentSource *) source; ComponentSource *component_source = (ComponentSource *) source;
GPollableSourceFunc func = (GPollableSourceFunc) callback; GPollableSourceFunc func = (GPollableSourceFunc) G_CALLBACK (callback);
return func (component_source->pollable_stream, user_data); return func (component_source->pollable_stream, user_data);
} }
...@@ -1349,7 +1349,7 @@ static GSourceFuncs component_source_funcs = { ...@@ -1349,7 +1349,7 @@ static GSourceFuncs component_source_funcs = {
NULL, /* check */ NULL, /* check */
component_source_dispatch, component_source_dispatch,
component_source_finalize, component_source_finalize,
(GSourceFunc) component_source_closure_callback, (GSourceFunc) G_CALLBACK (component_source_closure_callback),
}; };
/** /**
......
...@@ -418,7 +418,7 @@ nice_output_stream_write (GOutputStream *stream, const void *buffer, gsize count ...@@ -418,7 +418,7 @@ nice_output_stream_write (GOutputStream *stream, const void *buffer, gsize count
writeable_id = g_signal_connect_data (G_OBJECT (agent), writeable_id = g_signal_connect_data (G_OBJECT (agent),
"reliable-transport-writable", "reliable-transport-writable",
(GCallback) reliable_transport_writeable_cb, write_data_ref (write_data), (GCallback) reliable_transport_writeable_cb, write_data_ref (write_data),
(GClosureNotify) write_data_unref, 0); (GClosureNotify) G_CALLBACK (write_data_unref), 0);
do { do {
......
...@@ -327,8 +327,7 @@ gst_nice_src_dispose (GObject *object) ...@@ -327,8 +327,7 @@ gst_nice_src_dispose (GObject *object)
src->mainctx = NULL; src->mainctx = NULL;
if (src->outbufs) { if (src->outbufs) {
g_queue_foreach (src->outbufs, (GFunc) gst_buffer_unref, NULL); g_queue_free_full (src->outbufs, (GDestroyNotify) gst_buffer_unref);
g_queue_free (src->outbufs);
} }
src->outbufs = NULL; src->outbufs = NULL;
...@@ -430,8 +429,7 @@ gst_nice_src_change_state (GstElement * element, GstStateChange transition) ...@@ -430,8 +429,7 @@ gst_nice_src_change_state (GstElement * element, GstStateChange transition)
nice_agent_attach_recv (src->agent, src->stream_id, src->component_id, nice_agent_attach_recv (src->agent, src->stream_id, src->component_id,
src->mainctx, NULL, NULL); src->mainctx, NULL, NULL);
GST_OBJECT_LOCK (src); GST_OBJECT_LOCK (src);
g_queue_foreach (src->outbufs, (GFunc) gst_buffer_unref, NULL); g_queue_free_full (src->outbufs, (GDestroyNotify) gst_buffer_unref);
g_queue_clear (src->outbufs);
GST_OBJECT_UNLOCK (src); GST_OBJECT_UNLOCK (src);
break; break;
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
......
...@@ -75,7 +75,7 @@ void nice_socket_queue_send (GQueue *send_queue, const NiceAddress *to, ...@@ -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, void nice_socket_queue_send_with_callback (GQueue *send_queue,
const NiceOutputMessage *message, gsize message_offset, gsize message_len, const NiceOutputMessage *message, gsize message_offset, gsize message_len,
gboolean head, GSocket *gsock, GSource **io_source, GMainContext *context, gboolean head, GSocket *gsock, GSource **io_source, GMainContext *context,
GSourceFunc cb, gpointer user_data); GSocketSourceFunc cb, gpointer user_data);
/** /**
* nice_socket_flush_send_queue: * nice_socket_flush_send_queue:
......
...@@ -340,7 +340,7 @@ nice_socket_queue_send (GQueue *send_queue, const NiceAddress *to, ...@@ -340,7 +340,7 @@ nice_socket_queue_send (GQueue *send_queue, const NiceAddress *to,
void nice_socket_queue_send_with_callback (GQueue *send_queue, void nice_socket_queue_send_with_callback (GQueue *send_queue,
const NiceOutputMessage *message, gsize message_offset, gsize message_len, const NiceOutputMessage *message, gsize message_offset, gsize message_len,
gboolean head, GSocket *gsock, GSource **io_source, GMainContext *context, gboolean head, GSocket *gsock, GSource **io_source, GMainContext *context,
GSourceFunc cb, gpointer user_data) GSocketSourceFunc cb, gpointer user_data)
{ {
NiceSocketQueuedSend *tbs; NiceSocketQueuedSend *tbs;
guint j; guint j;
...@@ -360,7 +360,7 @@ void nice_socket_queue_send_with_callback (GQueue *send_queue, ...@@ -360,7 +360,7 @@ void nice_socket_queue_send_with_callback (GQueue *send_queue,
if (io_source && gsock && context && cb && *io_source == NULL) { if (io_source && gsock && context && cb && *io_source == NULL) {
*io_source = g_socket_create_source(gsock, G_IO_OUT, 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); g_source_attach (*io_source, context);
} }
...@@ -450,6 +450,5 @@ gboolean nice_socket_flush_send_queue_to_socket (GSocket *gsock, ...@@ -450,6 +450,5 @@ gboolean nice_socket_flush_send_queue_to_socket (GSocket *gsock,
void void
nice_socket_free_send_queue (GQueue *send_queue) nice_socket_free_send_queue (GQueue *send_queue)
{ {
g_queue_foreach (send_queue, (GFunc) nice_socket_free_queued_send, NULL); g_queue_free_full (send_queue, (GDestroyNotify) nice_socket_free_queued_send);
g_queue_clear (send_queue);
} }
...@@ -312,7 +312,7 @@ socket_send_message (NiceSocket *sock, ...@@ -312,7 +312,7 @@ socket_send_message (NiceSocket *sock,
/* Queue the message and send it later. */ /* Queue the message and send it later. */
nice_socket_queue_send_with_callback (&priv->send_queue, nice_socket_queue_send_with_callback (&priv->send_queue,
message, 0, message_len, FALSE, sock->fileno, &priv->io_source, 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; ret = message_len;
} }
...@@ -321,7 +321,7 @@ socket_send_message (NiceSocket *sock, ...@@ -321,7 +321,7 @@ socket_send_message (NiceSocket *sock,
/* Partial send. */ /* Partial send. */
nice_socket_queue_send_with_callback (&priv->send_queue, nice_socket_queue_send_with_callback (&priv->send_queue,
message, ret, message_len, TRUE, sock->fileno, &priv->io_source, 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; ret = message_len;
} }
} else { } else {
...@@ -330,7 +330,7 @@ socket_send_message (NiceSocket *sock, ...@@ -330,7 +330,7 @@ socket_send_message (NiceSocket *sock,
/* Queue the message and send it later. */ /* Queue the message and send it later. */
nice_socket_queue_send_with_callback (&priv->send_queue, nice_socket_queue_send_with_callback (&priv->send_queue,
message, 0, message_len, FALSE, sock->fileno, &priv->io_source, 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; ret = message_len;
} else { } else {
/* non reliable send, so we shouldn't queue the message */ /* non reliable send, so we shouldn't queue the message */
......
...@@ -274,9 +274,7 @@ socket_close (NiceSocket *sock) ...@@ -274,9 +274,7 @@ socket_close (NiceSocket *sock)
} }
g_list_free (priv->channels); g_list_free (priv->channels);
g_list_foreach (priv->pending_bindings, (GFunc) nice_address_free, g_list_free_full (priv->pending_bindings, (GDestroyNotify) nice_address_free);
NULL);
g_list_free (priv->pending_bindings);
if (priv->tick_source_channel_bind != NULL) { if (priv->tick_source_channel_bind != NULL) {
g_source_destroy (priv->tick_source_channel_bind); g_source_destroy (priv->tick_source_channel_bind);
...@@ -305,8 +303,7 @@ socket_close (NiceSocket *sock) ...@@ -305,8 +303,7 @@ socket_close (NiceSocket *sock)
g_queue_free (priv->send_requests); g_queue_free (priv->send_requests);
priv_clear_permissions (priv); priv_clear_permissions (priv);
g_list_foreach (priv->sent_permissions, (GFunc) nice_address_free, NULL); g_list_free_full (priv->sent_permissions, (GDestroyNotify) nice_address_free);
g_list_free (priv->sent_permissions);
g_hash_table_destroy (priv->send_data_queues); g_hash_table_destroy (priv->send_data_queues);
if (priv->permission_timeout_source) { if (priv->permission_timeout_source) {
...@@ -320,8 +317,7 @@ socket_close (NiceSocket *sock) ...@@ -320,8 +317,7 @@ socket_close (NiceSocket *sock)
g_free (priv->current_binding); g_free (priv->current_binding);
g_free (priv->current_binding_msg); g_free (priv->current_binding_msg);
g_list_foreach (priv->pending_permissions, (GFunc) g_free, NULL); g_list_free_full (priv->pending_permissions, g_free);
g_list_free(priv->pending_permissions);
g_free (priv->username); g_free (priv->username);
g_free (priv->password); g_free (priv->password);
g_free (priv->cached_realm); g_free (priv->cached_realm);
...@@ -546,8 +542,7 @@ priv_remove_sent_permission_for_peer (UdpTurnPriv *priv, const NiceAddress *peer ...@@ -546,8 +542,7 @@ priv_remove_sent_permission_for_peer (UdpTurnPriv *priv, const NiceAddress *peer
static void static void
priv_clear_permissions (UdpTurnPriv *priv) priv_clear_permissions (UdpTurnPriv *priv)
{ {
g_list_foreach (priv->permissions, (GFunc) nice_address_free, NULL); g_list_free_full (priv->permissions, (GDestroyNotify) nice_address_free);
g_list_free (priv->permissions);
priv->permissions = NULL; priv->permissions = NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment