Commit 51cadfdc authored by Jakub Adam's avatar Jakub Adam

tests: Fix -Wcast-function-type warnings with GCC 8

glib documentation says G_SOURCE_FUNC() macro should be used to suppress
the warning about incompatible function types when the function will be
cast back to the correct type before it is called by the GSource.
parent 6e27c1ef
......@@ -42,6 +42,8 @@
#include "iostream.h"
#include "test-io-stream-common.h"
static void
test_invalid_stream (NiceAddress *addr)
{
......@@ -254,7 +256,7 @@ check_pollable_source_cancellation (GSource *pollable_source,
main_loop = g_main_loop_new (main_context, FALSE);
/* Set up the pollable source. */
g_source_set_callback (pollable_source, (GSourceFunc) source_cancelled_cb,
g_source_set_callback (pollable_source, G_SOURCE_FUNC (source_cancelled_cb),
main_loop, NULL);
g_source_attach (pollable_source, main_context);
......
......@@ -554,7 +554,7 @@ void
stop_main_loop (GMainLoop *loop)
{
GSource *src = g_idle_source_new ();
g_source_set_callback (src, (GSourceFunc) g_main_loop_quit,
g_source_set_callback (src, G_SOURCE_FUNC (g_main_loop_quit),
g_main_loop_ref (loop), (GDestroyNotify) g_main_loop_unref);
g_source_attach (src, g_main_loop_get_context (loop));
g_source_unref (src);
......
......@@ -44,6 +44,10 @@
#include <unistd.h>
#endif
#if !GLIB_CHECK_VERSION(2, 58, 0)
#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f))
#endif
/* Make the message sufficiently large to not hit Nagle’s algorithm in the
* pseudo-TCP implementation, and hence run really slowly. */
#define MESSAGE_SIZE 1284 /* bytes */
......
......@@ -107,7 +107,7 @@ read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data)
g_pollable_input_stream_create_source (
G_POLLABLE_INPUT_STREAM (input_stream), NULL);
g_source_set_callback (stream_source, (GSourceFunc) read_stream_cb,
g_source_set_callback (stream_source, G_SOURCE_FUNC (read_stream_cb),
data, NULL);
g_source_attach (stream_source, main_context);
g_source_unref (stream_source);
......
......@@ -954,7 +954,7 @@ read_thread_gsource_cb (GInputStream *input_stream,
g_pollable_input_stream_create_source (
G_POLLABLE_INPUT_STREAM (input_stream), NULL);
g_source_set_callback (stream_source, (GSourceFunc) read_stream_cb,
g_source_set_callback (stream_source, G_SOURCE_FUNC (read_stream_cb),
&gsource_data, NULL);
g_source_attach (stream_source, main_context);
......@@ -1031,7 +1031,7 @@ write_thread_gsource_cb (GOutputStream *output_stream,
g_pollable_output_stream_create_source (
G_POLLABLE_OUTPUT_STREAM (output_stream), NULL);
g_source_set_callback (stream_source, (GSourceFunc) write_stream_cb,
g_source_set_callback (stream_source, G_SOURCE_FUNC (write_stream_cb),
&gsource_data, NULL);
g_source_attach (stream_source, main_context);
......
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