[X2Go-Commits] [libx2goclient] 44/132: src/x2goclient-network{.{c, h}, -ssh.c}: fix gobject-introspection warnings due to non-namespaced function pointer and reference types.

git-admin at x2go.org git-admin at x2go.org
Fri Dec 3 15:26:30 CET 2021


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository libx2goclient.

commit 8502e1bd2c29c05bba2405a228bac951db6c38ff
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Apr 26 10:10:41 2021 +0200

    src/x2goclient-network{.{c,h},-ssh.c}: fix gobject-introspection warnings due to non-namespaced function pointer and reference types.
    
    This has two consequences:
      - it's ugly, because gir treats the function pointer itself as a
        symbol (hence needing a symbol_prefix), while the function pointer
        reference type is interpreted as an identifier (hence needing an
        IdentifierPrefix).
      - it makes gir generate a faulty .gir file and leads to a build
        failure. Reported as
        https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/385 ,
        but until this is resolved, we will have to work around the issue by
        hiding the reference type from gir.
---
 src/x2goclient-network-ssh.c |  8 ++++----
 src/x2goclient-network.c     | 16 ++++++++--------
 src/x2goclient-network.h     | 19 +++++++++++++------
 3 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c
index 7e7aae0..c9e1221 100644
--- a/src/x2goclient-network-ssh.c
+++ b/src/x2goclient-network-ssh.c
@@ -1187,8 +1187,8 @@ gboolean x2goclient_network_ssh_connect (X2GoClientNetworkSSH * const self, GErr
   (void) parent_class;
 
   /* Fetch parent's connect function. */
-  connect_type parent_connect = NULL;
-  connect_ref_type parent_connect_ref = NULL;
+  x2goclient_network_connect_type parent_connect = NULL;
+  X2GoClientNetwork_connect_ref_type parent_connect_ref = NULL;
   g_object_get (G_OBJECT (self), "connect-function", &parent_connect_ref, NULL);
   g_assert (parent_connect_ref);
 
@@ -1426,8 +1426,8 @@ gboolean x2goclient_network_ssh_disconnect (X2GoClientNetworkSSH * const self, G
   (void) parent_class;
 
   /* Fetch parent's disconnect function. */
-  disconnect_type parent_disconnect = NULL;
-  disconnect_ref_type parent_disconnect_ref = NULL;
+  x2goclient_network_disconnect_type parent_disconnect = NULL;
+  X2GoClientNetwork_disconnect_ref_type parent_disconnect_ref = NULL;
   g_object_get (G_OBJECT (self), "disconnect-function", &parent_disconnect_ref, NULL);
   g_assert (parent_disconnect_ref);
 
diff --git a/src/x2goclient-network.c b/src/x2goclient-network.c
index 164cfc2..67d1d8a 100644
--- a/src/x2goclient-network.c
+++ b/src/x2goclient-network.c
@@ -100,8 +100,8 @@ typedef struct X2GoClientNetworkPrivate_ {
   X2GoClientNetworkOptions *options;
   gchar *session_path; /* Will eventually be replaced with a session object, probably. */
   gboolean connected;
-  connect_type connect_func;
-  disconnect_type disconnect_func;
+  x2goclient_network_connect_type connect_func;
+  x2goclient_network_disconnect_type disconnect_func;
 } X2GoClientNetworkPrivate;
 
 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (X2GoClientNetwork, x2goclient_network, G_TYPE_OBJECT)
@@ -453,8 +453,8 @@ static void x2goclient_network_set_property (GObject * const object, guint prop_
   X2GoClientNetwork *self = X2GOCLIENT_NETWORK (object);
   X2GoClientNetworkPrivate *priv = x2goclient_network_get_instance_private (self);
 
-  connect_ref_type conn_ref = NULL;
-  disconnect_ref_type disconn_ref = NULL;
+  X2GoClientNetwork_connect_ref_type conn_ref = NULL;
+  X2GoClientNetwork_disconnect_ref_type disconn_ref = NULL;
   switch (prop_id) {
     case (X2GO_NET_PROP_SOCKET_SPEC):
                                       if (priv->socket_spec) {
@@ -515,8 +515,8 @@ static void x2goclient_network_get_property (GObject * const object, const guint
   X2GoClientNetwork *self = X2GOCLIENT_NETWORK (object);
   X2GoClientNetworkPrivate *priv = x2goclient_network_get_instance_private (self);
 
-  connect_ref_type conn_ref = NULL;
-  disconnect_ref_type disconn_ref = NULL;
+  X2GoClientNetwork_connect_ref_type conn_ref = NULL;
+  X2GoClientNetwork_disconnect_ref_type disconn_ref = NULL;
   switch (prop_id) {
     case (X2GO_NET_PROP_SOCKET_SPEC):
                                       g_value_set_boxed (value, priv->socket_spec);
@@ -538,7 +538,7 @@ static void x2goclient_network_get_property (GObject * const object, const guint
                                      * Create and pass function pointer as
                                      * data.
                                      */
-                                    conn_ref = g_new0 (connect_type, 1);
+                                    conn_ref = g_new0 (x2goclient_network_connect_type, 1);
                                     *(conn_ref) = priv->connect_func;
                                     g_value_set_pointer (value, conn_ref);
 
@@ -550,7 +550,7 @@ static void x2goclient_network_get_property (GObject * const object, const guint
                                     break;
     case (X2GO_NET_PROP_DISCONN_FUNC):
                                        /* Same as for CONN_FUNC. */
-                                       disconn_ref = g_new0 (disconnect_type, 1);
+                                       disconn_ref = g_new0 (x2goclient_network_disconnect_type, 1);
                                        *(disconn_ref) = priv->disconnect_func;
                                        g_value_set_pointer (value, disconn_ref);
                                        disconn_ref = NULL;
diff --git a/src/x2goclient-network.h b/src/x2goclient-network.h
index 2680197..689d083 100644
--- a/src/x2goclient-network.h
+++ b/src/x2goclient-network.h
@@ -66,16 +66,23 @@ G_DECLARE_DERIVABLE_TYPE (X2GoClientNetwork, x2goclient_network, X2GOCLIENT, NET
  * Due to this, the only way to pass them around is through indirection -
  * i.e., the address of an object pointer.
  */
-typedef gboolean (*connect_type) (X2GoClientNetwork * const self, GError ** const gerr);
-typedef connect_type *connect_ref_type;
-typedef gboolean (*disconnect_type) (X2GoClientNetwork * const self, GError ** const gerr);
-typedef disconnect_type *disconnect_ref_type;
+typedef gboolean (*x2goclient_network_connect_type) (X2GoClientNetwork * const self, GError ** const gerr);
+typedef gboolean (*x2goclient_network_disconnect_type) (X2GoClientNetwork * const self, GError ** const gerr);
+#ifndef __GI_SCANNER__
+/*
+ * We have to hide this until
+ * https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/385 is
+ * resolved.
+ */
+typedef x2goclient_network_connect_type *X2GoClientNetwork_connect_ref_type;
+typedef x2goclient_network_disconnect_type *X2GoClientNetwork_disconnect_ref_type;
+#endif
 
 struct _X2GoClientNetworkClass {
   GObjectClass parent_class;
 
-  connect_type connect;
-  disconnect_type disconnect;
+  x2goclient_network_connect_type connect;
+  x2goclient_network_disconnect_type disconnect;
 
   /*< private >*/
   GSocketAddress* (*parse_sockspec) (X2GoClientNetwork * const self, const GString * const sockspec);

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git


More information about the x2go-commits mailing list