gkdbus: Fix underflow and unreachable code bug
[platform/upstream/glib.git] / gio / gsocketconnection.c
index 4918279..67e8f3d 100644 (file)
@@ -4,10 +4,12 @@
  *           © 2008 codethink
  * Copyright © 2009 Red Hat, Inc
  *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * 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
@@ -139,7 +141,7 @@ g_socket_connection_is_connected (GSocketConnection  *connection)
  * g_socket_connection_connect:
  * @connection: a #GSocketConnection
  * @address: a #GSocketAddress specifying the remote address.
- * @cancellable: (allow-none): a %GCancellable or %NULL
+ * @cancellable: (nullable): a %GCancellable or %NULL
  * @error: #GError for error reporting, or %NULL to ignore.
  *
  * Connect @connection to the specified remote address.
@@ -169,9 +171,9 @@ static gboolean g_socket_connection_connect_callback (GSocket      *socket,
  * g_socket_connection_connect_async:
  * @connection: a #GSocketConnection
  * @address: a #GSocketAddress specifying the remote address.
- * @cancellable: (allow-none): a %GCancellable or %NULL
+ * @cancellable: (nullable): a %GCancellable or %NULL
  * @callback: (scope async): a #GAsyncReadyCallback
- * @user_data: (closure): user data for the callback
+ * @user_data: user data for the callback
  *
  * Asynchronously connect @connection to the specified remote address.
  *
@@ -196,6 +198,7 @@ g_socket_connection_connect_async (GSocketConnection   *connection,
   g_return_if_fail (G_IS_SOCKET_ADDRESS (address));
 
   task = g_task_new (connection, cancellable, callback, user_data);
+  g_task_set_source_tag (task, g_socket_connection_connect_async);
 
   g_socket_set_blocking (connection->priv->socket, FALSE);
 
@@ -388,7 +391,9 @@ g_socket_connection_set_property (GObject      *object,
 static void
 g_socket_connection_constructed (GObject *object)
 {
+#ifndef G_DISABLE_ASSERT
   GSocketConnection *connection = G_SOCKET_CONNECTION (object);
+#endif
 
   g_assert (connection->priv->socket != NULL);
 }
@@ -501,6 +506,7 @@ g_socket_connection_close_async (GIOStream           *stream,
   class = G_IO_STREAM_GET_CLASS (stream);
 
   task = g_task_new (stream, cancellable, callback, user_data);
+  g_task_set_source_tag (task, g_socket_connection_close_async);
 
   /* socket close is not blocked, just do it! */
   error = NULL;
@@ -611,9 +617,7 @@ g_socket_connection_factory_register_type (GType         g_type,
 static void
 init_builtin_types (void)
 {
-#ifndef G_OS_WIN32
   g_type_ensure (G_TYPE_UNIX_CONNECTION);
-#endif
   g_type_ensure (G_TYPE_TCP_CONNECTION);
 }