From 95b6d0eab06f10ea88f69958ca7684a61831423e Mon Sep 17 00:00:00 2001 From: RamiHg Date: Fri, 23 Dec 2022 10:50:40 -0800 Subject: [PATCH] Checking in changes from https://github.com/kleisauke/wasm-vips. These are the original set of changes very kindly organized and released in a patch by https://github.com/kleisauke. The details of this patch are in this thread: https://github.com/emscripten-core/emscripten/issues/11066. --- gio/gappinfo.c | 4 +- gio/gapplication.c | 18 ++-- gio/gapplicationcommandline.c | 4 +- gio/gbufferedinputstream.c | 6 +- gio/gbufferedoutputstream.c | 6 +- gio/gbytesicon.c | 12 ++- gio/gcharsetconverter.c | 12 ++- gio/gconverterinputstream.c | 7 +- gio/gconverteroutputstream.c | 6 +- gio/gdataoutputstream.c | 6 +- gio/gdbusactiongroup.c | 12 ++- gio/gdbusconnection.c | 12 ++- gio/gdbusdaemon.c | 12 ++- gio/gdbusobjectmanagerclient.c | 18 ++-- gio/gdbusproxy.c | 18 ++-- gio/gdbusserver.c | 6 +- gio/gdebugcontrollerdbus.c | 12 ++- gio/gdesktopappinfo.c | 12 ++- gio/gdummyfile.c | 6 +- gio/gdummyproxyresolver.c | 6 +- gio/gdummytlsbackend.c | 36 ++++--- gio/gemblem.c | 6 +- gio/gemblemedicon.c | 6 +- gio/gfile.c | 2 +- gio/gfileicon.c | 12 ++- gio/gfileinputstream.c | 6 +- gio/gfileiostream.c | 6 +- gio/gfileoutputstream.c | 6 +- gio/ghttpproxy.c | 6 +- gio/ginetaddressmask.c | 6 +- gio/ginetsocketaddress.c | 6 +- gio/gkeyfilesettingsbackend.c | 2 +- gio/gliststore.c | 6 +- gio/glocalfile.c | 14 ++- gio/glocalfileinfo.c | 6 +- gio/glocalfileinputstream.c | 20 ++-- gio/glocalfileoutputstream.c | 26 ++--- gio/glocalvfs.c | 6 +- gio/gmemoryinputstream.c | 12 ++- gio/gmemorymonitordbus.c | 12 ++- gio/gmemorymonitorportal.c | 12 ++- gio/gmemorymonitorwin32.c | 12 ++- gio/gmemoryoutputstream.c | 12 ++- gio/gnetworkaddress.c | 6 +- gio/gnetworkmonitorbase.c | 12 ++- gio/gnetworkmonitornetlink.c | 12 ++- gio/gnetworkmonitornm.c | 12 ++- gio/gnetworkmonitorportal.c | 12 ++- gio/gnetworkservice.c | 6 +- gio/gosxappinfo.m | 6 +- gio/gportalsupport.c | 14 +++ gio/gpowerprofilemonitordbus.c | 12 ++- gio/gpowerprofilemonitorportal.c | 12 ++- gio/gpropertyaction.c | 6 +- gio/gproxyresolverportal.c | 6 +- gio/gresourcefile.c | 6 +- gio/gsettings.c | 6 +- gio/gsettingsschema.c | 57 +---------- gio/gsimpleaction.c | 6 +- gio/gsimpleactiongroup.c | 12 ++- gio/gsimpleasyncresult.c | 6 +- gio/gsimpleproxyresolver.c | 6 +- gio/gsocket.c | 28 +++--- gio/gsocketaddress.c | 6 +- gio/gsocketinputstream.c | 20 ++-- gio/gsocketoutputstream.c | 20 ++-- gio/gsocks4aproxy.c | 6 +- gio/gsocks5proxy.c | 6 +- gio/gsubprocess.c | 58 ++++++----- gio/gtask.c | 6 +- gio/gtestdbus.c | 4 +- gio/gthemedicon.c | 6 +- gio/gunixfdlist.c | 4 + gio/gunixinputstream.c | 12 ++- gio/gunixmount.c | 6 +- gio/gunixoutputstream.c | 12 ++- gio/gunixsocketaddress.c | 6 +- gio/gunixvolume.c | 6 +- gio/gwin32appinfo.c | 6 +- gio/gwin32mount.c | 6 +- gio/gwin32networkmonitor.c | 12 ++- gio/gwin32registrykey.c | 6 +- gio/gzlibcompressor.c | 6 +- gio/gzlibdecompressor.c | 6 +- gio/meson.build | 150 +--------------------------- gio/win32/gwinhttpfile.c | 6 +- glib/gbacktrace.c | 4 +- glib/gi18n-lib.h | 15 +-- glib/glib-autocleanups.h | 2 - glib/glib.h | 1 - glib/gmain.c | 49 ++++++--- glib/gspawn-wasm.c | 164 +++++++++++++++++++++++++++++++ glib/gthread.c | 8 +- glib/gtimezone.c | 12 ++- glib/gutils.c | 7 +- glib/gwakeup.c | 29 ++++++ glib/meson.build | 16 +-- gobject/gboxed.c | 3 - gobject/glib-types.h | 9 -- gobject/gobject.c | 6 +- gobject/gparam.h | 3 +- gobject/gparamspecs.c | 66 ++++++++----- gobject/gsourceclosure.c | 14 +-- gobject/gtype.h | 26 +++-- gobject/gtypemodule.c | 3 +- gobject/gtypemodule.h | 8 +- gobject/meson.build | 5 - meson.build | 60 +++-------- 108 files changed, 913 insertions(+), 649 deletions(-) create mode 100644 glib/gspawn-wasm.c diff --git a/gio/gappinfo.c b/gio/gappinfo.c index d1a1a1d65cb..559dcde8c1c 100644 --- a/gio/gappinfo.c +++ b/gio/gappinfo.c @@ -1016,7 +1016,7 @@ g_app_info_launch_default_for_uri (const char *uri, g_object_unref (app_info); } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) if (!res && glib_should_use_portal ()) { const char *parent_window = NULL; @@ -1068,7 +1068,7 @@ launch_default_for_uri_portal_open_uri_cb (GObject *object, static void launch_default_for_uri_portal_open_uri (GTask *task, GError *error) { -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) LaunchDefaultForUriData *data = g_task_get_task_data (task); GCancellable *cancellable = g_task_get_cancellable (task); diff --git a/gio/gapplication.c b/gio/gapplication.c index 1d602c763de..8e3abe893f7 100644 --- a/gio/gapplication.c +++ b/gio/gapplication.c @@ -287,8 +287,10 @@ enum static guint g_application_signals[NR_SIGNALS]; -static void g_application_action_group_iface_init (GActionGroupInterface *); -static void g_application_action_map_iface_init (GActionMapInterface *); +static void g_application_action_group_iface_init (GActionGroupInterface *iface, + gpointer iface_data); +static void g_application_action_map_iface_init (GActionMapInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GApplication, g_application, G_TYPE_OBJECT, G_ADD_PRIVATE (GApplication) G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_application_action_group_iface_init) @@ -314,7 +316,8 @@ typedef struct } GApplicationExportedActions; static GType g_application_exported_actions_get_type (void); -static void g_application_exported_actions_iface_init (GRemoteActionGroupInterface *iface); +static void g_application_exported_actions_iface_init (GRemoteActionGroupInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GApplicationExportedActions, g_application_exported_actions, G_TYPE_SIMPLE_ACTION_GROUP, G_IMPLEMENT_INTERFACE (G_TYPE_REMOTE_ACTION_GROUP, g_application_exported_actions_iface_init)) @@ -358,7 +361,8 @@ g_application_exported_actions_init (GApplicationExportedActions *actions) } static void -g_application_exported_actions_iface_init (GRemoteActionGroupInterface *iface) +g_application_exported_actions_iface_init (GRemoteActionGroupInterface *iface, + gpointer iface_data) { iface->activate_action_full = g_application_exported_actions_activate_action_full; iface->change_action_state_full = g_application_exported_actions_change_action_state_full; @@ -2731,7 +2735,8 @@ g_application_remove_action (GActionMap *action_map, } static void -g_application_action_group_iface_init (GActionGroupInterface *iface) +g_application_action_group_iface_init (GActionGroupInterface *iface, + gpointer iface_data) { iface->list_actions = g_application_list_actions; iface->query_action = g_application_query_action; @@ -2740,7 +2745,8 @@ g_application_action_group_iface_init (GActionGroupInterface *iface) } static void -g_application_action_map_iface_init (GActionMapInterface *iface) +g_application_action_map_iface_init (GActionMapInterface *iface, + gpointer iface_data) { iface->lookup_action = g_application_lookup_action; iface->add_action = g_application_add_action; diff --git a/gio/gapplicationcommandline.c b/gio/gapplicationcommandline.c index 9fe52da5dd4..51e7986ff72 100644 --- a/gio/gapplicationcommandline.c +++ b/gio/gapplicationcommandline.c @@ -297,7 +297,9 @@ g_application_command_line_real_printerr_literal (GApplicationCommandLine *cmdli static GInputStream * g_application_command_line_real_get_stdin (GApplicationCommandLine *cmdline) { -#ifdef G_OS_UNIX +#ifdef G_PLATFORM_WASM + return NULL; +#elif defined(G_OS_UNIX) return g_unix_input_stream_new (0, FALSE); #else return g_win32_input_stream_new (GetStdHandle (STD_INPUT_HANDLE), FALSE); diff --git a/gio/gbufferedinputstream.c b/gio/gbufferedinputstream.c index 55450ce0e6e..8f144c6fabf 100644 --- a/gio/gbufferedinputstream.c +++ b/gio/gbufferedinputstream.c @@ -115,7 +115,8 @@ static gssize g_buffered_input_stream_real_fill_finish (GBufferedInputStream *s GAsyncResult *result, GError **error); -static void g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface); +static void g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data); static goffset g_buffered_input_stream_tell (GSeekable *seekable); static gboolean g_buffered_input_stream_can_seek (GSeekable *seekable); static gboolean g_buffered_input_stream_seek (GSeekable *seekable, @@ -302,7 +303,8 @@ g_buffered_input_stream_finalize (GObject *object) } static void -g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface) +g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data) { iface->tell = g_buffered_input_stream_tell; iface->can_seek = g_buffered_input_stream_can_seek; diff --git a/gio/gbufferedoutputstream.c b/gio/gbufferedoutputstream.c index 4999a7d69b2..af5581c5592 100644 --- a/gio/gbufferedoutputstream.c +++ b/gio/gbufferedoutputstream.c @@ -107,7 +107,8 @@ static gboolean g_buffered_output_stream_close_finish (GOutputStream *str GAsyncResult *result, GError **error); -static void g_buffered_output_stream_seekable_iface_init (GSeekableIface *iface); +static void g_buffered_output_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data); static goffset g_buffered_output_stream_tell (GSeekable *seekable); static gboolean g_buffered_output_stream_can_seek (GSeekable *seekable); static gboolean g_buffered_output_stream_seek (GSeekable *seekable, @@ -348,7 +349,8 @@ g_buffered_output_stream_init (GBufferedOutputStream *stream) } static void -g_buffered_output_stream_seekable_iface_init (GSeekableIface *iface) +g_buffered_output_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data) { iface->tell = g_buffered_output_stream_tell; iface->can_seek = g_buffered_output_stream_can_seek; diff --git a/gio/gbytesicon.c b/gio/gbytesicon.c index b402a517895..8a88f8da073 100644 --- a/gio/gbytesicon.c +++ b/gio/gbytesicon.c @@ -59,8 +59,10 @@ enum PROP_BYTES }; -static void g_bytes_icon_icon_iface_init (GIconIface *iface); -static void g_bytes_icon_loadable_icon_iface_init (GLoadableIconIface *iface); +static void g_bytes_icon_icon_iface_init (GIconIface *iface, + gpointer iface_data); +static void g_bytes_icon_loadable_icon_iface_init (GLoadableIconIface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GBytesIcon, g_bytes_icon, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_ICON, g_bytes_icon_icon_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_LOADABLE_ICON, g_bytes_icon_loadable_icon_iface_init)) @@ -210,7 +212,8 @@ g_bytes_icon_serialize (GIcon *icon) } static void -g_bytes_icon_icon_iface_init (GIconIface *iface) +g_bytes_icon_icon_iface_init (GIconIface *iface, + gpointer iface_data) { iface->hash = g_bytes_icon_hash; iface->equal = g_bytes_icon_equal; @@ -263,7 +266,8 @@ g_bytes_icon_load_finish (GLoadableIcon *icon, } static void -g_bytes_icon_loadable_icon_iface_init (GLoadableIconIface *iface) +g_bytes_icon_loadable_icon_iface_init (GLoadableIconIface *iface, + gpointer iface_data) { iface->load = g_bytes_icon_load; iface->load_async = g_bytes_icon_load_async; diff --git a/gio/gcharsetconverter.c b/gio/gcharsetconverter.c index 499319999da..ab22439a74c 100644 --- a/gio/gcharsetconverter.c +++ b/gio/gcharsetconverter.c @@ -47,8 +47,10 @@ enum { * GIConv. */ -static void g_charset_converter_iface_init (GConverterIface *iface); -static void g_charset_converter_initable_iface_init (GInitableIface *iface); +static void g_charset_converter_iface_init (GConverterIface *iface, + gpointer iface_data); +static void g_charset_converter_initable_iface_init (GInitableIface *iface, + gpointer iface_data); /** * GCharsetConverter: @@ -423,7 +425,8 @@ g_charset_converter_get_num_fallbacks (GCharsetConverter *converter) } static void -g_charset_converter_iface_init (GConverterIface *iface) +g_charset_converter_iface_init (GConverterIface *iface, + gpointer iface_data) { iface->convert = g_charset_converter_convert; iface->reset = g_charset_converter_reset; @@ -468,7 +471,8 @@ g_charset_converter_initable_init (GInitable *initable, } static void -g_charset_converter_initable_iface_init (GInitableIface *iface) +g_charset_converter_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_charset_converter_initable_init; } diff --git a/gio/gconverterinputstream.c b/gio/gconverterinputstream.c index 59277bf833f..306d1235f64 100644 --- a/gio/gconverterinputstream.c +++ b/gio/gconverterinputstream.c @@ -93,8 +93,8 @@ static gssize g_converter_input_stream_read_nonblocking (GPollableInputStream static GSource *g_converter_input_stream_create_source (GPollableInputStream *stream, GCancellable *cancellable); -static void g_converter_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface); - +static void g_converter_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GConverterInputStream, g_converter_input_stream, G_TYPE_FILTER_INPUT_STREAM, @@ -129,7 +129,8 @@ g_converter_input_stream_class_init (GConverterInputStreamClass *klass) } static void -g_converter_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) +g_converter_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, + gpointer iface_data) { iface->can_poll = g_converter_input_stream_can_poll; iface->is_readable = g_converter_input_stream_is_readable; diff --git a/gio/gconverteroutputstream.c b/gio/gconverteroutputstream.c index b26f645d4d7..4e563c0ffa0 100644 --- a/gio/gconverteroutputstream.c +++ b/gio/gconverteroutputstream.c @@ -108,7 +108,8 @@ static gssize g_converter_output_stream_write_nonblocking (GPollableOutputStre static GSource *g_converter_output_stream_create_source (GPollableOutputStream *stream, GCancellable *cancellable); -static void g_converter_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); +static void g_converter_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GConverterOutputStream, g_converter_output_stream, @@ -145,7 +146,8 @@ g_converter_output_stream_class_init (GConverterOutputStreamClass *klass) } static void -g_converter_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) +g_converter_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, + gpointer iface_data) { iface->can_poll = g_converter_output_stream_can_poll; iface->is_writable = g_converter_output_stream_is_writable; diff --git a/gio/gdataoutputstream.c b/gio/gdataoutputstream.c index f2d1f3988ac..4484089d808 100644 --- a/gio/gdataoutputstream.c +++ b/gio/gdataoutputstream.c @@ -60,7 +60,8 @@ static void g_data_output_stream_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void g_data_output_stream_seekable_iface_init (GSeekableIface *iface); +static void g_data_output_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data); static goffset g_data_output_stream_tell (GSeekable *seekable); static gboolean g_data_output_stream_can_seek (GSeekable *seekable); static gboolean g_data_output_stream_seek (GSeekable *seekable, @@ -162,7 +163,8 @@ g_data_output_stream_init (GDataOutputStream *stream) } static void -g_data_output_stream_seekable_iface_init (GSeekableIface *iface) +g_data_output_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data) { iface->tell = g_data_output_stream_tell; iface->can_seek = g_data_output_stream_can_seek; diff --git a/gio/gdbusactiongroup.c b/gio/gdbusactiongroup.c index 275c5fc0159..34c6c080fe6 100644 --- a/gio/gdbusactiongroup.c +++ b/gio/gdbusactiongroup.c @@ -131,8 +131,10 @@ action_info_new_from_iter (GVariantIter *iter) return info; } -static void g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface); -static void g_dbus_action_group_iface_init (GActionGroupInterface *iface); +static void g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface, + gpointer iface_data); +static void g_dbus_action_group_iface_init (GActionGroupInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GDBusActionGroup, g_dbus_action_group, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_dbus_action_group_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_REMOTE_ACTION_GROUP, g_dbus_action_group_remote_iface_init)) @@ -459,14 +461,16 @@ g_dbus_action_group_class_init (GDBusActionGroupClass *class) } static void -g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface) +g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface, + gpointer iface_data) { iface->activate_action_full = g_dbus_action_group_activate_action_full; iface->change_action_state_full = g_dbus_action_group_change_action_state_full; } static void -g_dbus_action_group_iface_init (GActionGroupInterface *iface) +g_dbus_action_group_iface_init (GActionGroupInterface *iface, + gpointer iface_data) { iface->list_actions = g_dbus_action_group_list_actions; iface->query_action = g_dbus_action_group_query_action; diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index d9887f768e1..39ed39e3ee1 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -510,8 +510,10 @@ static void schedule_method_call (GDBusConnection *connection, static guint signals[LAST_SIGNAL] = { 0 }; -static void initable_iface_init (GInitableIface *initable_iface); -static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface); +static void initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data); +static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GDBusConnection, g_dbus_connection, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init) @@ -2662,7 +2664,8 @@ initable_init (GInitable *initable, } static void -initable_iface_init (GInitableIface *initable_iface) +initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data) { initable_iface->init = initable_init; } @@ -2670,7 +2673,8 @@ initable_iface_init (GInitableIface *initable_iface) /* ---------------------------------------------------------------------------------------------------- */ static void -async_initable_iface_init (GAsyncInitableIface *async_initable_iface) +async_initable_iface_init (GAsyncInitableIface *async_initable_iface, + gpointer iface_data) { /* Use default */ } diff --git a/gio/gdbusdaemon.c b/gio/gdbusdaemon.c index 5a8e523f050..4f955f99633 100644 --- a/gio/gdbusdaemon.c +++ b/gio/gdbusdaemon.c @@ -90,8 +90,10 @@ enum static guint g_dbus_daemon_signals[NR_SIGNALS]; -static void initable_iface_init (GInitableIface *initable_iface); -static void g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface); +static void initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data); +static void g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface, + gpointer iface_data); #define g_dbus_daemon_get_type _g_dbus_daemon_get_type G_DEFINE_TYPE_WITH_CODE (GDBusDaemon, g_dbus_daemon, _G_TYPE_FREEDESKTOP_DBUS_SKELETON, @@ -1718,7 +1720,8 @@ g_dbus_daemon_class_init (GDBusDaemonClass *klass) } static void -g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface) +g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface, + gpointer iface_data) { iface->handle_add_match = handle_add_match; iface->handle_get_connection_selinux_security_context = handle_get_connection_selinux_security_context; @@ -1740,7 +1743,8 @@ g_dbus_daemon_iface_init (_GFreedesktopDBusIface *iface) } static void -initable_iface_init (GInitableIface *initable_iface) +initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data) { initable_iface->init = initable_init; } diff --git a/gio/gdbusobjectmanagerclient.c b/gio/gdbusobjectmanagerclient.c index fa5e73041e2..f7951c3435d 100644 --- a/gio/gdbusobjectmanagerclient.c +++ b/gio/gdbusobjectmanagerclient.c @@ -174,9 +174,12 @@ enum static guint signals[LAST_SIGNAL] = { 0 }; -static void initable_iface_init (GInitableIface *initable_iface); -static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface); -static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface); +static void initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data); +static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface, + gpointer iface_data); +static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GDBusObjectManagerClient, g_dbus_object_manager_client, G_TYPE_OBJECT, G_ADD_PRIVATE (GDBusObjectManagerClient) @@ -1516,13 +1519,15 @@ initable_init (GInitable *initable, } static void -initable_iface_init (GInitableIface *initable_iface) +initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data) { initable_iface->init = initable_init; } static void -async_initable_iface_init (GAsyncInitableIface *async_initable_iface) +async_initable_iface_init (GAsyncInitableIface *async_initable_iface, + gpointer iface_data) { /* for now, just use default: run GInitable code in thread */ } @@ -1863,7 +1868,8 @@ g_dbus_object_manager_client_get_objects (GDBusObjectManager *_manager) static void -dbus_object_manager_interface_init (GDBusObjectManagerIface *iface) +dbus_object_manager_interface_init (GDBusObjectManagerIface *iface, + gpointer iface_data) { iface->get_object_path = g_dbus_object_manager_client_get_object_path; iface->get_objects = g_dbus_object_manager_client_get_objects; diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c index 292c7b5e169..b40ee81c1f8 100644 --- a/gio/gdbusproxy.c +++ b/gio/gdbusproxy.c @@ -177,9 +177,12 @@ enum static guint signals[LAST_SIGNAL] = {0}; -static void dbus_interface_iface_init (GDBusInterfaceIface *dbus_interface_iface); -static void initable_iface_init (GInitableIface *initable_iface); -static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface); +static void dbus_interface_iface_init (GDBusInterfaceIface *dbus_interface_iface, + gpointer iface_data); +static void initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data); +static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GDBusProxy, g_dbus_proxy, G_TYPE_OBJECT, G_ADD_PRIVATE (GDBusProxy) @@ -1849,7 +1852,8 @@ async_initable_init_finish (GAsyncInitable *initable, } static void -async_initable_iface_init (GAsyncInitableIface *async_initable_iface) +async_initable_iface_init (GAsyncInitableIface *async_initable_iface, + gpointer iface_data) { async_initable_iface->init_async = async_initable_init_async; async_initable_iface->init_finish = async_initable_init_finish; @@ -1936,7 +1940,8 @@ initable_init (GInitable *initable, } static void -initable_iface_init (GInitableIface *initable_iface) +initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data) { initable_iface->init = initable_init; } @@ -3191,7 +3196,8 @@ _g_dbus_proxy_set_object (GDBusInterface *interface, } static void -dbus_interface_iface_init (GDBusInterfaceIface *dbus_interface_iface) +dbus_interface_iface_init (GDBusInterfaceIface *dbus_interface_iface, + gpointer iface_data) { dbus_interface_iface->get_info = _g_dbus_proxy_get_info; dbus_interface_iface->get_object = _g_dbus_proxy_get_object; diff --git a/gio/gdbusserver.c b/gio/gdbusserver.c index db0c9ab50a8..cd40a20bd44 100644 --- a/gio/gdbusserver.c +++ b/gio/gdbusserver.c @@ -165,7 +165,8 @@ enum static guint _signals[LAST_SIGNAL] = {0}; -static void initable_iface_init (GInitableIface *initable_iface); +static void initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GDBusServer, g_dbus_server, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)) @@ -1182,7 +1183,8 @@ initable_init (GInitable *initable, static void -initable_iface_init (GInitableIface *initable_iface) +initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data) { initable_iface->init = initable_init; } diff --git a/gio/gdebugcontrollerdbus.c b/gio/gdebugcontrollerdbus.c index 84d2e649921..97cf3c5793b 100644 --- a/gio/gdebugcontrollerdbus.c +++ b/gio/gdebugcontrollerdbus.c @@ -160,8 +160,10 @@ static GDBusInterfaceInfo *org_gtk_Debugging; #define G_DEBUG_CONTROLLER_DBUS_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) -static void g_debug_controller_dbus_iface_init (GDebugControllerInterface *iface); -static void g_debug_controller_dbus_initable_iface_init (GInitableIface *iface); +static void g_debug_controller_dbus_iface_init (GDebugControllerInterface *iface, + gpointer iface_data); +static void g_debug_controller_dbus_initable_iface_init (GInitableIface *iface, + gpointer iface_data); static gboolean g_debug_controller_dbus_authorize_default (GDebugControllerDBus *self, GDBusMethodInvocation *invocation); @@ -615,12 +617,14 @@ g_debug_controller_dbus_class_init (GDebugControllerDBusClass *klass) } static void -g_debug_controller_dbus_iface_init (GDebugControllerInterface *iface) +g_debug_controller_dbus_iface_init (GDebugControllerInterface *iface, + gpointer iface_data) { } static void -g_debug_controller_dbus_initable_iface_init (GInitableIface *iface) +g_debug_controller_dbus_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_debug_controller_dbus_initable_init; } diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index d0cdef51a93..be082b86e9c 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -42,7 +42,7 @@ #include "gcontenttypeprivate.h" #include "gdesktopappinfo.h" -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include "glib-unix.h" #endif #include "gfile.h" @@ -57,7 +57,7 @@ #include "gappinfoprivate.h" #include "glocalfilemonitor.h" -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include "gdocumentportal.h" #endif @@ -89,7 +89,8 @@ enum { PROP_FILENAME }; -static void g_desktop_app_info_iface_init (GAppInfoIface *iface); +static void g_desktop_app_info_iface_init (GAppInfoIface *iface, + gpointer iface_data); static gboolean g_desktop_app_info_ensure_saved (GDesktopAppInfo *info, GError **error); static gboolean g_desktop_app_info_load_file (GDesktopAppInfo *self); @@ -3168,7 +3169,7 @@ g_desktop_app_info_launch_uris_with_dbus (GDesktopAppInfo *info, g_return_val_if_fail (info != NULL, FALSE); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) app_id = g_desktop_app_info_get_string (info, "X-Flatpak"); if (app_id && *app_id) { @@ -4271,7 +4272,8 @@ g_app_info_create_from_commandline (const char *commandline, /* GAppInfo interface init */ static void -g_desktop_app_info_iface_init (GAppInfoIface *iface) +g_desktop_app_info_iface_init (GAppInfoIface *iface, + gpointer iface_data) { iface->dup = g_desktop_app_info_dup; iface->equal = g_desktop_app_info_equal; diff --git a/gio/gdummyfile.c b/gio/gdummyfile.c index 4ec352c6e41..36d55ceeaf2 100644 --- a/gio/gdummyfile.c +++ b/gio/gdummyfile.c @@ -33,7 +33,8 @@ #include "gfile.h" -static void g_dummy_file_file_iface_init (GFileIface *iface); +static void g_dummy_file_file_iface_init (GFileIface *iface, + gpointer iface_data); typedef struct { char *scheme; @@ -398,7 +399,8 @@ g_dummy_file_get_uri_scheme (GFile *file) static void -g_dummy_file_file_iface_init (GFileIface *iface) +g_dummy_file_file_iface_init (GFileIface *iface, + gpointer iface_data) { iface->dup = g_dummy_file_dup; iface->hash = g_dummy_file_hash; diff --git a/gio/gdummyproxyresolver.c b/gio/gdummyproxyresolver.c index 1cac1db746f..fe354166f08 100644 --- a/gio/gdummyproxyresolver.c +++ b/gio/gdummyproxyresolver.c @@ -38,7 +38,8 @@ struct _GDummyProxyResolver { GObject parent_instance; }; -static void g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface); +static void g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface, + gpointer iface_data); #define g_dummy_proxy_resolver_get_type _g_dummy_proxy_resolver_get_type G_DEFINE_TYPE_WITH_CODE (GDummyProxyResolver, g_dummy_proxy_resolver, G_TYPE_OBJECT, @@ -127,7 +128,8 @@ g_dummy_proxy_resolver_class_init (GDummyProxyResolverClass *resolver_class) } static void -g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface) +g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface, + gpointer iface_data) { iface->is_supported = g_dummy_proxy_resolver_is_supported; iface->lookup = g_dummy_proxy_resolver_lookup; diff --git a/gio/gdummytlsbackend.c b/gio/gdummytlsbackend.c index 1ec00c99e8b..d2f73c5f3a3 100644 --- a/gio/gdummytlsbackend.c +++ b/gio/gdummytlsbackend.c @@ -53,7 +53,8 @@ struct _GDummyTlsBackend { GTlsDatabase *database; }; -static void g_dummy_tls_backend_iface_init (GTlsBackendInterface *iface); +static void g_dummy_tls_backend_iface_init (GTlsBackendInterface *iface, + gpointer iface_data); #define g_dummy_tls_backend_get_type _g_dummy_tls_backend_get_type G_DEFINE_TYPE_WITH_CODE (GDummyTlsBackend, g_dummy_tls_backend, G_TYPE_OBJECT, @@ -105,7 +106,8 @@ g_dummy_tls_backend_get_default_database (GTlsBackend *backend) } static void -g_dummy_tls_backend_iface_init (GTlsBackendInterface *iface) +g_dummy_tls_backend_iface_init (GTlsBackendInterface *iface, + gpointer iface_data) { iface->get_certificate_type = _g_dummy_tls_certificate_get_type; iface->get_client_connection_type = _g_dummy_tls_connection_get_type; @@ -140,7 +142,8 @@ enum PROP_CERT_ISSUER }; -static void g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface); +static void g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface, + gpointer iface_data); #define g_dummy_tls_certificate_get_type _g_dummy_tls_certificate_get_type G_DEFINE_TYPE_WITH_CODE (GDummyTlsCertificate, g_dummy_tls_certificate, G_TYPE_TLS_CERTIFICATE, @@ -199,7 +202,8 @@ g_dummy_tls_certificate_initable_init (GInitable *initable, } static void -g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface) +g_dummy_tls_certificate_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_dummy_tls_certificate_initable_init; } @@ -242,7 +246,8 @@ enum PROP_CONN_NEGOTIATED_PROTOCOL, }; -static void g_dummy_tls_connection_initable_iface_init (GInitableIface *iface); +static void g_dummy_tls_connection_initable_iface_init (GInitableIface *iface, + gpointer iface_data); #define g_dummy_tls_connection_get_type _g_dummy_tls_connection_get_type G_DEFINE_TYPE_WITH_CODE (GDummyTlsConnection, g_dummy_tls_connection, G_TYPE_TLS_CONNECTION, @@ -325,7 +330,8 @@ g_dummy_tls_connection_initable_init (GInitable *initable, } static void -g_dummy_tls_connection_initable_iface_init (GInitableIface *iface) +g_dummy_tls_connection_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_dummy_tls_connection_initable_init; } @@ -363,7 +369,8 @@ enum PROP_DTLS_CONN_AUTHENTICATION_MODE, }; -static void g_dummy_dtls_connection_initable_iface_init (GInitableIface *iface); +static void g_dummy_dtls_connection_initable_iface_init (GInitableIface *iface, + gpointer iface_data); #define g_dummy_dtls_connection_get_type _g_dummy_dtls_connection_get_type G_DEFINE_TYPE_WITH_CODE (GDummyDtlsConnection, g_dummy_dtls_connection, G_TYPE_OBJECT, @@ -427,7 +434,8 @@ g_dummy_dtls_connection_initable_init (GInitable *initable, } static void -g_dummy_dtls_connection_initable_iface_init (GInitableIface *iface) +g_dummy_dtls_connection_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_dummy_dtls_connection_initable_init; } @@ -453,8 +461,10 @@ enum PROP_ANCHORS, }; -static void g_dummy_tls_database_file_database_iface_init (GTlsFileDatabaseInterface *iface); -static void g_dummy_tls_database_initable_iface_init (GInitableIface *iface); +static void g_dummy_tls_database_file_database_iface_init (GTlsFileDatabaseInterface *iface, + gpointer iface_data); +static void g_dummy_tls_database_initable_iface_init (GInitableIface *iface, + gpointer iface_data); #define g_dummy_tls_database_get_type _g_dummy_tls_database_get_type G_DEFINE_TYPE_WITH_CODE (GDummyTlsDatabase, g_dummy_tls_database, G_TYPE_TLS_DATABASE, @@ -502,7 +512,8 @@ g_dummy_tls_database_init (GDummyTlsDatabase *database) } static void -g_dummy_tls_database_file_database_iface_init (GTlsFileDatabaseInterface *iface) +g_dummy_tls_database_file_database_iface_init (GTlsFileDatabaseInterface *iface, + gpointer iface_data) { } @@ -517,7 +528,8 @@ g_dummy_tls_database_initable_init (GInitable *initable, } static void -g_dummy_tls_database_initable_iface_init (GInitableIface *iface) +g_dummy_tls_database_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_dummy_tls_database_initable_init; } diff --git a/gio/gemblem.c b/gio/gemblem.c index af1ba000609..7f926f2b68d 100644 --- a/gio/gemblem.c +++ b/gio/gemblem.c @@ -44,7 +44,8 @@ * supported. More may be added in the future. */ -static void g_emblem_iface_init (GIconIface *iface); +static void g_emblem_iface_init (GIconIface *iface, + gpointer iface_data); struct _GEmblem { @@ -371,7 +372,8 @@ g_emblem_serialize (GIcon *icon) } static void -g_emblem_iface_init (GIconIface *iface) +g_emblem_iface_init (GIconIface *iface, + gpointer iface_data) { iface->hash = g_emblem_hash; iface->equal = g_emblem_equal; diff --git a/gio/gemblemedicon.c b/gio/gemblemedicon.c index 8b72f12f9e0..84070224eee 100644 --- a/gio/gemblemedicon.c +++ b/gio/gemblemedicon.c @@ -58,7 +58,8 @@ struct _GEmblemedIconPrivate { static GParamSpec *properties[NUM_PROPERTIES] = { NULL, }; -static void g_emblemed_icon_icon_iface_init (GIconIface *iface); +static void g_emblemed_icon_icon_iface_init (GIconIface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GEmblemedIcon, g_emblemed_icon, G_TYPE_OBJECT, G_ADD_PRIVATE (GEmblemedIcon) @@ -459,7 +460,8 @@ g_emblemed_icon_serialize (GIcon *icon) } static void -g_emblemed_icon_icon_iface_init (GIconIface *iface) +g_emblemed_icon_icon_iface_init (GIconIface *iface, + gpointer iface_data) { iface->hash = g_emblemed_icon_hash; iface->equal = g_emblemed_icon_equal; diff --git a/gio/gfile.c b/gio/gfile.c index e78b5e18574..4484ab62297 100644 --- a/gio/gfile.c +++ b/gio/gfile.c @@ -58,7 +58,7 @@ #include "gfile.h" #include "glib/gstdio.h" -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include "glib-unix.h" #endif #include "gvfs.h" diff --git a/gio/gfileicon.c b/gio/gfileicon.c index bd727cd7a68..2abe576aaf1 100644 --- a/gio/gfileicon.c +++ b/gio/gfileicon.c @@ -43,8 +43,10 @@ * **/ -static void g_file_icon_icon_iface_init (GIconIface *iface); -static void g_file_icon_loadable_icon_iface_init (GLoadableIconIface *iface); +static void g_file_icon_icon_iface_init (GIconIface *iface, + gpointer iface_data); +static void g_file_icon_loadable_icon_iface_init (GLoadableIconIface *iface, + gpointer iface_data); static void g_file_icon_load_async (GLoadableIcon *icon, int size, GCancellable *cancellable, @@ -280,7 +282,8 @@ g_file_icon_serialize (GIcon *icon) } static void -g_file_icon_icon_iface_init (GIconIface *iface) +g_file_icon_icon_iface_init (GIconIface *iface, + gpointer iface_data) { iface->hash = g_file_icon_hash; iface->equal = g_file_icon_equal; @@ -360,7 +363,8 @@ g_file_icon_load_finish (GLoadableIcon *icon, } static void -g_file_icon_loadable_icon_iface_init (GLoadableIconIface *iface) +g_file_icon_loadable_icon_iface_init (GLoadableIconIface *iface, + gpointer iface_data) { iface->load = g_file_icon_load; iface->load_async = g_file_icon_load_async; diff --git a/gio/gfileinputstream.c b/gio/gfileinputstream.c index 44eb07c68ed..f5c19c80edf 100644 --- a/gio/gfileinputstream.c +++ b/gio/gfileinputstream.c @@ -49,7 +49,8 @@ * To position a file input stream, use g_seekable_seek(). **/ -static void g_file_input_stream_seekable_iface_init (GSeekableIface *iface); +static void g_file_input_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data); static goffset g_file_input_stream_seekable_tell (GSeekable *seekable); static gboolean g_file_input_stream_seekable_can_seek (GSeekable *seekable); static gboolean g_file_input_stream_seekable_seek (GSeekable *seekable, @@ -90,7 +91,8 @@ g_file_input_stream_class_init (GFileInputStreamClass *klass) } static void -g_file_input_stream_seekable_iface_init (GSeekableIface *iface) +g_file_input_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data) { iface->tell = g_file_input_stream_seekable_tell; iface->can_seek = g_file_input_stream_seekable_can_seek; diff --git a/gio/gfileiostream.c b/gio/gfileiostream.c index 97dbc322f23..8080aab9aea 100644 --- a/gio/gfileiostream.c +++ b/gio/gfileiostream.c @@ -62,7 +62,8 @@ * Since: 2.22 **/ -static void g_file_io_stream_seekable_iface_init (GSeekableIface *iface); +static void g_file_io_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data); static goffset g_file_io_stream_seekable_tell (GSeekable *seekable); static gboolean g_file_io_stream_seekable_can_seek (GSeekable *seekable); static gboolean g_file_io_stream_seekable_seek (GSeekable *seekable, @@ -95,7 +96,8 @@ G_DEFINE_TYPE_WITH_CODE (GFileIOStream, g_file_io_stream, G_TYPE_IO_STREAM, g_file_io_stream_seekable_iface_init)) static void -g_file_io_stream_seekable_iface_init (GSeekableIface *iface) +g_file_io_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data) { iface->tell = g_file_io_stream_seekable_tell; iface->can_seek = g_file_io_stream_seekable_can_seek; diff --git a/gio/gfileoutputstream.c b/gio/gfileoutputstream.c index d767c53a183..495bfa893b2 100644 --- a/gio/gfileoutputstream.c +++ b/gio/gfileoutputstream.c @@ -54,7 +54,8 @@ * stream, use g_seekable_truncate(). **/ -static void g_file_output_stream_seekable_iface_init (GSeekableIface *iface); +static void g_file_output_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data); static goffset g_file_output_stream_seekable_tell (GSeekable *seekable); static gboolean g_file_output_stream_seekable_can_seek (GSeekable *seekable); static gboolean g_file_output_stream_seekable_seek (GSeekable *seekable, @@ -94,7 +95,8 @@ g_file_output_stream_class_init (GFileOutputStreamClass *klass) } static void -g_file_output_stream_seekable_iface_init (GSeekableIface *iface) +g_file_output_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data) { iface->tell = g_file_output_stream_seekable_tell; iface->can_seek = g_file_output_stream_seekable_can_seek; diff --git a/gio/ghttpproxy.c b/gio/ghttpproxy.c index 605a7299415..28e36747138 100644 --- a/gio/ghttpproxy.c +++ b/gio/ghttpproxy.c @@ -53,7 +53,8 @@ struct _GHttpProxyClass GObjectClass parent_class; }; -static void g_http_proxy_iface_init (GProxyInterface *proxy_iface); +static void g_http_proxy_iface_init (GProxyInterface *proxy_iface, + gpointer iface_data); #define g_http_proxy_get_type _g_http_proxy_get_type G_DEFINE_TYPE_WITH_CODE (GHttpProxy, g_http_proxy, G_TYPE_OBJECT, @@ -379,7 +380,8 @@ g_http_proxy_class_init (GHttpProxyClass *class) } static void -g_http_proxy_iface_init (GProxyInterface *proxy_iface) +g_http_proxy_iface_init (GProxyInterface *proxy_iface, + gpointer iface_data) { proxy_iface->connect = g_http_proxy_connect; proxy_iface->connect_async = g_http_proxy_connect_async; diff --git a/gio/ginetaddressmask.c b/gio/ginetaddressmask.c index c0704db14a0..e9a19061862 100644 --- a/gio/ginetaddressmask.c +++ b/gio/ginetaddressmask.c @@ -56,7 +56,8 @@ struct _GInetAddressMaskPrivate guint length; }; -static void g_inet_address_mask_initable_iface_init (GInitableIface *iface); +static void g_inet_address_mask_initable_iface_init (GInitableIface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GInetAddressMask, g_inet_address_mask, G_TYPE_OBJECT, G_ADD_PRIVATE (GInetAddressMask) @@ -230,7 +231,8 @@ g_inet_address_mask_initable_init (GInitable *initable, } static void -g_inet_address_mask_initable_iface_init (GInitableIface *iface) +g_inet_address_mask_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_inet_address_mask_initable_init; } diff --git a/gio/ginetsocketaddress.c b/gio/ginetsocketaddress.c index 76930355815..f09158cb734 100644 --- a/gio/ginetsocketaddress.c +++ b/gio/ginetsocketaddress.c @@ -57,7 +57,8 @@ struct _GInetSocketAddressPrivate guint32 scope_id; }; -static void g_inet_socket_address_connectable_iface_init (GSocketConnectableIface *iface); +static void g_inet_socket_address_connectable_iface_init (GSocketConnectableIface *iface, + gpointer iface_data); static gchar *g_inet_socket_address_connectable_to_string (GSocketConnectable *connectable); G_DEFINE_TYPE_WITH_CODE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS, @@ -311,7 +312,8 @@ g_inet_socket_address_class_init (GInetSocketAddressClass *klass) } static void -g_inet_socket_address_connectable_iface_init (GSocketConnectableIface *iface) +g_inet_socket_address_connectable_iface_init (GSocketConnectableIface *iface, + gpointer iface_data) { GSocketConnectableIface *parent_iface = g_type_interface_peek_parent (iface); diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c index 79a02668b8b..74371b1cf2b 100644 --- a/gio/gkeyfilesettingsbackend.c +++ b/gio/gkeyfilesettingsbackend.c @@ -79,7 +79,7 @@ typedef struct GFileMonitor *dir_monitor; } GKeyfileSettingsBackend; -#ifdef G_OS_WIN32 +#if defined(G_OS_WIN32) || defined(G_PLATFORM_WASM) #define EXTENSION_PRIORITY 10 #else #define EXTENSION_PRIORITY (glib_should_use_portal () && !glib_has_dconf_access_in_sandbox () ? 110 : 10) diff --git a/gio/gliststore.c b/gio/gliststore.c index e7dbbd38fe8..4b7e75cb4f0 100644 --- a/gio/gliststore.c +++ b/gio/gliststore.c @@ -68,7 +68,8 @@ enum N_PROPERTIES }; -static void g_list_store_iface_init (GListModelInterface *iface); +static void g_list_store_iface_init (GListModelInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GListStore, g_list_store, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, g_list_store_iface_init)); @@ -229,7 +230,8 @@ g_list_store_get_item (GListModel *list, } static void -g_list_store_iface_init (GListModelInterface *iface) +g_list_store_iface_init (GListModelInterface *iface, + gpointer iface_data) { iface->get_item_type = g_list_store_get_item_type; iface->get_n_items = g_list_store_get_n_items; diff --git a/gio/glocalfile.c b/gio/glocalfile.c index 4f8df369bb9..c1628c7d416 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -27,7 +27,7 @@ #include #include #include -#if G_OS_UNIX +#ifdef G_OS_UNIX #include #include #endif @@ -65,7 +65,7 @@ #include #include #include "glibintl.h" -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include "glib-unix.h" #include "gportalsupport.h" #include "gtrashportal.h" @@ -95,7 +95,8 @@ #endif -static void g_local_file_file_iface_init (GFileIface *iface); +static void g_local_file_file_iface_init (GFileIface *iface, + gpointer iface_data); static GFileAttributeInfoList *local_writable_attributes = NULL; static /* GFileAttributeInfoList * */ gsize local_writable_namespaces = 0; @@ -1925,7 +1926,7 @@ _g_local_file_has_trash_dir (const char *dirname, dev_t dir_dev) return res; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) gboolean _g_local_file_is_lost_found_dir (const char *path, dev_t path_dev) { @@ -1989,8 +1990,10 @@ g_local_file_trash (GFile *file, GVfs *vfs; int errsv; +#ifndef G_PLATFORM_WASM if (glib_should_use_portal ()) return g_trash_portal_trash_file (file, error); +#endif if (g_lstat (local->filename, &file_stat) != 0) { @@ -2991,7 +2994,8 @@ g_local_file_measure_disk_usage (GFile *file, } static void -g_local_file_file_iface_init (GFileIface *iface) +g_local_file_file_iface_init (GFileIface *iface, + gpointer iface_data) { iface->dup = g_local_file_dup; iface->hash = g_local_file_hash; diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index b63f7826c6d..32cc2c38eb8 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -62,8 +62,10 @@ #ifdef G_OS_UNIX #include +#ifndef G_PLATFORM_WASM #include "glib-unix.h" -#endif +#endif /*!G_PLATFORM_WASM*/ +#endif /*G_OS_UNIX*/ #include "glib-private.h" @@ -1944,7 +1946,7 @@ _g_local_file_info_get (const char *basename, if (stat_ok) set_info_from_stat (info, &statbuf, attribute_matcher); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) if (stat_ok && _g_local_file_is_lost_found_dir (path, _g_stat_dev (&statbuf))) g_file_info_set_is_hidden (info, TRUE); #endif diff --git a/gio/glocalfileinputstream.c b/gio/glocalfileinputstream.c index 933f317147e..c370eba84e5 100644 --- a/gio/glocalfileinputstream.c +++ b/gio/glocalfileinputstream.c @@ -37,9 +37,11 @@ #ifdef G_OS_UNIX #include +#ifndef G_PLATFORM_WASM #include "glib-unix.h" #include "gfiledescriptorbased.h" -#endif +#endif /*!G_PLATFORM_WASM*/ +#endif /*G_OS_UNIX*/ #ifdef G_OS_WIN32 #include @@ -50,12 +52,13 @@ struct _GLocalFileInputStreamPrivate { guint do_close : 1; }; -#ifdef G_OS_UNIX -static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) +static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data); #endif #define g_local_file_input_stream_get_type _g_local_file_input_stream_get_type -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM, G_ADD_PRIVATE (GLocalFileInputStream) G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, @@ -84,7 +87,7 @@ static GFileInfo *g_local_file_input_stream_query_info (GFileInputStream *strea const char *attributes, GCancellable *cancellable, GError **error); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static int g_local_file_input_stream_get_fd (GFileDescriptorBased *stream); #endif @@ -109,9 +112,10 @@ g_local_file_input_stream_class_init (GLocalFileInputStreamClass *klass) file_stream_class->query_info = g_local_file_input_stream_query_info; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static void -g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) +g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data) { iface->get_fd = g_local_file_input_stream_get_fd; } @@ -297,7 +301,7 @@ g_local_file_input_stream_query_info (GFileInputStream *stream, error); } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static int g_local_file_input_stream_get_fd (GFileDescriptorBased *fd_based) { diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c index 3ce987fba8d..288ef111432 100644 --- a/gio/glocalfileoutputstream.c +++ b/gio/glocalfileoutputstream.c @@ -44,9 +44,11 @@ #ifdef G_OS_UNIX #include +#ifndef G_PLATFORM_WASM #include "gfiledescriptorbased.h" #include -#endif +#endif /*!G_PLATFORM_WASM*/ +#endif /*G_OS_UNIX*/ #include "glib-private.h" #include "gioprivate.h" @@ -81,12 +83,13 @@ struct _GLocalFileOutputStreamPrivate { int fd; }; -#ifdef G_OS_UNIX -static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) +static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data); #endif #define g_local_file_output_stream_get_type _g_local_file_output_stream_get_type -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM, G_ADD_PRIVATE (GLocalFileOutputStream) G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, @@ -108,7 +111,7 @@ static gssize g_local_file_output_stream_write (GOutputStream *s gsize count, GCancellable *cancellable, GError **error); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static gboolean g_local_file_output_stream_writev (GOutputStream *stream, const GOutputVector *vectors, gsize n_vectors, @@ -136,7 +139,7 @@ static gboolean g_local_file_output_stream_truncate (GFileOutputStream *s goffset size, GCancellable *cancellable, GError **error); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static int g_local_file_output_stream_get_fd (GFileDescriptorBased *stream); #endif @@ -165,7 +168,7 @@ g_local_file_output_stream_class_init (GLocalFileOutputStreamClass *klass) gobject_class->finalize = g_local_file_output_stream_finalize; stream_class->write_fn = g_local_file_output_stream_write; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) stream_class->writev_fn = g_local_file_output_stream_writev; #endif stream_class->close_fn = g_local_file_output_stream_close; @@ -178,9 +181,10 @@ g_local_file_output_stream_class_init (GLocalFileOutputStreamClass *klass) file_stream_class->truncate_fn = g_local_file_output_stream_truncate; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static void -g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) +g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data) { iface->get_fd = g_local_file_output_stream_get_fd; } @@ -234,7 +238,7 @@ g_local_file_output_stream_write (GOutputStream *stream, * things, that each chunk is the size of a whole page and in memory aligned * to a page. We can't possibly guarantee that in GLib. */ -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) /* Macro to check if struct iovec and GOutputVector have the same ABI */ #define G_OUTPUT_VECTOR_IS_IOVEC (sizeof (struct iovec) == sizeof (GOutputVector) && \ G_SIZEOF_MEMBER (struct iovec, iov_base) == G_SIZEOF_MEMBER (GOutputVector, buffer) && \ @@ -1333,7 +1337,7 @@ _g_local_file_output_stream_get_fd (GLocalFileOutputStream *stream) return stream->priv->fd; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static int g_local_file_output_stream_get_fd (GFileDescriptorBased *fd_based) { diff --git a/gio/glocalvfs.c b/gio/glocalvfs.c index a830cc35002..bb7909740af 100644 --- a/gio/glocalvfs.c +++ b/gio/glocalvfs.c @@ -28,7 +28,7 @@ #include "gvfs.h" #include #include -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include "glib-unix.h" #include #endif @@ -147,7 +147,7 @@ g_local_vfs_parse_name (GVfs *vfs, { if (*parse_name == '~') { -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) const char *user_start; user_start = parse_name + 1; #endif @@ -158,7 +158,7 @@ g_local_vfs_parse_name (GVfs *vfs, user_end = parse_name; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) if (user_end == user_start) user_prefix = g_strdup (g_get_home_dir ()); else diff --git a/gio/gmemoryinputstream.c b/gio/gmemoryinputstream.c index 80f77d107e2..ec02e057d7e 100644 --- a/gio/gmemoryinputstream.c +++ b/gio/gmemoryinputstream.c @@ -80,7 +80,8 @@ static gboolean g_memory_input_stream_close_finish (GInputStream *stream GAsyncResult *result, GError **error); -static void g_memory_input_stream_seekable_iface_init (GSeekableIface *iface); +static void g_memory_input_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data); static goffset g_memory_input_stream_tell (GSeekable *seekable); static gboolean g_memory_input_stream_can_seek (GSeekable *seekable); static gboolean g_memory_input_stream_seek (GSeekable *seekable, @@ -94,7 +95,8 @@ static gboolean g_memory_input_stream_truncate (GSeekable *seek GCancellable *cancellable, GError **error); -static void g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface); +static void g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, + gpointer iface_data); static gboolean g_memory_input_stream_is_readable (GPollableInputStream *stream); static GSource *g_memory_input_stream_create_source (GPollableInputStream *stream, GCancellable *cancellable); @@ -145,7 +147,8 @@ g_memory_input_stream_finalize (GObject *object) } static void -g_memory_input_stream_seekable_iface_init (GSeekableIface *iface) +g_memory_input_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data) { iface->tell = g_memory_input_stream_tell; iface->can_seek = g_memory_input_stream_can_seek; @@ -155,7 +158,8 @@ g_memory_input_stream_seekable_iface_init (GSeekableIface *iface) } static void -g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) +g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, + gpointer iface_data) { iface->is_readable = g_memory_input_stream_is_readable; iface->create_source = g_memory_input_stream_create_source; diff --git a/gio/gmemorymonitordbus.c b/gio/gmemorymonitordbus.c index 37542f75c6f..995b7bf9688 100644 --- a/gio/gmemorymonitordbus.c +++ b/gio/gmemorymonitordbus.c @@ -33,8 +33,10 @@ #define G_MEMORY_MONITOR_DBUS_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) -static void g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *iface); -static void g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface); +static void g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *iface, + gpointer iface_data); +static void g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface, + gpointer iface_data); struct _GMemoryMonitorDBus { @@ -176,12 +178,14 @@ g_memory_monitor_dbus_class_init (GMemoryMonitorDBusClass *nl_class) } static void -g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *monitor_iface) +g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *monitor_iface, + gpointer iface_data) { } static void -g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface) +g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_memory_monitor_dbus_initable_init; } diff --git a/gio/gmemorymonitorportal.c b/gio/gmemorymonitorportal.c index 1517d61a9ff..235d45a935e 100644 --- a/gio/gmemorymonitorportal.c +++ b/gio/gmemorymonitorportal.c @@ -29,8 +29,10 @@ #define G_MEMORY_MONITOR_PORTAL_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) -static void g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *iface); -static void g_memory_monitor_portal_initable_iface_init (GInitableIface *iface); +static void g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *iface, + gpointer iface_data); +static void g_memory_monitor_portal_initable_iface_init (GInitableIface *iface, + gpointer iface_data); struct _GMemoryMonitorPortal { @@ -143,12 +145,14 @@ g_memory_monitor_portal_class_init (GMemoryMonitorPortalClass *nl_class) } static void -g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *monitor_iface) +g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *monitor_iface, + gpointer iface_data) { } static void -g_memory_monitor_portal_initable_iface_init (GInitableIface *iface) +g_memory_monitor_portal_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_memory_monitor_portal_initable_init; } diff --git a/gio/gmemorymonitorwin32.c b/gio/gmemorymonitorwin32.c index 83fef504fb5..36d5ff0eaa7 100644 --- a/gio/gmemorymonitorwin32.c +++ b/gio/gmemorymonitorwin32.c @@ -35,8 +35,10 @@ G_DECLARE_FINAL_TYPE (GMemoryMonitorWin32, g_memory_monitor_win32, G, MEMORY_MON #define G_MEMORY_MONITOR_WIN32_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) -static void g_memory_monitor_win32_iface_init (GMemoryMonitorInterface *iface); -static void g_memory_monitor_win32_initable_iface_init (GInitableIface *iface); +static void g_memory_monitor_win32_iface_init (GMemoryMonitorInterface *iface, + gpointer iface_data); +static void g_memory_monitor_win32_initable_iface_init (GInitableIface *iface, + gpointer iface_data); struct _GMemoryMonitorWin32 { @@ -252,12 +254,14 @@ g_memory_monitor_win32_class_init (GMemoryMonitorWin32Class *nl_class) } static void -g_memory_monitor_win32_iface_init (GMemoryMonitorInterface *monitor_iface) +g_memory_monitor_win32_iface_init (GMemoryMonitorInterface *monitor_iface, + gpointer iface_data) { } static void -g_memory_monitor_win32_initable_iface_init (GInitableIface *iface) +g_memory_monitor_win32_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_memory_monitor_win32_initable_init; } diff --git a/gio/gmemoryoutputstream.c b/gio/gmemoryoutputstream.c index 0339a7ad7de..119554ee6d2 100644 --- a/gio/gmemoryoutputstream.c +++ b/gio/gmemoryoutputstream.c @@ -99,7 +99,8 @@ static gboolean g_memory_output_stream_close_finish (GOutputStream *strea GAsyncResult *result, GError **error); -static void g_memory_output_stream_seekable_iface_init (GSeekableIface *iface); +static void g_memory_output_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data); static goffset g_memory_output_stream_tell (GSeekable *seekable); static gboolean g_memory_output_stream_can_seek (GSeekable *seekable); static gboolean g_memory_output_stream_seek (GSeekable *seekable, @@ -117,7 +118,8 @@ static gboolean g_memory_output_stream_is_writable (GPollableOutputStream static GSource *g_memory_output_stream_create_source (GPollableOutputStream *stream, GCancellable *cancellable); -static void g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); +static void g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GMemoryOutputStream, g_memory_output_stream, G_TYPE_OUTPUT_STREAM, G_ADD_PRIVATE (GMemoryOutputStream) @@ -224,7 +226,8 @@ g_memory_output_stream_class_init (GMemoryOutputStreamClass *klass) } static void -g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) +g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, + gpointer iface_data) { iface->is_writable = g_memory_output_stream_is_writable; iface->create_source = g_memory_output_stream_create_source; @@ -313,7 +316,8 @@ g_memory_output_stream_finalize (GObject *object) } static void -g_memory_output_stream_seekable_iface_init (GSeekableIface *iface) +g_memory_output_stream_seekable_iface_init (GSeekableIface *iface, + gpointer iface_data) { iface->tell = g_memory_output_stream_tell; iface->can_seek = g_memory_output_stream_can_seek; diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c index 598917de2ac..68f607a2208 100644 --- a/gio/gnetworkaddress.c +++ b/gio/gnetworkaddress.c @@ -94,7 +94,8 @@ static void g_network_address_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void g_network_address_connectable_iface_init (GSocketConnectableIface *iface); +static void g_network_address_connectable_iface_init (GSocketConnectableIface *iface, + gpointer iface_data); static GSocketAddressEnumerator *g_network_address_connectable_enumerate (GSocketConnectable *connectable); static GSocketAddressEnumerator *g_network_address_connectable_proxy_enumerate (GSocketConnectable *connectable); static gchar *g_network_address_connectable_to_string (GSocketConnectable *connectable); @@ -153,7 +154,8 @@ g_network_address_class_init (GNetworkAddressClass *klass) } static void -g_network_address_connectable_iface_init (GSocketConnectableIface *connectable_iface) +g_network_address_connectable_iface_init (GSocketConnectableIface *connectable_iface, + gpointer iface_data) { connectable_iface->enumerate = g_network_address_connectable_enumerate; connectable_iface->proxy_enumerate = g_network_address_connectable_proxy_enumerate; diff --git a/gio/gnetworkmonitorbase.c b/gio/gnetworkmonitorbase.c index 4654d22e316..51ceaf7dfa9 100644 --- a/gio/gnetworkmonitorbase.c +++ b/gio/gnetworkmonitorbase.c @@ -33,8 +33,10 @@ #include "gtask.h" #include "glibintl.h" -static void g_network_monitor_base_iface_init (GNetworkMonitorInterface *iface); -static void g_network_monitor_base_initable_iface_init (GInitableIface *iface); +static void g_network_monitor_base_iface_init (GNetworkMonitorInterface *iface, + gpointer iface_data); +static void g_network_monitor_base_initable_iface_init (GInitableIface *iface, + gpointer iface_data); enum { @@ -344,7 +346,8 @@ g_network_monitor_base_can_reach_finish (GNetworkMonitor *monitor, } static void -g_network_monitor_base_iface_init (GNetworkMonitorInterface *monitor_iface) +g_network_monitor_base_iface_init (GNetworkMonitorInterface *monitor_iface, + gpointer iface_data) { monitor_iface->can_reach = g_network_monitor_base_can_reach; monitor_iface->can_reach_async = g_network_monitor_base_can_reach_async; @@ -366,7 +369,8 @@ g_network_monitor_base_initable_init (GInitable *initable, } static void -g_network_monitor_base_initable_iface_init (GInitableIface *iface) +g_network_monitor_base_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_network_monitor_base_initable_init; } diff --git a/gio/gnetworkmonitornetlink.c b/gio/gnetworkmonitornetlink.c index 9d4b0f9c572..64ce26e5fc2 100644 --- a/gio/gnetworkmonitornetlink.c +++ b/gio/gnetworkmonitornetlink.c @@ -42,8 +42,10 @@ #include static GInitableIface *initable_parent_iface; -static void g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *iface); -static void g_network_monitor_netlink_initable_iface_init (GInitableIface *iface); +static void g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *iface, + gpointer iface_data); +static void g_network_monitor_netlink_initable_iface_init (GInitableIface *iface, + gpointer iface_data); struct _GNetworkMonitorNetlinkPrivate { @@ -502,12 +504,14 @@ g_network_monitor_netlink_class_init (GNetworkMonitorNetlinkClass *nl_class) } static void -g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *monitor_iface) +g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *monitor_iface, + gpointer iface_data) { } static void -g_network_monitor_netlink_initable_iface_init (GInitableIface *iface) +g_network_monitor_netlink_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { initable_parent_iface = g_type_interface_peek_parent (iface); diff --git a/gio/gnetworkmonitornm.c b/gio/gnetworkmonitornm.c index 207d50d5e3d..22eea24f193 100644 --- a/gio/gnetworkmonitornm.c +++ b/gio/gnetworkmonitornm.c @@ -34,8 +34,10 @@ #include "gnetworkmonitor.h" #include "gdbusproxy.h" -static void g_network_monitor_nm_iface_init (GNetworkMonitorInterface *iface); -static void g_network_monitor_nm_initable_iface_init (GInitableIface *iface); +static void g_network_monitor_nm_iface_init (GNetworkMonitorInterface *iface, + gpointer iface_data); +static void g_network_monitor_nm_initable_iface_init (GInitableIface *iface, + gpointer iface_data); enum { @@ -365,12 +367,14 @@ g_network_monitor_nm_class_init (GNetworkMonitorNMClass *nl_class) } static void -g_network_monitor_nm_iface_init (GNetworkMonitorInterface *monitor_iface) +g_network_monitor_nm_iface_init (GNetworkMonitorInterface *monitor_iface, + gpointer iface_data) { } static void -g_network_monitor_nm_initable_iface_init (GInitableIface *iface) +g_network_monitor_nm_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_network_monitor_nm_initable_init; } diff --git a/gio/gnetworkmonitorportal.c b/gio/gnetworkmonitorportal.c index bc51178b119..cc170dd217f 100644 --- a/gio/gnetworkmonitorportal.c +++ b/gio/gnetworkmonitorportal.c @@ -27,8 +27,10 @@ #include "gportalsupport.h" static GInitableIface *initable_parent_iface; -static void g_network_monitor_portal_iface_init (GNetworkMonitorInterface *iface); -static void g_network_monitor_portal_initable_iface_init (GInitableIface *iface); +static void g_network_monitor_portal_iface_init (GNetworkMonitorInterface *iface, + gpointer iface_data); +static void g_network_monitor_portal_initable_iface_init (GInitableIface *iface, + gpointer iface_data); enum { @@ -613,7 +615,8 @@ g_network_monitor_portal_can_reach_finish (GNetworkMonitor *monitor, } static void -g_network_monitor_portal_iface_init (GNetworkMonitorInterface *monitor_iface) +g_network_monitor_portal_iface_init (GNetworkMonitorInterface *monitor_iface, + gpointer iface_data) { monitor_iface->can_reach = g_network_monitor_portal_can_reach; monitor_iface->can_reach_async = g_network_monitor_portal_can_reach_async; @@ -621,7 +624,8 @@ g_network_monitor_portal_iface_init (GNetworkMonitorInterface *monitor_iface) } static void -g_network_monitor_portal_initable_iface_init (GInitableIface *iface) +g_network_monitor_portal_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { initable_parent_iface = g_type_interface_peek_parent (iface); diff --git a/gio/gnetworkservice.c b/gio/gnetworkservice.c index 8fa74eca352..beeeb9cae47 100644 --- a/gio/gnetworkservice.c +++ b/gio/gnetworkservice.c @@ -88,7 +88,8 @@ static void g_network_service_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void g_network_service_connectable_iface_init (GSocketConnectableIface *iface); +static void g_network_service_connectable_iface_init (GSocketConnectableIface *iface, + gpointer iface_data); static GSocketAddressEnumerator *g_network_service_connectable_enumerate (GSocketConnectable *connectable); static GSocketAddressEnumerator *g_network_service_connectable_proxy_enumerate (GSocketConnectable *connectable); static gchar *g_network_service_connectable_to_string (GSocketConnectable *connectable); @@ -158,7 +159,8 @@ g_network_service_class_init (GNetworkServiceClass *klass) } static void -g_network_service_connectable_iface_init (GSocketConnectableIface *connectable_iface) +g_network_service_connectable_iface_init (GSocketConnectableIface *connectable_iface, + gpointer iface_data) { connectable_iface->enumerate = g_network_service_connectable_enumerate; connectable_iface->proxy_enumerate = g_network_service_connectable_proxy_enumerate; diff --git a/gio/gosxappinfo.m b/gio/gosxappinfo.m index 60b088641bd..671baa0645c 100644 --- a/gio/gosxappinfo.m +++ b/gio/gosxappinfo.m @@ -43,7 +43,8 @@ * Note that `` is unique to OSX. */ -static void g_osx_app_info_iface_init (GAppInfoIface *iface); +static void g_osx_app_info_iface_init (GAppInfoIface *iface, + gpointer iface_data); static const char *g_osx_app_info_get_id (GAppInfo *appinfo); /** @@ -557,7 +558,8 @@ } static void -g_osx_app_info_iface_init (GAppInfoIface *iface) +g_osx_app_info_iface_init (GAppInfoIface *iface, + gpointer iface_data) { iface->dup = g_osx_app_info_dup; iface->equal = g_osx_app_info_equal; diff --git a/gio/gportalsupport.c b/gio/gportalsupport.c index 7d0e3226c4c..b471d32ac4c 100644 --- a/gio/gportalsupport.c +++ b/gio/gportalsupport.c @@ -27,6 +27,7 @@ static gboolean use_portal; static gboolean network_available; static gboolean dconf_access; +#ifndef G_PLATFORM_WASM static void read_flatpak_info (void) { @@ -88,24 +89,37 @@ read_flatpak_info (void) g_once_init_leave (&flatpak_info_read, 1); } +#endif gboolean glib_should_use_portal (void) { +#ifdef G_PLATFORM_WASM + return FALSE; +#else read_flatpak_info (); return use_portal; +#endif } gboolean glib_network_available_in_sandbox (void) { +#ifdef G_PLATFORM_WASM + return FALSE; +#else read_flatpak_info (); return network_available; +#endif } gboolean glib_has_dconf_access_in_sandbox (void) { +#ifdef G_PLATFORM_WASM + return FALSE; +#else read_flatpak_info (); return dconf_access; +#endif } diff --git a/gio/gpowerprofilemonitordbus.c b/gio/gpowerprofilemonitordbus.c index ac6f8a88c7a..ffd66d5ed9f 100644 --- a/gio/gpowerprofilemonitordbus.c +++ b/gio/gpowerprofilemonitordbus.c @@ -34,8 +34,10 @@ #define G_POWER_PROFILE_MONITOR_DBUS_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) -static void g_power_profile_monitor_dbus_iface_init (GPowerProfileMonitorInterface *iface); -static void g_power_profile_monitor_dbus_initable_iface_init (GInitableIface *iface); +static void g_power_profile_monitor_dbus_iface_init (GPowerProfileMonitorInterface *iface, + gpointer iface_data); +static void g_power_profile_monitor_dbus_initable_iface_init (GInitableIface *iface, + gpointer iface_data); struct _GPowerProfileMonitorDBus { @@ -233,12 +235,14 @@ g_power_profile_monitor_dbus_class_init (GPowerProfileMonitorDBusClass *nl_class } static void -g_power_profile_monitor_dbus_iface_init (GPowerProfileMonitorInterface *monitor_iface) +g_power_profile_monitor_dbus_iface_init (GPowerProfileMonitorInterface *monitor_iface, + gpointer iface_data) { } static void -g_power_profile_monitor_dbus_initable_iface_init (GInitableIface *iface) +g_power_profile_monitor_dbus_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_power_profile_monitor_dbus_initable_init; } diff --git a/gio/gpowerprofilemonitorportal.c b/gio/gpowerprofilemonitorportal.c index 0c69ed9b522..3ba794aeeed 100644 --- a/gio/gpowerprofilemonitorportal.c +++ b/gio/gpowerprofilemonitorportal.c @@ -31,8 +31,10 @@ #define G_POWER_PROFILE_MONITOR_PORTAL_GET_INITABLE_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_INITABLE, GInitable)) -static void g_power_profile_monitor_portal_iface_init (GPowerProfileMonitorInterface *iface); -static void g_power_profile_monitor_portal_initable_iface_init (GInitableIface *iface); +static void g_power_profile_monitor_portal_iface_init (GPowerProfileMonitorInterface *iface, + gpointer iface_data); +static void g_power_profile_monitor_portal_initable_iface_init (GInitableIface *iface, + gpointer iface_data); typedef enum { @@ -180,12 +182,14 @@ g_power_profile_monitor_portal_class_init (GPowerProfileMonitorPortalClass *nl_c } static void -g_power_profile_monitor_portal_iface_init (GPowerProfileMonitorInterface *monitor_iface) +g_power_profile_monitor_portal_iface_init (GPowerProfileMonitorInterface *monitor_iface, + gpointer iface_data) { } static void -g_power_profile_monitor_portal_initable_iface_init (GInitableIface *iface) +g_power_profile_monitor_portal_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_power_profile_monitor_portal_initable_init; } diff --git a/gio/gpropertyaction.c b/gio/gpropertyaction.c index 8df765e985a..285c242101d 100644 --- a/gio/gpropertyaction.c +++ b/gio/gpropertyaction.c @@ -108,7 +108,8 @@ struct _GPropertyAction typedef GObjectClass GPropertyActionClass; -static void g_property_action_iface_init (GActionInterface *iface); +static void g_property_action_iface_init (GActionInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GPropertyAction, g_property_action, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_ACTION, g_property_action_iface_init)) @@ -426,7 +427,8 @@ g_property_action_init (GPropertyAction *property) } void -g_property_action_iface_init (GActionInterface *iface) +g_property_action_iface_init (GActionInterface *iface, + gpointer iface_data) { iface->get_name = g_property_action_get_name; iface->get_parameter_type = g_property_action_get_parameter_type; diff --git a/gio/gproxyresolverportal.c b/gio/gproxyresolverportal.c index ec803b9c412..a25e6e8ccb1 100644 --- a/gio/gproxyresolverportal.c +++ b/gio/gproxyresolverportal.c @@ -33,7 +33,8 @@ struct _GProxyResolverPortal { gboolean network_available; }; -static void g_proxy_resolver_portal_iface_init (GProxyResolverInterface *iface); +static void g_proxy_resolver_portal_iface_init (GProxyResolverInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GProxyResolverPortal, g_proxy_resolver_portal, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_PROXY_RESOLVER, @@ -201,7 +202,8 @@ g_proxy_resolver_portal_class_init (GProxyResolverPortalClass *resolver_class) } static void -g_proxy_resolver_portal_iface_init (GProxyResolverInterface *iface) +g_proxy_resolver_portal_iface_init (GProxyResolverInterface *iface, + gpointer iface_data) { iface->is_supported = g_proxy_resolver_portal_is_supported; iface->lookup = g_proxy_resolver_portal_lookup; diff --git a/gio/gresourcefile.c b/gio/gresourcefile.c index 24f20f2903d..a52dbbca513 100644 --- a/gio/gresourcefile.c +++ b/gio/gresourcefile.c @@ -68,7 +68,8 @@ struct _GResourceFileEnumeratorClass typedef struct _GResourceFileEnumerator GResourceFileEnumerator; typedef struct _GResourceFileEnumeratorClass GResourceFileEnumeratorClass; -static void g_resource_file_file_iface_init (GFileIface *iface); +static void g_resource_file_file_iface_init (GFileIface *iface, + gpointer iface_data); static GFileAttributeInfoList *resource_writable_attributes = NULL; static GFileAttributeInfoList *resource_writable_namespaces = NULL; @@ -660,7 +661,8 @@ g_resource_file_set_display_name (GFile *file, } static void -g_resource_file_file_iface_init (GFileIface *iface) +g_resource_file_file_iface_init (GFileIface *iface, + gpointer iface_data) { iface->dup = g_resource_file_dup; iface->hash = g_resource_file_hash; diff --git a/gio/gsettings.c b/gio/gsettings.c index 12b987050e7..4ff6fd67afe 100644 --- a/gio/gsettings.c +++ b/gio/gsettings.c @@ -3163,7 +3163,8 @@ typedef struct typedef GObjectClass GSettingsActionClass; static GType g_settings_action_get_type (void); -static void g_settings_action_iface_init (GActionInterface *iface); +static void g_settings_action_iface_init (GActionInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GSettingsAction, g_settings_action, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_ACTION, g_settings_action_iface_init)) @@ -3323,7 +3324,8 @@ g_settings_action_init (GSettingsAction *gsa) } static void -g_settings_action_iface_init (GActionInterface *iface) +g_settings_action_iface_init (GActionInterface *iface, + gpointer iface_data) { iface->get_name = g_settings_action_get_name; iface->get_parameter_type = g_settings_action_get_parameter_type; diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c index fb3bb701221..d03be72c00c 100644 --- a/gio/gsettingsschema.c +++ b/gio/gsettingsschema.c @@ -553,62 +553,7 @@ start_element (GMarkupParseContext *context, static gchar * normalise_whitespace (const gchar *orig) { - /* We normalise by the same rules as in intltool: - * - * sub cleanup { - * s/^\s+//; - * s/\s+$//; - * s/\s+/ /g; - * return $_; - * } - * - * $message = join "\n\n", map &cleanup, split/\n\s*\n+/, $message; - * - * Where \s is an ascii space character. - * - * We aim for ease of implementation over efficiency -- this code is - * not run in normal applications. - */ - static GRegex *cleanup[3]; - static GRegex *splitter; - gchar **lines; - gchar *result; - gint i; - - if (g_once_init_enter (&splitter)) - { - GRegex *s; - - cleanup[0] = g_regex_new ("^\\s+", G_REGEX_DEFAULT, - G_REGEX_MATCH_DEFAULT, NULL); - cleanup[1] = g_regex_new ("\\s+$", G_REGEX_DEFAULT, - G_REGEX_MATCH_DEFAULT, NULL); - cleanup[2] = g_regex_new ("\\s+", G_REGEX_DEFAULT, - G_REGEX_MATCH_DEFAULT, NULL); - s = g_regex_new ("\\n\\s*\\n+", G_REGEX_DEFAULT, - G_REGEX_MATCH_DEFAULT, NULL); - - g_once_init_leave (&splitter, s); - } - - lines = g_regex_split (splitter, orig, 0); - for (i = 0; lines[i]; i++) - { - gchar *a, *b, *c; - - a = g_regex_replace_literal (cleanup[0], lines[i], -1, 0, "", 0, 0); - b = g_regex_replace_literal (cleanup[1], a, -1, 0, "", 0, 0); - c = g_regex_replace_literal (cleanup[2], b, -1, 0, " ", 0, 0); - g_free (lines[i]); - g_free (a); - g_free (b); - lines[i] = c; - } - - result = g_strjoinv ("\n\n", lines); - g_strfreev (lines); - - return result; + return orig; } static void diff --git a/gio/gsimpleaction.c b/gio/gsimpleaction.c index 4e7e5b5eea6..7ec06dd518a 100644 --- a/gio/gsimpleaction.c +++ b/gio/gsimpleaction.c @@ -60,7 +60,8 @@ struct _GSimpleAction typedef GObjectClass GSimpleActionClass; -static void g_simple_action_iface_init (GActionInterface *iface); +static void g_simple_action_iface_init (GActionInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GSimpleAction, g_simple_action, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_ACTION, g_simple_action_iface_init)) @@ -349,7 +350,8 @@ g_simple_action_init (GSimpleAction *simple) } void -g_simple_action_iface_init (GActionInterface *iface) +g_simple_action_iface_init (GActionInterface *iface, + gpointer iface_data) { iface->get_name = g_simple_action_get_name; iface->get_parameter_type = g_simple_action_get_parameter_type; diff --git a/gio/gsimpleactiongroup.c b/gio/gsimpleactiongroup.c index 28ca21ab574..92ccf016058 100644 --- a/gio/gsimpleactiongroup.c +++ b/gio/gsimpleactiongroup.c @@ -42,8 +42,10 @@ struct _GSimpleActionGroupPrivate GHashTable *table; /* string -> GAction */ }; -static void g_simple_action_group_iface_init (GActionGroupInterface *); -static void g_simple_action_group_map_iface_init (GActionMapInterface *); +static void g_simple_action_group_iface_init (GActionGroupInterface *iface, + gpointer iface_data); +static void g_simple_action_group_map_iface_init (GActionMapInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GSimpleActionGroup, g_simple_action_group, G_TYPE_OBJECT, G_ADD_PRIVATE (GSimpleActionGroup) @@ -274,7 +276,8 @@ g_simple_action_group_class_init (GSimpleActionGroupClass *class) } static void -g_simple_action_group_iface_init (GActionGroupInterface *iface) +g_simple_action_group_iface_init (GActionGroupInterface *iface, + gpointer iface_data) { iface->list_actions = g_simple_action_group_list_actions; iface->query_action = g_simple_action_group_query_action; @@ -283,7 +286,8 @@ g_simple_action_group_iface_init (GActionGroupInterface *iface) } static void -g_simple_action_group_map_iface_init (GActionMapInterface *iface) +g_simple_action_group_map_iface_init (GActionMapInterface *iface, + gpointer iface_data) { iface->add_action = g_simple_action_group_add_action; iface->remove_action = g_simple_action_group_remove_action; diff --git a/gio/gsimpleasyncresult.c b/gio/gsimpleasyncresult.c index d0de309735a..fa677e5db42 100644 --- a/gio/gsimpleasyncresult.c +++ b/gio/gsimpleasyncresult.c @@ -207,7 +207,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS -static void g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface); +static void g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface, + gpointer iface_data); struct _GSimpleAsyncResult { @@ -466,7 +467,8 @@ g_simple_async_result_is_tagged (GAsyncResult *res, } static void -g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface) +g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface, + gpointer iface_data) { iface->get_user_data = g_simple_async_result_get_user_data; iface->get_source_object = g_simple_async_result_get_source_object; diff --git a/gio/gsimpleproxyresolver.c b/gio/gsimpleproxyresolver.c index 8de26cb7b6c..1ca5cdaff48 100644 --- a/gio/gsimpleproxyresolver.c +++ b/gio/gsimpleproxyresolver.c @@ -64,7 +64,8 @@ struct _GSimpleProxyResolverPrivate { GSimpleProxyResolverDomain *ignore_domains; }; -static void g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface); +static void g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GSimpleProxyResolver, g_simple_proxy_resolver, G_TYPE_OBJECT, G_ADD_PRIVATE (GSimpleProxyResolver) @@ -484,7 +485,8 @@ g_simple_proxy_resolver_class_init (GSimpleProxyResolverClass *resolver_class) } static void -g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface) +g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface, + gpointer iface_data) { iface->lookup = g_simple_proxy_resolver_lookup; iface->lookup_async = g_simple_proxy_resolver_lookup_async; diff --git a/gio/gsocket.c b/gio/gsocket.c index bd5549f3a22..6c05a81d133 100644 --- a/gio/gsocket.c +++ b/gio/gsocket.c @@ -31,7 +31,7 @@ #include "gsocket.h" -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include "glib-unix.h" #endif @@ -54,7 +54,7 @@ # include #endif -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include #endif @@ -143,12 +143,14 @@ * Since: 2.22 */ -static void g_socket_initable_iface_init (GInitableIface *iface); +static void g_socket_initable_iface_init (GInitableIface *iface, + gpointer iface_data); static gboolean g_socket_initable_init (GInitable *initable, GCancellable *cancellable, GError **error); -static void g_socket_datagram_based_iface_init (GDatagramBasedInterface *iface); +static void g_socket_datagram_based_iface_init (GDatagramBasedInterface *iface, + gpointer iface_data); static gint g_socket_datagram_based_receive_messages (GDatagramBased *self, GInputMessage *messages, guint num_messages, @@ -708,9 +710,9 @@ g_socket_constructed (GObject *object) if (socket->priv->fd != -1) { -#ifndef G_OS_WIN32 +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) GError *error = NULL; -#else +#elif defined(G_OS_WIN32) gulong arg; #endif @@ -718,13 +720,13 @@ g_socket_constructed (GObject *object) * nonblocking automatically in certain operations. This way we make * things work the same on all platforms. */ -#ifndef G_OS_WIN32 +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) if (!g_unix_set_fd_nonblocking (socket->priv->fd, TRUE, &error)) { g_warning ("Error setting socket nonblocking: %s", error->message); g_clear_error (&error); } -#else +#elif defined(G_OS_WIN32) arg = TRUE; if (ioctlsocket (socket->priv->fd, FIONBIO, &arg) == SOCKET_ERROR) @@ -1103,13 +1105,15 @@ g_socket_class_init (GSocketClass *klass) } static void -g_socket_initable_iface_init (GInitableIface *iface) +g_socket_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_socket_initable_init; } static void -g_socket_datagram_based_iface_init (GDatagramBasedInterface *iface) +g_socket_datagram_based_iface_init (GDatagramBasedInterface *iface, + gpointer iface_data) { iface->receive_messages = g_socket_datagram_based_receive_messages; iface->send_messages = g_socket_datagram_based_send_messages; @@ -4012,7 +4016,7 @@ socket_source_dispatch (GSource *source, events = G_IO_NVAL; else events = update_condition (socket_source->socket); -#else +#elif defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) if (g_socket_is_closed (socket_source->socket)) { if (socket_source->fd_tag) @@ -4150,7 +4154,7 @@ socket_source_new (GSocket *socket, socket_source->pollfd.events = condition; socket_source->pollfd.revents = 0; g_source_add_poll (source, &socket_source->pollfd); -#else +#elif defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) socket_source->fd_tag = g_source_add_unix_fd (source, socket->priv->fd, condition); #endif diff --git a/gio/gsocketaddress.c b/gio/gsocketaddress.c index 994037c0596..03afad81b1b 100644 --- a/gio/gsocketaddress.c +++ b/gio/gsocketaddress.c @@ -68,7 +68,8 @@ enum PROP_FAMILY }; -static void g_socket_address_connectable_iface_init (GSocketConnectableIface *iface); +static void g_socket_address_connectable_iface_init (GSocketConnectableIface *iface, + gpointer iface_data); static GSocketAddressEnumerator *g_socket_address_connectable_enumerate (GSocketConnectable *connectable); static GSocketAddressEnumerator *g_socket_address_connectable_proxy_enumerate (GSocketConnectable *connectable); @@ -129,7 +130,8 @@ g_socket_address_class_init (GSocketAddressClass *klass) } static void -g_socket_address_connectable_iface_init (GSocketConnectableIface *connectable_iface) +g_socket_address_connectable_iface_init (GSocketConnectableIface *connectable_iface, + gpointer iface_data) { connectable_iface->enumerate = g_socket_address_connectable_enumerate; connectable_iface->proxy_enumerate = g_socket_address_connectable_proxy_enumerate; diff --git a/gio/gsocketinputstream.c b/gio/gsocketinputstream.c index 5307fcdada4..1c4a6421ae7 100644 --- a/gio/gsocketinputstream.c +++ b/gio/gsocketinputstream.c @@ -41,14 +41,16 @@ struct _GSocketInputStreamPrivate gsize count; }; -static void g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface); -#ifdef G_OS_UNIX -static void g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); +static void g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, + gpointer iface_data); +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) +static void g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data); #endif #define g_socket_input_stream_get_type _g_socket_input_stream_get_type -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) G_DEFINE_TYPE_WITH_CODE (GSocketInputStream, g_socket_input_stream, G_TYPE_INPUT_STREAM, G_ADD_PRIVATE (GSocketInputStream) G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, g_socket_input_stream_pollable_iface_init) @@ -168,7 +170,7 @@ g_socket_input_stream_pollable_read_nonblocking (GPollableInputStream *pollable NULL, error); } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static int g_socket_input_stream_get_fd (GFileDescriptorBased *fd_based) { @@ -198,16 +200,18 @@ g_socket_input_stream_class_init (GSocketInputStreamClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static void -g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) +g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data) { iface->get_fd = g_socket_input_stream_get_fd; } #endif static void -g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) +g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, + gpointer iface_data) { iface->is_readable = g_socket_input_stream_pollable_is_readable; iface->create_source = g_socket_input_stream_pollable_create_source; diff --git a/gio/gsocketoutputstream.c b/gio/gsocketoutputstream.c index d380c52ccc9..888c9d61e00 100644 --- a/gio/gsocketoutputstream.c +++ b/gio/gsocketoutputstream.c @@ -46,14 +46,16 @@ struct _GSocketOutputStreamPrivate gsize count; }; -static void g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); -#ifdef G_OS_UNIX -static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); +static void g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, + gpointer iface_data); +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) +static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data); #endif #define g_socket_output_stream_get_type _g_socket_output_stream_get_type -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) G_DEFINE_TYPE_WITH_CODE (GSocketOutputStream, g_socket_output_stream, G_TYPE_OUTPUT_STREAM, G_ADD_PRIVATE (GSocketOutputStream) G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, g_socket_output_stream_pollable_iface_init) @@ -223,7 +225,7 @@ g_socket_output_stream_pollable_create_source (GPollableOutputStream *pollable, return pollable_source; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static int g_socket_output_stream_get_fd (GFileDescriptorBased *fd_based) { @@ -254,16 +256,18 @@ g_socket_output_stream_class_init (GSocketOutputStreamClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static void -g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) +g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data) { iface->get_fd = g_socket_output_stream_get_fd; } #endif static void -g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) +g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, + gpointer iface_data) { iface->is_writable = g_socket_output_stream_pollable_is_writable; iface->create_source = g_socket_output_stream_pollable_create_source; diff --git a/gio/gsocks4aproxy.c b/gio/gsocks4aproxy.c index 3dad118eb78..e4a1306e689 100644 --- a/gio/gsocks4aproxy.c +++ b/gio/gsocks4aproxy.c @@ -50,7 +50,8 @@ #define SOCKS4_REP_NO_IDENT 92 #define SOCKS4_REP_BAD_IDENT 93 -static void g_socks4a_proxy_iface_init (GProxyInterface *proxy_iface); +static void g_socks4a_proxy_iface_init (GProxyInterface *proxy_iface, + gpointer iface_data); #define g_socks4a_proxy_get_type _g_socks4a_proxy_get_type G_DEFINE_TYPE_WITH_CODE (GSocks4aProxy, g_socks4a_proxy, G_TYPE_OBJECT, @@ -451,7 +452,8 @@ g_socks4a_proxy_class_init (GSocks4aProxyClass *class) } static void -g_socks4a_proxy_iface_init (GProxyInterface *proxy_iface) +g_socks4a_proxy_iface_init (GProxyInterface *proxy_iface, + gpointer iface_data) { proxy_iface->connect = g_socks4a_proxy_connect; proxy_iface->connect_async = g_socks4a_proxy_connect_async; diff --git a/gio/gsocks5proxy.c b/gio/gsocks5proxy.c index 6f256727a6c..ce2e9cef51d 100644 --- a/gio/gsocks5proxy.c +++ b/gio/gsocks5proxy.c @@ -82,7 +82,8 @@ struct _GSocks5ProxyClass GObjectClass parent_class; }; -static void g_socks5_proxy_iface_init (GProxyInterface *proxy_iface); +static void g_socks5_proxy_iface_init (GProxyInterface *proxy_iface, + gpointer iface_data); #define g_socks5_proxy_get_type _g_socks5_proxy_get_type G_DEFINE_TYPE_WITH_CODE (GSocks5Proxy, g_socks5_proxy, G_TYPE_OBJECT, @@ -1101,7 +1102,8 @@ g_socks5_proxy_class_init (GSocks5ProxyClass *class) } static void -g_socks5_proxy_iface_init (GProxyInterface *proxy_iface) +g_socks5_proxy_iface_init (GProxyInterface *proxy_iface, + gpointer iface_data) { proxy_iface->connect = g_socks5_proxy_connect; proxy_iface->connect_async = g_socks5_proxy_connect_async; diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c index c4747a14813..29eefad50f0 100644 --- a/gio/gsubprocess.c +++ b/gio/gsubprocess.c @@ -95,7 +95,7 @@ #include "glib-private.h" #include -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include #include #include @@ -108,6 +108,14 @@ #include #include "giowin32-priv.h" #endif +#ifdef G_PLATFORM_WASM +#include +#include +#include +#include +#include +#include +#endif #ifndef O_BINARY #define O_BINARY 0 @@ -145,7 +153,8 @@ * via the worker thread so that we don't race with waitpid() and * accidentally send a signal to an already-reaped child. */ -static void initable_iface_init (GInitableIface *initable_iface); +static void initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data); typedef GObjectClass GSubprocessClass; @@ -190,7 +199,9 @@ platform_input_stream_from_spawn_fd (gint fd) if (fd < 0) return NULL; -#ifdef G_OS_UNIX +#ifdef G_PLATFORM_WASM + return NULL; +#elif defined(G_OS_UNIX) return g_unix_input_stream_new (fd, TRUE); #else return g_win32_input_stream_new_from_fd (fd, TRUE); @@ -203,14 +214,16 @@ platform_output_stream_from_spawn_fd (gint fd) if (fd < 0) return NULL; -#ifdef G_OS_UNIX +#ifdef G_PLATFORM_WASM + return NULL; +#elif defined(G_OS_UNIX) return g_unix_output_stream_new (fd, TRUE); #else return g_win32_output_stream_new_from_fd (fd, TRUE); #endif } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static gint unix_open_file (const char *filename, gint mode, @@ -304,7 +317,7 @@ initable_init (GInitable *initable, gint *pipe_ptrs[3] = { NULL, NULL, NULL }; gint pipe_fds[3] = { -1, -1, -1 }; gint close_fds[3] = { -1, -1, -1 }; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) gint stdin_fd = -1, stdout_fd = -1, stderr_fd = -1; #endif GSpawnFlags spawn_flags = 0; @@ -327,7 +340,7 @@ initable_init (GInitable *initable, spawn_flags |= G_SPAWN_CHILD_INHERITS_STDIN; else if (self->flags & G_SUBPROCESS_FLAGS_STDIN_PIPE) pipe_ptrs[0] = &pipe_fds[0]; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) else if (self->launcher) { if (self->launcher->stdin_fd != -1) @@ -346,7 +359,7 @@ initable_init (GInitable *initable, spawn_flags |= G_SPAWN_STDOUT_TO_DEV_NULL; else if (self->flags & G_SUBPROCESS_FLAGS_STDOUT_PIPE) pipe_ptrs[1] = &pipe_fds[1]; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) else if (self->launcher) { if (self->launcher->stdout_fd != -1) @@ -365,7 +378,7 @@ initable_init (GInitable *initable, spawn_flags |= G_SPAWN_STDERR_TO_DEV_NULL; else if (self->flags & G_SUBPROCESS_FLAGS_STDERR_PIPE) pipe_ptrs[2] = &pipe_fds[2]; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) else if (self->flags & G_SUBPROCESS_FLAGS_STDERR_MERGE) /* This will work because stderr gets set up after stdout. */ stderr_fd = 1; @@ -401,7 +414,7 @@ initable_init (GInitable *initable, (const gchar * const *) self->argv, (const gchar * const *) (self->launcher ? self->launcher->envp : NULL), spawn_flags, -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) self->launcher ? self->launcher->child_setup_func : NULL, self->launcher ? self->launcher->child_setup_user_data : NULL, stdin_fd, stdout_fd, stderr_fd, @@ -445,7 +458,7 @@ initable_init (GInitable *initable, g_source_unref (source); } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) out: #endif /* we don't need this past init... */ @@ -487,7 +500,8 @@ g_subprocess_init (GSubprocess *self) } static void -initable_iface_init (GInitableIface *initable_iface) +initable_iface_init (GInitableIface *initable_iface, + gpointer iface_data) { initable_iface->init = initable_init; } @@ -950,7 +964,7 @@ g_subprocess_wait_check_finish (GSubprocess *subprocess, g_spawn_check_wait_status (subprocess->status, error); } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) typedef struct { GSubprocess *subprocess; @@ -1045,9 +1059,9 @@ g_subprocess_force_exit (GSubprocess *subprocess) { g_return_if_fail (G_IS_SUBPROCESS (subprocess)); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) g_subprocess_dispatch_signal (subprocess, SIGKILL); -#else +#elif defined(G_OS_WIN32) TerminateProcess (subprocess->pid, 1); #endif } @@ -1102,7 +1116,7 @@ g_subprocess_get_successful (GSubprocess *subprocess) g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), FALSE); g_return_val_if_fail (subprocess->pid == 0, FALSE); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) return WIFEXITED (subprocess->status) && WEXITSTATUS (subprocess->status) == 0; #else return subprocess->status == 0; @@ -1131,7 +1145,7 @@ g_subprocess_get_if_exited (GSubprocess *subprocess) g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), FALSE); g_return_val_if_fail (subprocess->pid == 0, FALSE); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) return WIFEXITED (subprocess->status); #else return TRUE; @@ -1161,7 +1175,7 @@ g_subprocess_get_exit_status (GSubprocess *subprocess) g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), 1); g_return_val_if_fail (subprocess->pid == 0, 1); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) g_return_val_if_fail (WIFEXITED (subprocess->status), 1); return WEXITSTATUS (subprocess->status); @@ -1191,7 +1205,7 @@ g_subprocess_get_if_signaled (GSubprocess *subprocess) g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), FALSE); g_return_val_if_fail (subprocess->pid == 0, FALSE); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) return WIFSIGNALED (subprocess->status); #else return FALSE; @@ -1220,12 +1234,12 @@ g_subprocess_get_term_sig (GSubprocess *subprocess) g_return_val_if_fail (G_IS_SUBPROCESS (subprocess), 0); g_return_val_if_fail (subprocess->pid == 0, 0); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) g_return_val_if_fail (WIFSIGNALED (subprocess->status), 0); return WTERMSIG (subprocess->status); #else - g_critical ("g_subprocess_get_term_sig() called on Windows, where " + g_critical ("g_subprocess_get_term_sig() called on Windows or Wasm, where " "g_subprocess_get_if_signaled() always returns FALSE..."); return 0; #endif @@ -1440,7 +1454,7 @@ g_subprocess_communicate_internal (GSubprocess *subprocess, { g_assert (stdin_buf != NULL); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) /* We're doing async writes to the pipe, and the async write mechanism assumes * that streams polling as writable do SOME progress (possibly partial) and then * stop, but never block. diff --git a/gio/gtask.c b/gio/gtask.c index 1d5b37e85dd..bbeac35296d 100644 --- a/gio/gtask.c +++ b/gio/gtask.c @@ -611,7 +611,8 @@ typedef enum PROP_COMPLETED = 1, } GTaskProperty; -static void g_task_async_result_iface_init (GAsyncResultIface *iface); +static void g_task_async_result_iface_init (GAsyncResultIface *iface, + gpointer iface_data); static void g_task_thread_pool_init (void); G_DEFINE_TYPE_WITH_CODE (GTask, g_task, G_TYPE_OBJECT, @@ -2308,7 +2309,8 @@ g_task_is_tagged (GAsyncResult *res, } static void -g_task_async_result_iface_init (GAsyncResultIface *iface) +g_task_async_result_iface_init (GAsyncResultIface *iface, + gpointer iface_data) { iface->get_user_data = g_task_get_user_data; iface->get_source_object = g_task_ref_source_object; diff --git a/gio/gtestdbus.c b/gio/gtestdbus.c index cf7d1a4b8ed..c06597c8257 100644 --- a/gio/gtestdbus.c +++ b/gio/gtestdbus.c @@ -48,7 +48,7 @@ #include "glibintl.h" -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include "glib-unix.h" #endif @@ -603,7 +603,7 @@ static gboolean make_pipe (gint pipe_fds[2], GError **error) { -#if defined(G_OS_UNIX) +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) return g_unix_open_pipe (pipe_fds, FD_CLOEXEC, error); #elif defined(G_OS_WIN32) if (_pipe (pipe_fds, 4096, _O_BINARY) < 0) diff --git a/gio/gthemedicon.c b/gio/gthemedicon.c index 8551bd27d3b..63866e905e8 100644 --- a/gio/gthemedicon.c +++ b/gio/gthemedicon.c @@ -45,7 +45,8 @@ * themes that inherit other themes. **/ -static void g_themed_icon_icon_iface_init (GIconIface *iface); +static void g_themed_icon_icon_iface_init (GIconIface *iface, + gpointer iface_data); struct _GThemedIcon { @@ -620,7 +621,8 @@ g_themed_icon_serialize (GIcon *icon) } static void -g_themed_icon_icon_iface_init (GIconIface *iface) +g_themed_icon_icon_iface_init (GIconIface *iface, + gpointer iface_data) { iface->hash = g_themed_icon_hash; iface->equal = g_themed_icon_equal; diff --git a/gio/gunixfdlist.c b/gio/gunixfdlist.c index e0617141422..d7ced32fe3f 100644 --- a/gio/gunixfdlist.c +++ b/gio/gunixfdlist.c @@ -54,6 +54,10 @@ #include "glib/glib-private.h" #include "glib/gstdio.h" +#ifdef G_OS_UNIX +#include /* dup() */ +#endif + #ifdef G_OS_WIN32 #include #endif diff --git a/gio/gunixinputstream.c b/gio/gunixinputstream.c index 2180ce8dcaf..8596bfe79d7 100644 --- a/gio/gunixinputstream.c +++ b/gio/gunixinputstream.c @@ -67,8 +67,10 @@ struct _GUnixInputStreamPrivate { guint can_poll : 1; }; -static void g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface); -static void g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); +static void g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, + gpointer iface_data); +static void g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GUnixInputStream, g_unix_input_stream, G_TYPE_INPUT_STREAM, G_ADD_PRIVATE (GUnixInputStream) @@ -159,7 +161,8 @@ g_unix_input_stream_class_init (GUnixInputStreamClass *klass) } static void -g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) +g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface, + gpointer iface_data) { iface->can_poll = g_unix_input_stream_pollable_can_poll; iface->is_readable = g_unix_input_stream_pollable_is_readable; @@ -167,7 +170,8 @@ g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface) } static void -g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) +g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data) { iface->get_fd = (int (*) (GFileDescriptorBased *))g_unix_input_stream_get_fd; } diff --git a/gio/gunixmount.c b/gio/gunixmount.c index 7055d8eddc2..a5d4127fea0 100644 --- a/gio/gunixmount.c +++ b/gio/gunixmount.c @@ -63,7 +63,8 @@ struct _GUnixMount { gboolean can_eject; }; -static void g_unix_mount_mount_iface_init (GMountIface *iface); +static void g_unix_mount_mount_iface_init (GMountIface *iface, + gpointer iface_data); #define g_unix_mount_get_type _g_unix_mount_get_type G_DEFINE_TYPE_WITH_CODE (GUnixMount, g_unix_mount, G_TYPE_OBJECT, @@ -379,7 +380,8 @@ g_unix_mount_eject_finish (GMount *mount, } static void -g_unix_mount_mount_iface_init (GMountIface *iface) +g_unix_mount_mount_iface_init (GMountIface *iface, + gpointer iface_data) { iface->get_root = g_unix_mount_get_root; iface->get_name = g_unix_mount_get_name; diff --git a/gio/gunixoutputstream.c b/gio/gunixoutputstream.c index 8a71c315cab..40012eb0a9f 100644 --- a/gio/gunixoutputstream.c +++ b/gio/gunixoutputstream.c @@ -69,8 +69,10 @@ struct _GUnixOutputStreamPrivate { guint can_poll : 1; }; -static void g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); -static void g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); +static void g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, + gpointer iface_data); +static void g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GUnixOutputStream, g_unix_output_stream, G_TYPE_OUTPUT_STREAM, G_ADD_PRIVATE (GUnixOutputStream) @@ -158,7 +160,8 @@ g_unix_output_stream_class_init (GUnixOutputStreamClass *klass) } static void -g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) +g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface, + gpointer iface_data) { iface->can_poll = g_unix_output_stream_pollable_can_poll; iface->is_writable = g_unix_output_stream_pollable_is_writable; @@ -167,7 +170,8 @@ g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface) } static void -g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface) +g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface, + gpointer iface_data) { iface->get_fd = (int (*) (GFileDescriptorBased *))g_unix_output_stream_get_fd; } diff --git a/gio/gunixsocketaddress.c b/gio/gunixsocketaddress.c index 3ccb2cbf16f..9c6167f8a3e 100644 --- a/gio/gunixsocketaddress.c +++ b/gio/gunixsocketaddress.c @@ -88,7 +88,8 @@ struct _GUnixSocketAddressPrivate GUnixSocketAddressType address_type; }; -static void g_unix_socket_address_connectable_iface_init (GSocketConnectableIface *iface); +static void g_unix_socket_address_connectable_iface_init (GSocketConnectableIface *iface, + gpointer iface_data); static gchar *g_unix_socket_address_connectable_to_string (GSocketConnectable *connectable); G_DEFINE_TYPE_WITH_CODE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS, @@ -321,7 +322,8 @@ g_unix_socket_address_class_init (GUnixSocketAddressClass *klass) } static void -g_unix_socket_address_connectable_iface_init (GSocketConnectableIface *iface) +g_unix_socket_address_connectable_iface_init (GSocketConnectableIface *iface, + gpointer iface_data) { GSocketConnectableIface *parent_iface = g_type_interface_peek_parent (iface); diff --git a/gio/gunixvolume.c b/gio/gunixvolume.c index a0f00ffbb66..2257a287f2f 100644 --- a/gio/gunixvolume.c +++ b/gio/gunixvolume.c @@ -61,7 +61,8 @@ struct _GUnixVolume { GIcon *symbolic_icon; }; -static void g_unix_volume_volume_iface_init (GVolumeIface *iface); +static void g_unix_volume_volume_iface_init (GVolumeIface *iface, + gpointer iface_data); #define g_unix_volume_get_type _g_unix_volume_get_type G_DEFINE_TYPE_WITH_CODE (GUnixVolume, g_unix_volume, G_TYPE_OBJECT, @@ -421,7 +422,8 @@ g_unix_volume_enumerate_identifiers (GVolume *volume) } static void -g_unix_volume_volume_iface_init (GVolumeIface *iface) +g_unix_volume_volume_iface_init (GVolumeIface *iface, + gpointer iface_data) { iface->get_name = g_unix_volume_get_name; iface->get_icon = g_unix_volume_get_icon; diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c index dec82954f16..760fc72b30e 100644 --- a/gio/gwin32appinfo.c +++ b/gio/gwin32appinfo.c @@ -4045,7 +4045,8 @@ gio_win32_appinfo_init (gboolean do_wait) } -static void g_win32_app_info_iface_init (GAppInfoIface *iface); +static void g_win32_app_info_iface_init (GAppInfoIface *iface, + gpointer iface_data); struct _GWin32AppInfo { @@ -5594,7 +5595,8 @@ g_app_info_create_from_commandline (const char *commandline, /* GAppInfo interface init */ static void -g_win32_app_info_iface_init (GAppInfoIface *iface) +g_win32_app_info_iface_init (GAppInfoIface *iface, + gpointer iface_data) { iface->dup = g_win32_app_info_dup; iface->equal = g_win32_app_info_equal; diff --git a/gio/gwin32mount.c b/gio/gwin32mount.c index 8df59b76522..a06b5426581 100644 --- a/gio/gwin32mount.c +++ b/gio/gwin32mount.c @@ -97,7 +97,8 @@ struct _GWin32Mount { gboolean can_eject; }; -static void g_win32_mount_mount_iface_init (GMountIface *iface); +static void g_win32_mount_mount_iface_init (GMountIface *iface, + gpointer iface_data) #define g_win32_mount_get_type _g_win32_mount_get_type G_DEFINE_TYPE_WITH_CODE (GWin32Mount, g_win32_mount, G_TYPE_OBJECT, @@ -523,7 +524,8 @@ g_win32_mount_eject_finish (GMount *mount, } static void -g_win32_mount_mount_iface_init (GMountIface *iface) +g_win32_mount_mount_iface_init (GMountIface *iface, + gpointer iface_data) { iface->get_root = g_win32_mount_get_root; iface->get_name = g_win32_mount_get_name; diff --git a/gio/gwin32networkmonitor.c b/gio/gwin32networkmonitor.c index 9dd5da757c3..77888cddf34 100644 --- a/gio/gwin32networkmonitor.c +++ b/gio/gwin32networkmonitor.c @@ -46,8 +46,10 @@ #include "gioerror.h" static GInitableIface *initable_parent_iface; -static void g_win32_network_monitor_iface_init (GNetworkMonitorInterface *iface); -static void g_win32_network_monitor_initable_iface_init (GInitableIface *iface); +static void g_win32_network_monitor_iface_init (GNetworkMonitorInterface *iface, + gpointer iface_data); +static void g_win32_network_monitor_initable_iface_init (GInitableIface *iface, + gpointer iface_data); struct _GWin32NetworkMonitorPrivate { @@ -328,12 +330,14 @@ g_win32_network_monitor_class_init (GWin32NetworkMonitorClass *win_class) } static void -g_win32_network_monitor_iface_init (GNetworkMonitorInterface *monitor_iface) +g_win32_network_monitor_iface_init (GNetworkMonitorInterface *monitor_iface, + gpointer iface_data) { } static void -g_win32_network_monitor_initable_iface_init (GInitableIface *iface) +g_win32_network_monitor_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { initable_parent_iface = g_type_interface_peek_parent (iface); diff --git a/gio/gwin32registrykey.c b/gio/gwin32registrykey.c index df20db1023c..e468cf578f7 100644 --- a/gio/gwin32registrykey.c +++ b/gio/gwin32registrykey.c @@ -434,7 +434,8 @@ struct _GWin32RegistryKeyPrivate { gpointer user_data; }; -static void g_win32_registry_key_initable_iface_init (GInitableIface *iface); +static void g_win32_registry_key_initable_iface_init (GInitableIface *iface, + gpointer iface_data); static gboolean g_win32_registry_key_initable_init (GInitable *initable, GCancellable *cancellable, GError **error); @@ -541,7 +542,8 @@ g_win32_registry_key_new_w (const gunichar2 *path, } static void -g_win32_registry_key_initable_iface_init (GInitableIface *iface) +g_win32_registry_key_initable_iface_init (GInitableIface *iface, + gpointer iface_data) { iface->init = g_win32_registry_key_initable_init; } diff --git a/gio/gzlibcompressor.c b/gio/gzlibcompressor.c index a1c018a01ca..59d9a7822c9 100644 --- a/gio/gzlibcompressor.c +++ b/gio/gzlibcompressor.c @@ -51,7 +51,8 @@ enum { * compresses data using zlib. */ -static void g_zlib_compressor_iface_init (GConverterIface *iface); +static void g_zlib_compressor_iface_init (GConverterIface *iface, + gpointer iface_data); /** * GZlibCompressor: @@ -431,7 +432,8 @@ g_zlib_compressor_convert (GConverter *converter, } static void -g_zlib_compressor_iface_init (GConverterIface *iface) +g_zlib_compressor_iface_init (GConverterIface *iface, + gpointer iface_data) { iface->convert = g_zlib_compressor_convert; iface->reset = g_zlib_compressor_reset; diff --git a/gio/gzlibdecompressor.c b/gio/gzlibdecompressor.c index f7045093e68..1133d5e5e2a 100644 --- a/gio/gzlibdecompressor.c +++ b/gio/gzlibdecompressor.c @@ -50,7 +50,8 @@ enum { * decompresses data compressed with zlib. */ -static void g_zlib_decompressor_iface_init (GConverterIface *iface); +static void g_zlib_decompressor_iface_init (GConverterIface *iface, + gpointer iface_data); typedef struct { gz_header gzheader; @@ -411,7 +412,8 @@ g_zlib_decompressor_convert (GConverter *converter, } static void -g_zlib_decompressor_iface_init (GConverterIface *iface) +g_zlib_decompressor_iface_init (GConverterIface *iface, + gpointer iface_data) { iface->convert = g_zlib_decompressor_convert; iface->reset = g_zlib_decompressor_reset; diff --git a/gio/meson.build b/gio/meson.build index 0ddbb6a2983..4c0123487ec 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -39,7 +39,7 @@ endif network_libs = [ ] network_args = [ ] -if host_system != 'windows' +if host_system not in ['windows', 'emscripten'] # res_query() res_query_test = '''#include int main (int argc, char ** argv) { @@ -354,7 +354,7 @@ gdbus_daemon_sources = [ gdbus_daemon_generated, ] -if host_system != 'windows' +if host_system not in ['windows', 'emscripten'] unix_sources = files( 'gfiledescriptorbased.c', 'giounix-private.c', @@ -406,20 +406,6 @@ if host_system != 'windows' contenttype_sources += files('gcontenttype.c') appinfo_sources += files('gdesktopappinfo.c') gio_unix_include_headers += files('gdesktopappinfo.h') - launch_desktop_sources = files('gio-launch-desktop.c') - - if host_system == 'linux' - launch_desktop_sources += files('../glib/gjournal-private.c') - endif - - gio_launch_desktop = executable('gio-launch-desktop', launch_desktop_sources, - include_directories : glibinc, - install : true, - install_dir : multiarch_libexecdir, - install_tag : 'bin', - c_args : gio_c_args, - # intl.lib is not compatible with SAFESEH - link_args : noseh_link_args) endif subdir('xdgmime') @@ -433,7 +419,7 @@ if host_system != 'windows' 'gnetworkmonitornm.c', ) endif -else +elif host_system == 'windows' appinfo_sources += files('gwin32appinfo.c') contenttype_sources += files('gcontenttype-win32.c') platform_deps += [cc.find_library('shlwapi'), @@ -908,7 +894,7 @@ if host_system == 'windows' description : 'Windows specific headers for glib I/O library', ) meson.override_dependency('gio-windows-2.0', libgio_dep) -else +elif host_system != 'emscripten' pkg.generate(requires : ['gobject-2.0', 'gio-2.0'], subdirs : ['gio-unix-2.0'], version : glib_version, @@ -957,115 +943,6 @@ gconstructor_as_data_h = custom_target('gconstructor_as_data.h', output : ['gconstructor_as_data.h'], command : [python, '@INPUT0@', '@INPUT1@', 'gconstructor_code', '@OUTPUT@']) -# Several installed executables -gio_tool_sources = [ - 'gio-tool.c', - 'gio-tool.h', - 'gio-tool-cat.c', - 'gio-tool-copy.c', - 'gio-tool-info.c', - 'gio-tool-launch.c', - 'gio-tool-list.c', - 'gio-tool-mime.c', - 'gio-tool-mkdir.c', - 'gio-tool-monitor.c', - 'gio-tool-mount.c', - 'gio-tool-move.c', - 'gio-tool-open.c', - 'gio-tool-rename.c', - 'gio-tool-remove.c', - 'gio-tool-save.c', - 'gio-tool-set.c', - 'gio-tool-trash.c', - 'gio-tool-tree.c', -] - -executable('gio', gio_tool_sources, - install : true, - install_tag : 'bin', - c_args : gio_c_args, - # intl.lib is not compatible with SAFESEH - link_args : noseh_link_args, - dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) - -executable('gresource', 'gresource-tool.c', - install : true, - install_tag : 'bin', - # intl.lib is not compatible with SAFESEH - link_args : noseh_link_args, - dependencies : [libelf, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) - -gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c', - install : true, - install_dir : multiarch_bindir, - install_tag : 'bin', - c_args : gio_c_args, - # intl.lib is not compatible with SAFESEH - link_args : noseh_link_args, - dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) - -glib_compile_schemas = executable('glib-compile-schemas', - ['glib-compile-schemas.c'], - install : true, - install_dir : multiarch_bindir, - install_tag : 'bin', - # intl.lib is not compatible with SAFESEH - link_args : noseh_link_args, - dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep, gvdb_dep]) - -glib_compile_resources = executable('glib-compile-resources', - [gconstructor_as_data_h, 'glib-compile-resources.c'], - install : true, - install_tag : 'bin-devel', - c_args : gio_c_args, - # intl.lib is not compatible with SAFESEH - link_args : noseh_link_args, - dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep, gvdb_dep]) - -# Cannot override those programs in cross compilation case because they are -# native executables that cannot be run on the build machine. -# See https://gitlab.gnome.org/GNOME/glib/issues/1859. -if meson.can_run_host_binaries() - meson.override_find_program('glib-compile-schemas', glib_compile_schemas) - meson.override_find_program('glib-compile-resources', glib_compile_resources) - meson.override_find_program('gio-querymodules', gio_querymodules) -endif - -executable('gsettings', 'gsettings-tool.c', - install : true, - install_tag : 'bin', - c_args : gio_c_args, - # intl.lib is not compatible with SAFESEH - link_args : noseh_link_args, - dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) -install_data('gschema.dtd', - install_dir : get_option('datadir') / schemas_subdir, - install_tag : 'devel', -) - -install_data(['gschema.loc', 'gschema.its'], - install_dir : get_option('datadir') / 'gettext' / 'its', - install_tag : 'devel', -) - -executable('gdbus', 'gdbus-tool.c', - install : true, - install_tag : 'bin', - c_args : gio_c_args, - # intl.lib is not compatible with SAFESEH - link_args : noseh_link_args, - dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) - -if host_system != 'windows' and not glib_have_cocoa - executable('gapplication', 'gapplication-tool.c', - install : true, - install_tag : 'bin', - c_args : gio_c_args, - # intl.lib is not compatible with SAFESEH - link_args : noseh_link_args, - dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) -endif - if enable_systemtap gio_stp = configure_file(input : 'gio.stp.in', output : '@0@.stp'.format(libgio.full_path().split('/').get(-1)), @@ -1075,25 +952,6 @@ if enable_systemtap ) endif -if multiarch_bindir != get_option('bindir') - foreach exe : ['gio-querymodules', 'glib-compile-schemas'] - if meson.version().version_compare('>=0.61.0') - install_symlink( - exe, - install_dir : get_option('bindir'), - pointing_to : get_option('prefix') / multiarch_bindir / exe, - ) - else - warning( - 'Please use Meson >= 0.61.0 or create a symlink @1@ -> @2@ in packaging'.format( - get_option('prefix') / get_option('bindir') / exe, - get_option('prefix') / multiarch_bindir / exe, - ) - ) - endif - endforeach -endif - if build_tests subdir('tests') endif diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c index e73c87658b4..c9c2d0336a2 100644 --- a/gio/win32/gwinhttpfile.c +++ b/gio/win32/gwinhttpfile.c @@ -37,7 +37,8 @@ #include "glibintl.h" -static void g_winhttp_file_file_iface_init (GFileIface *iface); +static void g_winhttp_file_file_iface_init (GFileIface *iface, + gpointer iface_data); #define g_winhttp_file_get_type _g_winhttp_file_get_type G_DEFINE_TYPE_WITH_CODE (GWinHttpFile, g_winhttp_file, G_TYPE_OBJECT, @@ -757,7 +758,8 @@ g_winhttp_file_move (GFile *source, #endif static void -g_winhttp_file_file_iface_init (GFileIface *iface) +g_winhttp_file_file_iface_init (GFileIface *iface, + gpointer iface_data) { iface->dup = g_winhttp_file_dup; iface->hash = g_winhttp_file_hash; diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c index 9c52a7d295a..38c0b473e14 100644 --- a/glib/gbacktrace.c +++ b/glib/gbacktrace.c @@ -259,7 +259,7 @@ g_on_error_query (const gchar *prg_name) void g_on_error_stack_trace (const gchar *prg_name) { -#if defined(G_OS_UNIX) +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) pid_t pid; gchar buf[16]; const gchar *args[5] = { DEBUGGER, NULL, NULL, NULL, NULL }; @@ -301,9 +301,11 @@ g_on_error_stack_trace (const gchar *prg_name) break; } #else +#ifdef G_OS_WIN32 if (IsDebuggerPresent ()) G_BREAKPOINT (); else +#endif g_abort (); #endif } diff --git a/glib/gi18n-lib.h b/glib/gi18n-lib.h index fe9e79dbd96..8597f90d1de 100644 --- a/glib/gi18n-lib.h +++ b/glib/gi18n-lib.h @@ -20,19 +20,10 @@ #ifndef __G_I18N_LIB_H__ #define __G_I18N_LIB_H__ -#include - -#include -#include - -#ifndef GETTEXT_PACKAGE -#error You must define GETTEXT_PACKAGE before including gi18n-lib.h. Did you forget to include config.h? -#endif - -#define _(String) ((char *) g_dgettext (GETTEXT_PACKAGE, String)) -#define Q_(String) g_dpgettext (GETTEXT_PACKAGE, String, 0) +#define _(String) (String) +#define Q_(String) (String) #define N_(String) (String) -#define C_(Context,String) g_dpgettext (GETTEXT_PACKAGE, Context "\004" String, strlen (Context) + 1) +#define C_(Context,String) (String) #define NC_(Context, String) (String) #endif /* __G_I18N_LIB_H__ */ diff --git a/glib/glib-autocleanups.h b/glib/glib-autocleanups.h index e2e0075e5af..61e7d3c65e9 100644 --- a/glib/glib-autocleanups.h +++ b/glib/glib-autocleanups.h @@ -73,8 +73,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free) diff --git a/glib/glib.h b/glib/glib.h index cfd28ce0d51..d83b2256ba6 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -74,7 +74,6 @@ #include #include #include -#include #include #include #include diff --git a/glib/gmain.c b/glib/gmain.c index dba5f40e4ef..f9a9ca8ad64 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -48,7 +48,7 @@ #define G_MAIN_POLL_DEBUG #endif -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include "glib-unix.h" #include #ifdef HAVE_EVENTFD @@ -369,7 +369,7 @@ struct _GChildWatchSource gint child_status; /* @poll is always used on Windows, and used on Unix iff @using_pidfd is set: */ GPollFD poll; -#ifndef G_OS_WIN32 +#if !defined(G_OS_WIN32) && !defined(G_PLATFORM_WASM) gboolean child_exited; /* (atomic); not used iff @using_pidfd is set */ gboolean using_pidfd; #endif /* G_OS_WIN32 */ @@ -464,7 +464,7 @@ static gboolean g_child_watch_dispatch (GSource *source, GSourceFunc callback, gpointer user_data); static void g_child_watch_finalize (GSource *source); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static void g_unix_signal_handler (int signum); static gboolean g_unix_signal_watch_prepare (GSource *source, gint *timeout); @@ -485,7 +485,7 @@ static void block_source (GSource *source); static GMainContext *glib_worker_context; -#ifndef G_OS_WIN32 +#if !defined(G_OS_WIN32) && !defined(G_PLATFORM_WASM) /* UNIX signals work by marking one of these variables then waking the @@ -526,7 +526,7 @@ GSourceFuncs g_unix_signal_funcs = g_unix_signal_watch_finalize, NULL, NULL }; -#endif /* !G_OS_WIN32 */ +#endif /* !G_OS_WIN32 && !G_PLATFORM_WASM */ G_LOCK_DEFINE_STATIC (main_context_list); static GSList *main_context_list = NULL; @@ -2695,7 +2695,7 @@ g_clear_handle_id (guint *tag_ptr, } } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) /** * g_source_add_unix_fd: * @source: a #GSource @@ -2877,7 +2877,7 @@ g_source_query_unix_fd (GSource *source, return poll_fd->revents; } -#endif /* G_OS_UNIX */ +#endif /* G_OS_UNIX && !G_PLATFORM_WASM */ /** * g_get_current_time: @@ -5406,7 +5406,28 @@ g_child_watch_finalize (GSource *source) { } -#else /* G_OS_WIN32 */ +#elif defined(G_PLATFORM_WASM) /* G_OS_WIN32 */ + +static gboolean +g_child_watch_prepare (GSource *source, + gint *timeout) +{ + *timeout = -1; + return FALSE; +} + +static gboolean +g_child_watch_check (GSource *source) +{ + return FALSE; +} + +static void +g_child_watch_finalize (GSource *source) +{ +} + +#else /* G_PLATFORM_WASM */ static void wake_source (GSource *source) @@ -5841,7 +5862,7 @@ g_child_watch_dispatch (GSource *source, return FALSE; } -#ifndef G_OS_WIN32 +#if !defined(G_OS_WIN32) && !defined(G_PLATFORM_WASM) static void g_unix_signal_handler (int signum) @@ -5862,7 +5883,7 @@ g_unix_signal_handler (int signum) errno = saved_errno; } -#endif /* !G_OS_WIN32 */ +#endif /* !G_OS_WIN32 && !G_PLATFORM_WASM */ /** * g_child_watch_source_new: @@ -5932,7 +5953,7 @@ g_child_watch_source_new (GPid pid) child_watch_source->poll.events = G_IO_IN; g_source_add_poll (source, &child_watch_source->poll); -#else /* !G_OS_WIN32 */ +#elif !defined(G_PLATFORM_WASM) /* !G_OS_WIN32 */ #ifdef HAVE_PIDFD /* Use a pidfd, if possible, to avoid having to install a global SIGCHLD @@ -6413,7 +6434,7 @@ glib_worker_main (gpointer data) { g_main_context_iteration (glib_worker_context, TRUE); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) if (g_atomic_int_get (&any_unix_signal_pending)) dispatch_unix_signals (); #endif @@ -6430,7 +6451,7 @@ g_get_worker_context (void) if (g_once_init_enter (&initialised)) { /* mask all signals in the worker thread */ -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) sigset_t prev_mask; sigset_t all; @@ -6439,7 +6460,7 @@ g_get_worker_context (void) #endif glib_worker_context = g_main_context_new (); g_thread_new ("gmain", glib_worker_main, NULL); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) pthread_sigmask (SIG_SETMASK, &prev_mask, NULL); #endif g_once_init_leave (&initialised, TRUE); diff --git a/glib/gspawn-wasm.c b/glib/gspawn-wasm.c new file mode 100644 index 00000000000..6972250e33f --- /dev/null +++ b/glib/gspawn-wasm.c @@ -0,0 +1,164 @@ +/* gspawn-wasm.c - Process launching on WebAssembly, no-op implementation + * + * Copyright 2022 Kleis Auke Wolthuizen + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#include "config.h" + +#include "glib.h" +#include "glibintl.h" +#include "gspawn.h" + +G_DEFINE_QUARK (g-exec-error-quark, g_spawn_error) +G_DEFINE_QUARK (g-spawn-exit-error-quark, g_spawn_exit_error) + +gboolean +g_spawn_async (const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + GPid *child_pid, + GError **error) +{ + g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("g_spawn_async is no-op on WebAssembly")); + return FALSE; +} + +gboolean +g_spawn_async_with_pipes (const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + GPid *child_pid, + gint *standard_input, + gint *standard_output, + gint *standard_error, + GError **error) +{ + g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("g_spawn_async_with_pipes is no-op on WebAssembly")); + return FALSE; +} + +gboolean +g_spawn_async_with_pipes_and_fds (const gchar *working_directory, + const gchar * const *argv, + const gchar * const *envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + gint stdin_fd, + gint stdout_fd, + gint stderr_fd, + const gint *source_fds, + const gint *target_fds, + gsize n_fds, + GPid *child_pid_out, + gint *stdin_pipe_out, + gint *stdout_pipe_out, + gint *stderr_pipe_out, + GError **error) +{ + g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("g_spawn_async_with_pipes_and_fds is no-op on WebAssembly")); + return FALSE; +} + +gboolean +g_spawn_async_with_fds (const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + GPid *child_pid, + gint stdin_fd, + gint stdout_fd, + gint stderr_fd, + GError **error) +{ + g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("g_spawn_async_with_fds is no-op on WebAssembly")); + return FALSE; +} + +gboolean +g_spawn_sync (const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + gchar **standard_output, + gchar **standard_error, + gint *wait_status, + GError **error) +{ + g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("g_spawn_sync is no-op on WebAssembly")); + return FALSE; +} + +gboolean +g_spawn_command_line_sync (const gchar *command_line, + gchar **standard_output, + gchar **standard_error, + gint *wait_status, + GError **error) +{ + g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("g_spawn_command_line_sync is no-op on WebAssembly")); + return FALSE; +} + +gboolean +g_spawn_command_line_async (const gchar *command_line, + GError **error) +{ + g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("g_spawn_command_line_async is no-op on WebAssembly")); + return FALSE; +} + +gboolean +g_spawn_check_wait_status (gint wait_status, + GError **error) +{ + g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("g_spawn_check_wait_status is no-op on WebAssembly")); + return FALSE; +} + +gboolean +g_spawn_check_exit_status (gint wait_status, + GError **error) +{ + g_set_error_literal (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("g_spawn_check_exit_status is no-op on WebAssembly")); + return FALSE; +} + +void +g_spawn_close_pid (GPid pid) +{ +} diff --git a/glib/gthread.c b/glib/gthread.c index bc9b1c2b370..f9969b174a3 100644 --- a/glib/gthread.c +++ b/glib/gthread.c @@ -56,6 +56,10 @@ #include #endif /* G_OS_WIN32 */ +#ifdef G_PLATFORM_WASM +#include +#endif /*G_PLATFORM_WASM*/ + #include "gslice.h" #include "gstrfuncs.h" #include "gtestutils.h" @@ -1070,7 +1074,9 @@ g_thread_self (void) guint g_get_num_processors (void) { -#ifdef G_OS_WIN32 +#ifdef G_PLATFORM_WASM + return emscripten_num_logical_cores(); +#elif defined(G_OS_WIN32) unsigned int count; SYSTEM_INFO sysinfo; DWORD_PTR process_cpus; diff --git a/glib/gtimezone.c b/glib/gtimezone.c index 00492995c85..a8623ae7678 100644 --- a/glib/gtimezone.c +++ b/glib/gtimezone.c @@ -211,7 +211,7 @@ static GTimeZone *tz_local = NULL; there's no point in getting carried away. */ -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static GTimeZone *parse_footertz (const gchar *, size_t); #endif @@ -445,7 +445,7 @@ zone_for_constant_offset (GTimeZone *gtz, const gchar *name) gtz->transitions = NULL; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #if defined(__sun) && defined(__SVR4) /* @@ -1704,7 +1704,7 @@ rules_from_identifier (const gchar *identifier, return create_ruleset_from_rule (rules, &tzr); } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static GTimeZone * parse_footertz (const gchar *footer, size_t footerlen) { @@ -1863,7 +1863,9 @@ g_time_zone_new_identifier (const gchar *identifier) else { G_LOCK (tz_default); -#ifdef G_OS_UNIX +#ifdef G_PLATFORM_WASM + resolved_identifier = g_strdup ("UTC0"); +#elif defined (G_OS_UNIX) resolved_identifier = zone_identifier_unix (); #elif defined (G_OS_WIN32) resolved_identifier = windows_default_tzname (); @@ -1903,7 +1905,7 @@ g_time_zone_new_identifier (const gchar *identifier) if (tz->t_info == NULL) { -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) GBytes *zoneinfo = zone_info_unix (identifier, resolved_identifier); if (zoneinfo != NULL) { diff --git a/glib/gutils.c b/glib/gutils.c index 78ccd612145..16fd528b377 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -1414,7 +1414,7 @@ get_windows_version (gboolean with_windows) } #endif -#if defined (G_OS_UNIX) && !defined (__APPLE__) +#if defined (G_OS_UNIX) && !defined (__APPLE__) && !defined (G_PLATFORM_WASM) static gchar * get_os_info_from_os_release (const gchar *key_name, const gchar *buffer) @@ -1571,6 +1571,11 @@ g_get_os_info (const gchar *key_name) return g_strdup ("macOS"); else return NULL; +#elif defined (G_PLATFORM_WASM) + if (g_strcmp0 (key_name, G_OS_INFO_KEY_NAME) == 0) + return g_strdup ("wasm"); + else + return NULL; #elif defined (G_OS_UNIX) const gchar * const os_release_files[] = { "/etc/os-release", "/usr/lib/os-release" }; gsize i; diff --git a/glib/gwakeup.c b/glib/gwakeup.c index 0f76be62bd5..354d03d0c1a 100644 --- a/glib/gwakeup.c +++ b/glib/gwakeup.c @@ -111,16 +111,24 @@ g_wakeup_free (GWakeup *wakeup) #else +#ifdef G_PLATFORM_WASM +#ifdef GLIB_COMPILATION +#include "gmessages.h" +#endif +#else /*!G_PLATFORM_WASM*/ #include "glib-unix.h" #include #if defined (HAVE_EVENTFD) #include #endif +#endif /*G_PLATFORM_WASM*/ struct _GWakeup { +#ifndef G_PLATFORM_WASM gint fds[2]; +#endif }; /** @@ -137,6 +145,10 @@ struct _GWakeup GWakeup * g_wakeup_new (void) { +#ifdef G_PLATFORM_WASM + g_error ("g_wakeup_new is no-op on WebAssembly"); + return NULL; +#else GError *error = NULL; GWakeup *wakeup; @@ -167,6 +179,7 @@ g_wakeup_new (void) g_error ("Set pipes non-blocking for GWakeup: %s", error->message); return wakeup; +#endif } /** @@ -185,8 +198,12 @@ void g_wakeup_get_pollfd (GWakeup *wakeup, GPollFD *poll_fd) { +#ifdef G_PLATFORM_WASM + g_error ("g_wakeup_get_pollfd is no-op on WebAssembly"); +#else poll_fd->fd = wakeup->fds[0]; poll_fd->events = G_IO_IN; +#endif } /** @@ -206,10 +223,14 @@ g_wakeup_get_pollfd (GWakeup *wakeup, void g_wakeup_acknowledge (GWakeup *wakeup) { +#ifdef G_PLATFORM_WASM + g_error ("g_wakeup_acknowledge is no-op on WebAssembly"); +#else char buffer[16]; /* read until it is empty */ while (read (wakeup->fds[0], buffer, sizeof buffer) == sizeof buffer); +#endif } /** @@ -229,6 +250,9 @@ g_wakeup_acknowledge (GWakeup *wakeup) void g_wakeup_signal (GWakeup *wakeup) { +#ifdef G_PLATFORM_WASM + g_error ("g_wakeup_signal is no-op on WebAssembly"); +#else int res; if (wakeup->fds[1] == -1) @@ -251,6 +275,7 @@ g_wakeup_signal (GWakeup *wakeup) res = write (wakeup->fds[1], &one, sizeof one); while (G_UNLIKELY (res == -1 && errno == EINTR)); } +#endif } /** @@ -265,12 +290,16 @@ g_wakeup_signal (GWakeup *wakeup) void g_wakeup_free (GWakeup *wakeup) { +#ifdef G_PLATFORM_WASM + g_error ("g_wakeup_free is no-op on WebAssembly"); +#else close (wakeup->fds[0]); if (wakeup->fds[1] != -1) close (wakeup->fds[1]); g_slice_free (GWakeup, wakeup); +#endif } #endif /* !_WIN32 */ diff --git a/glib/meson.build b/glib/meson.build index 4130b1ba6f1..3dcb11b0482 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -215,7 +215,6 @@ glib_sub_headers = files( 'grcbox.h', 'grefcount.h', 'grefstring.h', - 'gregex.h', 'gscanner.h', 'gsequence.h', 'gshell.h', @@ -303,7 +302,6 @@ glib_sources += files( 'grcbox.c', 'grefcount.c', 'grefstring.c', - 'gregex.c', 'gscanner.c', 'gsequence.c', 'gshell.c', @@ -362,9 +360,10 @@ if host_system == 'windows' if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' glib_sources += files('dirent/wdirent.c') endif +elif host_system == 'emscripten' + glib_sources += files('gspawn-wasm.c') else glib_sources += files('glib-unix.c', 'gspawn.c', 'giounix.c') - platform_deps = [] endif if host_system == 'linux' @@ -392,13 +391,7 @@ else glib_dtrace_hdr = [] endif -pcre2_static_args = [] - -if use_pcre2_static_flag - pcre2_static_args = ['-DPCRE2_STATIC'] -endif - -glib_c_args = ['-DG_LOG_DOMAIN="GLib"'] + glib_c_args_internal + pcre2_static_args +glib_c_args = ['-DG_LOG_DOMAIN="GLib"'] + glib_c_args_internal libglib = library('glib-2.0', glib_dtrace_obj, glib_dtrace_hdr, sources : [deprecated_sources, glib_sources], @@ -417,7 +410,6 @@ libglib = library('glib-2.0', libm, librt, libsysprof_capture_dep, - pcre2, platform_deps, thread_dep, ], @@ -475,7 +467,7 @@ if host_system == 'windows' include_directories : configinc, dependencies : [libglib_dep]) endif -else +elif host_system != 'emscripten' gtester = executable('gtester', 'gtester.c', install : true, install_tag : 'bin-devel', diff --git a/gobject/gboxed.c b/gobject/gboxed.c index 04d283a7e91..bc830d4ebea 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -150,9 +150,6 @@ G_DEFINE_BOXED_TYPE (GByteArray, g_byte_array, g_byte_array_ref, g_byte_array_un G_DEFINE_BOXED_TYPE (GBytes, g_bytes, g_bytes_ref, g_bytes_unref) G_DEFINE_BOXED_TYPE (GTree, g_tree, g_tree_ref, g_tree_unref) -G_DEFINE_BOXED_TYPE (GRegex, g_regex, g_regex_ref, g_regex_unref) -G_DEFINE_BOXED_TYPE (GMatchInfo, g_match_info, g_match_info_ref, g_match_info_unref) - #define g_variant_type_get_type g_variant_type_get_gtype G_DEFINE_BOXED_TYPE (GVariantType, g_variant_type, g_variant_type_copy, g_variant_type_free) #undef g_variant_type_get_type diff --git a/gobject/glib-types.h b/gobject/glib-types.h index 21081d2b5fc..91f1ebdb597 100644 --- a/gobject/glib-types.h +++ b/gobject/glib-types.h @@ -87,15 +87,6 @@ typedef gsize GType; */ #define G_TYPE_HASH_TABLE (g_hash_table_get_type ()) -/** - * G_TYPE_REGEX: - * - * The #GType for a boxed type holding a #GRegex reference. - * - * Since: 2.14 - */ -#define G_TYPE_REGEX (g_regex_get_type ()) - /** * G_TYPE_MATCH_INFO: * diff --git a/gobject/gobject.c b/gobject/gobject.c index d0e2e877f34..a3c5f4b01bb 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -203,7 +203,8 @@ G_STATIC_ASSERT(G_STRUCT_OFFSET(GObject, qdata) == G_STRUCT_OFFSET(GObjectReal, /* --- prototypes --- */ static void g_object_base_class_init (GObjectClass *class); static void g_object_base_class_finalize (GObjectClass *class); -static void g_object_do_class_init (GObjectClass *class); +static void g_object_do_class_init (GObjectClass *class, + gpointer class_data); static void g_object_init (GObject *object, GObjectClass *class); static GObject* g_object_constructor (GType type, @@ -518,7 +519,8 @@ g_object_base_class_finalize (GObjectClass *class) } static void -g_object_do_class_init (GObjectClass *class) +g_object_do_class_init (GObjectClass *class, + gpointer class_data) { /* read the comment about typedef struct CArray; on why not to change this quark */ quark_closure_array = g_quark_from_static_string ("GObject-closure-array"); diff --git a/gobject/gparam.h b/gobject/gparam.h index 6454e69a9df..f65e76ad57e 100644 --- a/gobject/gparam.h +++ b/gobject/gparam.h @@ -399,7 +399,8 @@ struct _GParamSpecTypeInfo /* type system portion */ guint16 instance_size; /* obligatory */ guint16 n_preallocs; /* optional */ - void (*instance_init) (GParamSpec *pspec); /* optional */ + void (*instance_init) (GParamSpec *pspec, /* optional */ + gpointer class_data); /* class portion */ GType value_type; /* obligatory */ diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c index 17b86065723..7d3f77984e7 100644 --- a/gobject/gparamspecs.c +++ b/gobject/gparamspecs.c @@ -66,7 +66,8 @@ /* --- param spec functions --- */ static void -param_char_init (GParamSpec *pspec) +param_char_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecChar *cspec = G_PARAM_SPEC_CHAR (pspec); @@ -105,7 +106,8 @@ param_char_validate (GParamSpec *pspec, } static void -param_uchar_init (GParamSpec *pspec) +param_uchar_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecUChar *uspec = G_PARAM_SPEC_UCHAR (pspec); @@ -171,7 +173,8 @@ param_boolean_validate (GParamSpec *pspec, } static void -param_int_init (GParamSpec *pspec) +param_int_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec); @@ -221,7 +224,8 @@ param_int_values_cmp (GParamSpec *pspec, } static void -param_uint_init (GParamSpec *pspec) +param_uint_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecUInt *uspec = G_PARAM_SPEC_UINT (pspec); @@ -271,7 +275,8 @@ param_uint_values_cmp (GParamSpec *pspec, } static void -param_long_init (GParamSpec *pspec) +param_long_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecLong *lspec = G_PARAM_SPEC_LONG (pspec); @@ -326,7 +331,8 @@ param_long_values_cmp (GParamSpec *pspec, } static void -param_ulong_init (GParamSpec *pspec) +param_ulong_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecULong *uspec = G_PARAM_SPEC_ULONG (pspec); @@ -380,7 +386,8 @@ param_ulong_values_cmp (GParamSpec *pspec, } static void -param_int64_init (GParamSpec *pspec) +param_int64_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecInt64 *lspec = G_PARAM_SPEC_INT64 (pspec); @@ -430,7 +437,8 @@ param_int64_values_cmp (GParamSpec *pspec, } static void -param_uint64_init (GParamSpec *pspec) +param_uint64_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecUInt64 *uspec = G_PARAM_SPEC_UINT64 (pspec); @@ -480,7 +488,8 @@ param_uint64_values_cmp (GParamSpec *pspec, } static void -param_unichar_init (GParamSpec *pspec) +param_unichar_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecUnichar *uspec = G_PARAM_SPEC_UNICHAR (pspec); @@ -529,7 +538,8 @@ param_unichar_values_cmp (GParamSpec *pspec, } static void -param_enum_init (GParamSpec *pspec) +param_enum_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec); @@ -584,7 +594,8 @@ param_enum_validate (GParamSpec *pspec, } static void -param_flags_init (GParamSpec *pspec) +param_flags_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec); @@ -639,7 +650,8 @@ param_flags_validate (GParamSpec *pspec, } static void -param_float_init (GParamSpec *pspec) +param_float_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecFloat *fspec = G_PARAM_SPEC_FLOAT (pspec); @@ -692,7 +704,8 @@ param_float_values_cmp (GParamSpec *pspec, } static void -param_double_init (GParamSpec *pspec) +param_double_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec); @@ -745,7 +758,8 @@ param_double_values_cmp (GParamSpec *pspec, } static void -param_string_init (GParamSpec *pspec) +param_string_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec); @@ -876,7 +890,8 @@ param_string_values_cmp (GParamSpec *pspec, } static void -param_param_init (GParamSpec *pspec) +param_param_init (GParamSpec *pspec, + gpointer class_data) { /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */ } @@ -919,7 +934,8 @@ param_param_validate (GParamSpec *pspec, } static void -param_boxed_init (GParamSpec *pspec) +param_boxed_init (GParamSpec *pspec, + gpointer class_data) { /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */ } @@ -945,7 +961,8 @@ param_boxed_values_cmp (GParamSpec *pspec, } static void -param_pointer_init (GParamSpec *pspec) +param_pointer_init (GParamSpec *pspec, + gpointer class_data) { /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */ } @@ -971,7 +988,8 @@ param_pointer_values_cmp (GParamSpec *pspec, } static void -param_value_array_init (GParamSpec *pspec) +param_value_array_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec); @@ -1122,7 +1140,8 @@ param_value_array_values_cmp (GParamSpec *pspec, } static void -param_object_init (GParamSpec *pspec) +param_object_init (GParamSpec *pspec, + gpointer class_data) { /* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */ } @@ -1177,7 +1196,8 @@ param_object_values_cmp (GParamSpec *pspec, } static void -param_override_init (GParamSpec *pspec) +param_override_init (GParamSpec *pspec, + gpointer class_data) { /* GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec); */ } @@ -1235,7 +1255,8 @@ param_override_values_cmp (GParamSpec *pspec, } static void -param_gtype_init (GParamSpec *pspec) +param_gtype_init (GParamSpec *pspec, + gpointer class_data) { } @@ -1290,7 +1311,8 @@ param_gtype_values_cmp (GParamSpec *pspec, } static void -param_variant_init (GParamSpec *pspec) +param_variant_init (GParamSpec *pspec, + gpointer class_data) { GParamSpecVariant *vspec = G_PARAM_SPEC_VARIANT (pspec); diff --git a/gobject/gsourceclosure.c b/gobject/gsourceclosure.c index 6a42f779cbb..4b79b13accc 100644 --- a/gobject/gsourceclosure.c +++ b/gobject/gsourceclosure.c @@ -25,7 +25,7 @@ #include "gmarshal.h" #include "gvalue.h" #include "gvaluetypes.h" -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) #include "glib-unix.h" #endif @@ -119,7 +119,7 @@ g_child_watch_closure_callback (GPid pid, g_value_init (&result_value, G_TYPE_BOOLEAN); -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) g_value_init (¶ms[0], G_TYPE_ULONG); g_value_set_ulong (¶ms[0], pid); #endif @@ -141,7 +141,7 @@ g_child_watch_closure_callback (GPid pid, return result; } -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) static gboolean g_unix_fd_source_closure_callback (int fd, GIOCondition condition, @@ -203,12 +203,12 @@ closure_callback_get (gpointer cb_data, closure_callback = (GSourceFunc)io_watch_closure_callback; else if (source->source_funcs == &g_child_watch_funcs) closure_callback = (GSourceFunc)g_child_watch_closure_callback; -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) else if (source->source_funcs == &g_unix_fd_source_funcs) closure_callback = (GSourceFunc)g_unix_fd_source_closure_callback; #endif else if (source->source_funcs == &g_timeout_funcs || -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) source->source_funcs == &g_unix_signal_funcs || #endif source->source_funcs == &g_idle_funcs) @@ -251,7 +251,7 @@ g_source_set_closure (GSource *source, g_return_if_fail (closure != NULL); if (!source->source_funcs->closure_callback && -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) source->source_funcs != &g_unix_fd_source_funcs && source->source_funcs != &g_unix_signal_funcs && #endif @@ -276,7 +276,7 @@ g_source_set_closure (GSource *source, if (marshal) g_closure_set_marshal (closure, marshal); else if (source->source_funcs == &g_idle_funcs || -#ifdef G_OS_UNIX +#if defined(G_OS_UNIX) && !defined(G_PLATFORM_WASM) source->source_funcs == &g_unix_signal_funcs || #endif source->source_funcs == &g_timeout_funcs) diff --git a/gobject/gtype.h b/gobject/gtype.h index dc8fa25d485..42fbcdbc748 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -1985,7 +1985,7 @@ guint g_type_get_type_registration_serial (void); */ #define G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) { \ const GInterfaceInfo g_implement_interface_info = { \ - (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ + (GInterfaceInitFunc) iface_init, NULL, NULL \ }; \ g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ } @@ -2127,7 +2127,8 @@ guint g_type_get_type_registration_serial (void); */ #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 #define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ -static void type_name##_class_intern_init (gpointer klass) \ +static void type_name##_class_intern_init (gpointer klass, \ + gpointer class_data) \ { \ type_name##_parent_class = g_type_class_peek_parent (klass); \ if (TypeName##_private_offset != 0) \ @@ -2137,7 +2138,8 @@ static void type_name##_class_intern_init (gpointer klass) \ #else #define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ -static void type_name##_class_intern_init (gpointer klass) \ +static void type_name##_class_intern_init (gpointer klass, \ + gpointer class_data) \ { \ type_name##_parent_class = g_type_class_peek_parent (klass); \ type_name##_class_init ((TypeName##Class*) klass); \ @@ -2149,6 +2151,11 @@ static void type_name##_class_intern_init (gpointer klass) \ \ static void type_name##_init (TypeName *self); \ static void type_name##_class_init (TypeName##Class *klass); \ +static void type_name##_init_adapter (TypeName *self, \ + gpointer class_data) \ +{ \ + type_name##_init (self); \ +} \ static GType type_name##_get_type_once (void); \ static gpointer type_name##_parent_class = NULL; \ static gint TypeName##_private_offset; \ @@ -2186,9 +2193,9 @@ type_name##_get_type_once (void) \ g_type_register_static_simple (TYPE_PARENT, \ g_intern_static_string (#TypeName), \ sizeof (TypeName##Class), \ - (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ + (GClassInitFunc) type_name##_class_intern_init, \ sizeof (TypeName), \ - (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ + (GInstanceInitFunc) type_name##_init_adapter, \ (GTypeFlags) flags); \ { /* custom code follows */ #define _G_DEFINE_TYPE_EXTENDED_END() \ @@ -2208,7 +2215,12 @@ type_name##_get_type_once (void) \ * to avoid deprecation warnings with older GLIB_VERSION_MAX_ALLOWED */ #define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \ \ -static void type_name##_default_init (TypeName##Interface *klass); \ +static void type_name##_default_init (TypeName##Interface *klass); \ +static void type_name##_default_init_adapter (TypeName##Interface *klass, \ + gpointer class_data) \ +{ \ + type_name##_default_init (klass); \ +} \ \ GType \ type_name##_get_type (void) \ @@ -2220,7 +2232,7 @@ type_name##_get_type (void) \ g_type_register_static_simple (G_TYPE_INTERFACE, \ g_intern_static_string (#TypeName), \ sizeof (TypeName##Interface), \ - (GClassInitFunc)(void (*)(void)) type_name##_default_init, \ + (GClassInitFunc) type_name##_default_init_adapter, \ 0, \ (GInstanceInitFunc)NULL, \ (GTypeFlags) 0); \ diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c index ec951109022..ce6b02dae8c 100644 --- a/gobject/gtypemodule.c +++ b/gobject/gtypemodule.c @@ -131,7 +131,8 @@ g_type_module_class_init (GTypeModuleClass *class) } static void -g_type_module_iface_init (GTypePluginClass *iface) +g_type_module_iface_init (GTypePluginClass *iface, + gpointer iface_data) { iface->use_plugin = g_type_module_use_plugin; iface->unuse_plugin = (void (*) (GTypePlugin *))g_type_module_unuse; diff --git a/gobject/gtypemodule.h b/gobject/gtypemodule.h index e386b50dff5..f3096a939bf 100644 --- a/gobject/gtypemodule.h +++ b/gobject/gtypemodule.h @@ -209,12 +209,12 @@ type_name##_register_type (GTypeModule *type_module) \ sizeof (TypeName##Class), \ (GBaseInitFunc) NULL, \ (GBaseFinalizeFunc) NULL, \ - (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ - (GClassFinalizeFunc)(void (*)(void)) type_name##_class_finalize, \ + (GClassInitFunc) type_name##_class_intern_init, \ + (GClassFinalizeFunc) type_name##_class_finalize, \ NULL, /* class_data */ \ sizeof (TypeName), \ 0, /* n_preallocs */ \ - (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ + (GInstanceInitFunc) type_name##_init_adapter, \ NULL /* value_table */ \ }; \ type_name##_type_id = g_type_module_register_type (type_module, \ @@ -244,7 +244,7 @@ type_name##_register_type (GTypeModule *type_module) \ */ #define G_IMPLEMENT_INTERFACE_DYNAMIC(TYPE_IFACE, iface_init) { \ const GInterfaceInfo g_implement_interface_info = { \ - (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ + (GInterfaceInitFunc) iface_init, NULL, NULL \ }; \ g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ } diff --git a/gobject/meson.build b/gobject/meson.build index dafc44b095b..d6d079eaa71 100644 --- a/gobject/meson.build +++ b/gobject/meson.build @@ -170,11 +170,6 @@ libgobject_dep = declare_dependency(link_with : libgobject, ) meson.override_dependency('gobject-2.0', libgobject_dep) -gobject_query = executable('gobject-query', 'gobject-query.c', - install : true, - install_tag : 'bin-devel', - dependencies : [libglib_dep, libgobject_dep]) - install_data('gobject_gdb.py', install_dir : glib_pkgdatadir / 'gdb', install_tag : 'devel', diff --git a/meson.build b/meson.build index 2d434ad8eeb..9ff6b16ac2d 100644 --- a/meson.build +++ b/meson.build @@ -276,6 +276,9 @@ if host_system == 'windows' elif host_system == 'cygwin' glib_os = '''#define G_OS_UNIX #define G_WITH_CYGWIN''' +elif host_system == 'emscripten' + glib_os = '''#define G_OS_UNIX +#define G_PLATFORM_WASM''' else glib_os = '#define G_OS_UNIX' endif @@ -472,7 +475,7 @@ foreach m : struct_members endforeach # Compiler flags -if cc.get_id() == 'gcc' or cc.get_id() == 'clang' +if cc.get_id() == 'gcc' or cc.get_id() == 'clang' or cc.get_id() == 'emscripten' warning_common_args = [ '-Wduplicated-branches', '-Wimplicit-fallthrough', @@ -724,7 +727,7 @@ if host_system != 'windows' and cc.has_function('posix_memalign', prefix: '#incl endif # Check that posix_spawn() is usable; must use header -if cc.has_function('posix_spawn', prefix : '#include ') +if host_system != 'emscripten' and cc.has_function('posix_spawn', prefix : '#include ') glib_conf.set('HAVE_POSIX_SPAWN', 1) endif @@ -1040,9 +1043,9 @@ if host_system == 'windows' and (cc.get_id() == 'msvc' or cc.get_id() == 'clang- glib_conf.set('HAVE_C99_SNPRINTF', false) glib_conf.set('HAVE_C99_VSNPRINTF', false) glib_conf.set('HAVE_UNIX98_PRINTF', false) -elif not cc_can_run and host_system in ['ios', 'darwin'] - # All these are true when compiling natively on macOS, so we should use good - # defaults when building for iOS and tvOS. +elif not cc_can_run and host_system in ['ios', 'darwin', 'emscripten'] + # All these are true when compiling natively on macOS, or when compiling with + # Emscripten (which uses musl libc internally). glib_conf.set('HAVE_C99_SNPRINTF', true) glib_conf.set('HAVE_C99_VSNPRINTF', true) glib_conf.set('HAVE_UNIX98_PRINTF', true) @@ -1567,10 +1570,10 @@ g_sizet_compatibility = { 'long long': sizet_size == long_long_size, } -# Do separate checks for gcc/clang (and ignore other compilers for now), since -# we need to explicitly pass -Werror to the compilers. +# Do separate checks for gcc/clang/emscripten (and ignore other compilers for now), +# since we need to explicitly pass -Werror to the compilers. # FIXME: https://github.com/mesonbuild/meson/issues/5399 -if cc.get_id() == 'gcc' or cc.get_id() == 'clang' +if cc.get_id() == 'gcc' or cc.get_id() == 'clang' or cc.get_id() == 'emscripten' foreach type_name, size_compatibility : g_sizet_compatibility g_sizet_compatibility += { type_name: size_compatibility and cc.compiles( @@ -1655,6 +1658,8 @@ glibconfig_conf.set('gssizebits', ssizet_size * 8) # XXX: https://gitlab.gnome.org/GNOME/glib/issues/1413 if host_system == 'windows' g_module_suffix = 'dll' +elif host_system == 'emscripten' + g_module_suffix = 'wasm' else g_module_suffix = 'so' endif @@ -1861,8 +1866,8 @@ atomicdefine = ''' # We know that we can always use real ("lock free") atomic operations with MSVC if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' or cc.links(atomictest, name : 'atomic ops') have_atomic_lock_free = true - if cc.get_id() == 'gcc' and not cc.compiles(atomicdefine, name : 'atomic ops define') - # Old gcc release may provide + if (cc.get_id() == 'gcc' or host_system == 'emscripten') and not cc.compiles(atomicdefine, name : 'atomic ops define') + # gcc (some old releases) or Emscripten provides # __sync_bool_compare_and_swap but doesn't define # __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 glib_conf.set('__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4', true) @@ -2011,40 +2016,6 @@ else libiconv = dependency('iconv') endif -pcre2 = dependency('libpcre2-8', version: '>= 10.32', required : false) -if not pcre2.found() - if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' - # MSVC: Search for the PCRE2 library by the configuration, which corresponds - # to the output of CMake builds of PCRE2. Note that debugoptimized - # is really a Release build with .PDB files. - if vs_crt == 'debug' - pcre2 = cc.find_library('pcre2d-8', required : false) - else - pcre2 = cc.find_library('pcre2-8', required : false) - endif - endif -endif - -# Try again with the fallback -if not pcre2.found() - pcre2 = dependency('libpcre2-8', required : true, fallback : ['pcre2', 'libpcre2_8']) - use_pcre2_static_flag = true -elif host_system == 'windows' - pcre2_static = cc.links('''#define PCRE2_STATIC - #define PCRE2_CODE_UNIT_WIDTH 8 - #include - int main() { - void *p = NULL; - pcre2_code_free(p); - return 0; - }''', - dependencies: pcre2, - name : 'Windows system PCRE2 is a static build') - use_pcre2_static_flag = pcre2_static -else - use_pcre2_static_flag = false -endif - # Import the gvdb sources as a subproject to avoid having the copylib in-tree subproject('gvdb') gvdb_dep = dependency('gvdb') @@ -2357,7 +2328,6 @@ subdir('gobject') subdir('gthread') subdir('gmodule') subdir('gio') -subdir('fuzzing') # xgettext is optional (on Windows for instance) if find_program('xgettext', required : get_option('nls')).found()