[at-spi2-atk: 1/2] Make sure returned values are initialized
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-atk: 1/2] Make sure returned values are initialized
- Date: Mon, 19 Aug 2019 15:24:11 +0000 (UTC)
commit ffedc3504b0d1984f46dcbc61da325bbcc9dee0b
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date: Mon Aug 19 11:18:58 2019 +0200
Make sure returned values are initialized
Some methods do not have a way to notify that they have failed.
They should thus make sure that they set some value, rather than let them
uninitialized and thus random.
As newly documented by https://gitlab.gnome.org/GNOME/atk/merge_requests/22
atk-adaptor/adaptors/socket-adaptor.c | 38 +++++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 8 deletions(-)
---
diff --git a/atk-adaptor/adaptors/socket-adaptor.c b/atk-adaptor/adaptors/socket-adaptor.c
index ed6faa3..c81b2d8 100644
--- a/atk-adaptor/adaptors/socket-adaptor.c
+++ b/atk-adaptor/adaptors/socket-adaptor.c
@@ -76,14 +76,24 @@ atspi_plug_component_get_extents (AtkComponent *component, gint *x, gint *y,
message, -1, &error);
dbus_message_unref (message);
if (!reply)
- return;
+ {
+ *x = -1;
+ *y = -1;
+ *width = -1;
+ *height = -1;
+ return;
+ }
signature = dbus_message_get_signature (reply);
if (g_strcmp0 (signature, "(iiii)") != 0)
- {
- g_warning ("Got unexpected signature %s from GetExtents\n", signature);
- dbus_message_unref (reply);
- return;
- }
+ {
+ g_warning ("Got unexpected signature %s from GetExtents\n", signature);
+ dbus_message_unref (reply);
+ *x = -1;
+ *y = -1;
+ *width = -1;
+ *height = -1;
+ return;
+ }
dbus_message_iter_init (reply, &iter);
dbus_message_iter_recurse (&iter, &iter_struct);
dbus_message_iter_get_basic (&iter_struct, &tmp);
@@ -116,12 +126,18 @@ atspi_plug_component_get_position (AtkComponent *component, gint *x, gint *y,
message, -1, &error);
dbus_message_unref (message);
if (!reply)
- return;
+ {
+ *x = -1;
+ *y = -1;
+ return;
+ }
if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_INT32, &x_dbus,
DBUS_TYPE_INT32, &y_dbus, DBUS_TYPE_INVALID))
{
g_warning ("GetPosition failed: %s", error.message);
dbus_error_free (&error);
+ *x = -1;
+ *y = -1;
}
else
{
@@ -145,12 +161,18 @@ atspi_plug_component_get_size (AtkComponent *component,
message, -1, &error);
dbus_message_unref (message);
if (!reply)
- return;
+ {
+ *width = -1;
+ *height = -1;
+ return;
+ }
if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_INT32, &width_dbus,
DBUS_TYPE_INT32, &height_dbus, DBUS_TYPE_INVALID))
{
g_warning ("GetSize failed: %s", error.message);
dbus_error_free (&error);
+ *width = -1;
+ *height = -1;
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]