diff options
author | Hyunjee Kim <hj0426.kim@samsung.com> | 2019-12-03 11:00:55 +0900 |
---|---|---|
committer | Hyunjee Kim <hj0426.kim@samsung.com> | 2019-12-03 11:00:55 +0900 |
commit | 85ef543166f81464323d083c9a21096cc634cad0 (patch) | |
tree | a68d53ee7eb4ff2e4f116e5a9fd69fce3d3059f4 /gio | |
parent | 68bf5c4184c2899c4b0594930c7112d88f15e199 (diff) | |
download | glib-85ef543166f81464323d083c9a21096cc634cad0.tar.gz glib-85ef543166f81464323d083c9a21096cc634cad0.tar.bz2 glib-85ef543166f81464323d083c9a21096cc634cad0.zip |
Imported Upstream version 2.61.2
Diffstat (limited to 'gio')
111 files changed, 4617 insertions, 570 deletions
diff --git a/gio/fam/meson.build b/gio/fam/meson.build index d24670a63..8019fe5c4 100644 --- a/gio/fam/meson.build +++ b/gio/fam/meson.build @@ -3,7 +3,7 @@ if not get_option('fam') endif fam_dep = cc.find_library('fam') -fam_c_args = ['-DG_DISABLE_DEPRECATED'] + gio_c_args +fam_c_args = gio_c_args if cc.has_function('FAMNoExists', dependencies : fam_dep) fam_c_args += '-DHAVE_FAM_NO_EXISTS=1' endif diff --git a/gio/gactiongroup.c b/gio/gactiongroup.c index 6d361f228..2345ce3b9 100644 --- a/gio/gactiongroup.c +++ b/gio/gactiongroup.c @@ -21,6 +21,7 @@ #include "gactiongroup.h" #include "gaction.h" #include "glibintl.h" +#include "gmarshal-internal.h" /** * SECTION:gactiongroup @@ -260,7 +261,7 @@ g_action_group_default_init (GActionGroupInterface *iface) G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (GActionGroupInterface, action_added), NULL, NULL, - g_cclosure_marshal_VOID__STRING, + NULL, G_TYPE_NONE, 1, G_TYPE_STRING); @@ -281,7 +282,7 @@ g_action_group_default_init (GActionGroupInterface *iface) G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (GActionGroupInterface, action_removed), NULL, NULL, - g_cclosure_marshal_VOID__STRING, + NULL, G_TYPE_NONE, 1, G_TYPE_STRING); @@ -303,10 +304,13 @@ g_action_group_default_init (GActionGroupInterface *iface) G_STRUCT_OFFSET (GActionGroupInterface, action_enabled_changed), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__STRING_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN); + g_signal_set_va_marshaller (g_action_group_signals[SIGNAL_ACTION_ENABLED_CHANGED], + G_TYPE_FROM_INTERFACE (iface), + _g_cclosure_marshal_VOID__STRING_BOOLEANv); /** * GActionGroup::action-state-changed: @@ -327,10 +331,13 @@ g_action_group_default_init (GActionGroupInterface *iface) G_STRUCT_OFFSET (GActionGroupInterface, action_state_changed), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__STRING_VARIANT, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); + g_signal_set_va_marshaller (g_action_group_signals[SIGNAL_ACTION_STATE_CHANGED], + G_TYPE_FROM_INTERFACE (iface), + _g_cclosure_marshal_VOID__STRING_VARIANTv); } /** diff --git a/gio/gappinfo.c b/gio/gappinfo.c index b2135e644..6f2b72c4e 100644 --- a/gio/gappinfo.c +++ b/gio/gappinfo.c @@ -27,6 +27,7 @@ #include "gcancellable.h" #include "glibintl.h" +#include "gmarshal-internal.h" #include <gioerror.h> #include <gfile.h> @@ -1177,9 +1178,13 @@ g_app_launch_context_class_init (GAppLaunchContextClass *klass) G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GAppLaunchContextClass, launched), - NULL, NULL, NULL, + NULL, NULL, + _g_cclosure_marshal_VOID__OBJECT_VARIANT, G_TYPE_NONE, 2, G_TYPE_APP_INFO, G_TYPE_VARIANT); + g_signal_set_va_marshaller (signals[LAUNCHED], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_VOID__OBJECT_VARIANTv); } static void diff --git a/gio/gapplication.c b/gio/gapplication.c index b154cbe6a..f702b6b9d 100644 --- a/gio/gapplication.c +++ b/gio/gapplication.c @@ -38,6 +38,7 @@ #include "gfile.h" #include "glibintl.h" +#include "gmarshal-internal.h" #include <string.h> @@ -1372,6 +1373,9 @@ g_application_finalize (GObject *object) { GApplication *application = G_APPLICATION (object); + if (application->priv->inactivity_timeout_id) + g_source_remove (application->priv->inactivity_timeout_id); + g_slist_free_full (application->priv->option_groups, (GDestroyNotify) g_option_group_unref); if (application->priv->main_options) g_option_group_unref (application->priv->main_options); @@ -1532,7 +1536,7 @@ g_application_class_init (GApplicationClass *class) g_application_signals[SIGNAL_STARTUP] = g_signal_new (I_("startup"), G_TYPE_APPLICATION, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GApplicationClass, startup), - NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + NULL, NULL, NULL, G_TYPE_NONE, 0); /** * GApplication::shutdown: @@ -1544,7 +1548,7 @@ g_application_class_init (GApplicationClass *class) g_application_signals[SIGNAL_SHUTDOWN] = g_signal_new (I_("shutdown"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GApplicationClass, shutdown), - NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + NULL, NULL, NULL, G_TYPE_NONE, 0); /** * GApplication::activate: @@ -1556,7 +1560,7 @@ g_application_class_init (GApplicationClass *class) g_application_signals[SIGNAL_ACTIVATE] = g_signal_new (I_("activate"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GApplicationClass, activate), - NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + NULL, NULL, NULL, G_TYPE_NONE, 0); /** @@ -1572,8 +1576,12 @@ g_application_class_init (GApplicationClass *class) g_application_signals[SIGNAL_OPEN] = g_signal_new (I_("open"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GApplicationClass, open), - NULL, NULL, NULL, + NULL, NULL, + _g_cclosure_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); + g_signal_set_va_marshaller (g_application_signals[SIGNAL_OPEN], + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_VOID__POINTER_INT_STRINGv); /** * GApplication::command-line: @@ -1592,8 +1600,11 @@ g_application_class_init (GApplicationClass *class) g_signal_new (I_("command-line"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GApplicationClass, command_line), g_signal_accumulator_first_wins, NULL, - NULL, + _g_cclosure_marshal_INT__OBJECT, G_TYPE_INT, 1, G_TYPE_APPLICATION_COMMAND_LINE); + g_signal_set_va_marshaller (g_application_signals[SIGNAL_COMMAND_LINE], + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_INT__OBJECTv); /** * GApplication::handle-local-options: @@ -1652,8 +1663,12 @@ g_application_class_init (GApplicationClass *class) g_application_signals[SIGNAL_HANDLE_LOCAL_OPTIONS] = g_signal_new (I_("handle-local-options"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GApplicationClass, handle_local_options), - g_application_handle_local_options_accumulator, NULL, NULL, + g_application_handle_local_options_accumulator, NULL, + _g_cclosure_marshal_INT__BOXED, G_TYPE_INT, 1, G_TYPE_VARIANT_DICT); + g_signal_set_va_marshaller (g_application_signals[SIGNAL_HANDLE_LOCAL_OPTIONS], + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_INT__BOXEDv); /** * GApplication::name-lost: @@ -1672,8 +1687,12 @@ g_application_class_init (GApplicationClass *class) g_application_signals[SIGNAL_NAME_LOST] = g_signal_new (I_("name-lost"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GApplicationClass, name_lost), - g_signal_accumulator_true_handled, NULL, NULL, + g_signal_accumulator_true_handled, NULL, + _g_cclosure_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); + g_signal_set_va_marshaller (g_application_signals[SIGNAL_NAME_LOST], + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_BOOLEAN__VOIDv); } /* Application ID validity {{{1 */ diff --git a/gio/gasyncinitable.c b/gio/gasyncinitable.c index bc5e40e7b..8936f98b2 100644 --- a/gio/gasyncinitable.c +++ b/gio/gasyncinitable.c @@ -369,6 +369,7 @@ g_async_initable_new_async (GType object_type, * Deprecated: 2.54: Use g_object_new_with_properties() and * g_async_initable_init_async() instead. See #GParameter for more information. */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS void g_async_initable_newv_async (GType object_type, guint n_parameters, @@ -382,15 +383,14 @@ g_async_initable_newv_async (GType object_type, g_return_if_fail (G_TYPE_IS_ASYNC_INITABLE (object_type)); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS obj = g_object_newv (object_type, n_parameters, parameters); -G_GNUC_END_IGNORE_DEPRECATIONS g_async_initable_init_async (G_ASYNC_INITABLE (obj), io_priority, cancellable, callback, user_data); g_object_unref (obj); /* Passed ownership to async call */ } +G_GNUC_END_IGNORE_DEPRECATIONS /** * g_async_initable_new_valist_async: diff --git a/gio/gasyncinitable.h b/gio/gasyncinitable.h index 8b05a22e7..f30d2cec7 100644 --- a/gio/gasyncinitable.h +++ b/gio/gasyncinitable.h @@ -95,6 +95,9 @@ void g_async_initable_new_async (GType object_type, gpointer user_data, const gchar *first_property_name, ...); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_async_initable_init_async) void g_async_initable_newv_async (GType object_type, guint n_parameters, @@ -103,6 +106,9 @@ void g_async_initable_newv_async (GType object_type, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); + +G_GNUC_END_IGNORE_DEPRECATIONS + GLIB_AVAILABLE_IN_ALL void g_async_initable_new_valist_async (GType object_type, const gchar *first_property_name, diff --git a/gio/gasyncresult.h b/gio/gasyncresult.h index 7ea9e3978..956cbc473 100644 --- a/gio/gasyncresult.h +++ b/gio/gasyncresult.h @@ -38,7 +38,7 @@ G_BEGIN_DECLS * GAsyncResult: * * Holds results information for an asynchronous operation, - * usually passed directly to a asynchronous _finish() operation. + * usually passed directly to an asynchronous _finish() operation. **/ typedef struct _GAsyncResultIface GAsyncResultIface; diff --git a/gio/gcancellable.c b/gio/gcancellable.c index 31e990f3c..0cfa91c0b 100644 --- a/gio/gcancellable.c +++ b/gio/gcancellable.c @@ -141,7 +141,7 @@ g_cancellable_class_init (GCancellableClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GCancellableClass, cancelled), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); } diff --git a/gio/gcontenttype-win32.c b/gio/gcontenttype-win32.c index 74d1b704c..2f07fa36e 100644 --- a/gio/gcontenttype-win32.c +++ b/gio/gcontenttype-win32.c @@ -83,6 +83,21 @@ get_registry_classes_key (const char *subdir, return value_utf8; } +/*< private >*/ +void +g_content_type_set_mime_dirs (const gchar * const *dirs) +{ + /* noop on Windows */ +} + +/*< private >*/ +const gchar * const * +g_content_type_get_mime_dirs (void) +{ + const gchar * const *mime_dirs = { NULL }; + return mime_dirs; +} + gboolean g_content_type_equals (const gchar *type1, const gchar *type2) diff --git a/gio/gcontenttype.h b/gio/gcontenttype.h index d970acbe1..db2c974f3 100644 --- a/gio/gcontenttype.h +++ b/gio/gcontenttype.h @@ -70,10 +70,12 @@ GLIB_AVAILABLE_IN_ALL GList * g_content_types_get_registered (void); /*< private >*/ +#ifndef __GTK_DOC_IGNORE__ GLIB_AVAILABLE_IN_2_60 const gchar * const *g_content_type_get_mime_dirs (void); GLIB_AVAILABLE_IN_2_60 void g_content_type_set_mime_dirs (const gchar * const *dirs); +#endif /* __GTK_DOC_IGNORE__ */ G_END_DECLS diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build index 24d2527bc..121e9e6bb 100644 --- a/gio/gdbus-2.0/codegen/meson.build +++ b/gio/gdbus-2.0/codegen/meson.build @@ -16,7 +16,6 @@ gdbus_codegen_conf.set('DATADIR', glib_datadir) # Install gdbus-codegen executable gdbus_codegen = configure_file(input : 'gdbus-codegen.in', output : 'gdbus-codegen', - install : true, install_dir : get_option('bindir'), configuration : gdbus_codegen_conf ) @@ -28,7 +27,6 @@ codegen_dir = join_paths(get_option('datadir'), 'glib-2.0/codegen') gdbus_codegen_built_files = [] gdbus_codegen_built_files += configure_file(input : 'config.py.in', output : 'config.py', - install : true, install_dir : codegen_dir, configuration : gdbus_codegen_conf) @@ -36,7 +34,6 @@ foreach f : gdbus_codegen_files # Copy these into the builddir so that gdbus-codegen can be used uninstalled # and then install it too so that it can be used after installation gdbus_codegen_built_files += configure_file(input : f, output : f, - install : true, install_dir : codegen_dir, copy : true) endforeach diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c index 1f7d19396..3015457a5 100644 --- a/gio/gdbusaddress.c +++ b/gio/gdbusaddress.c @@ -127,12 +127,14 @@ is_valid_unix (const gchar *address_entry, GList *keys; GList *l; const gchar *path; + const gchar *dir; const gchar *tmpdir; const gchar *abstract; ret = FALSE; keys = NULL; path = NULL; + dir = NULL; tmpdir = NULL; abstract = NULL; @@ -142,11 +144,13 @@ is_valid_unix (const gchar *address_entry, const gchar *key = l->data; if (g_strcmp0 (key, "path") == 0) path = g_hash_table_lookup (key_value_pairs, key); + else if (g_strcmp0 (key, "dir") == 0) + dir = g_hash_table_lookup (key_value_pairs, key); else if (g_strcmp0 (key, "tmpdir") == 0) tmpdir = g_hash_table_lookup (key_value_pairs, key); else if (g_strcmp0 (key, "abstract") == 0) abstract = g_hash_table_lookup (key_value_pairs, key); - else + else if (g_strcmp0 (key, "guid") != 0) { g_set_error (error, G_IO_ERROR, @@ -158,9 +162,8 @@ is_valid_unix (const gchar *address_entry, } } - if ((path != NULL && tmpdir != NULL) || - (tmpdir != NULL && abstract != NULL) || - (abstract != NULL && path != NULL)) + /* Exactly one key must be set */ + if ((path != NULL) + (dir != NULL) + (tmpdir != NULL) + (abstract != NULL) > 1) { g_set_error (error, G_IO_ERROR, @@ -169,12 +172,12 @@ is_valid_unix (const gchar *address_entry, address_entry); goto out; } - else if (path == NULL && tmpdir == NULL && abstract == NULL) + else if (path == NULL && dir == NULL && tmpdir == NULL && abstract == NULL) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, - _("Address “%s” is invalid (need exactly one of path, tmpdir or abstract keys)"), + _("Address “%s” is invalid (need exactly one of path, dir, tmpdir, or abstract keys)"), address_entry); goto out; } @@ -221,7 +224,7 @@ is_valid_nonce_tcp (const gchar *address_entry, family = g_hash_table_lookup (key_value_pairs, key); else if (g_strcmp0 (key, "noncefile") == 0) nonce_file = g_hash_table_lookup (key_value_pairs, key); - else + else if (g_strcmp0 (key, "guid") != 0) { g_set_error (error, G_IO_ERROR, @@ -302,7 +305,7 @@ is_valid_tcp (const gchar *address_entry, port = g_hash_table_lookup (key_value_pairs, key); else if (g_strcmp0 (key, "family") == 0) family = g_hash_table_lookup (key_value_pairs, key); - else + else if (g_strcmp0 (key, "guid") != 0) { g_set_error (error, G_IO_ERROR, @@ -1258,8 +1261,8 @@ get_session_address_platform_specific (GError **error) * The returned address will be in the * [D-Bus address format](https://dbus.freedesktop.org/doc/dbus-specification.html#addresses). * - * Returns: a valid D-Bus address string for @bus_type or %NULL if - * @error is set + * Returns: (transfer full): a valid D-Bus address string for @bus_type or + * %NULL if @error is set * * Since: 2.26 */ diff --git a/gio/gdbusauthobserver.c b/gio/gdbusauthobserver.c index 34758aa20..be36c9dac 100644 --- a/gio/gdbusauthobserver.c +++ b/gio/gdbusauthobserver.c @@ -27,6 +27,7 @@ #include "gdbusprivate.h" #include "glibintl.h" +#include "gmarshal-internal.h" /** * SECTION:gdbusauthobserver @@ -39,11 +40,37 @@ * signals you are interested in. Note that new signals may be added * in the future * - * ## Controlling Authentication # {#auth-observer} + * ## Controlling Authentication Mechanisms * - * For example, if you only want to allow D-Bus connections from - * processes owned by the same uid as the server, you would use a - * signal handler like the following: + * By default, a #GDBusServer or server-side #GDBusConnection will allow + * any authentication mechanism to be used. If you only + * want to allow D-Bus connections with the `EXTERNAL` mechanism, + * which makes use of credentials passing and is the recommended + * mechanism for modern Unix platforms such as Linux and the BSD family, + * you would use a signal handler like this: + * + * |[<!-- language="C" --> + * static gboolean + * on_allow_mechanism (GDBusAuthObserver *observer, + * const gchar *mechanism, + * gpointer user_data) + * { + * if (g_strcmp0 (mechanism, "EXTERNAL") == 0) + * { + * return TRUE; + * } + * + * return FALSE; + * } + * ]| + * + * ## Controlling Authorization # {#auth-observer} + * + * By default, a #GDBusServer or server-side #GDBusConnection will accept + * connections from any successfully authenticated user (but not from + * anonymous connections using the `ANONYMOUS` mechanism). If you only + * want to allow D-Bus connections from processes owned by the same uid + * as the server, you would use a signal handler like the following: * * |[<!-- language="C" --> * static gboolean @@ -172,11 +199,14 @@ g_dbus_auth_observer_class_init (GDBusAuthObserverClass *klass) G_STRUCT_OFFSET (GDBusAuthObserverClass, authorize_authenticated_peer), _g_signal_accumulator_false_handled, NULL, /* accu_data */ - NULL, + _g_cclosure_marshal_BOOLEAN__OBJECT_OBJECT, G_TYPE_BOOLEAN, 2, G_TYPE_IO_STREAM, G_TYPE_CREDENTIALS); + g_signal_set_va_marshaller (signals[AUTHORIZE_AUTHENTICATED_PEER_SIGNAL], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_BOOLEAN__OBJECT_OBJECTv); /** * GDBusAuthObserver::allow-mechanism: @@ -196,10 +226,13 @@ g_dbus_auth_observer_class_init (GDBusAuthObserverClass *klass) G_STRUCT_OFFSET (GDBusAuthObserverClass, allow_mechanism), _g_signal_accumulator_false_handled, NULL, /* accu_data */ - NULL, + _g_cclosure_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); + g_signal_set_va_marshaller (signals[ALLOW_MECHANISM_SIGNAL], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_BOOLEAN__STRINGv); } static void diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 677fa76f9..6ae1e21ce 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -111,6 +111,7 @@ #include "giostream.h" #include "gasyncresult.h" #include "gtask.h" +#include "gmarshal-internal.h" #ifdef G_OS_UNIX #include "gunixconnection.h" @@ -127,7 +128,7 @@ * The #GDBusConnection type is used for D-Bus connections to remote * peers such as a message buses. It is a low-level API that offers a * lot of flexibility. For instance, it lets you establish a connection - * over any transport that can by represented as an #GIOStream. + * over any transport that can by represented as a #GIOStream. * * This class is rarely used directly in D-Bus clients. If you are writing * a D-Bus client, it is often easier to use the g_bus_own_name(), @@ -1049,11 +1050,14 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass) G_STRUCT_OFFSET (GDBusConnectionClass, closed), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__BOOLEAN_BOXED, G_TYPE_NONE, 2, G_TYPE_BOOLEAN, G_TYPE_ERROR); + g_signal_set_va_marshaller (signals[CLOSED_SIGNAL], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_VOID__BOOLEAN_BOXEDv); } static void @@ -2692,7 +2696,7 @@ async_initable_iface_init (GAsyncInitableIface *async_initable_iface) * then call g_dbus_connection_new_finish() to get the result of the * operation. * - * This is a asynchronous failable constructor. See + * This is an asynchronous failable constructor. See * g_dbus_connection_new_sync() for the synchronous * version. * @@ -2831,13 +2835,13 @@ g_dbus_connection_new_sync (GIOStream *stream, * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags. * * When the operation is finished, @callback will be invoked. You can - * then call g_dbus_connection_new_finish() to get the result of the - * operation. + * then call g_dbus_connection_new_for_address_finish() to get the result of + * the operation. * * If @observer is not %NULL it may be used to control the * authentication process. * - * This is a asynchronous failable constructor. See + * This is an asynchronous failable constructor. See * g_dbus_connection_new_for_address_sync() for the synchronous * version. * @@ -2964,8 +2968,8 @@ g_dbus_connection_new_for_address_sync (const gchar *address, * more details. * * Note that this function should be used with care. Most modern UNIX - * desktops tie the notion of a user session the session bus, and expect - * all of a users applications to quit when their bus connection goes away. + * desktops tie the notion of a user session with the session bus, and expect + * all of a user's applications to quit when their bus connection goes away. * If you are setting @exit_on_close to %FALSE for the shared session * bus connection, you should make sure that your application exits * when the user session ends. @@ -7360,7 +7364,7 @@ bus_get_async_initable_cb (GObject *source_object, * When the operation is finished, @callback will be invoked. You can * then call g_bus_get_finish() to get the result of the operation. * - * This is a asynchronous failable function. See g_bus_get_sync() for + * This is an asynchronous failable function. See g_bus_get_sync() for * the synchronous version. * * Since: 2.26 diff --git a/gio/gdbusdaemon.c b/gio/gdbusdaemon.c index a9b626215..0d5058f70 100644 --- a/gio/gdbusdaemon.c +++ b/gio/gdbusdaemon.c @@ -1539,7 +1539,7 @@ on_authorize_authenticated_peer (GDBusAuthObserver *observer, GCredentials *credentials, gpointer user_data) { - gboolean authorized = TRUE; + gboolean authorized = FALSE; if (credentials != NULL) { @@ -1549,6 +1549,14 @@ on_authorize_authenticated_peer (GDBusAuthObserver *observer, authorized = g_credentials_is_same_user (credentials, own_credentials, NULL); g_object_unref (own_credentials); } +#ifdef G_OS_WIN32 + else + { + /* We allow ANONYMOUS authentication on Windows for now, in + * combination with the nonce-tcp transport. */ + authorized = TRUE; + } +#endif return authorized; } @@ -1706,7 +1714,7 @@ g_dbus_daemon_class_init (GDBusDaemonClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); g_object_class_install_property (gobject_class, diff --git a/gio/gdbusinterfaceskeleton.c b/gio/gdbusinterfaceskeleton.c index 96bd520aa..4a06516c1 100644 --- a/gio/gdbusinterfaceskeleton.c +++ b/gio/gdbusinterfaceskeleton.c @@ -27,6 +27,7 @@ #include "gdbusprivate.h" #include "gdbusmethodinvocation.h" #include "gdbusconnection.h" +#include "gmarshal-internal.h" #include "gtask.h" #include "gioerror.h" @@ -248,10 +249,13 @@ g_dbus_interface_skeleton_class_init (GDBusInterfaceSkeletonClass *klass) G_STRUCT_OFFSET (GDBusInterfaceSkeletonClass, g_authorize_method), _g_signal_accumulator_false_handled, NULL, - NULL, + _g_cclosure_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + g_signal_set_va_marshaller (signals[G_AUTHORIZE_METHOD_SIGNAL], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_BOOLEAN__OBJECTv); } static void diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c index 9b89dc5b6..852a70430 100644 --- a/gio/gdbusmessage.c +++ b/gio/gdbusmessage.c @@ -873,7 +873,7 @@ g_dbus_message_set_message_type (GDBusMessage *message, GDBusMessageType type) { g_return_if_fail (G_IS_DBUS_MESSAGE (message)); - g_return_if_fail (type >=0 && type < 256); + g_return_if_fail ((guint) type >= 0 && (guint) type < 256); if (message->locked) { @@ -920,7 +920,7 @@ g_dbus_message_set_flags (GDBusMessage *message, GDBusMessageFlags flags) { g_return_if_fail (G_IS_DBUS_MESSAGE (message)); - g_return_if_fail (flags >=0 && flags < 256); + g_return_if_fail ((guint) flags >= 0 && (guint) flags < 256); if (message->locked) { @@ -998,7 +998,7 @@ g_dbus_message_get_header (GDBusMessage *message, GDBusMessageHeaderField header_field) { g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL); - g_return_val_if_fail (header_field >=0 && header_field < 256, NULL); + g_return_val_if_fail ((guint) header_field >= 0 && (guint) header_field < 256, NULL); return g_hash_table_lookup (message->headers, GUINT_TO_POINTER (header_field)); } @@ -1020,7 +1020,7 @@ g_dbus_message_set_header (GDBusMessage *message, GVariant *value) { g_return_if_fail (G_IS_DBUS_MESSAGE (message)); - g_return_if_fail (header_field >=0 && header_field < 256); + g_return_if_fail ((guint) header_field >= 0 && (guint) header_field < 256); if (message->locked) { diff --git a/gio/gdbusobject.c b/gio/gdbusobject.c index 3c52a6a84..32393edf6 100644 --- a/gio/gdbusobject.c +++ b/gio/gdbusobject.c @@ -65,7 +65,7 @@ g_dbus_object_default_init (GDBusObjectIface *iface) G_STRUCT_OFFSET (GDBusObjectIface, interface_added), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_DBUS_INTERFACE); @@ -85,7 +85,7 @@ g_dbus_object_default_init (GDBusObjectIface *iface) G_STRUCT_OFFSET (GDBusObjectIface, interface_removed), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_DBUS_INTERFACE); diff --git a/gio/gdbusobjectmanager.c b/gio/gdbusobjectmanager.c index 3ef622a33..87634cd83 100644 --- a/gio/gdbusobjectmanager.c +++ b/gio/gdbusobjectmanager.c @@ -26,6 +26,7 @@ #include "gdbusutils.h" #include "glibintl.h" +#include "gmarshal-internal.h" /** * SECTION:gdbusobjectmanager @@ -51,6 +52,16 @@ typedef GDBusObjectManagerIface GDBusObjectManagerInterface; G_DEFINE_INTERFACE (GDBusObjectManager, g_dbus_object_manager, G_TYPE_OBJECT) +enum { + OBJECT_ADDED, + OBJECT_REMOVED, + INTERFACE_ADDED, + INTERFACE_REMOVED, + N_SIGNALS +}; + +static guint signals[N_SIGNALS]; + static void g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface) { @@ -63,16 +74,17 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface) * * Since: 2.30 */ - g_signal_new (I_("object-added"), - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GDBusObjectManagerIface, object_added), - NULL, - NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, - 1, - G_TYPE_DBUS_OBJECT); + signals[OBJECT_ADDED] = + g_signal_new (I_("object-added"), + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GDBusObjectManagerIface, object_added), + NULL, + NULL, + NULL, + G_TYPE_NONE, + 1, + G_TYPE_DBUS_OBJECT); /** * GDBusObjectManager::object-removed: @@ -83,16 +95,17 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface) * * Since: 2.30 */ - g_signal_new (I_("object-removed"), - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GDBusObjectManagerIface, object_removed), - NULL, - NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, - 1, - G_TYPE_DBUS_OBJECT); + signals[OBJECT_REMOVED] = + g_signal_new (I_("object-removed"), + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GDBusObjectManagerIface, object_removed), + NULL, + NULL, + NULL, + G_TYPE_NONE, + 1, + G_TYPE_DBUS_OBJECT); /** * GDBusObjectManager::interface-added: @@ -107,17 +120,21 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface) * * Since: 2.30 */ - g_signal_new (I_("interface-added"), - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_added), - NULL, - NULL, - NULL, - G_TYPE_NONE, - 2, - G_TYPE_DBUS_OBJECT, - G_TYPE_DBUS_INTERFACE); + signals[INTERFACE_ADDED] = + g_signal_new (I_("interface-added"), + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_added), + NULL, + NULL, + _g_cclosure_marshal_VOID__OBJECT_OBJECT, + G_TYPE_NONE, + 2, + G_TYPE_DBUS_OBJECT, + G_TYPE_DBUS_INTERFACE); + g_signal_set_va_marshaller (signals[INTERFACE_ADDED], + G_TYPE_FROM_INTERFACE (iface), + _g_cclosure_marshal_VOID__OBJECT_OBJECTv); /** * GDBusObjectManager::interface-removed: @@ -132,17 +149,21 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface) * * Since: 2.30 */ - g_signal_new (I_("interface-removed"), - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_removed), - NULL, - NULL, - NULL, - G_TYPE_NONE, - 2, - G_TYPE_DBUS_OBJECT, - G_TYPE_DBUS_INTERFACE); + signals[INTERFACE_REMOVED] = + g_signal_new (I_("interface-removed"), + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_removed), + NULL, + NULL, + _g_cclosure_marshal_VOID__OBJECT_OBJECT, + G_TYPE_NONE, + 2, + G_TYPE_DBUS_OBJECT, + G_TYPE_DBUS_INTERFACE); + g_signal_set_va_marshaller (signals[INTERFACE_REMOVED], + G_TYPE_FROM_INTERFACE (iface), + _g_cclosure_marshal_VOID__OBJECT_OBJECTv); } diff --git a/gio/gdbusobjectmanagerclient.c b/gio/gdbusobjectmanagerclient.c index 6a59c28b4..38e6f539f 100644 --- a/gio/gdbusobjectmanagerclient.c +++ b/gio/gdbusobjectmanagerclient.c @@ -36,6 +36,7 @@ #include "gdbusinterface.h" #include "glibintl.h" +#include "gmarshal-internal.h" /** * SECTION:gdbusobjectmanagerclient @@ -517,7 +518,7 @@ g_dbus_object_manager_client_class_init (GDBusObjectManagerClientClass *klass) G_STRUCT_OFFSET (GDBusObjectManagerClientClass, interface_proxy_signal), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT, G_TYPE_NONE, 5, G_TYPE_DBUS_OBJECT_PROXY, @@ -525,6 +526,9 @@ g_dbus_object_manager_client_class_init (GDBusObjectManagerClientClass *klass) G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT); + g_signal_set_va_marshaller (signals[INTERFACE_PROXY_SIGNAL_SIGNAL], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_VOID__OBJECT_OBJECT_STRING_STRING_VARIANTv); /** * GDBusObjectManagerClient::interface-proxy-properties-changed: @@ -556,13 +560,16 @@ g_dbus_object_manager_client_class_init (GDBusObjectManagerClientClass *klass) G_STRUCT_OFFSET (GDBusObjectManagerClientClass, interface_proxy_properties_changed), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__OBJECT_OBJECT_VARIANT_BOXED, G_TYPE_NONE, 4, G_TYPE_DBUS_OBJECT_PROXY, G_TYPE_DBUS_PROXY, G_TYPE_VARIANT, G_TYPE_STRV); + g_signal_set_va_marshaller (signals[INTERFACE_PROXY_PROPERTIES_CHANGED_SIGNAL], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_VOID__OBJECT_OBJECT_VARIANT_BOXEDv); } static void diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c index 488fe50c4..0421ca56c 100644 --- a/gio/gdbusprivate.c +++ b/gio/gdbusprivate.c @@ -701,7 +701,7 @@ _g_dbus_worker_do_read_cb (GInputStream *input_stream, worker); #endif - /* TODO: hmm, hmm... */ + /* The read failed, which could mean the dbus-daemon was sent SIGTERM. */ if (bytes_read == 0) { g_set_error (&error, diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c index 0ab117854..39eed1688 100644 --- a/gio/gdbusproxy.c +++ b/gio/gdbusproxy.c @@ -42,6 +42,7 @@ #endif #include "glibintl.h" +#include "gmarshal-internal.h" /** * SECTION:gdbusproxy @@ -595,11 +596,14 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass) G_STRUCT_OFFSET (GDBusProxyClass, g_properties_changed), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__VARIANT_BOXED, G_TYPE_NONE, 2, G_TYPE_VARIANT, G_TYPE_STRV | G_SIGNAL_TYPE_STATIC_SCOPE); + g_signal_set_va_marshaller (signals[PROPERTIES_CHANGED_SIGNAL], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_VOID__VARIANT_BOXEDv); /** * GDBusProxy::g-signal: @@ -618,12 +622,15 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass) G_STRUCT_OFFSET (GDBusProxyClass, g_signal), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__STRING_STRING_VARIANT, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT); + g_signal_set_va_marshaller (signals[SIGNAL_SIGNAL], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_VOID__STRING_STRING_VARIANTv); } @@ -1613,6 +1620,7 @@ async_init_start_service_by_name_cb (GDBusConnection *connection, } else { + g_dbus_error_strip_remote_error (error); g_prefix_error (&error, _("Error calling StartServiceByName for %s: "), proxy->priv->name); diff --git a/gio/gdbusserver.c b/gio/gdbusserver.c index 026d4ee6b..26f8dadd0 100644 --- a/gio/gdbusserver.c +++ b/gio/gdbusserver.c @@ -42,6 +42,7 @@ #include "ginetsocketaddress.h" #include "ginputstream.h" #include "giostream.h" +#include "gmarshal-internal.h" #ifdef G_OS_UNIX #include <unistd.h> @@ -72,6 +73,11 @@ * * An example of peer-to-peer communication with G-DBus can be found * in [gdbus-example-peer.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-peer.c). + * + * Note that a minimal #GDBusServer will accept connections from any + * peer. In many use-cases it will be necessary to add a #GDBusAuthObserver + * that only accepts connections that have successfully authenticated + * as the same user that is running the #GDBusServer. */ /** @@ -96,6 +102,7 @@ struct _GDBusServer gchar *client_address; + gchar *unix_socket_path; GSocketListener *listener; gboolean is_using_listener; gulong run_signal_handler_id; @@ -157,6 +164,17 @@ G_DEFINE_TYPE_WITH_CODE (GDBusServer, g_dbus_server, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)) static void +g_dbus_server_dispose (GObject *object) +{ + GDBusServer *server = G_DBUS_SERVER (object); + + if (server->active) + g_dbus_server_stop (server); + + G_OBJECT_CLASS (g_dbus_server_parent_class)->dispose (object); +} + +static void g_dbus_server_finalize (GObject *object) { GDBusServer *server = G_DBUS_SERVER (object); @@ -178,10 +196,20 @@ g_dbus_server_finalize (GObject *object) memset (server->nonce, '\0', 16); g_free (server->nonce); } - /* we could unlink the nonce file but I don't - * think it's really worth the effort/risk - */ - g_free (server->nonce_file); + + if (server->unix_socket_path) + { + if (g_unlink (server->unix_socket_path) != 0) + g_warning ("Failed to delete %s: %s", server->unix_socket_path, g_strerror (errno)); + g_free (server->unix_socket_path); + } + + if (server->nonce_file) + { + if (g_unlink (server->nonce_file) != 0) + g_warning ("Failed to delete %s: %s", server->nonce_file, g_strerror (errno)); + g_free (server->nonce_file); + } g_main_context_unref (server->main_context_at_construction); @@ -265,6 +293,7 @@ g_dbus_server_class_init (GDBusServerClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + gobject_class->dispose = g_dbus_server_dispose; gobject_class->finalize = g_dbus_server_finalize; gobject_class->set_property = g_dbus_server_set_property; gobject_class->get_property = g_dbus_server_get_property; @@ -424,10 +453,13 @@ g_dbus_server_class_init (GDBusServerClass *klass) G_STRUCT_OFFSET (GDBusServerClass, new_connection), g_signal_accumulator_true_handled, NULL, /* accu_data */ - NULL, + _g_cclosure_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_CONNECTION); + g_signal_set_va_marshaller (_signals[NEW_CONNECTION_SIGNAL], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_BOOLEAN__OBJECTv); } static void @@ -457,6 +489,10 @@ on_run (GSocketService *service, * Once constructed, you can use g_dbus_server_get_client_address() to * get a D-Bus address string that clients can use to connect. * + * To have control over the available authentication mechanisms and + * the users that are authorized to connect, it is strongly recommended + * to provide a non-%NULL #GDBusAuthObserver. + * * Connect to the #GDBusServer::new-connection signal to handle * incoming connections. * @@ -465,8 +501,8 @@ on_run (GSocketService *service, * * #GDBusServer is used in this [example][gdbus-peer-to-peer]. * - * This is a synchronous failable constructor. See - * g_dbus_server_new() for the asynchronous version. + * This is a synchronous failable constructor. There is currently no + * asynchronous version. * * Returns: A #GDBusServer or %NULL if @error is set. Free with * g_object_unref(). @@ -632,7 +668,7 @@ random_ascii (void) return ret; } -/* note that address_entry has already been validated => exactly one of path, tmpdir or abstract keys are set */ +/* note that address_entry has already been validated => exactly one of path, dir, tmpdir, or abstract keys are set */ static gboolean try_unix (GDBusServer *server, const gchar *address_entry, @@ -641,6 +677,7 @@ try_unix (GDBusServer *server, { gboolean ret; const gchar *path; + const gchar *dir; const gchar *tmpdir; const gchar *abstract; GSocketAddress *address; @@ -649,6 +686,7 @@ try_unix (GDBusServer *server, address = NULL; path = g_hash_table_lookup (key_value_pairs, "path"); + dir = g_hash_table_lookup (key_value_pairs, "dir"); tmpdir = g_hash_table_lookup (key_value_pairs, "tmpdir"); abstract = g_hash_table_lookup (key_value_pairs, "abstract"); @@ -656,20 +694,21 @@ try_unix (GDBusServer *server, { address = g_unix_socket_address_new (path); } - else if (tmpdir != NULL) + else if (dir != NULL || tmpdir != NULL) { gint n; GString *s; GError *local_error; retry: - s = g_string_new (tmpdir); + s = g_string_new (tmpdir != NULL ? tmpdir : dir); g_string_append (s, "/dbus-"); for (n = 0; n < 8; n++) g_string_append_c (s, random_ascii ()); - /* prefer abstract namespace if available */ - if (g_unix_socket_address_abstract_names_supported ()) + /* prefer abstract namespace if available for tmpdir: addresses + * abstract namespace is disallowed for dir: addresses */ + if (tmpdir != NULL && g_unix_socket_address_abstract_names_supported ()) address = g_unix_socket_address_new_with_type (s->str, -1, G_UNIX_SOCKET_ADDRESS_ABSTRACT); @@ -704,7 +743,7 @@ try_unix (GDBusServer *server, g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, - _("Abstract name space not supported")); + _("Abstract namespace not supported")); goto out; } address = g_unix_socket_address_new_with_type (abstract, @@ -734,24 +773,30 @@ try_unix (GDBusServer *server, /* Fill out client_address if the connection attempt worked */ if (ret) { + const char *address_path; + char *escaped_path; + server->is_using_listener = TRUE; + address_path = g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address)); + escaped_path = g_dbus_address_escape_value (address_path); switch (g_unix_socket_address_get_address_type (G_UNIX_SOCKET_ADDRESS (address))) { case G_UNIX_SOCKET_ADDRESS_ABSTRACT: - server->client_address = g_strdup_printf ("unix:abstract=%s", - g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address))); + server->client_address = g_strdup_printf ("unix:abstract=%s", escaped_path); break; case G_UNIX_SOCKET_ADDRESS_PATH: - server->client_address = g_strdup_printf ("unix:path=%s", - g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address))); + server->client_address = g_strdup_printf ("unix:path=%s", escaped_path); + server->unix_socket_path = g_strdup (address_path); break; default: g_assert_not_reached (); break; } + + g_free (escaped_path); } g_object_unref (address); } @@ -843,6 +888,7 @@ try_tcp (GDBusServer *server, gsize bytes_written; gsize bytes_remaining; char *file_escaped; + char *host_escaped; server->nonce = g_new0 (guchar, 16); for (n = 0; n < 16; n++) @@ -882,11 +928,13 @@ try_tcp (GDBusServer *server, } if (!g_close (fd, error)) goto out; - file_escaped = g_uri_escape_string (server->nonce_file, "/\\", FALSE); + host_escaped = g_dbus_address_escape_value (host); + file_escaped = g_dbus_address_escape_value (server->nonce_file); server->client_address = g_strdup_printf ("nonce-tcp:host=%s,port=%d,noncefile=%s", - host, + host_escaped, port_num, file_escaped); + g_free (host_escaped); g_free (file_escaped); } else diff --git a/gio/gdbusutils.c b/gio/gdbusutils.c index bfca02d6f..ff9b44117 100644 --- a/gio/gdbusutils.c +++ b/gio/gdbusutils.c @@ -291,22 +291,22 @@ gchar * g_dbus_generate_guid (void) { GString *s; - GTimeVal now; guint32 r1; guint32 r2; guint32 r3; + gint64 now_us; s = g_string_new (NULL); r1 = g_random_int (); r2 = g_random_int (); r3 = g_random_int (); - g_get_current_time (&now); + now_us = g_get_real_time (); g_string_append_printf (s, "%08x", r1); g_string_append_printf (s, "%08x", r2); g_string_append_printf (s, "%08x", r3); - g_string_append_printf (s, "%08x", (guint32) now.tv_sec); + g_string_append_printf (s, "%08x", (guint32) (now_us / G_USEC_PER_SEC)); return g_string_free (s, FALSE); } diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index 77e385aa5..a484c63d4 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -24,6 +24,10 @@ #include "config.h" +/* For the #GDesktopAppInfoLookup macros; since macro deprecation is implemented + * in the preprocessor, we need to define this before including glib.h*/ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <errno.h> #include <string.h> #include <unistd.h> @@ -2514,34 +2518,43 @@ prepend_terminal_to_vector (int *argc, term_argv = g_new0 (char *, 3); check = g_find_program_in_path ("gnome-terminal"); - if (check == NULL) - check = g_find_program_in_path ("mate-terminal"); - if (check == NULL) - check = g_find_program_in_path ("xfce4-terminal"); if (check != NULL) { term_argv[0] = check; - /* Note that gnome-terminal takes -x and - * as -e in gnome-terminal is broken we use that. */ - term_argv[1] = g_strdup ("-x"); + /* Since 2017, gnome-terminal has preferred `--` over `-x` or `-e`. */ + term_argv[1] = g_strdup ("--"); } else { if (check == NULL) - check = g_find_program_in_path ("nxterm"); - if (check == NULL) - check = g_find_program_in_path ("color-xterm"); - if (check == NULL) - check = g_find_program_in_path ("rxvt"); - if (check == NULL) - check = g_find_program_in_path ("dtterm"); + check = g_find_program_in_path ("mate-terminal"); if (check == NULL) + check = g_find_program_in_path ("xfce4-terminal"); + if (check != NULL) { - check = g_strdup ("xterm"); - g_debug ("Couldn’t find a terminal: falling back to xterm"); + term_argv[0] = check; + /* Note that gnome-terminal takes -x and + * as -e in gnome-terminal is broken we use that. */ + term_argv[1] = g_strdup ("-x"); + } + else + { + if (check == NULL) + check = g_find_program_in_path ("nxterm"); + if (check == NULL) + check = g_find_program_in_path ("color-xterm"); + if (check == NULL) + check = g_find_program_in_path ("rxvt"); + if (check == NULL) + check = g_find_program_in_path ("dtterm"); + if (check == NULL) + { + check = g_strdup ("xterm"); + g_debug ("Couldn’t find a terminal: falling back to xterm"); + } + term_argv[0] = check; + term_argv[1] = g_strdup ("-e"); } - term_argv[0] = check; - term_argv[1] = g_strdup ("-e"); } real_argc = term_argc + *argc; @@ -4555,6 +4568,9 @@ g_app_info_get_all (void) * * #GDesktopAppInfoLookup is an opaque data structure and can only be accessed * using the following functions. + * + * Deprecated: 2.28: The #GDesktopAppInfoLookup interface is deprecated and + * unused by GIO. **/ G_GNUC_BEGIN_IGNORE_DEPRECATIONS @@ -4575,17 +4591,18 @@ g_desktop_app_info_lookup_default_init (GDesktopAppInfoLookupInterface *iface) * @uri_scheme: a string containing a URI scheme. * * Gets the default application for launching applications - * using this URI scheme for a particular GDesktopAppInfoLookup + * using this URI scheme for a particular #GDesktopAppInfoLookup * implementation. * - * The GDesktopAppInfoLookup interface and this function is used + * The #GDesktopAppInfoLookup interface and this function is used * to implement g_app_info_get_default_for_uri_scheme() backends * in a GIO module. There is no reason for applications to use it * directly. Applications should use g_app_info_get_default_for_uri_scheme(). * * Returns: (transfer full): #GAppInfo for given @uri_scheme or %NULL on error. * - * Deprecated: The #GDesktopAppInfoLookup interface is deprecated and unused by gio. + * Deprecated: 2.28: The #GDesktopAppInfoLookup interface is deprecated and + * unused by GIO. */ GAppInfo * g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *lookup, diff --git a/gio/gdesktopappinfo.h b/gio/gdesktopappinfo.h index 1254038a4..591bdd2ef 100644 --- a/gio/gdesktopappinfo.h +++ b/gio/gdesktopappinfo.h @@ -106,22 +106,21 @@ GLIB_AVAILABLE_IN_2_38 gchar * g_desktop_app_info_get_action_name (GDesktopAppInfo *info, const gchar *action_name); -#ifndef G_DISABLE_DEPRECATED - -#define G_TYPE_DESKTOP_APP_INFO_LOOKUP (g_desktop_app_info_lookup_get_type ()) -#define G_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookup)) -#define G_IS_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP)) -#define G_DESKTOP_APP_INFO_LOOKUP_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookupIface)) +#define G_TYPE_DESKTOP_APP_INFO_LOOKUP (g_desktop_app_info_lookup_get_type ()) GLIB_DEPRECATED_MACRO_IN_2_28 +#define G_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookup)) GLIB_DEPRECATED_MACRO_IN_2_28 +#define G_IS_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP)) GLIB_DEPRECATED_MACRO_IN_2_28 +#define G_DESKTOP_APP_INFO_LOOKUP_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookupIface)) GLIB_DEPRECATED_MACRO_IN_2_28 /** * G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME: * * Extension point for default handler to URI association. See * [Extending GIO][extending-gio]. + * + * Deprecated: 2.28: The #GDesktopAppInfoLookup interface is deprecated and + * unused by GIO. */ -#define G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME "gio-desktop-app-info-lookup" - -#endif /* G_DISABLE_DEPRECATED */ +#define G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME "gio-desktop-app-info-lookup" GLIB_DEPRECATED_MACRO_IN_2_28 /** * GDesktopAppInfoLookupIface: diff --git a/gio/gdrive.c b/gio/gdrive.c index 24784f3df..08f72b23b 100644 --- a/gio/gdrive.c +++ b/gio/gdrive.c @@ -78,7 +78,7 @@ g_drive_default_init (GDriveInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GDriveIface, changed), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); /** @@ -95,7 +95,7 @@ g_drive_default_init (GDriveInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GDriveIface, disconnected), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); /** @@ -110,7 +110,7 @@ g_drive_default_init (GDriveInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GDriveIface, eject_button), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); /** @@ -127,7 +127,7 @@ g_drive_default_init (GDriveInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GDriveIface, stop_button), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); } diff --git a/gio/gdtlsconnection.c b/gio/gdtlsconnection.c index cbc25d4f2..1a74e3cc4 100644 --- a/gio/gdtlsconnection.c +++ b/gio/gdtlsconnection.c @@ -30,6 +30,7 @@ #include "gtlsdatabase.h" #include "gtlsinteraction.h" #include "glibintl.h" +#include "gmarshal-internal.h" /** * SECTION:gdtlsconnection @@ -317,10 +318,13 @@ g_dtls_connection_default_init (GDtlsConnectionInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GDtlsConnectionInterface, accept_certificate), g_signal_accumulator_true_handled, NULL, - NULL, + _g_cclosure_marshal_BOOLEAN__OBJECT_FLAGS, G_TYPE_BOOLEAN, 2, G_TYPE_TLS_CERTIFICATE, G_TYPE_TLS_CERTIFICATE_FLAGS); + g_signal_set_va_marshaller (signals[ACCEPT_CERTIFICATE], + G_TYPE_FROM_INTERFACE (iface), + _g_cclosure_marshal_BOOLEAN__OBJECT_FLAGSv); } /** @@ -638,6 +642,7 @@ g_dtls_connection_get_require_close_notify (GDtlsConnection *conn) * required for compatibility. Also, rehandshaking has been removed * from the TLS protocol in TLS 1.3. */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS void g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn, GTlsRehandshakeMode mode) @@ -648,6 +653,7 @@ g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn, "rehandshake-mode", mode, NULL); } +G_GNUC_END_IGNORE_DEPRECATIONS /** * g_dtls_connection_get_rehandshake_mode: @@ -660,6 +666,7 @@ g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn, * * Since: 2.48 */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS GTlsRehandshakeMode g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn) { @@ -672,6 +679,7 @@ g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn) NULL); return mode; } +G_GNUC_END_IGNORE_DEPRECATIONS /** * g_dtls_connection_handshake: diff --git a/gio/gdtlsconnection.h b/gio/gdtlsconnection.h index 364be935e..3901cdc9e 100644 --- a/gio/gdtlsconnection.h +++ b/gio/gdtlsconnection.h @@ -129,11 +129,13 @@ void g_dtls_connection_set_require_close_notify (GDtlsConnec GLIB_AVAILABLE_IN_2_48 gboolean g_dtls_connection_get_require_close_notify (GDtlsConnection *conn); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_DEPRECATED_IN_2_60 void g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn, GTlsRehandshakeMode mode); GLIB_DEPRECATED_IN_2_60 GTlsRehandshakeMode g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn); +G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_2_48 gboolean g_dtls_connection_handshake (GDtlsConnection *conn, diff --git a/gio/gfile.c b/gio/gfile.c index 24b136d80..45777a61d 100644 --- a/gio/gfile.c +++ b/gio/gfile.c @@ -1539,9 +1539,9 @@ g_file_query_filesystem_info_finish (GFile *file, * * Gets a #GMount for the #GFile. * - * If the #GFileIface for @file does not have a mount (e.g. - * possibly a remote share), @error will be set to %G_IO_ERROR_NOT_FOUND - * and %NULL will be returned. + * #GMount is returned only for user interesting locations, see + * #GVolumeMonitor. If the #GFileIface for @file does not have a #mount, + * @error will be set to %G_IO_ERROR_NOT_FOUND and %NULL #will be returned. * * If @cancellable is not %NULL, then the operation can be cancelled by * triggering the cancellable object from another thread. If the operation @@ -3284,12 +3284,12 @@ file_copy_fallback (GFile *source, out = (GOutputStream*)_g_local_file_output_stream_replace (_g_local_file_get_filename (G_LOCAL_FILE (destination)), FALSE, NULL, flags & G_FILE_COPY_BACKUP, - G_FILE_CREATE_REPLACE_DESTINATION, - info, + G_FILE_CREATE_REPLACE_DESTINATION | + G_FILE_CREATE_PRIVATE, info, cancellable, error); else out = (GOutputStream*)_g_local_file_output_stream_create (_g_local_file_get_filename (G_LOCAL_FILE (destination)), - FALSE, 0, info, + FALSE, G_FILE_CREATE_PRIVATE, info, cancellable, error); } else if (flags & G_FILE_COPY_OVERWRITE) @@ -3297,12 +3297,13 @@ file_copy_fallback (GFile *source, out = (GOutputStream *)g_file_replace (destination, NULL, flags & G_FILE_COPY_BACKUP, - G_FILE_CREATE_REPLACE_DESTINATION, + G_FILE_CREATE_REPLACE_DESTINATION | + G_FILE_CREATE_PRIVATE, cancellable, error); } else { - out = (GOutputStream *)g_file_create (destination, 0, cancellable, error); + out = (GOutputStream *)g_file_create (destination, G_FILE_CREATE_PRIVATE, cancellable, error); } if (!out) diff --git a/gio/gfileinfo.c b/gio/gfileinfo.c index d1c9140df..8c1d6c67f 100644 --- a/gio/gfileinfo.c +++ b/gio/gfileinfo.c @@ -832,9 +832,10 @@ _g_file_info_get_attribute_value (GFileInfo *info, * * Gets the value of a attribute, formated as a string. * This escapes things as needed to make the string valid - * utf8. + * UTF-8. * - * Returns: a UTF-8 string associated with the given @attribute. + * Returns: (nullable): a UTF-8 string associated with the given @attribute, or + * %NULL if the attribute wasn’t set. * When you're done with the string it must be freed with g_free(). **/ char * @@ -1463,7 +1464,8 @@ g_file_info_get_deletion_date (GFileInfo *info) static guint32 attr = 0; GFileAttributeValue *value; const char *date_str; - GTimeVal tv; + GTimeZone *local_tz = NULL; + GDateTime *dt = NULL; g_return_val_if_fail (G_IS_FILE_INFO (info), FALSE); @@ -1475,10 +1477,11 @@ g_file_info_get_deletion_date (GFileInfo *info) if (!date_str) return NULL; - if (g_time_val_from_iso8601 (date_str, &tv) == FALSE) - return NULL; + local_tz = g_time_zone_new_local (); + dt = g_date_time_new_from_iso8601 (date_str, local_tz); + g_time_zone_unref (local_tz); - return g_date_time_new_from_timeval_local (&tv); + return g_steal_pointer (&dt); } /** @@ -1752,7 +1755,11 @@ g_file_info_get_size (GFileInfo *info) * * Gets the modification time of the current @info and sets it * in @result. + * + * Deprecated: 2.62: Use g_file_info_get_modification_date_time() instead, as + * #GTimeVal is deprecated due to the year 2038 problem. **/ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS void g_file_info_get_modification_time (GFileInfo *info, GTimeVal *result) @@ -1774,6 +1781,47 @@ g_file_info_get_modification_time (GFileInfo *info, value = g_file_info_find_value (info, attr_mtime_usec); result->tv_usec = _g_file_attribute_value_get_uint32 (value); } +G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * g_file_info_get_modification_date_time: + * @info: a #GFileInfo. + * + * Gets the modification time of the current @info and returns it as a + * #GDateTime. + * + * Returns: (transfer full) (nullable): modification time, or %NULL if unknown + * Since: 2.62 + */ +GDateTime * +g_file_info_get_modification_date_time (GFileInfo *info) +{ + static guint32 attr_mtime = 0, attr_mtime_usec; + GFileAttributeValue *value, *value_usec; + GDateTime *dt = NULL, *dt2 = NULL; + + g_return_val_if_fail (G_IS_FILE_INFO (info), NULL); + + if (attr_mtime == 0) + { + attr_mtime = lookup_attribute (G_FILE_ATTRIBUTE_TIME_MODIFIED); + attr_mtime_usec = lookup_attribute (G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC); + } + + value = g_file_info_find_value (info, attr_mtime); + if (value == NULL) + return NULL; + + value_usec = g_file_info_find_value (info, attr_mtime_usec); + if (value_usec == NULL) + return NULL; + + dt = g_date_time_new_from_unix_utc (_g_file_attribute_value_get_uint64 (value)); + dt2 = g_date_time_add_seconds (dt, _g_file_attribute_value_get_uint32 (value_usec) / (gdouble) G_USEC_PER_SEC); + g_date_time_unref (dt); + + return g_steal_pointer (&dt2); +} /** * g_file_info_get_symlink_target: @@ -2112,7 +2160,11 @@ g_file_info_set_size (GFileInfo *info, * * Sets the %G_FILE_ATTRIBUTE_TIME_MODIFIED attribute in the file * info to the given time value. + * + * Deprecated: 2.62: Use g_file_info_set_modification_date_time() instead, as + * #GTimeVal is deprecated due to the year 2038 problem. **/ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS void g_file_info_set_modification_time (GFileInfo *info, GTimeVal *mtime) @@ -2136,6 +2188,41 @@ g_file_info_set_modification_time (GFileInfo *info, if (value) _g_file_attribute_value_set_uint32 (value, mtime->tv_usec); } +G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * g_file_info_set_modification_date_time: + * @info: a #GFileInfo. + * @mtime: (not nullable): a #GDateTime. + * + * Sets the %G_FILE_ATTRIBUTE_TIME_MODIFIED attribute in the file + * info to the given date/time value. + * + * Since: 2.62 + */ +void +g_file_info_set_modification_date_time (GFileInfo *info, + GDateTime *mtime) +{ + static guint32 attr_mtime = 0, attr_mtime_usec; + GFileAttributeValue *value; + + g_return_if_fail (G_IS_FILE_INFO (info)); + g_return_if_fail (mtime != NULL); + + if (attr_mtime == 0) + { + attr_mtime = lookup_attribute (G_FILE_ATTRIBUTE_TIME_MODIFIED); + attr_mtime_usec = lookup_attribute (G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC); + } + + value = g_file_info_create_value (info, attr_mtime); + if (value) + _g_file_attribute_value_set_uint64 (value, g_date_time_to_unix (mtime)); + value = g_file_info_create_value (info, attr_mtime_usec); + if (value) + _g_file_attribute_value_set_uint32 (value, g_date_time_get_microsecond (mtime)); +} /** * g_file_info_set_symlink_target: diff --git a/gio/gfileinfo.h b/gio/gfileinfo.h index 622c2b611..1629a2edb 100644 --- a/gio/gfileinfo.h +++ b/gio/gfileinfo.h @@ -1046,9 +1046,13 @@ GLIB_AVAILABLE_IN_ALL const char * g_file_info_get_content_type (GFileInfo *info); GLIB_AVAILABLE_IN_ALL goffset g_file_info_get_size (GFileInfo *info); -GLIB_AVAILABLE_IN_ALL +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_62_FOR(g_file_info_get_modification_date_time) void g_file_info_get_modification_time (GFileInfo *info, - GTimeVal *result); + GTimeVal *result); +G_GNUC_END_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_IN_2_62 +GDateTime * g_file_info_get_modification_date_time (GFileInfo *info); GLIB_AVAILABLE_IN_ALL const char * g_file_info_get_symlink_target (GFileInfo *info); GLIB_AVAILABLE_IN_ALL @@ -1093,9 +1097,14 @@ void g_file_info_set_content_type (GFileInfo *info, GLIB_AVAILABLE_IN_ALL void g_file_info_set_size (GFileInfo *info, goffset size); -GLIB_AVAILABLE_IN_ALL +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_62_FOR(g_file_info_set_modification_date_time) void g_file_info_set_modification_time (GFileInfo *info, - GTimeVal *mtime); + GTimeVal *mtime); +G_GNUC_END_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_IN_2_62 +void g_file_info_set_modification_date_time (GFileInfo *info, + GDateTime *mtime); GLIB_AVAILABLE_IN_ALL void g_file_info_set_symlink_target (GFileInfo *info, const char *symlink_target); diff --git a/gio/gfilemonitor.c b/gio/gfilemonitor.c index 36d35a88e..9b9c0ea2d 100644 --- a/gio/gfilemonitor.c +++ b/gio/gfilemonitor.c @@ -23,6 +23,7 @@ #include "gfilemonitor.h" #include "gioenumtypes.h" +#include "gmarshal-internal.h" #include "gfile.h" #include "gvfs.h" #include "glibintl.h" @@ -181,9 +182,12 @@ g_file_monitor_class_init (GFileMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GFileMonitorClass, changed), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__OBJECT_OBJECT_ENUM, G_TYPE_NONE, 3, G_TYPE_FILE, G_TYPE_FILE, G_TYPE_FILE_MONITOR_EVENT); + g_signal_set_va_marshaller (g_file_monitor_changed_signal, + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_VOID__OBJECT_OBJECT_ENUMv); g_object_class_install_property (object_class, PROP_RATE_LIMIT, g_param_spec_int ("rate-limit", diff --git a/gio/gfilenamecompleter.c b/gio/gfilenamecompleter.c index 2550fecec..5883b8004 100644 --- a/gio/gfilenamecompleter.c +++ b/gio/gfilenamecompleter.c @@ -105,7 +105,7 @@ g_filename_completer_class_init (GFilenameCompleterClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GFilenameCompleterClass, got_completion_data), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); } diff --git a/gio/ginitable.c b/gio/ginitable.c index b5b500618..f3fd76ffc 100644 --- a/gio/ginitable.c +++ b/gio/ginitable.c @@ -187,6 +187,7 @@ g_initable_new (GType object_type, * Deprecated: 2.54: Use g_object_new_with_properties() and * g_initable_init() instead. See #GParameter for more information. */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gpointer g_initable_newv (GType object_type, guint n_parameters, @@ -198,9 +199,7 @@ g_initable_newv (GType object_type, g_return_val_if_fail (G_TYPE_IS_INITABLE (object_type), NULL); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS obj = g_object_newv (object_type, n_parameters, parameters); -G_GNUC_END_IGNORE_DEPRECATIONS if (!g_initable_init (G_INITABLE (obj), cancellable, error)) { @@ -210,6 +209,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS return (gpointer)obj; } +G_GNUC_END_IGNORE_DEPRECATIONS /** * g_initable_new_valist: diff --git a/gio/ginitable.h b/gio/ginitable.h index c29098d53..463bfcc5a 100644 --- a/gio/ginitable.h +++ b/gio/ginitable.h @@ -81,12 +81,17 @@ gpointer g_initable_new (GType object_type, const gchar *first_property_name, ...); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_initable_init) gpointer g_initable_newv (GType object_type, guint n_parameters, GParameter *parameters, GCancellable *cancellable, GError **error); + +G_GNUC_END_IGNORE_DEPRECATIONS + GLIB_AVAILABLE_IN_ALL GObject* g_initable_new_valist (GType object_type, const gchar *first_property_name, diff --git a/gio/gio-querymodules.c b/gio/gio-querymodules.c index 74c659462..eb5094f4d 100644 --- a/gio/gio-querymodules.c +++ b/gio/gio-querymodules.c @@ -26,6 +26,8 @@ #include <errno.h> #include <locale.h> +#include "glib/glib-private.h" + static gboolean is_valid_module_name (const gchar *basename) { @@ -160,7 +162,7 @@ main (gint argc, return 1; } - setlocale (LC_ALL, ""); + setlocale (LC_ALL, GLIB_DEFAULT_LOCALE); /* Be defensive and ensure we're linked to GObject */ g_type_ensure (G_TYPE_OBJECT); diff --git a/gio/gio-tool.c b/gio/gio-tool.c index 847a2188b..c0aec7492 100644 --- a/gio/gio-tool.c +++ b/gio/gio-tool.c @@ -28,7 +28,7 @@ #include <errno.h> #include "gio-tool.h" - +#include "glib/glib-private.h" void print_error (const gchar *format, ...) @@ -253,9 +253,20 @@ main (int argc, char **argv) const char *command; gboolean do_help; - setlocale (LC_ALL, ""); +#ifdef G_OS_WIN32 + gchar *localedir; +#endif + + setlocale (LC_ALL, GLIB_DEFAULT_LOCALE); textdomain (GETTEXT_PACKAGE); + +#ifdef G_OS_WIN32 + localedir = _glib_get_locale_dir (); + bindtextdomain (GETTEXT_PACKAGE, localedir); + g_free (localedir); +#else bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR); +#endif #ifdef HAVE_BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); diff --git a/gio/gioenums.h b/gio/gioenums.h index d3ada454a..22fe7005c 100644 --- a/gio/gioenums.h +++ b/gio/gioenums.h @@ -1628,7 +1628,7 @@ typedef enum { G_TLS_REHANDSHAKE_NEVER, G_TLS_REHANDSHAKE_SAFELY, G_TLS_REHANDSHAKE_UNSAFELY -} GTlsRehandshakeMode; +} GTlsRehandshakeMode GLIB_DEPRECATED_TYPE_IN_2_60; /** * GTlsPasswordFlags: diff --git a/gio/giomodule.c b/gio/giomodule.c index ee1b0b6f4..1007abdbf 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -20,6 +20,10 @@ #include "config.h" +/* For the #GDesktopAppInfoLookup macros; since macro deprecation is implemented + * in the preprocessor, we need to define this before including glib.h*/ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <string.h> #include "giomodule.h" @@ -1087,9 +1091,7 @@ _g_io_modules_ensure_extension_points_registered (void) #if defined(G_OS_UNIX) && !defined(HAVE_COCOA) #if !GLIB_CHECK_VERSION (3, 0, 0) ep = g_io_extension_point_register (G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME); - G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_io_extension_point_set_required_type (ep, G_TYPE_DESKTOP_APP_INFO_LOOKUP); - G_GNUC_END_IGNORE_DEPRECATIONS #endif #endif @@ -1209,6 +1211,7 @@ _g_io_modules_ensure_loaded (void) /* Initialize types from built-in "modules" */ g_type_ensure (g_null_settings_backend_get_type ()); g_type_ensure (g_memory_settings_backend_get_type ()); + g_type_ensure (g_keyfile_settings_backend_get_type ()); #if defined(HAVE_INOTIFY_INIT1) g_type_ensure (g_inotify_file_monitor_get_type ()); #endif diff --git a/gio/gioprivate.h b/gio/gioprivate.h index a917510b9..2bc54e49b 100644 --- a/gio/gioprivate.h +++ b/gio/gioprivate.h @@ -35,6 +35,23 @@ gboolean g_output_stream_async_close_is_via_threads (GOutputStream *stream); void g_socket_connection_set_cached_remote_address (GSocketConnection *connection, GSocketAddress *address); +/* POSIX defines IOV_MAX/UIO_MAXIOV as the maximum number of iovecs that can + * be sent in one go. We define our own version of it here as there are two + * possible names, and also define a fall-back value if none of the constants + * are defined */ +#if defined(IOV_MAX) +#define G_IOV_MAX IOV_MAX +#elif defined(UIO_MAXIOV) +#define G_IOV_MAX UIO_MAXIOV +#else +/* 16 is the minimum value required by POSIX */ +#define G_IOV_MAX 16 +#endif + +/* The various functions taking iovecs as parameter use a plain int + * for the number of vectors. Limit it to G_MAXINT for this reason. + */ +G_STATIC_ASSERT (G_IOV_MAX <= G_MAXINT); G_END_DECLS diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c index 3bc392351..cd5765afd 100644 --- a/gio/gkeyfilesettingsbackend.c +++ b/gio/gkeyfilesettingsbackend.c @@ -80,7 +80,7 @@ typedef struct #ifdef G_OS_WIN32 #define EXTENSION_PRIORITY 10 #else -#define EXTENSION_PRIORITY (glib_should_use_portal () ? 110 : 10) +#define EXTENSION_PRIORITY (glib_should_use_portal () && !glib_has_dconf_access_in_sandbox () ? 110 : 10) #endif G_DEFINE_TYPE_WITH_CODE (GKeyfileSettingsBackend, @@ -740,7 +740,8 @@ g_keyfile_settings_backend_set_property (GObject *object, case PROP_FILENAME: /* Construct only. */ g_assert (kfsb->file == NULL); - kfsb->file = g_file_new_for_path (g_value_get_string (value)); + if (g_value_get_string (value)) + kfsb->file = g_file_new_for_path (g_value_get_string (value)); break; case PROP_ROOT_PATH: diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c index 399c567d2..ccffbce2c 100644 --- a/gio/glib-compile-resources.c +++ b/gio/glib-compile-resources.c @@ -43,10 +43,7 @@ #include "gvdb/gvdb-builder.h" #include "gconstructor_as_data.h" - -#ifdef G_OS_WIN32 #include "glib/glib-private.h" -#endif typedef struct { @@ -754,7 +751,7 @@ main (int argc, char **argv) gchar *tmp; #endif - setlocale (LC_ALL, ""); + setlocale (LC_ALL, GLIB_DEFAULT_LOCALE); textdomain (GETTEXT_PACKAGE); #ifdef G_OS_WIN32 diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c index 8ad3c6be1..f22265b82 100644 --- a/gio/glib-compile-schemas.c +++ b/gio/glib-compile-schemas.c @@ -29,10 +29,7 @@ #include "gvdb/gvdb-builder.h" #include "strinfo.c" - -#ifdef G_OS_WIN32 #include "glib/glib-private.h" -#endif static void strip_string (GString *string) @@ -1833,7 +1830,8 @@ parse_gschema_files (gchar **files, if (strict) { /* Translators: Do not translate "--strict". */ - fprintf (stderr, _("--strict was specified; exiting.\n")); + fprintf (stderr, "%s\n", _("--strict was specified; exiting.")); + g_hash_table_unref (state.schema_table); g_hash_table_unref (state.flags_table); g_hash_table_unref (state.enum_table); @@ -1843,7 +1841,9 @@ parse_gschema_files (gchar **files, return NULL; } else - fprintf (stderr, _("This entire file has been ignored.\n")); + { + fprintf (stderr, "%s\n", _("This entire file has been ignored.")); + } } /* cleanup */ @@ -1905,11 +1905,11 @@ set_overrides (GHashTable *schema_table, if (!strict) { - fprintf (stderr, _("Ignoring this file.\n")); + fprintf (stderr, "%s\n", _("Ignoring this file.")); continue; } - fprintf (stderr, _("--strict was specified; exiting.\n")); + fprintf (stderr, "%s\n", _("--strict was specified; exiting.")); return FALSE; } @@ -1958,17 +1958,22 @@ set_overrides (GHashTable *schema_table, if (state == NULL) { - fprintf (stderr, _("No such key “%s” in schema “%s” as " - "specified in override file “%s”"), - key, group, filename); - if (!strict) { - fprintf (stderr, _("; ignoring override for this key.\n")); + fprintf (stderr, _("No such key “%s” in schema “%s” as " + "specified in override file “%s”; " + "ignoring override for this key."), + key, group, filename); + fprintf (stderr, "\n"); continue; } - fprintf (stderr, _(" and --strict was specified; exiting.\n")); + fprintf (stderr, _("No such key “%s” in schema “%s” as " + "specified in override file “%s” and " + "--strict was specified; exiting."), + key, group, filename); + fprintf (stderr, "\n"); + g_key_file_free (key_file); g_strfreev (pieces); g_strfreev (groups); @@ -1982,18 +1987,24 @@ set_overrides (GHashTable *schema_table, /* Let's avoid the n*m case of per-desktop localised * default values, and just forbid it. */ - fprintf (stderr, - _("cannot provide per-desktop overrides for localised " - "key “%s” in schema “%s” (override file “%s”)"), - key, group, filename); - if (!strict) { - fprintf (stderr, _("; ignoring override for this key.\n")); + fprintf (stderr, + _("Cannot provide per-desktop overrides for " + "localised key “%s” in schema “%s” (override " + "file “%s”); ignoring override for this key."), + key, group, filename); + fprintf (stderr, "\n"); continue; } - fprintf (stderr, _(" and --strict was specified; exiting.\n")); + fprintf (stderr, + _("Cannot provide per-desktop overrides for " + "localised key “%s” in schema “%s” (override " + "file “%s”) and --strict was specified; exiting."), + key, group, filename); + fprintf (stderr, "\n"); + g_key_file_free (key_file); g_strfreev (pieces); g_strfreev (groups); @@ -2010,21 +2021,28 @@ set_overrides (GHashTable *schema_table, if (value == NULL) { - fprintf (stderr, _("error parsing key “%s” in schema “%s” " - "as specified in override file “%s”: " - "%s."), - key, group, filename, error->message); - - g_clear_error (&error); - g_free (string); - if (!strict) { - fprintf (stderr, _("Ignoring override for this key.\n")); + fprintf (stderr, _("Error parsing key “%s” in schema “%s” " + "as specified in override file “%s”: " + "%s. Ignoring override for this key."), + key, group, filename, error->message); + fprintf (stderr, "\n"); + + g_clear_error (&error); + g_free (string); + continue; } - fprintf (stderr, _("--strict was specified; exiting.\n")); + fprintf (stderr, _("Error parsing key “%s” in schema “%s” " + "as specified in override file “%s”: " + "%s. --strict was specified; exiting."), + key, group, filename, error->message); + fprintf (stderr, "\n"); + + g_clear_error (&error); + g_free (string); g_key_file_free (key_file); g_strfreev (pieces); g_strfreev (groups); @@ -2038,22 +2056,29 @@ set_overrides (GHashTable *schema_table, if (g_variant_compare (value, state->minimum) < 0 || g_variant_compare (value, state->maximum) > 0) { - fprintf (stderr, - _("override for key “%s” in schema “%s” in " - "override file “%s” is outside the range " - "given in the schema"), - key, group, filename); - g_variant_unref (value); g_free (string); if (!strict) { - fprintf (stderr, _("; ignoring override for this key.\n")); + fprintf (stderr, + _("Override for key “%s” in schema “%s” in " + "override file “%s” is outside the range " + "given in the schema; ignoring override " + "for this key."), + key, group, filename); + fprintf (stderr, "\n"); continue; } - fprintf (stderr, _(" and --strict was specified; exiting.\n")); + fprintf (stderr, + _("Override for key “%s” in schema “%s” in " + "override file “%s” is outside the range " + "given in the schema and --strict was " + "specified; exiting."), + key, group, filename); + fprintf (stderr, "\n"); + g_key_file_free (key_file); g_strfreev (pieces); g_strfreev (groups); @@ -2067,22 +2092,28 @@ set_overrides (GHashTable *schema_table, { if (!is_valid_choices (value, state->strinfo)) { - fprintf (stderr, - _("override for key “%s” in schema “%s” in " - "override file “%s” is not in the list " - "of valid choices"), - key, group, filename); - g_variant_unref (value); g_free (string); if (!strict) { - fprintf (stderr, _("; ignoring override for this key.\n")); + fprintf (stderr, + _("Override for key “%s” in schema “%s” in " + "override file “%s” is not in the list " + "of valid choices; ignoring override for " + "this key."), + key, group, filename); + fprintf (stderr, "\n"); continue; } - fprintf (stderr, _(" and --strict was specified; exiting.\n")); + fprintf (stderr, + _("Override for key “%s” in schema “%s” in " + "override file “%s” is not in the list " + "of valid choices and --strict was specified; " + "exiting."), + key, group, filename); + fprintf (stderr, "\n"); g_key_file_free (key_file); g_strfreev (pieces); g_strfreev (groups); @@ -2139,7 +2170,7 @@ main (int argc, char **argv) gint retval; GOptionEntry entries[] = { { "version", 0, 0, G_OPTION_ARG_NONE, &show_version_and_exit, N_("Show program version and exit"), NULL }, - { "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, N_("where to store the gschemas.compiled file"), N_("DIRECTORY") }, + { "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, N_("Where to store the gschemas.compiled file"), N_("DIRECTORY") }, { "strict", 0, 0, G_OPTION_ARG_NONE, &strict, N_("Abort on any errors in schemas"), NULL }, { "dry-run", 0, 0, G_OPTION_ARG_NONE, &dry_run, N_("Do not write the gschema.compiled file"), NULL }, { "allow-any-name", 0, 0, G_OPTION_ARG_NONE, &allow_any_name, N_("Do not enforce key name restrictions") }, @@ -2154,7 +2185,7 @@ main (int argc, char **argv) gchar *tmp = NULL; #endif - setlocale (LC_ALL, ""); + setlocale (LC_ALL, GLIB_DEFAULT_LOCALE); textdomain (GETTEXT_PACKAGE); #ifdef G_OS_WIN32 @@ -2192,7 +2223,7 @@ main (int argc, char **argv) if (!schema_files && argc != 2) { - fprintf (stderr, _("You should give exactly one directory name\n")); + fprintf (stderr, "%s\n", _("You should give exactly one directory name")); retval = 1; goto done; } @@ -2234,13 +2265,10 @@ main (int argc, char **argv) if (files->len == 0) { - fprintf (stdout, _("No schema files found: ")); - if (g_unlink (target)) - fprintf (stdout, _("doing nothing.\n")); - + fprintf (stdout, "%s\n", _("No schema files found: doing nothing.")); else - fprintf (stdout, _("removed existing output file.\n")); + fprintf (stdout, "%s\n", _("No schema files found: removed existing output file.")); g_ptr_array_unref (files); g_ptr_array_unref (overrides); diff --git a/gio/glistmodel.c b/gio/glistmodel.c index 2b943a87c..0dde9ad1f 100644 --- a/gio/glistmodel.c +++ b/gio/glistmodel.c @@ -24,6 +24,7 @@ #include "glistmodel.h" #include "glibintl.h" +#include "gmarshal-internal.h" G_DEFINE_INTERFACE (GListModel, g_list_model, G_TYPE_OBJECT) @@ -130,9 +131,12 @@ g_list_model_default_init (GListModelInterface *iface) * @removed: the number of items removed * @added: the number of items added * - * This signal is emitted whenever items were added or removed to - * @list. At @position, @removed items were removed and @added items - * were added in their place. + * This signal is emitted whenever items were added to or removed + * from @list. At @position, @removed items were removed and @added + * items were added in their place. + * + * Note: If @removed != @added, the positions of all later items + * in the model change. * * Since: 2.44 */ @@ -141,9 +145,12 @@ g_list_model_default_init (GListModelInterface *iface) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_generic, + _g_cclosure_marshal_VOID__UINT_UINT_UINT, G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); + g_signal_set_va_marshaller (g_list_model_changed_signal, + G_TYPE_FROM_INTERFACE (iface), + _g_cclosure_marshal_VOID__UINT_UINT_UINTv); } /** diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c index 6d44989bf..a3dd62172 100644 --- a/gio/glocalfileoutputstream.c +++ b/gio/glocalfileoutputstream.c @@ -42,6 +42,7 @@ #endif #include "glib-private.h" +#include "gioprivate.h" #ifdef G_OS_WIN32 #include <io.h> @@ -243,11 +244,11 @@ g_local_file_output_stream_writev (GOutputStream *stream, if (bytes_written) *bytes_written = 0; - /* Clamp to G_MAXINT as writev() takes an integer for the number of vectors. - * We handle this like a short write in this case + /* Clamp the number of vectors if more given than we can write in one go. + * The caller has to handle short writes anyway. */ - if (n_vectors > G_MAXINT) - n_vectors = G_MAXINT; + if (n_vectors > G_IOV_MAX) + n_vectors = G_IOV_MAX; file = G_LOCAL_FILE_OUTPUT_STREAM (stream); diff --git a/gio/gmarshal-internal.c b/gio/gmarshal-internal.c new file mode 100644 index 000000000..f9571c42e --- /dev/null +++ b/gio/gmarshal-internal.c @@ -0,0 +1,2632 @@ +/* GObject - GLib Type, Object, Parameter and Signal Library + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include <glib-object.h> +#include "gmarshal-internal.h" + +#ifdef G_ENABLE_DEBUG +#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +#define g_marshal_value_peek_char(v) g_value_get_schar (v) +#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) +#define g_marshal_value_peek_int(v) g_value_get_int (v) +#define g_marshal_value_peek_uint(v) g_value_get_uint (v) +#define g_marshal_value_peek_long(v) g_value_get_long (v) +#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) +#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) +#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) +#define g_marshal_value_peek_enum(v) g_value_get_enum (v) +#define g_marshal_value_peek_flags(v) g_value_get_flags (v) +#define g_marshal_value_peek_float(v) g_value_get_float (v) +#define g_marshal_value_peek_double(v) g_value_get_double (v) +#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) +#define g_marshal_value_peek_param(v) g_value_get_param (v) +#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) +#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) +#define g_marshal_value_peek_object(v) g_value_get_object (v) +#define g_marshal_value_peek_variant(v) g_value_get_variant (v) +#else /* !G_ENABLE_DEBUG */ +/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. + * Do not access GValues directly in your code. Instead, use the + * g_value_get_*() functions + */ +#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int +#define g_marshal_value_peek_char(v) (v)->data[0].v_int +#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint +#define g_marshal_value_peek_int(v) (v)->data[0].v_int +#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint +#define g_marshal_value_peek_long(v) (v)->data[0].v_long +#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 +#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 +#define g_marshal_value_peek_enum(v) (v)->data[0].v_long +#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_float(v) (v)->data[0].v_float +#define g_marshal_value_peek_double(v) (v)->data[0].v_double +#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer +#endif /* !G_ENABLE_DEBUG */ + +/* BOOLEAN:OBJECT */ +void +_g_cclosure_marshal_BOOLEAN__OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__OBJECT) (gpointer data1, + gpointer arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__OBJECT callback; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 2); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__OBJECT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_object (param_values + 1), + data2); + + g_value_set_boolean (return_value, v_return); +} + +void +_g_cclosure_marshal_BOOLEAN__OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__OBJECT) (gpointer data1, + gpointer arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__OBJECT callback; + gboolean v_return; + gpointer arg0; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if (arg0 != NULL) + arg0 = g_object_ref (arg0); + va_end (args_copy); + + g_return_if_fail (return_value != NULL); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__OBJECT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + arg0, + data2); + if (arg0 != NULL) + g_object_unref (arg0); + + g_value_set_boolean (return_value, v_return); +} + +/* BOOLEAN:OBJECT,FLAGS */ +void +_g_cclosure_marshal_BOOLEAN__OBJECT_FLAGS (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__OBJECT_FLAGS) (gpointer data1, + gpointer arg1, + guint arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__OBJECT_FLAGS callback; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__OBJECT_FLAGS) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_flags (param_values + 2), + data2); + + g_value_set_boolean (return_value, v_return); +} + +void +_g_cclosure_marshal_BOOLEAN__OBJECT_FLAGSv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__OBJECT_FLAGS) (gpointer data1, + gpointer arg1, + guint arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__OBJECT_FLAGS callback; + gboolean v_return; + gpointer arg0; + guint arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if (arg0 != NULL) + arg0 = g_object_ref (arg0); + arg1 = (guint) va_arg (args_copy, guint); + va_end (args_copy); + + g_return_if_fail (return_value != NULL); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__OBJECT_FLAGS) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + arg0, + arg1, + data2); + if (arg0 != NULL) + g_object_unref (arg0); + + g_value_set_boolean (return_value, v_return); +} + +/* BOOLEAN:OBJECT,OBJECT */ +void +_g_cclosure_marshal_BOOLEAN__OBJECT_OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__OBJECT_OBJECT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__OBJECT_OBJECT callback; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_object (param_values + 2), + data2); + + g_value_set_boolean (return_value, v_return); +} + +void +_g_cclosure_marshal_BOOLEAN__OBJECT_OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__OBJECT_OBJECT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__OBJECT_OBJECT callback; + gboolean v_return; + gpointer arg0; + gpointer arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if (arg0 != NULL) + arg0 = g_object_ref (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if (arg1 != NULL) + arg1 = g_object_ref (arg1); + va_end (args_copy); + + g_return_if_fail (return_value != NULL); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + arg0, + arg1, + data2); + if (arg0 != NULL) + g_object_unref (arg0); + if (arg1 != NULL) + g_object_unref (arg1); + + g_value_set_boolean (return_value, v_return); +} + +/* BOOLEAN:POINTER,INT */ +void +_g_cclosure_marshal_BOOLEAN__POINTER_INT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_INT) (gpointer data1, + gpointer arg1, + gint arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__POINTER_INT callback; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__POINTER_INT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_pointer (param_values + 1), + g_marshal_value_peek_int (param_values + 2), + data2); + + g_value_set_boolean (return_value, v_return); +} + +void +_g_cclosure_marshal_BOOLEAN__POINTER_INTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_INT) (gpointer data1, + gpointer arg1, + gint arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__POINTER_INT callback; + gboolean v_return; + gpointer arg0; + gint arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + arg1 = (gint) va_arg (args_copy, gint); + va_end (args_copy); + + g_return_if_fail (return_value != NULL); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__POINTER_INT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + arg0, + arg1, + data2); + + + g_value_set_boolean (return_value, v_return); +} + +/* BOOLEAN:STRING */ +void +_g_cclosure_marshal_BOOLEAN__STRING (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__STRING) (gpointer data1, + gpointer arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__STRING callback; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 2); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__STRING) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_string (param_values + 1), + data2); + + g_value_set_boolean (return_value, v_return); +} + +void +_g_cclosure_marshal_BOOLEAN__STRINGv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__STRING) (gpointer data1, + gpointer arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__STRING callback; + gboolean v_return; + gpointer arg0; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_strdup (arg0); + va_end (args_copy); + + g_return_if_fail (return_value != NULL); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__STRING) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + arg0, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_free (arg0); + + g_value_set_boolean (return_value, v_return); +} + +/* BOOLEAN:UINT */ +void +_g_cclosure_marshal_BOOLEAN__UINT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__UINT) (gpointer data1, + guint arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__UINT callback; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 2); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__UINT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_uint (param_values + 1), + data2); + + g_value_set_boolean (return_value, v_return); +} + +void +_g_cclosure_marshal_BOOLEAN__UINTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__UINT) (gpointer data1, + guint arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__UINT callback; + gboolean v_return; + guint arg0; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (guint) va_arg (args_copy, guint); + va_end (args_copy); + + g_return_if_fail (return_value != NULL); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__UINT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + arg0, + data2); + + + g_value_set_boolean (return_value, v_return); +} + +/* BOOLEAN:VOID */ +void +_g_cclosure_marshal_BOOLEAN__VOID (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__VOID) (gpointer data1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__VOID callback; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 1); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__VOID) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + data2); + + g_value_set_boolean (return_value, v_return); +} + +void +_g_cclosure_marshal_BOOLEAN__VOIDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__VOID) (gpointer data1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_BOOLEAN__VOID callback; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__VOID) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + data2); + + + g_value_set_boolean (return_value, v_return); +} + +/* INT:BOXED */ +void +_g_cclosure_marshal_INT__BOXED (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gint (*GMarshalFunc_INT__BOXED) (gpointer data1, + gpointer arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_INT__BOXED callback; + gint v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 2); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_INT__BOXED) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_boxed (param_values + 1), + data2); + + g_value_set_int (return_value, v_return); +} + +void +_g_cclosure_marshal_INT__BOXEDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef gint (*GMarshalFunc_INT__BOXED) (gpointer data1, + gpointer arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_INT__BOXED callback; + gint v_return; + gpointer arg0; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_boxed_copy (param_types[0] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg0); + va_end (args_copy); + + g_return_if_fail (return_value != NULL); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_INT__BOXED) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + arg0, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_boxed_free (param_types[0] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg0); + + g_value_set_int (return_value, v_return); +} + +/* INT:OBJECT */ +void +_g_cclosure_marshal_INT__OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gint (*GMarshalFunc_INT__OBJECT) (gpointer data1, + gpointer arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_INT__OBJECT callback; + gint v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 2); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_INT__OBJECT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_object (param_values + 1), + data2); + + g_value_set_int (return_value, v_return); +} + +void +_g_cclosure_marshal_INT__OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef gint (*GMarshalFunc_INT__OBJECT) (gpointer data1, + gpointer arg1, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_INT__OBJECT callback; + gint v_return; + gpointer arg0; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if (arg0 != NULL) + arg0 = g_object_ref (arg0); + va_end (args_copy); + + g_return_if_fail (return_value != NULL); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_INT__OBJECT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + arg0, + data2); + if (arg0 != NULL) + g_object_unref (arg0); + + g_value_set_int (return_value, v_return); +} + +/* VOID:BOOLEAN,BOXED */ +void +_g_cclosure_marshal_VOID__BOOLEAN_BOXED (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__BOOLEAN_BOXED) (gpointer data1, + gboolean arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__BOOLEAN_BOXED callback; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__BOOLEAN_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_boolean (param_values + 1), + g_marshal_value_peek_boxed (param_values + 2), + data2); +} + +void +_g_cclosure_marshal_VOID__BOOLEAN_BOXEDv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__BOOLEAN_BOXED) (gpointer data1, + gboolean arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__BOOLEAN_BOXED callback; + gboolean arg0; + gpointer arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gboolean) va_arg (args_copy, gboolean); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + arg1 = g_boxed_copy (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__BOOLEAN_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + data2); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + g_boxed_free (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); +} + +/* VOID:ENUM,OBJECT */ +void +_g_cclosure_marshal_VOID__ENUM_OBJECT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__ENUM_OBJECT) (gpointer data1, + gint arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__ENUM_OBJECT callback; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__ENUM_OBJECT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_enum (param_values + 1), + g_marshal_value_peek_object (param_values + 2), + data2); +} + +void +_g_cclosure_marshal_VOID__ENUM_OBJECTv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__ENUM_OBJECT) (gpointer data1, + gint arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__ENUM_OBJECT callback; + gint arg0; + gpointer arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gint) va_arg (args_copy, gint); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if (arg1 != NULL) + arg1 = g_object_ref (arg1); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__ENUM_OBJECT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + data2); + if (arg1 != NULL) + g_object_unref (arg1); +} + +/* VOID:ENUM,OBJECT,OBJECT */ +void +_g_cclosure_marshal_VOID__ENUM_OBJECT_OBJECT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__ENUM_OBJECT_OBJECT) (gpointer data1, + gint arg1, + gpointer arg2, + gpointer arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__ENUM_OBJECT_OBJECT callback; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__ENUM_OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_enum (param_values + 1), + g_marshal_value_peek_object (param_values + 2), + g_marshal_value_peek_object (param_values + 3), + data2); +} + +void +_g_cclosure_marshal_VOID__ENUM_OBJECT_OBJECTv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__ENUM_OBJECT_OBJECT) (gpointer data1, + gint arg1, + gpointer arg2, + gpointer arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__ENUM_OBJECT_OBJECT callback; + gint arg0; + gpointer arg1; + gpointer arg2; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gint) va_arg (args_copy, gint); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if (arg1 != NULL) + arg1 = g_object_ref (arg1); + arg2 = (gpointer) va_arg (args_copy, gpointer); + if (arg2 != NULL) + arg2 = g_object_ref (arg2); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__ENUM_OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + data2); + if (arg1 != NULL) + g_object_unref (arg1); + if (arg2 != NULL) + g_object_unref (arg2); +} + +/* VOID:INT,INT,INT */ +void +_g_cclosure_marshal_VOID__INT_INT_INT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__INT_INT_INT) (gpointer data1, + gint arg1, + gint arg2, + gint arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__INT_INT_INT callback; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__INT_INT_INT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_int (param_values + 1), + g_marshal_value_peek_int (param_values + 2), + g_marshal_value_peek_int (param_values + 3), + data2); +} + +void +_g_cclosure_marshal_VOID__INT_INT_INTv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__INT_INT_INT) (gpointer data1, + gint arg1, + gint arg2, + gint arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__INT_INT_INT callback; + gint arg0; + gint arg1; + gint arg2; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gint) va_arg (args_copy, gint); + arg1 = (gint) va_arg (args_copy, gint); + arg2 = (gint) va_arg (args_copy, gint); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__INT_INT_INT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + data2); + +} + +/* VOID:OBJECT,OBJECT */ +void +_g_cclosure_marshal_VOID__OBJECT_OBJECT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_OBJECT callback; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_object (param_values + 2), + data2); +} + +void +_g_cclosure_marshal_VOID__OBJECT_OBJECTv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_OBJECT callback; + gpointer arg0; + gpointer arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if (arg0 != NULL) + arg0 = g_object_ref (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if (arg1 != NULL) + arg1 = g_object_ref (arg1); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + data2); + if (arg0 != NULL) + g_object_unref (arg0); + if (arg1 != NULL) + g_object_unref (arg1); +} + +/* VOID:OBJECT,OBJECT,ENUM */ +void +_g_cclosure_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_ENUM) (gpointer data1, + gpointer arg1, + gpointer arg2, + gint arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_OBJECT_ENUM callback; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_OBJECT_ENUM) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_object (param_values + 2), + g_marshal_value_peek_enum (param_values + 3), + data2); +} + +void +_g_cclosure_marshal_VOID__OBJECT_OBJECT_ENUMv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_ENUM) (gpointer data1, + gpointer arg1, + gpointer arg2, + gint arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_OBJECT_ENUM callback; + gpointer arg0; + gpointer arg1; + gint arg2; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if (arg0 != NULL) + arg0 = g_object_ref (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if (arg1 != NULL) + arg1 = g_object_ref (arg1); + arg2 = (gint) va_arg (args_copy, gint); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_OBJECT_ENUM) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + data2); + if (arg0 != NULL) + g_object_unref (arg0); + if (arg1 != NULL) + g_object_unref (arg1); +} + +/* VOID:OBJECT,OBJECT,STRING,STRING,VARIANT */ +void +_g_cclosure_marshal_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + gpointer arg4, + gpointer arg5, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT callback; + + g_return_if_fail (n_param_values == 6); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_object (param_values + 2), + g_marshal_value_peek_string (param_values + 3), + g_marshal_value_peek_string (param_values + 4), + g_marshal_value_peek_variant (param_values + 5), + data2); +} + +void +_g_cclosure_marshal_VOID__OBJECT_OBJECT_STRING_STRING_VARIANTv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + gpointer arg4, + gpointer arg5, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT callback; + gpointer arg0; + gpointer arg1; + gpointer arg2; + gpointer arg3; + gpointer arg4; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if (arg0 != NULL) + arg0 = g_object_ref (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if (arg1 != NULL) + arg1 = g_object_ref (arg1); + arg2 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + arg2 = g_strdup (arg2); + arg3 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[3] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg3 != NULL) + arg3 = g_strdup (arg3); + arg4 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[4] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg4 != NULL) + arg4 = g_variant_ref_sink (arg4); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + arg3, + arg4, + data2); + if (arg0 != NULL) + g_object_unref (arg0); + if (arg1 != NULL) + g_object_unref (arg1); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + g_free (arg2); + if ((param_types[3] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg3 != NULL) + g_free (arg3); + if ((param_types[4] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg4 != NULL) + g_variant_unref (arg4); +} + +/* VOID:OBJECT,OBJECT,VARIANT,BOXED */ +void +_g_cclosure_marshal_VOID__OBJECT_OBJECT_VARIANT_BOXED (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_VARIANT_BOXED) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + gpointer arg4, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_OBJECT_VARIANT_BOXED callback; + + g_return_if_fail (n_param_values == 5); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_OBJECT_VARIANT_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_object (param_values + 2), + g_marshal_value_peek_variant (param_values + 3), + g_marshal_value_peek_boxed (param_values + 4), + data2); +} + +void +_g_cclosure_marshal_VOID__OBJECT_OBJECT_VARIANT_BOXEDv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_VARIANT_BOXED) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + gpointer arg4, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_OBJECT_VARIANT_BOXED callback; + gpointer arg0; + gpointer arg1; + gpointer arg2; + gpointer arg3; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if (arg0 != NULL) + arg0 = g_object_ref (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if (arg1 != NULL) + arg1 = g_object_ref (arg1); + arg2 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + arg2 = g_variant_ref_sink (arg2); + arg3 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[3] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg3 != NULL) + arg3 = g_boxed_copy (param_types[3] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg3); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_OBJECT_VARIANT_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + arg3, + data2); + if (arg0 != NULL) + g_object_unref (arg0); + if (arg1 != NULL) + g_object_unref (arg1); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + g_variant_unref (arg2); + if ((param_types[3] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg3 != NULL) + g_boxed_free (param_types[3] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg3); +} + +/* VOID:OBJECT,VARIANT */ +void +_g_cclosure_marshal_VOID__OBJECT_VARIANT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_VARIANT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_VARIANT callback; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_VARIANT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_variant (param_values + 2), + data2); +} + +void +_g_cclosure_marshal_VOID__OBJECT_VARIANTv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_VARIANT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_VARIANT callback; + gpointer arg0; + gpointer arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if (arg0 != NULL) + arg0 = g_object_ref (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + arg1 = g_variant_ref_sink (arg1); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_VARIANT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + data2); + if (arg0 != NULL) + g_object_unref (arg0); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + g_variant_unref (arg1); +} + +/* VOID:POINTER,INT,STRING */ +void +_g_cclosure_marshal_VOID__POINTER_INT_STRING (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__POINTER_INT_STRING) (gpointer data1, + gpointer arg1, + gint arg2, + gpointer arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__POINTER_INT_STRING callback; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__POINTER_INT_STRING) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_pointer (param_values + 1), + g_marshal_value_peek_int (param_values + 2), + g_marshal_value_peek_string (param_values + 3), + data2); +} + +void +_g_cclosure_marshal_VOID__POINTER_INT_STRINGv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__POINTER_INT_STRING) (gpointer data1, + gpointer arg1, + gint arg2, + gpointer arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__POINTER_INT_STRING callback; + gpointer arg0; + gint arg1; + gpointer arg2; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + arg1 = (gint) va_arg (args_copy, gint); + arg2 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + arg2 = g_strdup (arg2); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__POINTER_INT_STRING) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + data2); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + g_free (arg2); +} + +/* VOID:STRING,BOOLEAN */ +void +_g_cclosure_marshal_VOID__STRING_BOOLEAN (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1, + gpointer arg1, + gboolean arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_BOOLEAN callback; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_boolean (param_values + 2), + data2); +} + +void +_g_cclosure_marshal_VOID__STRING_BOOLEANv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1, + gpointer arg1, + gboolean arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_BOOLEAN callback; + gpointer arg0; + gboolean arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_strdup (arg0); + arg1 = (gboolean) va_arg (args_copy, gboolean); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_free (arg0); +} + +/* VOID:STRING,BOXED */ +void +_g_cclosure_marshal_VOID__STRING_BOXED (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_BOXED) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_BOXED callback; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_boxed (param_values + 2), + data2); +} + +void +_g_cclosure_marshal_VOID__STRING_BOXEDv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__STRING_BOXED) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_BOXED callback; + gpointer arg0; + gpointer arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_strdup (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + arg1 = g_boxed_copy (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_free (arg0); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + g_boxed_free (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); +} + +/* VOID:STRING,BOXED,BOXED */ +void +_g_cclosure_marshal_VOID__STRING_BOXED_BOXED (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_BOXED_BOXED) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_BOXED_BOXED callback; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_BOXED_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_boxed (param_values + 2), + g_marshal_value_peek_boxed (param_values + 3), + data2); +} + +void +_g_cclosure_marshal_VOID__STRING_BOXED_BOXEDv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__STRING_BOXED_BOXED) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_BOXED_BOXED callback; + gpointer arg0; + gpointer arg1; + gpointer arg2; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_strdup (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + arg1 = g_boxed_copy (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); + arg2 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + arg2 = g_boxed_copy (param_types[2] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg2); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_BOXED_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_free (arg0); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + g_boxed_free (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + g_boxed_free (param_types[2] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg2); +} + +/* VOID:STRING,INT64,INT64 */ +void +_g_cclosure_marshal_VOID__STRING_INT64_INT64 (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_INT64_INT64) (gpointer data1, + gpointer arg1, + gint64 arg2, + gint64 arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_INT64_INT64 callback; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_INT64_INT64) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_int64 (param_values + 2), + g_marshal_value_peek_int64 (param_values + 3), + data2); +} + +void +_g_cclosure_marshal_VOID__STRING_INT64_INT64v (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__STRING_INT64_INT64) (gpointer data1, + gpointer arg1, + gint64 arg2, + gint64 arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_INT64_INT64 callback; + gpointer arg0; + gint64 arg1; + gint64 arg2; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_strdup (arg0); + arg1 = (gint64) va_arg (args_copy, gint64); + arg2 = (gint64) va_arg (args_copy, gint64); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_INT64_INT64) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_free (arg0); +} + +/* VOID:STRING,STRING,STRING,FLAGS */ +void +_g_cclosure_marshal_VOID__STRING_STRING_STRING_FLAGS (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING_FLAGS) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + guint arg4, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_STRING_STRING_FLAGS callback; + + g_return_if_fail (n_param_values == 5); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_STRING_STRING_FLAGS) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + g_marshal_value_peek_string (param_values + 3), + g_marshal_value_peek_flags (param_values + 4), + data2); +} + +void +_g_cclosure_marshal_VOID__STRING_STRING_STRING_FLAGSv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING_FLAGS) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + guint arg4, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_STRING_STRING_FLAGS callback; + gpointer arg0; + gpointer arg1; + gpointer arg2; + guint arg3; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_strdup (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + arg1 = g_strdup (arg1); + arg2 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + arg2 = g_strdup (arg2); + arg3 = (guint) va_arg (args_copy, guint); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_STRING_STRING_FLAGS) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + arg3, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_free (arg0); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + g_free (arg1); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + g_free (arg2); +} + +/* VOID:STRING,STRING,VARIANT */ +void +_g_cclosure_marshal_VOID__STRING_STRING_VARIANT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_STRING_VARIANT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_STRING_VARIANT callback; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_STRING_VARIANT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + g_marshal_value_peek_variant (param_values + 3), + data2); +} + +void +_g_cclosure_marshal_VOID__STRING_STRING_VARIANTv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__STRING_STRING_VARIANT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_STRING_VARIANT callback; + gpointer arg0; + gpointer arg1; + gpointer arg2; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_strdup (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + arg1 = g_strdup (arg1); + arg2 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + arg2 = g_variant_ref_sink (arg2); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_STRING_VARIANT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_free (arg0); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + g_free (arg1); + if ((param_types[2] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg2 != NULL) + g_variant_unref (arg2); +} + +/* VOID:STRING,VARIANT */ +void +_g_cclosure_marshal_VOID__STRING_VARIANT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_VARIANT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_VARIANT callback; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_VARIANT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_variant (param_values + 2), + data2); +} + +void +_g_cclosure_marshal_VOID__STRING_VARIANTv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__STRING_VARIANT) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__STRING_VARIANT callback; + gpointer arg0; + gpointer arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_strdup (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + arg1 = g_variant_ref_sink (arg1); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_VARIANT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_free (arg0); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + g_variant_unref (arg1); +} + +/* VOID:UINT,UINT,UINT */ +void +_g_cclosure_marshal_VOID__UINT_UINT_UINT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__UINT_UINT_UINT) (gpointer data1, + guint arg1, + guint arg2, + guint arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__UINT_UINT_UINT callback; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__UINT_UINT_UINT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_uint (param_values + 1), + g_marshal_value_peek_uint (param_values + 2), + g_marshal_value_peek_uint (param_values + 3), + data2); +} + +void +_g_cclosure_marshal_VOID__UINT_UINT_UINTv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__UINT_UINT_UINT) (gpointer data1, + guint arg1, + guint arg2, + guint arg3, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__UINT_UINT_UINT callback; + guint arg0; + guint arg1; + guint arg2; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (guint) va_arg (args_copy, guint); + arg1 = (guint) va_arg (args_copy, guint); + arg2 = (guint) va_arg (args_copy, guint); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__UINT_UINT_UINT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + arg2, + data2); + +} + +/* VOID:VARIANT,BOXED */ +void +_g_cclosure_marshal_VOID__VARIANT_BOXED (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__VARIANT_BOXED) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__VARIANT_BOXED callback; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__VARIANT_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_variant (param_values + 1), + g_marshal_value_peek_boxed (param_values + 2), + data2); +} + +void +_g_cclosure_marshal_VOID__VARIANT_BOXEDv (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types) +{ + typedef void (*GMarshalFunc_VOID__VARIANT_BOXED) (gpointer data1, + gpointer arg1, + gpointer arg2, + gpointer data2); + GCClosure *cc = (GCClosure *) closure; + gpointer data1, data2; + GMarshalFunc_VOID__VARIANT_BOXED callback; + gpointer arg0; + gpointer arg1; + va_list args_copy; + + G_VA_COPY (args_copy, args); + arg0 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + arg0 = g_variant_ref_sink (arg0); + arg1 = (gpointer) va_arg (args_copy, gpointer); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + arg1 = g_boxed_copy (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); + va_end (args_copy); + + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = instance; + } + else + { + data1 = instance; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__VARIANT_BOXED) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + arg0, + arg1, + data2); + if ((param_types[0] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg0 != NULL) + g_variant_unref (arg0); + if ((param_types[1] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && arg1 != NULL) + g_boxed_free (param_types[1] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg1); +} + diff --git a/gio/gmarshal-internal.h b/gio/gmarshal-internal.h new file mode 100644 index 000000000..ec5c3e877 --- /dev/null +++ b/gio/gmarshal-internal.h @@ -0,0 +1,503 @@ +/* GObject - GLib Type, Object, Parameter and Signal Library + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#ifndef ___G_CCLOSURE_MARSHAL_MARSHAL_H__ +#define ___G_CCLOSURE_MARSHAL_MARSHAL_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +/* BOOLEAN:OBJECT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* BOOLEAN:OBJECT,FLAGS */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__OBJECT_FLAGS (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__OBJECT_FLAGSv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* BOOLEAN:OBJECT,OBJECT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__OBJECT_OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__OBJECT_OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* BOOLEAN:POINTER,INT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__POINTER_INT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__POINTER_INTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* BOOLEAN:STRING */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__STRING (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__STRINGv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* BOOLEAN:UINT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__UINT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__UINTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* BOOLEAN:VOID */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__VOID (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_BOOLEAN__VOIDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* INT:BOXED */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_INT__BOXED (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_INT__BOXEDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* INT:OBJECT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_INT__OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_INT__OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:BOOLEAN,BOXED */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__BOOLEAN_BOXED (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__BOOLEAN_BOXEDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:ENUM,OBJECT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__ENUM_OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__ENUM_OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:ENUM,OBJECT,OBJECT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__ENUM_OBJECT_OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__ENUM_OBJECT_OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:INT,INT,INT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__INT_INT_INT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__INT_INT_INTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:OBJECT,OBJECT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:OBJECT,OBJECT,ENUM */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_OBJECT_ENUMv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:OBJECT,OBJECT,STRING,STRING,VARIANT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_OBJECT_STRING_STRING_VARIANTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:OBJECT,OBJECT,VARIANT,BOXED */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_OBJECT_VARIANT_BOXED (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_OBJECT_VARIANT_BOXEDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:OBJECT,VARIANT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_VARIANT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__OBJECT_VARIANTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:POINTER,INT,STRING */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__POINTER_INT_STRING (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__POINTER_INT_STRINGv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:STRING,BOOLEAN */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_BOOLEAN (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_BOOLEANv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:STRING,BOXED */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_BOXED (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_BOXEDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:STRING,BOXED,BOXED */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_BOXED_BOXED (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_BOXED_BOXEDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:STRING,INT64,INT64 */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_INT64_INT64 (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_INT64_INT64v (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:STRING,STRING,STRING,FLAGS */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_STRING_STRING_FLAGS (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_STRING_STRING_FLAGSv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:STRING,STRING,VARIANT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_STRING_VARIANT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_STRING_VARIANTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:STRING,VARIANT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_VARIANT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__STRING_VARIANTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:UINT,UINT,UINT */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__UINT_UINT_UINT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__UINT_UINT_UINTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:VARIANT,BOXED */ +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__VARIANT_BOXED (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +G_GNUC_INTERNAL +void _g_cclosure_marshal_VOID__VARIANT_BOXEDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + + +G_END_DECLS + +#endif /* ___G_CCLOSURE_MARSHAL_MARSHAL_H__ */ diff --git a/gio/gmarshal-internal.list b/gio/gmarshal-internal.list new file mode 100644 index 000000000..925ae4265 --- /dev/null +++ b/gio/gmarshal-internal.list @@ -0,0 +1,28 @@ +BOOLEAN:OBJECT +BOOLEAN:OBJECT,FLAGS +BOOLEAN:OBJECT,OBJECT +BOOLEAN:POINTER,INT +BOOLEAN:STRING +BOOLEAN:UINT +BOOLEAN:VOID +INT:BOXED +INT:OBJECT +VOID:BOOLEAN,BOXED +VOID:ENUM,OBJECT +VOID:ENUM,OBJECT,OBJECT +VOID:INT,INT,INT +VOID:OBJECT,OBJECT +VOID:OBJECT,OBJECT,ENUM +VOID:OBJECT,OBJECT,STRING,STRING,VARIANT +VOID:OBJECT,OBJECT,VARIANT,BOXED +VOID:OBJECT,VARIANT +VOID:POINTER,INT,STRING +VOID:STRING,BOOLEAN +VOID:STRING,BOXED +VOID:STRING,BOXED,BOXED +VOID:STRING,INT64,INT64 +VOID:STRING,STRING,STRING,FLAGS +VOID:STRING,STRING,VARIANT +VOID:STRING,VARIANT +VOID:UINT,UINT,UINT +VOID:VARIANT,BOXED diff --git a/gio/gmenumodel.c b/gio/gmenumodel.c index f4d7fcae5..8ca45e098 100644 --- a/gio/gmenumodel.c +++ b/gio/gmenumodel.c @@ -22,6 +22,7 @@ #include "gmenumodel.h" #include "glibintl.h" +#include "gmarshal-internal.h" /** * SECTION:gmenumodel @@ -452,8 +453,12 @@ g_menu_model_class_init (GMenuModelClass *class) g_menu_model_items_changed_signal = g_signal_new (I_("items-changed"), G_TYPE_MENU_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_generic, G_TYPE_NONE, + _g_cclosure_marshal_VOID__INT_INT_INT, + G_TYPE_NONE, 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); + g_signal_set_va_marshaller (g_menu_model_items_changed_signal, + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_VOID__INT_INT_INTv); } /** diff --git a/gio/gmount.c b/gio/gmount.c index dad4b8513..55caaa6bd 100644 --- a/gio/gmount.c +++ b/gio/gmount.c @@ -78,7 +78,7 @@ g_mount_default_init (GMountInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GMountIface, changed), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); /** @@ -95,7 +95,7 @@ g_mount_default_init (GMountInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GMountIface, unmounted), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); /** * GMount::pre-unmount: @@ -114,7 +114,7 @@ g_mount_default_init (GMountInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GMountIface, pre_unmount), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); } diff --git a/gio/gmountoperation.c b/gio/gmountoperation.c index 76a5024ff..39762e51d 100644 --- a/gio/gmountoperation.c +++ b/gio/gmountoperation.c @@ -25,6 +25,7 @@ #include "gmountoperation.h" #include "gioenumtypes.h" #include "glibintl.h" +#include "gmarshal-internal.h" /** @@ -321,9 +322,12 @@ g_mount_operation_class_init (GMountOperationClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GMountOperationClass, ask_password), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__STRING_STRING_STRING_FLAGS, G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ASK_PASSWORD_FLAGS); + g_signal_set_va_marshaller (signals[ASK_PASSWORD], + G_TYPE_FROM_CLASS (object_class), + _g_cclosure_marshal_VOID__STRING_STRING_STRING_FLAGSv); /** * GMountOperation::ask-question: @@ -344,9 +348,12 @@ g_mount_operation_class_init (GMountOperationClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GMountOperationClass, ask_question), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__STRING_BOXED, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRV); + g_signal_set_va_marshaller (signals[ASK_QUESTION], + G_TYPE_FROM_CLASS (object_class), + _g_cclosure_marshal_VOID__STRING_BOXEDv); /** * GMountOperation::reply: @@ -361,7 +368,7 @@ g_mount_operation_class_init (GMountOperationClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GMountOperationClass, reply), NULL, NULL, - g_cclosure_marshal_VOID__ENUM, + NULL, G_TYPE_NONE, 1, G_TYPE_MOUNT_OPERATION_RESULT); @@ -382,7 +389,7 @@ g_mount_operation_class_init (GMountOperationClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GMountOperationClass, aborted), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); /** @@ -414,9 +421,12 @@ g_mount_operation_class_init (GMountOperationClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GMountOperationClass, show_processes), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__STRING_BOXED_BOXED, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_ARRAY, G_TYPE_STRV); + g_signal_set_va_marshaller (signals[SHOW_PROCESSES], + G_TYPE_FROM_CLASS (object_class), + _g_cclosure_marshal_VOID__STRING_BOXED_BOXEDv); /** * GMountOperation::show-unmount-progress: @@ -452,9 +462,13 @@ g_mount_operation_class_init (GMountOperationClass *klass) G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GMountOperationClass, show_unmount_progress), - NULL, NULL, NULL, + NULL, NULL, + _g_cclosure_marshal_VOID__STRING_INT64_INT64, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_INT64, G_TYPE_INT64); + g_signal_set_va_marshaller (signals[SHOW_UNMOUNT_PROGRESS], + G_TYPE_FROM_CLASS (object_class), + _g_cclosure_marshal_VOID__STRING_INT64_INT64v); /** * GMountOperation:username: diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c index 4d8d74bd4..f12f93585 100644 --- a/gio/gnetworkaddress.c +++ b/gio/gnetworkaddress.c @@ -224,7 +224,7 @@ g_network_address_get_property (GObject *object, } -/** +/* * inet_addresses_to_inet_socket_addresses: * @addresses: (transfer full): #GList of #GInetAddress * @@ -1261,13 +1261,8 @@ got_ipv6_addresses (GObject *source_object, */ if (error != NULL && !addr_enum->last_error && (addr_enum->state & RESOLVE_STATE_WAITING_ON_IPV4)) { + /* ipv6 lookup failed, but ipv4 is still outstanding. wait. */ addr_enum->last_error = g_steal_pointer (&error); - - addr_enum->wait_source = g_timeout_source_new (HAPPY_EYEBALLS_RESOLUTION_DELAY_MS); - g_source_set_callback (addr_enum->wait_source, - on_address_timeout, - addr_enum, NULL); - g_source_attach (addr_enum->wait_source, addr_enum->context); } else if (addr_enum->waiting_task != NULL) { diff --git a/gio/gnetworkmonitor.c b/gio/gnetworkmonitor.c index 657c7047a..d65fc2bc4 100644 --- a/gio/gnetworkmonitor.c +++ b/gio/gnetworkmonitor.c @@ -321,7 +321,7 @@ g_network_monitor_default_init (GNetworkMonitorInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GNetworkMonitorInterface, network_changed), NULL, NULL, - g_cclosure_marshal_VOID__BOOLEAN, + NULL, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); diff --git a/gio/gnetworkmonitornm.c b/gio/gnetworkmonitornm.c index 7bb480f54..9013fd49c 100644 --- a/gio/gnetworkmonitornm.c +++ b/gio/gnetworkmonitornm.c @@ -196,7 +196,7 @@ sync_properties (GNetworkMonitorNM *nm, } else if (nm_state <= NM_STATE_CONNECTED_SITE) { - new_network_available = FALSE; + new_network_available = TRUE; new_network_metered = FALSE; if (nm_connectivity == NM_CONNECTIVITY_PORTAL) { diff --git a/gio/gopenuriportal.c b/gio/gopenuriportal.c index b798d7cd1..be68569ed 100644 --- a/gio/gopenuriportal.c +++ b/gio/gopenuriportal.c @@ -279,7 +279,7 @@ g_openuri_portal_open_uri_async (const char *uri, if (sender[i] == '.') sender[i] = '_'; - handle = g_strdup_printf ("/org/fredesktop/portal/desktop/request/%s/%s", sender, token); + handle = g_strdup_printf ("/org/freedesktop/portal/desktop/request/%s/%s", sender, token); g_object_set_data_full (G_OBJECT (task), "handle", handle, g_free); g_free (sender); diff --git a/gio/gosxcontenttype.m b/gio/gosxcontenttype.m index 52ba5763a..6119bbcae 100644 --- a/gio/gosxcontenttype.m +++ b/gio/gosxcontenttype.m @@ -100,6 +100,21 @@ create_cstr_from_cfstring_with_fallback (CFStringRef str, return cstr; } +/*< private >*/ +void +g_content_type_set_mime_dirs (const gchar * const *dirs) +{ + /* noop on macOS */ +} + +/*< private >*/ +const gchar * const * +g_content_type_get_mime_dirs (void) +{ + const gchar * const *mime_dirs = { NULL }; + return mime_dirs; +} + gboolean g_content_type_equals (const gchar *type1, const gchar *type2) diff --git a/gio/gportalsupport.c b/gio/gportalsupport.c index 2f1e82517..b0a94b360 100644 --- a/gio/gportalsupport.c +++ b/gio/gportalsupport.c @@ -23,6 +23,7 @@ static gboolean flatpak_info_read; static gboolean use_portal; static gboolean network_available; +static gboolean dconf_access; static void read_flatpak_info (void) @@ -40,11 +41,13 @@ read_flatpak_info (void) use_portal = TRUE; network_available = FALSE; + dconf_access = FALSE; keyfile = g_key_file_new (); if (g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, NULL)) { char **shared = NULL; + char *dconf_policy = NULL; shared = g_key_file_get_string_list (keyfile, "Context", "shared", NULL, NULL); if (shared) @@ -52,6 +55,14 @@ read_flatpak_info (void) network_available = g_strv_contains ((const char * const *)shared, "network"); g_strfreev (shared); } + + dconf_policy = g_key_file_get_string (keyfile, "Session Bus Policy", "ca.desrt.dconf", NULL); + if (dconf_policy) + { + if (strcmp (dconf_policy, "talk") == 0) + dconf_access = TRUE; + g_free (dconf_policy); + } } g_key_file_unref (keyfile); @@ -64,6 +75,7 @@ read_flatpak_info (void) if (var && var[0] == '1') use_portal = TRUE; network_available = TRUE; + dconf_access = TRUE; } } @@ -81,3 +93,9 @@ glib_network_available_in_sandbox (void) return network_available; } +gboolean +glib_has_dconf_access_in_sandbox (void) +{ + read_flatpak_info (); + return dconf_access; +} diff --git a/gio/gportalsupport.h b/gio/gportalsupport.h index a331f45d3..746f1fd6b 100644 --- a/gio/gportalsupport.h +++ b/gio/gportalsupport.h @@ -24,6 +24,7 @@ G_BEGIN_DECLS gboolean glib_should_use_portal (void); gboolean glib_network_available_in_sandbox (void); +gboolean glib_has_dconf_access_in_sandbox (void); G_END_DECLS diff --git a/gio/gpropertyaction.c b/gio/gpropertyaction.c index c1ce813ae..9ce9ab52e 100644 --- a/gio/gpropertyaction.c +++ b/gio/gpropertyaction.c @@ -158,6 +158,29 @@ g_property_action_get_state_type (GAction *action) static GVariant * g_property_action_get_state_hint (GAction *action) { + GPropertyAction *paction = G_PROPERTY_ACTION (action); + + if (paction->pspec->value_type == G_TYPE_INT) + { + GParamSpecInt *pspec = (GParamSpecInt *)paction->pspec; + return g_variant_new ("(ii)", pspec->minimum, pspec->maximum); + } + else if (paction->pspec->value_type == G_TYPE_UINT) + { + GParamSpecUInt *pspec = (GParamSpecUInt *)paction->pspec; + return g_variant_new ("(uu)", pspec->minimum, pspec->maximum); + } + else if (paction->pspec->value_type == G_TYPE_FLOAT) + { + GParamSpecFloat *pspec = (GParamSpecFloat *)paction->pspec; + return g_variant_new ("(dd)", (double)pspec->minimum, (double)pspec->maximum); + } + else if (paction->pspec->value_type == G_TYPE_DOUBLE) + { + GParamSpecDouble *pspec = (GParamSpecDouble *)paction->pspec; + return g_variant_new ("(dd)", pspec->minimum, pspec->maximum); + } + return NULL; } diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c index 70d391a32..26de2518c 100644 --- a/gio/gregistrysettingsbackend.c +++ b/gio/gregistrysettingsbackend.c @@ -408,7 +408,7 @@ registry_cache_add_item (GNode *parent, item->block_count = 0; item->readable = FALSE; - trace ("\treg cache: adding %s to %s\n", + trace ("\tregistry cache: adding %s to %s\n", name, ((RegistryCacheItem *)parent->data)->name); cache_node = g_node_new (item); diff --git a/gio/gresolver.c b/gio/gresolver.c index 3e61ccaff..732d21709 100644 --- a/gio/gresolver.c +++ b/gio/gresolver.c @@ -169,7 +169,7 @@ g_resolver_class_init (GResolverClass *resolver_class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GResolverClass, reload), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); } diff --git a/gio/gresource-tool.c b/gio/gresource-tool.c index d1de02631..1914c5228 100644 --- a/gio/gresource-tool.c +++ b/gio/gresource-tool.c @@ -41,9 +41,7 @@ #include <glib/gstdio.h> #include <gi18n.h> -#ifdef G_OS_WIN32 #include "glib/glib-private.h" -#endif #if defined(HAVE_LIBELF) && defined(HAVE_MMAP) #define USE_LIBELF @@ -610,7 +608,7 @@ main (int argc, char *argv[]) gchar *tmp; #endif - setlocale (LC_ALL, ""); + setlocale (LC_ALL, GLIB_DEFAULT_LOCALE); textdomain (GETTEXT_PACKAGE); #ifdef G_OS_WIN32 diff --git a/gio/gresource.c b/gio/gresource.c index 9aaae8b53..cdcb1ac3f 100644 --- a/gio/gresource.c +++ b/gio/gresource.c @@ -78,7 +78,7 @@ G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref) * * `to-pixdata` which will use the gdk-pixbuf-pixdata command to convert * images to the GdkPixdata format, which allows you to create pixbufs directly using the data inside - * the resource file, rather than an (uncompressed) copy if it. For this, the gdk-pixbuf-pixdata + * the resource file, rather than an (uncompressed) copy of it. For this, the gdk-pixbuf-pixdata * program must be in the PATH, or the `GDK_PIXBUF_PIXDATA` environment variable must be * set to the full path to the gdk-pixbuf-pixdata executable; otherwise the resource compiler will * abort. diff --git a/gio/gsettings-tool.c b/gio/gsettings-tool.c index b7dd9d8fb..3096f9d9b 100644 --- a/gio/gsettings-tool.c +++ b/gio/gsettings-tool.c @@ -25,9 +25,7 @@ #include <string.h> #include <stdlib.h> -#ifdef G_OS_WIN32 #include "glib/glib-private.h" -#endif static GSettingsSchemaSource *global_schema_source; static GSettings *global_settings; @@ -743,7 +741,7 @@ main (int argc, char **argv) gchar *tmp; #endif - setlocale (LC_ALL, ""); + setlocale (LC_ALL, GLIB_DEFAULT_LOCALE); textdomain (GETTEXT_PACKAGE); #ifdef G_OS_WIN32 diff --git a/gio/gsettings.c b/gio/gsettings.c index dd8f94485..6272cce51 100644 --- a/gio/gsettings.c +++ b/gio/gsettings.c @@ -30,6 +30,7 @@ #include "gsettings-mapping.h" #include "gsettingsschema-internal.h" #include "gaction.h" +#include "gmarshal-internal.h" #include "strinfo.c" @@ -743,7 +744,7 @@ g_settings_class_init (GSettingsClass *class) g_signal_new (I_("changed"), G_TYPE_SETTINGS, G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (GSettingsClass, changed), - NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, + NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE); /** @@ -777,8 +778,11 @@ g_settings_class_init (GSettingsClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GSettingsClass, change_event), g_signal_accumulator_true_handled, NULL, - NULL, + _g_cclosure_marshal_BOOLEAN__POINTER_INT, G_TYPE_BOOLEAN, 2, G_TYPE_POINTER, G_TYPE_INT); + g_signal_set_va_marshaller (g_settings_signals[SIGNAL_CHANGE_EVENT], + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_BOOLEAN__POINTER_INTv); /** * GSettings::writable-changed: @@ -797,7 +801,7 @@ g_settings_class_init (GSettingsClass *class) g_signal_new (I_("writable-changed"), G_TYPE_SETTINGS, G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (GSettingsClass, writable_changed), - NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, + NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE); /** @@ -832,7 +836,11 @@ g_settings_class_init (GSettingsClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GSettingsClass, writable_change_event), g_signal_accumulator_true_handled, NULL, - NULL, G_TYPE_BOOLEAN, 1, G_TYPE_UINT); + _g_cclosure_marshal_BOOLEAN__UINT, + G_TYPE_BOOLEAN, 1, G_TYPE_UINT); + g_signal_set_va_marshaller (g_settings_signals[SIGNAL_WRITABLE_CHANGE_EVENT], + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_BOOLEAN__UINTv); /** * GSettings:backend: @@ -2336,7 +2344,7 @@ g_settings_get_has_unapplied (GSettings *settings) * Resets @key to its default value. * * This call resets the key, as much as possible, to its default value. - * That might the value specified in the schema or the one set by the + * That might be the value specified in the schema or the one set by the * administrator. **/ void @@ -2459,7 +2467,9 @@ g_settings_get_child (GSettings *settings, * You should free the return value with g_strfreev() when you are done * with it. * - * Returns: (transfer full) (element-type utf8): a list of the keys on @settings + * Returns: (transfer full) (element-type utf8): a list of the keys on + * @settings, in no defined order + * Deprecated: 2.46: Use g_settings_schema_list_keys instead(). */ gchar ** g_settings_list_keys (GSettings *settings) @@ -2483,7 +2493,8 @@ g_settings_list_keys (GSettings *settings) * You should free the return value with g_strfreev() when you are done * with it. * - * Returns: (transfer full) (element-type utf8): a list of the children on @settings + * Returns: (transfer full) (element-type utf8): a list of the children on + * @settings, in no defined order */ gchar ** g_settings_list_children (GSettings *settings) diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c index f7c50c210..3a60b8c64 100644 --- a/gio/gsettingsschema.c +++ b/gio/gsettingsschema.c @@ -742,9 +742,9 @@ g_settings_schema_source_get_text_tables (GSettingsSchemaSource *source) * @source: a #GSettingsSchemaSource * @recursive: if we should recurse * @non_relocatable: (out) (transfer full) (array zero-terminated=1): the - * list of non-relocatable schemas + * list of non-relocatable schemas, in no defined order * @relocatable: (out) (transfer full) (array zero-terminated=1): the list - * of relocatable schemas + * of relocatable schemas, in no defined order * * Lists the schemas in a given source. * @@ -857,8 +857,8 @@ ensure_schema_lists (void) * Deprecated. * * Returns: (element-type utf8) (transfer none): a list of #GSettings - * schemas that are available. The list must not be modified or - * freed. + * schemas that are available, in no defined order. The list must not be + * modified or freed. * * Since: 2.26 * @@ -881,8 +881,8 @@ g_settings_list_schemas (void) * Deprecated. * * Returns: (element-type utf8) (transfer none): a list of relocatable - * #GSettings schemas that are available. The list must not be - * modified or freed. + * #GSettings schemas that are available, in no defined order. The list must + * not be modified or freed. * * Since: 2.28 * @@ -1035,7 +1035,8 @@ g_settings_schema_has_key (GSettingsSchema *schema, * You should free the return value with g_strfreev() when you are done * with it. * - * Returns: (transfer full) (element-type utf8): a list of the children on @settings + * Returns: (transfer full) (element-type utf8): a list of the children on + * @settings, in no defined order * * Since: 2.44 */ @@ -1080,7 +1081,7 @@ g_settings_schema_list_children (GSettingsSchema *schema) * function is intended for introspection reasons. * * Returns: (transfer full) (element-type utf8): a list of the keys on - * @schema + * @schema, in no defined order * * Since: 2.46 */ diff --git a/gio/gsimpleaction.c b/gio/gsimpleaction.c index c788252bb..499adb25a 100644 --- a/gio/gsimpleaction.c +++ b/gio/gsimpleaction.c @@ -395,7 +395,7 @@ g_simple_action_class_init (GSimpleActionClass *class) G_TYPE_SIMPLE_ACTION, G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT, 0, NULL, NULL, - g_cclosure_marshal_VOID__VARIANT, + NULL, G_TYPE_NONE, 1, G_TYPE_VARIANT); @@ -445,7 +445,7 @@ g_simple_action_class_init (GSimpleActionClass *class) G_TYPE_SIMPLE_ACTION, G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT, 0, NULL, NULL, - g_cclosure_marshal_VOID__VARIANT, + NULL, G_TYPE_NONE, 1, G_TYPE_VARIANT); diff --git a/gio/gsocket.c b/gio/gsocket.c index 06514d102..66073af83 100644 --- a/gio/gsocket.c +++ b/gio/gsocket.c @@ -74,6 +74,7 @@ #include "gcredentials.h" #include "gcredentialsprivate.h" #include "glibintl.h" +#include "gioprivate.h" #ifdef G_OS_WIN32 /* For Windows XP runtime compatibility, but use the system's if_nametoindex() if available */ @@ -2161,6 +2162,122 @@ g_socket_bind (GSocket *socket, return TRUE; } +#ifdef G_OS_WIN32 +static gulong +g_socket_w32_get_adapter_ipv4_addr (const gchar *name_or_ip) +{ + ULONG bufsize = 15000; /* MS-recommended initial bufsize */ + DWORD ret = ERROR_BUFFER_OVERFLOW; + unsigned int malloc_iterations = 0; + PIP_ADAPTER_ADDRESSES addr_buf = NULL, eth_adapter; + wchar_t *wchar_name_or_ip = NULL; + gulong ip_result; + NET_IFINDEX if_index; + + /* + * For Windows OS only - return adapter IPv4 address in network byte order. + * + * Input string can be either friendly name of adapter, IP address of adapter, + * indextoname, or fullname of adapter. + * Example: + * 192.168.1.109 ===> IP address given directly, + * convert directly with inet_addr() function + * Wi-Fi ===> Adapter friendly name "Wi-Fi", + * scan with GetAdapterAddresses and adapter->FriendlyName + * ethernet_32774 ===> Adapter name as returned by if_indextoname + * {33E8F5CD-BAEA-4214-BE13-B79AB8080CAB} ===> Adaptername, + * as returned in GetAdapterAddresses and adapter->AdapterName + */ + + /* Step 1: Check if string is an IP address: */ + ip_result = inet_addr (name_or_ip); + if (ip_result != INADDR_NONE) + return ip_result; /* Success, IP address string was given directly */ + + /* + * Step 2: Check if name represents a valid Interface index (e.g. ethernet_75521) + * function if_nametoindex will return >=1 if a valid index, or 0=no match + * valid index will be used later in GetAdaptersAddress loop for lookup of adapter IP address + */ + if_index = if_nametoindex (name_or_ip); + + /* Step 3: Prepare wchar string for friendly name comparision */ + if (if_index == 0) + { + size_t if_name_len = strlen (name_or_ip); + if (if_name_len >= MAX_ADAPTER_NAME_LENGTH + 4) + return INADDR_NONE; + /* Name-check only needed if index=0... */ + wchar_name_or_ip = (wchar_t *) g_try_malloc ((if_name_len + 1) * sizeof(wchar_t)); + if (wchar_name_or_ip) + mbstowcs (wchar_name_or_ip, name_or_ip, if_name_len + 1); + /* NOTE: Even if malloc fails here, some comparisions can still be done later... so no exit here! */ + } + + /* + * Step 4: Allocate memory and get adapter addresses. + * Buffer allocation loop recommended by MS, since size can be dynamic + * https://docs.microsoft.com/en-us/windows/desktop/api/iphlpapi/nf-iphlpapi-getadaptersaddresses + */ + #define MAX_ALLOC_ITERATIONS 3 + do + { + malloc_iterations++; + addr_buf = (PIP_ADAPTER_ADDRESSES) g_try_realloc (addr_buf, bufsize); + if (addr_buf) + ret = GetAdaptersAddresses (AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, addr_buf, &bufsize); + } + while (addr_buf && + ret == ERROR_BUFFER_OVERFLOW && + malloc_iterations < MAX_ALLOC_ITERATIONS); + #undef MAX_ALLOC_ITERATIONS + + if (addr_buf == 0 || ret != NO_ERROR) + { + g_free (addr_buf); + g_free (wchar_name_or_ip); + return INADDR_NONE; + } + + /* Step 5: Loop through adapters and check match for index or name */ + for (eth_adapter = addr_buf; eth_adapter != NULL; eth_adapter = eth_adapter->Next) + { + /* Check if match for interface index/name: */ + gboolean any_match = (if_index > 0) && (eth_adapter->IfIndex == if_index); + + /* Check if match for friendly name - but only if NO if_index! */ + if (!any_match && if_index == 0 && eth_adapter->FriendlyName && + eth_adapter->FriendlyName[0] != 0 && wchar_name_or_ip != NULL) + any_match = (_wcsicmp (eth_adapter->FriendlyName, wchar_name_or_ip) == 0); + + /* Check if match for adapter low level name - but only if NO if_index: */ + if (!any_match && if_index == 0 && eth_adapter->AdapterName && + eth_adapter->AdapterName[0] != 0) + any_match = (stricmp (eth_adapter->AdapterName, name_or_ip) == 0); + + if (any_match) + { + /* We have match for this adapter, lets get its local unicast IP address! */ + PIP_ADAPTER_UNICAST_ADDRESS uni_addr; + for (uni_addr = eth_adapter->FirstUnicastAddress; + uni_addr != NULL; uni_addr = uni_addr->Next) + { + if (uni_addr->Address.lpSockaddr->sa_family == AF_INET) + { + ip_result = ((PSOCKADDR_IN) uni_addr->Address.lpSockaddr)->sin_addr.S_un.S_addr; + break; /* finished, exit unicast addr loop */ + } + } + } + } + + g_free (addr_buf); + g_free (wchar_name_or_ip); + + return ip_result; +} +#endif + static gboolean g_socket_multicast_group_operation (GSocket *socket, GInetAddress *group, @@ -2198,7 +2315,7 @@ g_socket_multicast_group_operation (GSocket *socket, mc_req.imr_ifindex = 0; /* Pick any. */ #elif defined(G_OS_WIN32) if (iface) - mc_req.imr_interface.s_addr = g_htonl (if_nametoindex (iface)); + mc_req.imr_interface.s_addr = g_socket_w32_get_adapter_ipv4_addr (iface); else mc_req.imr_interface.s_addr = g_htonl (INADDR_ANY); #else @@ -2397,18 +2514,8 @@ g_socket_multicast_group_operation_ssm (GSocket *socket, if (iface) { -#if defined(G_OS_WIN32) && defined (HAVE_IF_NAMETOINDEX) - guint iface_index = if_nametoindex (iface); - if (iface_index == 0) - { - int errsv = errno; - - g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv), - _("Interface not found: %s"), g_strerror (errsv)); - return FALSE; - } - /* (0.0.0.iface_index) only works on Windows. */ - S_ADDR_FIELD(mc_req_src) = g_htonl (iface_index); +#if defined(G_OS_WIN32) + S_ADDR_FIELD(mc_req_src) = g_socket_w32_get_adapter_ipv4_addr (iface); #elif defined (HAVE_SIOCGIFADDR) int ret; struct ifreq ifr; @@ -4960,14 +5067,11 @@ g_socket_send_messages_with_timeout (GSocket *socket, struct mmsghdr *msgvec; gint i, num_sent; -#ifdef UIO_MAXIOV -#define MAX_NUM_MESSAGES UIO_MAXIOV -#else -#define MAX_NUM_MESSAGES 1024 -#endif - - if (num_messages > MAX_NUM_MESSAGES) - num_messages = MAX_NUM_MESSAGES; + /* Clamp the number of vectors if more given than we can write in one go. + * The caller has to handle short writes anyway. + */ + if (num_messages > G_IOV_MAX) + num_messages = G_IOV_MAX; msgvec = g_newa (struct mmsghdr, num_messages); @@ -5482,14 +5586,11 @@ g_socket_receive_messages_with_timeout (GSocket *socket, struct mmsghdr *msgvec; guint i, num_received; -#ifdef UIO_MAXIOV -#define MAX_NUM_MESSAGES UIO_MAXIOV -#else -#define MAX_NUM_MESSAGES 1024 -#endif - - if (num_messages > MAX_NUM_MESSAGES) - num_messages = MAX_NUM_MESSAGES; + /* Clamp the number of vectors if more given than we can write in one go. + * The caller has to handle short writes anyway. + */ + if (num_messages > G_IOV_MAX) + num_messages = G_IOV_MAX; msgvec = g_newa (struct mmsghdr, num_messages); @@ -5755,6 +5856,13 @@ g_socket_receive_message (GSocket *socket, * the %G_IO_ERROR_NOT_SUPPORTED error. On Linux this is implemented * by reading the %SO_PEERCRED option on the underlying socket. * + * This method can be expected to be available on the following platforms: + * + * - Linux since GLib 2.26 + * - OpenBSD since GLib 2.30 + * - Solaris, Illumos and OpenSolaris since GLib 2.40 + * - NetBSD since GLib 2.42 + * * Other ways to obtain credentials from a foreign peer includes the * #GUnixCredentialsMessage type and * g_unix_connection_send_credentials() / diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c index 59af25abf..6adeee299 100644 --- a/gio/gsocketclient.c +++ b/gio/gsocketclient.c @@ -49,6 +49,7 @@ #include <gio/gtlsclientconnection.h> #include <gio/ginetaddress.h> #include "glibintl.h" +#include "gmarshal-internal.h" /* As recommended by RFC 8305 this is the time it waits * on a connection before starting another concurrent attempt. @@ -832,11 +833,14 @@ g_socket_client_class_init (GSocketClientClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GSocketClientClass, event), NULL, NULL, - NULL, + _g_cclosure_marshal_VOID__ENUM_OBJECT_OBJECT, G_TYPE_NONE, 3, G_TYPE_SOCKET_CLIENT_EVENT, G_TYPE_SOCKET_CONNECTABLE, G_TYPE_IO_STREAM); + g_signal_set_va_marshaller (signals[EVENT], + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_VOID__ENUM_OBJECT_OBJECTv); g_object_class_install_property (gobject_class, PROP_FAMILY, g_param_spec_enum ("family", diff --git a/gio/gsocketlistener.c b/gio/gsocketlistener.c index a2c879d9c..d11f10ae4 100644 --- a/gio/gsocketlistener.c +++ b/gio/gsocketlistener.c @@ -36,6 +36,7 @@ #include <gio/gsocketconnection.h> #include <gio/ginetsocketaddress.h> #include "glibintl.h" +#include "gmarshal-internal.h" /** @@ -181,10 +182,14 @@ g_socket_listener_class_init (GSocketListenerClass *klass) G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GSocketListenerClass, event), - NULL, NULL, NULL, + NULL, NULL, + _g_cclosure_marshal_VOID__ENUM_OBJECT, G_TYPE_NONE, 2, G_TYPE_SOCKET_LISTENER_EVENT, G_TYPE_SOCKET); + g_signal_set_va_marshaller (signals[EVENT], + G_TYPE_FROM_CLASS (gobject_class), + _g_cclosure_marshal_VOID__ENUM_OBJECTv); source_quark = g_quark_from_static_string ("g-socket-listener-source"); } @@ -965,7 +970,9 @@ g_socket_listener_accept_finish (GSocketListener *listener, * @listener: a #GSocketListener * @listen_backlog: an integer * - * Sets the listen backlog on the sockets in the listener. + * Sets the listen backlog on the sockets in the listener. This must be called + * before adding any sockets, addresses or ports to the #GSocketListener (for + * example, by calling g_socket_listener_add_inet_port()) to be effective. * * See g_socket_set_listen_backlog() for details * diff --git a/gio/gsocketoutputstream.c b/gio/gsocketoutputstream.c index fcca56efc..482ee39b9 100644 --- a/gio/gsocketoutputstream.c +++ b/gio/gsocketoutputstream.c @@ -33,6 +33,7 @@ #include "gioerror.h" #include "glibintl.h" #include "gfiledescriptorbased.h" +#include "gioprivate.h" struct _GSocketOutputStreamPrivate { @@ -146,8 +147,8 @@ g_socket_output_stream_writev (GOutputStream *stream, /* Clamp the number of vectors if more given than we can write in one go. * The caller has to handle short writes anyway. */ - if (n_vectors > G_MAXINT) - n_vectors = G_MAXINT; + if (n_vectors > G_IOV_MAX) + n_vectors = G_IOV_MAX; res = g_socket_send_message_with_timeout (output_stream->priv->socket, NULL, vectors, n_vectors, @@ -194,8 +195,8 @@ g_socket_output_stream_pollable_writev_nonblocking (GPollableOutputStream *poll /* Clamp the number of vectors if more given than we can write in one go. * The caller has to handle short writes anyway. */ - if (n_vectors > G_MAXINT) - n_vectors = G_MAXINT; + if (n_vectors > G_IOV_MAX) + n_vectors = G_IOV_MAX; return g_socket_send_message_with_timeout (output_stream->priv->socket, NULL, vectors, n_vectors, diff --git a/gio/gsocketservice.c b/gio/gsocketservice.c index 1ac31d505..176c122eb 100644 --- a/gio/gsocketservice.c +++ b/gio/gsocketservice.c @@ -64,6 +64,7 @@ #include "gsocketlistener.h" #include "gsocketconnection.h" #include "glibintl.h" +#include "gmarshal-internal.h" struct _GSocketServicePrivate { @@ -346,8 +347,12 @@ g_socket_service_class_init (GSocketServiceClass *class) g_signal_new (I_("incoming"), G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GSocketServiceClass, incoming), g_signal_accumulator_true_handled, NULL, - NULL, G_TYPE_BOOLEAN, + _g_cclosure_marshal_BOOLEAN__OBJECT_OBJECT, + G_TYPE_BOOLEAN, 2, G_TYPE_SOCKET_CONNECTION, G_TYPE_OBJECT); + g_signal_set_va_marshaller (g_socket_service_incoming_signal, + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_BOOLEAN__OBJECT_OBJECTv); /** * GSocketService:active: diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c index 7630c7b45..b5515c705 100644 --- a/gio/gsubprocess.c +++ b/gio/gsubprocess.c @@ -749,6 +749,11 @@ g_subprocess_newv (const gchar * const *argv, * * On UNIX, returns the process ID as a decimal string. * On Windows, returns the result of GetProcessId() also as a string. + * If the subprocess has terminated, this will return %NULL. + * + * Returns: (nullable): the subprocess identifier, or %NULL if the subprocess + * has terminated + * Since: 2.40 */ const gchar * g_subprocess_get_identifier (GSubprocess *subprocess) diff --git a/gio/gtestdbus.c b/gio/gtestdbus.c index 2fc2d51f5..11cf029d9 100644 --- a/gio/gtestdbus.c +++ b/gio/gtestdbus.c @@ -67,15 +67,14 @@ on_weak_notify_timeout (gpointer user_data) } static gboolean -dispose_on_idle (gpointer object) +unref_on_idle (gpointer object) { - g_object_run_dispose (object); g_object_unref (object); return FALSE; } static gboolean -_g_object_dispose_and_wait_weak_notify (gpointer object) +_g_object_unref_and_wait_weak_notify (gpointer object) { WeakNotifyData data; guint timeout_id; @@ -85,9 +84,10 @@ _g_object_dispose_and_wait_weak_notify (gpointer object) g_object_weak_ref (object, (GWeakNotify) g_main_loop_quit, data.loop); - /* Drop the ref in an idle callback, this is to make sure the mainloop - * is already running when weak notify happens */ - g_idle_add (dispose_on_idle, object); + /* Drop the strong ref held by the caller in an idle callback. This is to + * make sure the mainloop is already running when weak notify happens (when + * all other strong ref holders have dropped theirs). */ + g_idle_add (unref_on_idle, object); /* Make sure we don't block forever */ timeout_id = g_timeout_add (30 * 1000, on_weak_notify_timeout, &data); @@ -801,7 +801,7 @@ g_test_dbus_stop (GTestDBus *self) * Stop the session bus started by g_test_dbus_up(). * * This will wait for the singleton returned by g_bus_get() or g_bus_get_sync() - * is destroyed. This is done to ensure that the next unit test won't get a + * to be destroyed. This is done to ensure that the next unit test won't get a * leaked singleton from this test. */ void @@ -820,7 +820,7 @@ g_test_dbus_down (GTestDBus *self) stop_daemon (self); if (connection != NULL) - _g_object_dispose_and_wait_weak_notify (connection); + _g_object_unref_and_wait_weak_notify (connection); g_test_dbus_unset (); _g_bus_forget_singleton (G_BUS_TYPE_SESSION); diff --git a/gio/gthreadedsocketservice.c b/gio/gthreadedsocketservice.c index b330196e3..c48a93424 100644 --- a/gio/gthreadedsocketservice.c +++ b/gio/gthreadedsocketservice.c @@ -48,6 +48,7 @@ #include "gsocketconnection.h" #include "gthreadedsocketservice.h" #include "glibintl.h" +#include "gmarshal-internal.h" struct _GThreadedSocketServicePrivate { @@ -238,8 +239,12 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class) g_signal_new (I_("run"), G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GThreadedSocketServiceClass, run), g_signal_accumulator_true_handled, NULL, - NULL, G_TYPE_BOOLEAN, + _g_cclosure_marshal_BOOLEAN__OBJECT_OBJECT, + G_TYPE_BOOLEAN, 2, G_TYPE_SOCKET_CONNECTION, G_TYPE_OBJECT); + g_signal_set_va_marshaller (g_threaded_socket_service_run_signal, + G_TYPE_FROM_CLASS (class), + _g_cclosure_marshal_BOOLEAN__OBJECT_OBJECTv); g_object_class_install_property (gobject_class, PROP_MAX_THREADS, g_param_spec_int ("max-threads", diff --git a/gio/gtlsconnection.c b/gio/gtlsconnection.c index 02a3098c1..2e431ae7e 100644 --- a/gio/gtlsconnection.c +++ b/gio/gtlsconnection.c @@ -29,6 +29,7 @@ #include "gtlsdatabase.h" #include "gtlsinteraction.h" #include "glibintl.h" +#include "gmarshal-internal.h" /** * SECTION:gtlsconnection @@ -345,10 +346,13 @@ g_tls_connection_class_init (GTlsConnectionClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GTlsConnectionClass, accept_certificate), g_signal_accumulator_true_handled, NULL, - NULL, + _g_cclosure_marshal_BOOLEAN__OBJECT_FLAGS, G_TYPE_BOOLEAN, 2, G_TYPE_TLS_CERTIFICATE, G_TYPE_TLS_CERTIFICATE_FLAGS); + g_signal_set_va_marshaller (signals[ACCEPT_CERTIFICATE], + G_TYPE_FROM_CLASS (klass), + _g_cclosure_marshal_BOOLEAN__OBJECT_FLAGSv); } static void @@ -754,6 +758,7 @@ g_tls_connection_get_require_close_notify (GTlsConnection *conn) * required for compatibility. Also, rehandshaking has been removed * from the TLS protocol in TLS 1.3. */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS void g_tls_connection_set_rehandshake_mode (GTlsConnection *conn, GTlsRehandshakeMode mode) @@ -764,6 +769,7 @@ g_tls_connection_set_rehandshake_mode (GTlsConnection *conn, "rehandshake-mode", mode, NULL); } +G_GNUC_END_IGNORE_DEPRECATIONS /** * g_tls_connection_get_rehandshake_mode: @@ -780,6 +786,7 @@ g_tls_connection_set_rehandshake_mode (GTlsConnection *conn, * required for compatibility. Also, rehandshaking has been removed * from the TLS protocol in TLS 1.3. */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS GTlsRehandshakeMode g_tls_connection_get_rehandshake_mode (GTlsConnection *conn) { @@ -792,6 +799,7 @@ g_tls_connection_get_rehandshake_mode (GTlsConnection *conn) NULL); return mode; } +G_GNUC_END_IGNORE_DEPRECATIONS /** * g_tls_connection_set_advertised_protocols: diff --git a/gio/gtlsconnection.h b/gio/gtlsconnection.h index 39ec3fa02..be38dcf5c 100644 --- a/gio/gtlsconnection.h +++ b/gio/gtlsconnection.h @@ -109,11 +109,13 @@ void g_tls_connection_set_require_close_notify (GTlsConnecti GLIB_AVAILABLE_IN_ALL gboolean g_tls_connection_get_require_close_notify (GTlsConnection *conn); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_DEPRECATED_IN_2_60 void g_tls_connection_set_rehandshake_mode (GTlsConnection *conn, GTlsRehandshakeMode mode); GLIB_DEPRECATED_IN_2_60 GTlsRehandshakeMode g_tls_connection_get_rehandshake_mode (GTlsConnection *conn); +G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_2_60 void g_tls_connection_set_advertised_protocols (GTlsConnection *conn, diff --git a/gio/gunixconnection.c b/gio/gunixconnection.c index c85ac3650..e9e2f75f0 100644 --- a/gio/gunixconnection.c +++ b/gio/gunixconnection.c @@ -300,6 +300,14 @@ gboolean g_unix_connection_create_pair (GUnixCo * byte to the stream, as this is required for credentials passing to * work on some implementations. * + * This method can be expected to be available on the following platforms: + * + * - Linux since GLib 2.26 + * - FreeBSD since GLib 2.26 + * - GNU/kFreeBSD since GLib 2.36 + * - Solaris, Illumos and OpenSolaris since GLib 2.40 + * - GNU/Hurd since GLib 2.40 + * * Other ways to exchange credentials with a foreign peer includes the * #GUnixCredentialsMessage type and g_socket_get_credentials() function. * @@ -450,6 +458,14 @@ g_unix_connection_send_credentials_finish (GUnixConnection *connection, * single byte from the stream, as this is required for credentials * passing to work on some implementations. * + * This method can be expected to be available on the following platforms: + * + * - Linux since GLib 2.26 + * - FreeBSD since GLib 2.26 + * - GNU/kFreeBSD since GLib 2.36 + * - Solaris, Illumos and OpenSolaris since GLib 2.40 + * - GNU/Hurd since GLib 2.40 + * * Other ways to exchange credentials with a foreign peer includes the * #GUnixCredentialsMessage type and g_socket_get_credentials() function. * diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c index 44a4b113d..cf73fe5e0 100644 --- a/gio/gunixmounts.c +++ b/gio/gunixmounts.c @@ -1929,7 +1929,7 @@ g_unix_mount_monitor_class_init (GUnixMountMonitorClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); /** @@ -1944,7 +1944,7 @@ g_unix_mount_monitor_class_init (GUnixMountMonitorClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); } diff --git a/gio/gunixoutputstream.c b/gio/gunixoutputstream.c index 5536e00b4..506e09a8c 100644 --- a/gio/gunixoutputstream.c +++ b/gio/gunixoutputstream.c @@ -37,6 +37,7 @@ #include "gasynchelper.h" #include "gfiledescriptorbased.h" #include "glibintl.h" +#include "gioprivate.h" /** @@ -425,11 +426,11 @@ g_unix_output_stream_writev (GOutputStream *stream, if (bytes_written) *bytes_written = 0; - /* Clamp to G_MAXINT as writev() takes an integer for the number of vectors. - * We handle this like a short write in this case + /* Clamp the number of vectors if more given than we can write in one go. + * The caller has to handle short writes anyway. */ - if (n_vectors > G_MAXINT) - n_vectors = G_MAXINT; + if (n_vectors > G_IOV_MAX) + n_vectors = G_IOV_MAX; unix_stream = G_UNIX_OUTPUT_STREAM (stream); @@ -635,11 +636,11 @@ g_unix_output_stream_pollable_writev_nonblocking (GPollableOutputStream *stream return G_POLLABLE_RETURN_WOULD_BLOCK; } - /* Clamp to G_MAXINT as writev() takes an integer for the number of vectors. - * We handle this like a short write in this case + /* Clamp the number of vectors if more given than we can write in one go. + * The caller has to handle short writes anyway. */ - if (n_vectors > G_MAXINT) - n_vectors = G_MAXINT; + if (n_vectors > G_IOV_MAX) + n_vectors = G_IOV_MAX; if (G_OUTPUT_VECTOR_IS_IOVEC) { diff --git a/gio/gvdb/gvdb-reader.c b/gio/gvdb/gvdb-reader.c index ccae40e64..83ad2ac19 100644 --- a/gio/gvdb/gvdb-reader.c +++ b/gio/gvdb/gvdb-reader.c @@ -332,7 +332,7 @@ gvdb_table_list_from_item (GvdbTable *table, /** * gvdb_table_get_names: * @table: a #GvdbTable - * @length: (optional): the number of items returned, or %NULL + * @length: (out) (optional): the number of items returned, or %NULL * * Gets a list of all names contained in @table. * diff --git a/gio/gvolume.c b/gio/gvolume.c index dd49df7d6..0e14ddaf6 100644 --- a/gio/gvolume.c +++ b/gio/gvolume.c @@ -93,7 +93,7 @@ g_volume_default_init (GVolumeInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeIface, changed), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); /** @@ -108,7 +108,7 @@ g_volume_default_init (GVolumeInterface *iface) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeIface, removed), NULL, NULL, - g_cclosure_marshal_VOID__VOID, + NULL, G_TYPE_NONE, 0); } diff --git a/gio/gvolume.h b/gio/gvolume.h index 6d8a814dc..e153b7c38 100644 --- a/gio/gvolume.h +++ b/gio/gvolume.h @@ -30,7 +30,6 @@ G_BEGIN_DECLS -#ifndef G_DISABLE_DEPRECATED /** * G_VOLUME_IDENTIFIER_KIND_HAL_UDI: * @@ -38,8 +37,7 @@ G_BEGIN_DECLS * * Deprecated: 2.58: Do not use, HAL is deprecated. */ -#define G_VOLUME_IDENTIFIER_KIND_HAL_UDI "hal-udi" -#endif /* G_DISABLE_DEPRECATED */ +#define G_VOLUME_IDENTIFIER_KIND_HAL_UDI "hal-udi" GLIB_DEPRECATED_MACRO_IN_2_58 /** * G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE: diff --git a/gio/gvolumemonitor.c b/gio/gvolumemonitor.c index 1718bb6a5..65ec955a9 100644 --- a/gio/gvolumemonitor.c +++ b/gio/gvolumemonitor.c @@ -94,7 +94,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, volume_added), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_VOLUME); /** @@ -109,7 +109,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, volume_removed), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_VOLUME); /** @@ -124,7 +124,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, volume_changed), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_VOLUME); /** @@ -139,7 +139,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, mount_added), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_MOUNT); /** @@ -154,7 +154,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, mount_removed), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_MOUNT); /** @@ -172,7 +172,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, mount_pre_unmount), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_MOUNT); /** @@ -187,7 +187,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, mount_changed), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_MOUNT); /** @@ -202,7 +202,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, drive_connected), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_DRIVE); /** @@ -217,7 +217,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, drive_disconnected), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_DRIVE); /** @@ -232,7 +232,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, drive_changed), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_DRIVE); /** @@ -249,7 +249,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, drive_eject_button), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_DRIVE); /** @@ -266,7 +266,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GVolumeMonitorClass, drive_stop_button), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, + NULL, G_TYPE_NONE, 1, G_TYPE_DRIVE); } diff --git a/gio/inotify/inotify-kernel.c b/gio/inotify/inotify-kernel.c index 9a2e5008f..881cbfc5a 100644 --- a/gio/inotify/inotify-kernel.c +++ b/gio/inotify/inotify-kernel.c @@ -30,6 +30,9 @@ #include <glib.h> #include "inotify-kernel.h" #include <sys/inotify.h> +#ifdef HAVE_SYS_FILIO_H +#include <sys/filio.h> +#endif #include <glib/glib-unix.h> #include "glib-private.h" diff --git a/gio/inotify/meson.build b/gio/inotify/meson.build index 8183f141e..9b0c7ab30 100644 --- a/gio/inotify/meson.build +++ b/gio/inotify/meson.build @@ -12,4 +12,4 @@ inotify_lib = static_library('inotify', include_directories : [configinc, glibinc, gmoduleinc], dependencies : [gioenumtypes_dep, libglib_dep, libgobject_dep], pic : true, - c_args : [ '-DG_DISABLE_DEPRECATED' ] + gio_c_args) + c_args : gio_c_args) diff --git a/gio/kqueue/meson.build b/gio/kqueue/meson.build index e5057c83d..d389b06f7 100644 --- a/gio/kqueue/meson.build +++ b/gio/kqueue/meson.build @@ -10,4 +10,4 @@ kqueue_lib = static_library('kqueue', include_directories : [configinc, glibinc, gmoduleinc], dependencies : [gioenumtypes_dep], pic : true, - c_args : [ '-DG_DISABLE_DEPRECATED' ] + gio_c_args) + c_args : gio_c_args) diff --git a/gio/meson.build b/gio/meson.build index f0e08b40f..987d0f4c6 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -526,6 +526,7 @@ gio_sources = files( 'gioscheduler.c', 'giostream.c', 'gloadableicon.c', + 'gmarshal-internal.c', 'gmount.c', 'gmemoryinputstream.c', 'gmemoryoutputstream.c', @@ -829,9 +830,14 @@ pkg.generate(libgio, 'schemasdir=' + join_paths('${datadir}', schemas_subdir), 'bindir=' + join_paths('${prefix}', get_option('bindir')), 'giomoduledir=' + giomodulesdir, + 'gio=' + join_paths('${bindir}', 'gio'), + 'gio_querymodules=' + join_paths('${bindir}', 'gio-querymodules'), 'glib_compile_schemas=' + join_paths('${bindir}', 'glib-compile-schemas'), 'glib_compile_resources=' + join_paths('${bindir}', 'glib-compile-resources'), - 'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen')], + 'gdbus=' + join_paths('${bindir}', 'gdbus'), + 'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen'), + 'gresource=' + join_paths('${bindir}', 'gresource'), + 'gsettings=' + join_paths('${bindir}', 'gsettings')], version : glib_version, install_dir : glib_pkgconfigreldir, filebase : 'gio-2.0', @@ -990,7 +996,7 @@ if enable_systemtap output : '@0@.stp'.format(libgio.full_path().split('/').get(-1)), configuration : stp_cdata, install_dir : tapset_install_dir, - install : true) + ) endif subdir('fam') @@ -998,4 +1004,15 @@ subdir('fam') build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper()) if build_tests subdir('tests') -endif
\ No newline at end of file +endif + +# The following is an example for building internal marshallers that are used +# by GIO. We cannot guarantee glib-genmarshal availability while building GLib +# so they are pre-generated and placed into gmarshal-internal.[ch]. +# +# gmarshal_internal = gnome.genmarshal('gmarshal-internal', +# sources: 'gmarshal-internal.list', +# prefix: '_g_cclosure_marshal', +# valist_marshallers: true, +# internal: true, +# ) diff --git a/gio/tests/appinfo-test.desktop.in b/gio/tests/appinfo-test.desktop.in index bc292b135..1f6ff7144 100644 --- a/gio/tests/appinfo-test.desktop.in +++ b/gio/tests/appinfo-test.desktop.in @@ -9,7 +9,7 @@ Comment=GAppInfo example Comment[de]=GAppInfo Beispiel Exec=@installed_tests_dir@/appinfo-test --option %U %i --name %c --filename %k %m %% Icon=testicon.svg -Terminal=true +Terminal=false StartupNotify=true StartupWMClass=appinfo-class MimeType=image/png;image/jpeg; diff --git a/gio/tests/appinfo.c b/gio/tests/appinfo.c index f13698d70..4fec6b379 100644 --- a/gio/tests/appinfo.c +++ b/gio/tests/appinfo.c @@ -87,7 +87,7 @@ test_launch_no_app_id (void) "Comment=GAppInfo example\n" "Comment[de]=GAppInfo Beispiel\n" "Icon=testicon.svg\n" - "Terminal=true\n" + "Terminal=false\n" "StartupNotify=true\n" "StartupWMClass=appinfo-class\n" "MimeType=image/png;image/jpeg;\n" diff --git a/gio/tests/contenttype.c b/gio/tests/contenttype.c index 2424b8e5f..3696e3662 100644 --- a/gio/tests/contenttype.c +++ b/gio/tests/contenttype.c @@ -39,7 +39,7 @@ test_guess (void) g_free (existing_directory); expected = g_content_type_from_mime_type ("inode/directory"); g_assert_content_type_equals (expected, res); - g_assert (uncertain); + g_assert_true (uncertain); g_free (res); g_free (expected); @@ -52,7 +52,7 @@ test_guess (void) res = g_content_type_guess ("foo.txt", data, sizeof (data) - 1, &uncertain); expected = g_content_type_from_mime_type ("text/plain"); g_assert_content_type_equals (expected, res); - g_assert (!uncertain); + g_assert_false (uncertain); g_free (res); g_free (expected); @@ -61,21 +61,21 @@ test_guess (void) res = g_content_type_guess ("foo", data, sizeof (data) - 1, &uncertain); expected = g_content_type_from_mime_type ("text/plain"); g_assert_content_type_equals (expected, res); - g_assert (!uncertain); + g_assert_false (uncertain); g_free (res); g_free (expected); res = g_content_type_guess ("foo.desktop", data, sizeof (data) - 1, &uncertain); expected = g_content_type_from_mime_type ("application/x-desktop"); g_assert_content_type_equals (expected, res); - g_assert (!uncertain); + g_assert_false (uncertain); g_free (res); g_free (expected); res = g_content_type_guess (NULL, data, sizeof (data) - 1, &uncertain); expected = g_content_type_from_mime_type ("application/x-desktop"); g_assert_content_type_equals (expected, res); - g_assert (!uncertain); + g_assert_false (uncertain); g_free (res); g_free (expected); @@ -84,14 +84,14 @@ test_guess (void) res = g_content_type_guess ("test.pot", (guchar *)"ABC abc", 7, &uncertain); expected = g_content_type_from_mime_type ("text/x-gettext-translation-template"); g_assert_content_type_equals (expected, res); - g_assert (!uncertain); + g_assert_false (uncertain); g_free (res); g_free (expected); res = g_content_type_guess ("test.pot", (guchar *)"msgid \"", 7, &uncertain); expected = g_content_type_from_mime_type ("text/x-gettext-translation-template"); g_assert_content_type_equals (expected, res); - g_assert (!uncertain); + g_assert_false (uncertain); g_free (res); g_free (expected); @@ -107,7 +107,7 @@ test_guess (void) res = g_content_type_guess ("test.otf", (guchar *)"OTTO", 4, &uncertain); expected = g_content_type_from_mime_type ("application/x-font-otf"); g_assert_content_type_equals (expected, res); - g_assert (!uncertain); + g_assert_false (uncertain); g_free (res); g_free (expected); #endif @@ -115,7 +115,15 @@ test_guess (void) res = g_content_type_guess (NULL, (guchar *)"%!PS-Adobe-2.0 EPSF-1.2", 23, &uncertain); expected = g_content_type_from_mime_type ("image/x-eps"); g_assert_content_type_equals (expected, res); - g_assert (!uncertain); + g_assert_false (uncertain); + g_free (res); + g_free (expected); + + /* The data below would be detected as a valid content type, but shouldn’t be read at all. */ + res = g_content_type_guess (NULL, (guchar *)"%!PS-Adobe-2.0 EPSF-1.2", 0, &uncertain); + expected = g_content_type_from_mime_type ("application/x-zerosize"); + g_assert_content_type_equals (expected, res); + g_assert_false (uncertain); g_free (res); g_free (expected); } @@ -127,7 +135,7 @@ test_unknown (void) gchar *str; unknown = g_content_type_from_mime_type ("application/octet-stream"); - g_assert (g_content_type_is_unknown (unknown)); + g_assert_true (g_content_type_is_unknown (unknown)); str = g_content_type_get_mime_type (unknown); g_assert_cmpstr (str, ==, "application/octet-stream"); g_free (str); @@ -143,8 +151,8 @@ test_subtype (void) plain = g_content_type_from_mime_type ("text/plain"); xml = g_content_type_from_mime_type ("application/xml"); - g_assert (g_content_type_is_a (xml, plain)); - g_assert (g_content_type_is_mime_type (xml, "text/plain")); + g_assert_true (g_content_type_is_a (xml, plain)); + g_assert_true (g_content_type_is_mime_type (xml, "text/plain")); g_free (plain); g_free (xml); @@ -175,11 +183,11 @@ test_list (void) types = g_content_types_get_registered (); - g_assert (g_list_length (types) > 1); + g_assert_cmpuint (g_list_length (types), >, 1); /* just check that some types are in the list */ - g_assert (g_list_find_custom (types, plain, find_mime) != NULL); - g_assert (g_list_find_custom (types, xml, find_mime) != NULL); + g_assert_nonnull (g_list_find_custom (types, plain, find_mime)); + g_assert_nonnull (g_list_find_custom (types, xml, find_mime)); g_list_free_full (types, g_free); @@ -193,15 +201,15 @@ test_executable (void) gchar *type; type = g_content_type_from_mime_type ("application/x-executable"); - g_assert (g_content_type_can_be_executable (type)); + g_assert_true (g_content_type_can_be_executable (type)); g_free (type); type = g_content_type_from_mime_type ("text/plain"); - g_assert (g_content_type_can_be_executable (type)); + g_assert_true (g_content_type_can_be_executable (type)); g_free (type); type = g_content_type_from_mime_type ("image/png"); - g_assert (!g_content_type_can_be_executable (type)); + g_assert_false (g_content_type_can_be_executable (type)); g_free (type); } @@ -213,7 +221,7 @@ test_description (void) type = g_content_type_from_mime_type ("text/plain"); desc = g_content_type_get_description (type); - g_assert (desc != NULL); + g_assert_nonnull (desc); g_free (desc); g_free (type); @@ -227,17 +235,17 @@ test_icon (void) type = g_content_type_from_mime_type ("text/plain"); icon = g_content_type_get_icon (type); - g_assert (G_IS_ICON (icon)); + g_assert_true (G_IS_ICON (icon)); if (G_IS_THEMED_ICON (icon)) { const gchar *const *names; names = g_themed_icon_get_names (G_THEMED_ICON (icon)); #ifdef __APPLE__ - g_assert (g_strv_contains (names, "text-*")); + g_assert_true (g_strv_contains (names, "text-*")); #else - g_assert (g_strv_contains (names, "text-plain")); - g_assert (g_strv_contains (names, "text-x-generic")); + g_assert_true (g_strv_contains (names, "text-plain")); + g_assert_true (g_strv_contains (names, "text-x-generic")); #endif } g_object_unref (icon); @@ -245,15 +253,15 @@ test_icon (void) type = g_content_type_from_mime_type ("application/rtf"); icon = g_content_type_get_icon (type); - g_assert (G_IS_ICON (icon)); + g_assert_true (G_IS_ICON (icon)); if (G_IS_THEMED_ICON (icon)) { const gchar *const *names; names = g_themed_icon_get_names (G_THEMED_ICON (icon)); - g_assert (g_strv_contains (names, "application-rtf")); + g_assert_true (g_strv_contains (names, "application-rtf")); #ifndef __APPLE__ - g_assert (g_strv_contains (names, "x-office-document")); + g_assert_true (g_strv_contains (names, "x-office-document")); #endif } g_object_unref (icon); @@ -269,20 +277,20 @@ test_symbolic_icon (void) type = g_content_type_from_mime_type ("text/plain"); icon = g_content_type_get_symbolic_icon (type); - g_assert (G_IS_ICON (icon)); + g_assert_true (G_IS_ICON (icon)); if (G_IS_THEMED_ICON (icon)) { const gchar *const *names; names = g_themed_icon_get_names (G_THEMED_ICON (icon)); #ifdef __APPLE__ - g_assert (g_strv_contains (names, "text-*-symbolic")); - g_assert (g_strv_contains (names, "text-*")); + g_assert_true (g_strv_contains (names, "text-*-symbolic")); + g_assert_true (g_strv_contains (names, "text-*")); #else - g_assert (g_strv_contains (names, "text-plain-symbolic")); - g_assert (g_strv_contains (names, "text-x-generic-symbolic")); - g_assert (g_strv_contains (names, "text-plain")); - g_assert (g_strv_contains (names, "text-x-generic")); + g_assert_true (g_strv_contains (names, "text-plain-symbolic")); + g_assert_true (g_strv_contains (names, "text-x-generic-symbolic")); + g_assert_true (g_strv_contains (names, "text-plain")); + g_assert_true (g_strv_contains (names, "text-x-generic")); #endif } g_object_unref (icon); @@ -290,17 +298,17 @@ test_symbolic_icon (void) type = g_content_type_from_mime_type ("application/rtf"); icon = g_content_type_get_symbolic_icon (type); - g_assert (G_IS_ICON (icon)); + g_assert_true (G_IS_ICON (icon)); if (G_IS_THEMED_ICON (icon)) { const gchar *const *names; names = g_themed_icon_get_names (G_THEMED_ICON (icon)); - g_assert (g_strv_contains (names, "application-rtf-symbolic")); - g_assert (g_strv_contains (names, "application-rtf")); + g_assert_true (g_strv_contains (names, "application-rtf-symbolic")); + g_assert_true (g_strv_contains (names, "application-rtf")); #ifndef __APPLE__ - g_assert (g_strv_contains (names, "x-office-document-symbolic")); - g_assert (g_strv_contains (names, "x-office-document")); + g_assert_true (g_strv_contains (names, "x-office-document-symbolic")); + g_assert_true (g_strv_contains (names, "x-office-document")); #endif } g_object_unref (icon); diff --git a/gio/tests/gdbus-addresses.c b/gio/tests/gdbus-addresses.c index d6a5c2360..173383d83 100644 --- a/gio/tests/gdbus-addresses.c +++ b/gio/tests/gdbus-addresses.c @@ -108,14 +108,20 @@ test_unix_address (void) g_test_skip ("unix transport is not supported on non-Unix platforms"); #else assert_is_supported_address ("unix:path=/tmp/dbus-test"); + assert_is_supported_address ("unix:path=/tmp/dbus-test,guid=0"); assert_is_supported_address ("unix:abstract=/tmp/dbus-another-test"); + assert_is_supported_address ("unix:abstract=/tmp/dbus-another-test,guid=1000"); assert_not_supported_address ("unix:foo=bar"); g_assert_false (g_dbus_is_address ("unix:path=/foo;abstract=/bar")); assert_is_supported_address ("unix:path=/tmp/concrete;unix:abstract=/tmp/abstract"); assert_is_supported_address ("unix:tmpdir=/tmp"); + assert_is_supported_address ("unix:dir=/tmp"); assert_not_supported_address ("unix:tmpdir=/tmp,path=/tmp"); assert_not_supported_address ("unix:tmpdir=/tmp,abstract=/tmp/foo"); + assert_not_supported_address ("unix:tmpdir=/tmp,dir=/tmp"); assert_not_supported_address ("unix:path=/tmp,abstract=/tmp/foo"); + assert_not_supported_address ("unix:path=/tmp,dir=/tmp"); + assert_not_supported_address ("unix:abstract=/tmp/foo,dir=/tmp"); assert_not_supported_address ("unix:"); #endif } @@ -124,9 +130,11 @@ static void test_nonce_tcp_address (void) { assert_is_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar"); + assert_is_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar,guid=0"); assert_is_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar,family=ipv6"); assert_is_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar,family=ipv4"); assert_is_supported_address ("nonce-tcp:host=localhost"); + assert_is_supported_address ("nonce-tcp:host=localhost,guid=1000"); assert_not_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar,family=blah"); assert_not_supported_address ("nonce-tcp:host=localhost,port=420000,noncefile=/foo/bar,family=ipv4"); @@ -144,8 +152,10 @@ static void test_tcp_address (void) { assert_is_supported_address ("tcp:host=localhost"); + assert_is_supported_address ("tcp:host=localhost,guid=1000"); assert_not_supported_address ("tcp:host=localhost,noncefile=/tmp/foo"); assert_is_supported_address ("tcp:host=localhost,port=42"); + assert_is_supported_address ("tcp:host=localhost,port=42,guid=1000"); assert_not_supported_address ("tcp:host=localhost,port=-1"); assert_not_supported_address ("tcp:host=localhost,port=420000"); assert_not_supported_address ("tcp:host=localhost,port=42x"); diff --git a/gio/tests/gdbus-connection-loss.c b/gio/tests/gdbus-connection-loss.c index 9dbbeb2a4..8f7023f3f 100644 --- a/gio/tests/gdbus-connection-loss.c +++ b/gio/tests/gdbus-connection-loss.c @@ -136,9 +136,10 @@ main (int argc, ret = g_test_run(); + g_object_unref (c); + session_bus_down (); - g_object_unref (c); g_main_loop_unref (loop); return ret; diff --git a/gio/tests/gdbus-example-peer.c b/gio/tests/gdbus-example-peer.c index bf151cfcf..9d5de32a6 100755 --- a/gio/tests/gdbus-example-peer.c +++ b/gio/tests/gdbus-example-peer.c @@ -169,6 +169,74 @@ on_new_connection (GDBusServer *server, /* ---------------------------------------------------------------------------------------------------- */ +static gboolean +allow_mechanism_cb (GDBusAuthObserver *observer, + const gchar *mechanism, + G_GNUC_UNUSED gpointer user_data) +{ + /* + * In a production GDBusServer that only needs to work on modern Unix + * platforms, consider requiring EXTERNAL (credentials-passing), + * which is the recommended authentication mechanism for AF_UNIX + * sockets: + * + * if (g_strcmp0 (mechanism, "EXTERNAL") == 0) + * return TRUE; + * + * return FALSE; + * + * For this example we accept everything. + */ + + g_print ("Considering whether to accept %s authentication...\n", mechanism); + return TRUE; +} + +static gboolean +authorize_authenticated_peer_cb (GDBusAuthObserver *observer, + G_GNUC_UNUSED GIOStream *stream, + GCredentials *credentials, + G_GNUC_UNUSED gpointer user_data) +{ + gboolean authorized = FALSE; + + g_print ("Considering whether to authorize authenticated peer...\n"); + + if (credentials != NULL) + { + GCredentials *own_credentials; + gchar *credentials_string = NULL; + + credentials_string = g_credentials_to_string (credentials); + g_print ("Peer's credentials: %s\n", credentials_string); + g_free (credentials_string); + + own_credentials = g_credentials_new (); + + credentials_string = g_credentials_to_string (own_credentials); + g_print ("Server's credentials: %s\n", credentials_string); + g_free (credentials_string); + + if (g_credentials_is_same_user (credentials, own_credentials, NULL)) + authorized = TRUE; + + g_object_unref (own_credentials); + } + + if (!authorized) + { + /* In most servers you'd want to reject this, but for this example + * we allow it. */ + g_print ("A server would often not want to authorize this identity\n"); + g_print ("Authorizing it anyway for demonstration purposes\n"); + authorized = TRUE; + } + + return authorized; +} + +/* ---------------------------------------------------------------------------------------------------- */ + int main (int argc, char *argv[]) { @@ -221,6 +289,7 @@ main (int argc, char *argv[]) if (opt_server) { + GDBusAuthObserver *observer; GDBusServer *server; gchar *guid; GMainLoop *loop; @@ -232,14 +301,20 @@ main (int argc, char *argv[]) if (opt_allow_anonymous) server_flags |= G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS; + observer = g_dbus_auth_observer_new (); + g_signal_connect (observer, "allow-mechanism", G_CALLBACK (allow_mechanism_cb), NULL); + g_signal_connect (observer, "authorize-authenticated-peer", G_CALLBACK (authorize_authenticated_peer_cb), NULL); + error = NULL; server = g_dbus_server_new_sync (opt_address, server_flags, guid, - NULL, /* GDBusAuthObserver */ + observer, NULL, /* GCancellable */ &error); g_dbus_server_start (server); + + g_object_unref (observer); g_free (guid); if (server == NULL) diff --git a/gio/tests/gdbus-names.c b/gio/tests/gdbus-names.c index 648b54774..4f95b457a 100644 --- a/gio/tests/gdbus-names.c +++ b/gio/tests/gdbus-names.c @@ -472,9 +472,6 @@ test_bus_own_name (void) g_object_unref (c2); session_bus_down (); - - /* See https://bugzilla.gnome.org/show_bug.cgi?id=711807 */ - g_usleep (1000000); } /* ---------------------------------------------------------------------------------------------------- */ diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c index c21b9e9f2..c46340386 100644 --- a/gio/tests/gdbus-peer.c +++ b/gio/tests/gdbus-peer.c @@ -53,6 +53,7 @@ static gboolean is_unix = TRUE; static gboolean is_unix = FALSE; #endif +static gchar *tmpdir = NULL; static gchar *tmp_address = NULL; static gchar *test_guid = NULL; static GMutex service_loop_lock; @@ -267,6 +268,58 @@ on_proxy_signal_received_with_name_set (GDBusProxy *proxy, /* ---------------------------------------------------------------------------------------------------- */ +static void +setup_test_address (void) +{ + if (is_unix) + { + g_test_message ("Testing with unix:tmpdir address"); + if (g_unix_socket_address_abstract_names_supported ()) + tmp_address = g_strdup ("unix:tmpdir=/tmp/gdbus-test-"); + else + { + tmpdir = g_dir_make_tmp ("gdbus-test-XXXXXX", NULL); + tmp_address = g_strdup_printf ("unix:tmpdir=%s", tmpdir); + } + } + else + tmp_address = g_strdup ("nonce-tcp:"); +} + +#ifdef G_OS_UNIX +static void +setup_dir_test_address (void) +{ + g_test_message ("Testing with unix:dir address"); + tmpdir = g_dir_make_tmp ("gdbus-test-XXXXXX", NULL); + tmp_address = g_strdup_printf ("unix:dir=%s", tmpdir); +} + +static void +setup_path_test_address (void) +{ + g_test_message ("Testing with unix:path address"); + tmpdir = g_dir_make_tmp ("gdbus-test-XXXXXX", NULL); + tmp_address = g_strdup_printf ("unix:path=%s/gdbus-peer-socket", tmpdir); +} +#endif + +static void +teardown_test_address (void) +{ + g_free (tmp_address); + if (tmpdir) + { + /* Ensuring the rmdir succeeds also ensures any sockets created on the + * filesystem are also deleted. + */ + g_assert_cmpint (g_rmdir (tmpdir), ==, 0); + g_clear_pointer (&tmpdir, g_free); + } +} + +/* ---------------------------------------------------------------------------------------------------- */ + static gboolean on_authorize_authenticated_peer (GDBusAuthObserver *observer, GIOStream *stream, @@ -656,7 +709,7 @@ read_all_from_fd (gint fd, gsize *out_len, GError **error) #endif static void -test_peer (void) +do_test_peer (void) { GDBusConnection *c; GDBusConnection *c2; @@ -977,6 +1030,27 @@ test_peer (void) g_thread_join (service_thread); } +static void +test_peer (void) +{ + /* Run this test multiple times using different address formats to ensure + * they all work. + */ + setup_test_address (); + do_test_peer (); + teardown_test_address (); + +#ifdef G_OS_UNIX + setup_dir_test_address (); + do_test_peer (); + teardown_test_address (); + + setup_path_test_address (); + do_test_peer (); + teardown_test_address (); +#endif +} + /* ---------------------------------------------------------------------------------------------------- */ typedef struct @@ -1116,6 +1190,8 @@ delayed_message_processing (void) GThread *service_thread; guint n; + setup_test_address (); + data = g_new0 (DmpData, 1); service_thread = g_thread_new ("dmp", @@ -1160,6 +1236,7 @@ delayed_message_processing (void) g_main_loop_quit (data->loop); g_thread_join (service_thread); dmp_data_free (data); + teardown_test_address (); } /* ---------------------------------------------------------------------------------------------------- */ @@ -1351,12 +1428,16 @@ test_nonce_tcp (void) g_error_free (error); g_assert (c == NULL); - g_free (nonce_file); + /* Recreate the nonce-file so we can ensure the server deletes it when stopped. */ + g_assert_cmpint (g_creat (nonce_file, 0600), !=, -1); g_dbus_server_stop (server); g_object_unref (server); server = NULL; + g_assert_false (g_file_test (nonce_file, G_FILE_TEST_EXISTS)); + g_free (nonce_file); + g_main_loop_quit (service_loop); g_thread_join (service_thread); @@ -1616,6 +1697,8 @@ codegen_test_peer (void) GVariant *value; const gchar *s; + setup_test_address (); + /* bring up a server - we run the server in a different thread to avoid deadlocks */ service_thread = g_thread_new ("codegen_test_peer", codegen_service_thread_func, @@ -1719,6 +1802,8 @@ codegen_test_peer (void) g_object_unref (animal1); g_object_unref (animal2); g_thread_join (service_thread); + + teardown_test_address (); } /* ---------------------------------------------------------------------------------------------------- */ @@ -1730,7 +1815,6 @@ main (int argc, { gint ret; GDBusNodeInfo *introspection_data = NULL; - gchar *tmpdir = NULL; g_test_init (&argc, &argv, NULL); @@ -1740,19 +1824,6 @@ main (int argc, test_guid = g_dbus_generate_guid (); - if (is_unix) - { - if (g_unix_socket_address_abstract_names_supported ()) - tmp_address = g_strdup ("unix:tmpdir=/tmp/gdbus-test-"); - else - { - tmpdir = g_dir_make_tmp ("gdbus-test-XXXXXX", NULL); - tmp_address = g_strdup_printf ("unix:tmpdir=%s", tmpdir); - } - } - else - tmp_address = g_strdup ("nonce-tcp:"); - /* all the tests rely on a shared main loop */ loop = g_main_loop_new (NULL, FALSE); @@ -1769,13 +1840,6 @@ main (int argc, g_main_loop_unref (loop); g_free (test_guid); g_dbus_node_info_unref (introspection_data); - if (is_unix) - g_free (tmp_address); - if (tmpdir) - { - g_rmdir (tmpdir); - g_free (tmpdir); - } return ret; } diff --git a/gio/tests/gdbus-threading.c b/gio/tests/gdbus-threading.c index 3e4dc92e5..ffca6f317 100644 --- a/gio/tests/gdbus-threading.c +++ b/gio/tests/gdbus-threading.c @@ -361,13 +361,12 @@ test_method_calls_on_proxy (GDBusProxy *proxy) SyncThreadData data1; SyncThreadData data2; SyncThreadData data3; - GTimeVal start_time; - GTimeVal end_time; + gint64 start_time, end_time; guint elapsed_msec; do_async = (n == 0); - g_get_current_time (&start_time); + start_time = g_get_real_time (); data1.proxy = proxy; data1.msec = 40; @@ -397,10 +396,9 @@ test_method_calls_on_proxy (GDBusProxy *proxy) g_thread_join (thread2); g_thread_join (thread3); - g_get_current_time (&end_time); + end_time = g_get_real_time (); - elapsed_msec = ((end_time.tv_sec * G_USEC_PER_SEC + end_time.tv_usec) - - (start_time.tv_sec * G_USEC_PER_SEC + start_time.tv_usec)) / 1000; + elapsed_msec = (end_time - start_time) / 1000; //g_debug ("Elapsed time for %s = %d msec", n == 0 ? "async" : "sync", elapsed_msec); diff --git a/gio/tests/giomodule.c b/gio/tests/giomodule.c index e832e95d3..b4923eeef 100644 --- a/gio/tests/giomodule.c +++ b/gio/tests/giomodule.c @@ -21,6 +21,13 @@ */ #include <gio/gio.h> +#include <glibconfig.h> + +#ifdef _MSC_VER +# define MODULE_FILENAME_PREFIX "" +#else +# define MODULE_FILENAME_PREFIX "lib" +#endif static void test_extension_point (void) @@ -76,6 +83,13 @@ test_extension_point (void) static void test_module_scan_all (void) { +#ifdef GLIB_STATIC_COMPILATION + /* The plugin module is statically linked with a separate copy + * of GLib so g_io_extension_point_implement won't work. */ + g_test_skip ("GIOExtensionPoint with dynamic modules isn't supported in static builds."); + return; +#endif + if (g_test_subprocess ()) { GIOExtensionPoint *ep; @@ -83,7 +97,6 @@ test_module_scan_all (void) GList *list; ep = g_io_extension_point_register ("test-extension-point"); g_io_modules_scan_all_in_directory (g_test_get_filename (G_TEST_BUILT, "modules", NULL)); - g_io_modules_scan_all_in_directory (g_test_get_filename (G_TEST_BUILT, "modules/.libs", NULL)); list = g_io_extension_point_get_extensions (ep); g_assert_cmpint (g_list_length (list), ==, 2); ext = list->data; @@ -99,6 +112,12 @@ test_module_scan_all (void) static void test_module_scan_all_with_scope (void) { +#ifdef GLIB_STATIC_COMPILATION + /* Disabled for the same reason as test_module_scan_all. */ + g_test_skip ("GIOExtensionPoint with dynamic modules isn't supported in static builds."); + return; +#endif + if (g_test_subprocess ()) { GIOExtensionPoint *ep; @@ -108,11 +127,9 @@ test_module_scan_all_with_scope (void) ep = g_io_extension_point_register ("test-extension-point"); scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES); - g_io_module_scope_block (scope, "libtestmoduleb." G_MODULE_SUFFIX); + g_io_module_scope_block (scope, MODULE_FILENAME_PREFIX "testmoduleb." G_MODULE_SUFFIX); g_io_modules_scan_all_in_directory_with_scope (g_test_get_filename (G_TEST_BUILT, "modules", NULL), scope); list = g_io_extension_point_get_extensions (ep); - g_io_modules_scan_all_in_directory_with_scope (g_test_get_filename (G_TEST_BUILT, "modules/.libs", NULL), scope); - list = g_io_extension_point_get_extensions (ep); g_assert_cmpint (g_list_length (list), ==, 1); ext = list->data; g_assert_cmpstr (g_io_extension_get_name (ext), ==, "test-a"); diff --git a/gio/tests/glistmodel.c b/gio/tests/glistmodel.c index 2fef4ccbe..b867bd54a 100644 --- a/gio/tests/glistmodel.c +++ b/gio/tests/glistmodel.c @@ -77,7 +77,6 @@ test_store_boundaries (void) store = g_list_store_new (G_TYPE_MENU_ITEM); item = g_menu_item_new (NULL, NULL); - g_object_add_weak_pointer (G_OBJECT (item), (gpointer *) &item); /* remove an item from an empty list */ g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*g_sequence*"); @@ -123,8 +122,7 @@ test_store_boundaries (void) g_assert_cmpuint (g_list_model_get_n_items (G_LIST_MODEL (store)), ==, 1); g_object_unref (store); - g_object_unref (item); - g_assert_null (item); + g_assert_finalize_object (item); } static void diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c index 52b06a2e6..400fa00a1 100644 --- a/gio/tests/gsubprocess.c +++ b/gio/tests/gsubprocess.c @@ -66,14 +66,11 @@ test_noop (void) GError **error = &local_error; GPtrArray *args; GSubprocess *proc; - const gchar *id; args = get_test_subprocess_args ("noop", NULL); proc = g_subprocess_newv ((const gchar * const *) args->pdata, G_SUBPROCESS_FLAGS_NONE, error); g_ptr_array_free (args, TRUE); g_assert_no_error (local_error); - id = g_subprocess_get_identifier (proc); - g_assert_nonnull (id); g_subprocess_wait_check (proc, NULL, error); g_assert_no_error (local_error); @@ -1297,12 +1294,16 @@ test_terminate (void) GSubprocess *proc; GPtrArray *args; GMainLoop *loop; + const gchar *id; args = get_test_subprocess_args ("sleep-forever", NULL); proc = g_subprocess_newv ((const gchar * const *) args->pdata, G_SUBPROCESS_FLAGS_NONE, error); g_ptr_array_free (args, TRUE); g_assert_no_error (local_error); + id = g_subprocess_get_identifier (proc); + g_assert_nonnull (id); + loop = g_main_loop_new (NULL, TRUE); g_subprocess_wait_async (proc, NULL, on_request_quit_exited, loop); diff --git a/gio/tests/meson.build b/gio/tests/meson.build index a0c09444b..3a6b50bb5 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -97,7 +97,7 @@ test_env.set('GIO_LAUNCH_DESKTOP', meson.build_root() + '/gio/gio-launch-desktop # 1.2.14 required for dbus_message_set_serial dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14') if not dbus1_dep.found() - if cc.get_id() == 'msvc' + if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' # MSVC: Search for the DBus library by the configuration, which corresponds # to the output of CMake builds of DBus. Note that debugoptimized # is really a Release build with .PDB files. @@ -382,7 +382,7 @@ test_extra_programs += { }, } -if cc.get_id() != 'msvc' +if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl' test_extra_programs += { # These three are manual-run tests because they need a session bus but don't bring one up themselves # FIXME: these build but don't seem to work! @@ -424,13 +424,20 @@ else endif foreach appinfo_test_desktop_file : appinfo_test_desktop_files - configure_file( - input: appinfo_test_desktop_file + '.in', - output: appinfo_test_desktop_file, - install_dir: installed_tests_execdir, - install: installed_tests_enabled, - configuration: cdata, - ) + if installed_tests_enabled + configure_file( + input: appinfo_test_desktop_file + '.in', + output: appinfo_test_desktop_file, + install_dir: installed_tests_execdir, + configuration: cdata, + ) + else + configure_file( + input: appinfo_test_desktop_file + '.in', + output: appinfo_test_desktop_file, + configuration: cdata, + ) + endif endforeach if installed_tests_enabled @@ -558,7 +565,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper() test_generated_txt = configure_file(input : 'test1.txt', output : 'test-generated.txt', copy : true, - install : false) + ) resources_extra_sources = [ test_gresource, diff --git a/gio/tests/network-address.c b/gio/tests/network-address.c index 0dcd7b292..bda76050a 100644 --- a/gio/tests/network-address.c +++ b/gio/tests/network-address.c @@ -820,6 +820,31 @@ test_happy_eyeballs_ipv6_error_ipv6_first (HappyEyeballsFixture *fixture, } static void +test_happy_eyeballs_ipv6_error_ipv4_very_slow (HappyEyeballsFixture *fixture, + gconstpointer user_data) +{ + AsyncData data = { 0 }; + GError *ipv6_error; + + g_test_bug ("merge_requests/865"); + g_test_summary ("Ensure that we successfully return IPv4 results even when they come significantly later than an IPv6 failure."); + + /* If ipv6 fails, ensuring that ipv6 errors before ipv4 finishes, we still get ipv4. */ + + data.loop = fixture->loop; + ipv6_error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_TIMED_OUT, "IPv6 Broken"); + mock_resolver_set_ipv6_error (fixture->mock_resolver, ipv6_error); + mock_resolver_set_ipv4_delay_ms (fixture->mock_resolver, SLOW_DELAY_MORE_THAN_TIMEOUT); + + g_socket_address_enumerator_next_async (fixture->enumerator, NULL, got_addr, &data); + g_main_loop_run (fixture->loop); + + assert_list_matches_expected (data.addrs, fixture->input_ipv4_results); + + g_error_free (ipv6_error); +} + +static void test_happy_eyeballs_ipv4_error_ipv4_first (HappyEyeballsFixture *fixture, gconstpointer user_data) { @@ -977,6 +1002,7 @@ main (int argc, char *argv[]) gchar *path; g_test_init (&argc, &argv, NULL); + g_test_bug_base ("https://gitlab.gnome.org/GNOME/glib/"); g_test_add_func ("/network-address/basic", test_basic); @@ -1031,6 +1057,8 @@ main (int argc, char *argv[]) happy_eyeballs_setup, test_happy_eyeballs_ipv6_error_ipv4_first, happy_eyeballs_teardown); g_test_add ("/network-address/happy-eyeballs/ipv6-error-ipv6-first", HappyEyeballsFixture, NULL, happy_eyeballs_setup, test_happy_eyeballs_ipv6_error_ipv6_first, happy_eyeballs_teardown); + g_test_add ("/network-address/happy-eyeballs/ipv6-error-ipv4-very-slow", HappyEyeballsFixture, NULL, + happy_eyeballs_setup, test_happy_eyeballs_ipv6_error_ipv4_very_slow, happy_eyeballs_teardown); g_test_add ("/network-address/happy-eyeballs/ipv4-error-ipv6-first", HappyEyeballsFixture, NULL, happy_eyeballs_setup, test_happy_eyeballs_ipv4_error_ipv6_first, happy_eyeballs_teardown); g_test_add ("/network-address/happy-eyeballs/ipv4-error-ipv4-first", HappyEyeballsFixture, NULL, diff --git a/gio/tests/resourceplugin.c b/gio/tests/resourceplugin.c index b66d54142..fc8d8d2f1 100644 --- a/gio/tests/resourceplugin.c +++ b/gio/tests/resourceplugin.c @@ -1,3 +1,14 @@ +/* + * Ensure the g_io_module_*() symbols are exported + * on all supported compilers without using config.h. + * This must be done before including any GLib headers, + * since GLIB_AVAILABLE_IN_ALL, which is used to mark the + * g_io_module*() symbols, is defined to be _GLIB_EXTERN, + * which must be overriden to export the symbols. + */ +#include "modules/symbol-visibility.h" +#define _GLIB_EXTERN GLIB_TEST_EXPORT_SYMBOL + #include <gio/gio.h> void diff --git a/gio/tests/resources.c b/gio/tests/resources.c index cb2c00a48..c44d21485 100644 --- a/gio/tests/resources.c +++ b/gio/tests/resources.c @@ -18,10 +18,17 @@ #include <string.h> #include <gio/gio.h> +#include <glibconfig.h> #include "gconstructor.h" #include "test_resources2.h" #include "digit_test_resources.h" +#ifdef _MSC_VER +# define MODULE_FILENAME_PREFIX "" +#else +# define MODULE_FILENAME_PREFIX "lib" +#endif + static void test_resource (GResource *resource) { @@ -638,10 +645,18 @@ test_resource_module (void) GBytes *data; GError *error; +#ifdef GLIB_STATIC_COMPILATION + /* The resource module is statically linked with a separate copy + * of a GLib so g_static_resource_init won't work as expected. */ + g_test_skip ("Resource modules aren't supported in static builds."); + return; +#endif + if (g_module_supported ()) { - /* For in-tree, this will find the .la file and use it to get to the .so in .libs/ */ - module = g_io_module_new (g_test_get_filename (G_TEST_BUILT, "libresourceplugin", NULL)); + module = g_io_module_new (g_test_get_filename (G_TEST_BUILT, + MODULE_FILENAME_PREFIX "resourceplugin", + NULL)); error = NULL; diff --git a/gio/tests/send-data.c b/gio/tests/send-data.c index 514442976..a66976fa3 100644 --- a/gio/tests/send-data.c +++ b/gio/tests/send-data.c @@ -66,14 +66,14 @@ socket_client_event (GSocketClient *client, GSocketConnection *connection) { static GEnumClass *event_class; - GTimeVal tv; + gint64 now_us; if (!event_class) event_class = g_type_class_ref (G_TYPE_SOCKET_CLIENT_EVENT); - g_get_current_time (&tv); - printf ("% 12ld.%06ld GSocketClient => %s [%s]\n", - tv.tv_sec, tv.tv_usec, + now_us = g_get_real_time (); + g_print ("%" G_GINT64_FORMAT " GSocketClient => %s [%s]\n", + now_us, g_enum_get_value (event_class, event)->value_nick, connection ? G_OBJECT_TYPE_NAME (connection) : ""); } diff --git a/gio/tests/testfilemonitor.c b/gio/tests/testfilemonitor.c index 0fa72d3d9..605795890 100644 --- a/gio/tests/testfilemonitor.c +++ b/gio/tests/testfilemonitor.c @@ -9,6 +9,37 @@ * the tests, e.g. the length of timeouts */ +typedef struct +{ + GFile *tmp_dir; +} Fixture; + +static void +setup (Fixture *fixture, + gconstpointer user_data) +{ + gchar *path = NULL; + GError *local_error = NULL; + + path = g_dir_make_tmp ("gio-test-testfilemonitor_XXXXXX", &local_error); + g_assert_no_error (local_error); + + fixture->tmp_dir = g_file_new_for_path (path); + + g_test_message ("Using temporary directory: %s", path); +} + +static void +teardown (Fixture *fixture, + gconstpointer user_data) +{ + GError *local_error = NULL; + + g_file_delete (fixture->tmp_dir, NULL, &local_error); + g_assert_no_error (local_error); + g_clear_object (&fixture->tmp_dir); +} + typedef enum { NONE = 0, INOTIFY = (1 << 1), @@ -48,36 +79,24 @@ typedef struct GFileOutputStream *output_stream; } TestData; -#if 0 static void -output_event (RecordedEvent *event) +output_event (const RecordedEvent *event) { if (event->step >= 0) - g_print (">>>> step %d\n", event->step); + g_test_message (">>>> step %d", event->step); else { GTypeClass *class; class = g_type_class_ref (g_type_from_name ("GFileMonitorEvent")); - g_print ("%s file=%s other_file=%s\n", - g_enum_get_value (G_ENUM_CLASS (class), event->event_type)->value_nick, - event->file, - event->other_file); + g_test_message ("%s file=%s other_file=%s\n", + g_enum_get_value (G_ENUM_CLASS (class), event->event_type)->value_nick, + event->file, + event->other_file); g_type_class_unref (class); } } -static void -output_events (GList *list) -{ - GList *l; - - g_print (">>>output events\n"); - for (l = list; l; l = l->next) - output_event ((RecordedEvent *)l->data); -} -#endif - /* a placeholder for temp file names we don't want to compare */ static const gchar DONT_CARE[] = ""; @@ -210,9 +229,20 @@ check_expected_events (RecordedEvent *expected, continue; } /* Run above checks under g_assert_* again to provide more useful - * error messages. */ + * error messages. Print the expected and actual events first. */ else { + GList *l; + gsize j; + + g_test_message ("Recorded events:"); + for (l = recorded; l != NULL; l = l->next) + output_event ((RecordedEvent *) l->data); + + g_test_message ("Expected events:"); + for (j = 0; j < n_expected; j++) + output_event (&expected[j]); + g_assert_cmpint (e1->step, ==, e2->step); g_assert_cmpint (e1->event_type, ==, e2->event_type); @@ -322,7 +352,8 @@ static RecordedEvent atomic_replace_output[] = { }; static void -test_atomic_replace (void) +test_atomic_replace (Fixture *fixture, + gconstpointer user_data) { GError *error = NULL; TestData data; @@ -330,12 +361,14 @@ test_atomic_replace (void) data.step = 0; data.events = NULL; - data.file = g_file_new_for_path ("atomic_replace_file"); + data.file = g_file_get_child (fixture->tmp_dir, "atomic_replace_file"); g_file_delete (data.file, NULL, NULL); data.monitor = g_file_monitor_file (data.file, G_FILE_MONITOR_WATCH_MOVES, NULL, &error); g_assert_no_error (error); + g_test_message ("Using GFileMonitor %s", G_OBJECT_TYPE_NAME (data.monitor)); + g_file_monitor_set_rate_limit (data.monitor, 200); g_signal_connect (data.monitor, "changed", G_CALLBACK (monitor_changed), &data); @@ -345,7 +378,6 @@ test_atomic_replace (void) g_main_loop_run (data.loop); - /*output_events (data.events);*/ check_expected_events (atomic_replace_output, G_N_ELEMENTS (atomic_replace_output), data.events, @@ -425,7 +457,8 @@ static RecordedEvent change_output[] = { }; static void -test_file_changes (void) +test_file_changes (Fixture *fixture, + gconstpointer user_data) { GError *error = NULL; TestData data; @@ -433,12 +466,14 @@ test_file_changes (void) data.step = 0; data.events = NULL; - data.file = g_file_new_for_path ("change_file"); + data.file = g_file_get_child (fixture->tmp_dir, "change_file"); g_file_delete (data.file, NULL, NULL); data.monitor = g_file_monitor_file (data.file, G_FILE_MONITOR_WATCH_MOVES, NULL, &error); g_assert_no_error (error); + g_test_message ("Using GFileMonitor %s", G_OBJECT_TYPE_NAME (data.monitor)); + g_file_monitor_set_rate_limit (data.monitor, 200); g_signal_connect (data.monitor, "changed", G_CALLBACK (monitor_changed), &data); @@ -448,7 +483,6 @@ test_file_changes (void) g_main_loop_run (data.loop); - /*output_events (data.events);*/ check_expected_events (change_output, G_N_ELEMENTS (change_output), data.events, @@ -540,7 +574,8 @@ static RecordedEvent dir_output[] = { }; static void -test_dir_monitor (void) +test_dir_monitor (Fixture *fixture, + gconstpointer user_data) { GError *error = NULL; TestData data; @@ -548,13 +583,15 @@ test_dir_monitor (void) data.step = 0; data.events = NULL; - data.file = g_file_new_for_path ("dir_monitor_test"); + data.file = g_file_get_child (fixture->tmp_dir, "dir_monitor_test"); g_file_delete (data.file, NULL, NULL); g_file_make_directory (data.file, NULL, &error); data.monitor = g_file_monitor_directory (data.file, G_FILE_MONITOR_WATCH_MOVES, NULL, &error); g_assert_no_error (error); + g_test_message ("Using GFileMonitor %s", G_OBJECT_TYPE_NAME (data.monitor)); + g_file_monitor_set_rate_limit (data.monitor, 200); g_signal_connect (data.monitor, "changed", G_CALLBACK (monitor_changed), &data); @@ -564,7 +601,6 @@ test_dir_monitor (void) g_main_loop_run (data.loop); - /*output_events (data.events);*/ check_expected_events (dir_output, G_N_ELEMENTS (dir_output), data.events, @@ -635,7 +671,8 @@ static RecordedEvent nodir_output[] = { }; static void -test_dir_non_existent (void) +test_dir_non_existent (Fixture *fixture, + gconstpointer user_data) { TestData data; GError *error = NULL; @@ -643,10 +680,12 @@ test_dir_non_existent (void) data.step = 0; data.events = NULL; - data.file = g_file_new_for_path ("nosuchdir/nosuchfile"); + data.file = g_file_get_child (fixture->tmp_dir, "nosuchdir/nosuchfile"); data.monitor = g_file_monitor_file (data.file, G_FILE_MONITOR_WATCH_MOVES, NULL, &error); g_assert_no_error (error); + g_test_message ("Using GFileMonitor %s", G_OBJECT_TYPE_NAME (data.monitor)); + g_file_monitor_set_rate_limit (data.monitor, 200); g_signal_connect (data.monitor, "changed", G_CALLBACK (monitor_changed), &data); @@ -659,7 +698,6 @@ test_dir_non_existent (void) g_main_loop_run (data.loop); - /*output_events (data.events);*/ check_expected_events (nodir_output, G_N_ELEMENTS (nodir_output), data.events, @@ -742,7 +780,8 @@ static RecordedEvent cross_dir_b_output[] = { { -1, NULL, NULL, 3, NONE }, }; static void -test_cross_dir_moves (void) +test_cross_dir_moves (Fixture *fixture, + gconstpointer user_data) { GError *error = NULL; TestData data[2]; @@ -750,26 +789,30 @@ test_cross_dir_moves (void) data[0].step = 0; data[0].events = NULL; - data[0].file = g_file_new_for_path ("cross_dir_a"); + data[0].file = g_file_get_child (fixture->tmp_dir, "cross_dir_a"); g_file_delete (data[0].file, NULL, NULL); g_file_make_directory (data[0].file, NULL, &error); data[0].monitor = g_file_monitor_directory (data[0].file, 0, NULL, &error); g_assert_no_error (error); + g_test_message ("Using GFileMonitor 0 %s", G_OBJECT_TYPE_NAME (data[0].monitor)); + g_file_monitor_set_rate_limit (data[0].monitor, 200); g_signal_connect (data[0].monitor, "changed", G_CALLBACK (monitor_changed), &data[0]); data[1].step = 0; data[1].events = NULL; - data[1].file = g_file_new_for_path ("cross_dir_b"); + data[1].file = g_file_get_child (fixture->tmp_dir, "cross_dir_b"); g_file_delete (data[1].file, NULL, NULL); g_file_make_directory (data[1].file, NULL, &error); data[1].monitor = g_file_monitor_directory (data[1].file, G_FILE_MONITOR_WATCH_MOVES, NULL, &error); g_assert_no_error (error); + g_test_message ("Using GFileMonitor 1 %s", G_OBJECT_TYPE_NAME (data[1].monitor)); + g_file_monitor_set_rate_limit (data[1].monitor, 200); g_signal_connect (data[1].monitor, "changed", G_CALLBACK (monitor_changed), &data[1]); @@ -779,13 +822,6 @@ test_cross_dir_moves (void) g_main_loop_run (data[0].loop); -#if 0 - g_print ("monitor a:\n"); - output_events (data[0].events); - g_print ("monitor b:\n"); - output_events (data[1].events); -#endif - check_expected_events (cross_dir_a_output, G_N_ELEMENTS (cross_dir_a_output), data[0].events, @@ -913,7 +949,8 @@ static RecordedEvent file_hard_links_output[] = { }; static void -test_file_hard_links (void) +test_file_hard_links (Fixture *fixture, + gconstpointer user_data) { GError *error = NULL; TestData data; @@ -930,7 +967,7 @@ test_file_hard_links (void) data.events = NULL; /* Create a file which exists and is not a directory. */ - data.file = g_file_new_for_path ("testfilemonitor.db"); + data.file = g_file_get_child (fixture->tmp_dir, "testfilemonitor.db"); data.output_stream = g_file_replace (data.file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error); g_assert_no_error (error); @@ -945,6 +982,8 @@ test_file_hard_links (void) g_assert_no_error (error); g_assert_nonnull (data.monitor); + g_test_message ("Using GFileMonitor %s", G_OBJECT_TYPE_NAME (data.monitor)); + /* Change the file a bit. */ g_file_monitor_set_rate_limit (data.monitor, 200); g_signal_connect (data.monitor, "changed", (GCallback) monitor_changed, &data); @@ -953,7 +992,6 @@ test_file_hard_links (void) g_timeout_add (500, file_hard_links_step, &data); g_main_loop_run (data.loop); - /* output_events (data.events); */ check_expected_events (file_hard_links_output, G_N_ELEMENTS (file_hard_links_output), data.events, @@ -973,12 +1011,12 @@ main (int argc, char *argv[]) g_test_bug_base ("https://bugzilla.gnome.org/show_bug.cgi?id="); - g_test_add_func ("/monitor/atomic-replace", test_atomic_replace); - g_test_add_func ("/monitor/file-changes", test_file_changes); - g_test_add_func ("/monitor/dir-monitor", test_dir_monitor); - g_test_add_func ("/monitor/dir-not-existent", test_dir_non_existent); - g_test_add_func ("/monitor/cross-dir-moves", test_cross_dir_moves); - g_test_add_func ("/monitor/file/hard-links", test_file_hard_links); + g_test_add ("/monitor/atomic-replace", Fixture, NULL, setup, test_atomic_replace, teardown); + g_test_add ("/monitor/file-changes", Fixture, NULL, setup, test_file_changes, teardown); + g_test_add ("/monitor/dir-monitor", Fixture, NULL, setup, test_dir_monitor, teardown); + g_test_add ("/monitor/dir-not-existent", Fixture, NULL, setup, test_dir_non_existent, teardown); + g_test_add ("/monitor/cross-dir-moves", Fixture, NULL, setup, test_cross_dir_moves, teardown); + g_test_add ("/monitor/file/hard-links", Fixture, NULL, setup, test_file_hard_links, teardown); return g_test_run (); } diff --git a/gio/tests/tls-interaction.c b/gio/tests/tls-interaction.c index 345656e29..4f0737d7e 100644 --- a/gio/tests/tls-interaction.c +++ b/gio/tests/tls-interaction.c @@ -673,18 +673,10 @@ static void teardown_without_loop (Test *test, gconstpointer unused) { - gpointer weak_pointer = test->interaction; - - g_object_add_weak_pointer (weak_pointer, &weak_pointer); - g_object_unref (test->connection); - g_object_unref (test->password); - g_object_unref (test->interaction); - - g_assert (weak_pointer == NULL); - + g_assert_finalize_object (test->interaction); } typedef struct { diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c index d5df16d91..465f41b6b 100644 --- a/gio/win32/gwinhttpfile.c +++ b/gio/win32/gwinhttpfile.c @@ -439,31 +439,6 @@ g_winhttp_file_set_display_name (GFile *file, return NULL; } -static time_t -mktime_utc (SYSTEMTIME *t) -{ - time_t retval; - - static const gint days_before[] = - { - 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 - }; - - if (t->wMonth < 1 || t->wMonth > 12) - return (time_t) -1; - - retval = (t->wYear - 1970) * 365; - retval += (t->wYear - 1968) / 4; - retval += days_before[t->wMonth-1] + t->wDay - 1; - - if (t->wYear % 4 == 0 && t->wMonth < 3) - retval -= 1; - - retval = ((((retval * 24) + t->wHour) * 60) + t->wMinute) * 60 + t->wSecond; - - return retval; -} - static GFileInfo * g_winhttp_file_query_info (GFile *file, const char *attributes, @@ -603,12 +578,15 @@ g_winhttp_file_query_info (GFile *file, last_modified.wYear >= 1970 && last_modified.wYear < 2038) { - GTimeVal tv; + GDateTime *dt = NULL, *dt2 = NULL; + + dt = g_date_time_new_from_unix_utc (last_modified.wMilliseconds / 1000); + dt2 = g_date_time_add_seconds (dt, (last_modified.wMilliseconds % 1000) / 1000); - tv.tv_sec = mktime_utc (&last_modified); - tv.tv_usec = last_modified.wMilliseconds * 1000; + g_file_info_set_modification_date_time (info, dt2); - g_file_info_set_modification_time (info, &tv); + g_date_time_unref (dt2); + g_date_time_unref (dt); } g_file_attribute_matcher_unref (matcher); diff --git a/gio/win32/meson.build b/gio/win32/meson.build index f0fc307ba..8d589989b 100644 --- a/gio/win32/meson.build +++ b/gio/win32/meson.build @@ -12,4 +12,4 @@ giowin32_lib = static_library('giowin32', include_directories : [configinc, glibinc, gioinc, gmoduleinc], dependencies : [libintl, gioenumtypes_dep], pic : true, - c_args : [ '-DG_DISABLE_DEPRECATED' ] + gio_c_args) + c_args : gio_c_args) diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c index 2446d3813..9bb93f791 100644 --- a/gio/xdgmime/xdgmime.c +++ b/gio/xdgmime/xdgmime.c @@ -531,7 +531,8 @@ xdg_mime_get_mime_type_for_data (const void *data, if (len == 0) { - *result_prio = 100; + if (result_prio != NULL) + *result_prio = 100; return XDG_MIME_TYPE_EMPTY; } |