Commit 9118d447 authored by Samuel Thibault's avatar Samuel Thibault
Browse files

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.

It allows to be sure that Orca will have a well-defined behavior rather
than possibly very erratic behavior.
parent 57af1951
......@@ -258,6 +258,9 @@ atk_component_ref_accessible_at_point (AtkComponent *component,
*
* Gets the rectangle which gives the extent of the @component.
*
* If the extent can not be obtained (e.g. a non-embedded plug or missing
* support), all of x, y, width, height are set to -1.
*
**/
void
atk_component_get_extents (AtkComponent *component,
......@@ -294,6 +297,13 @@ atk_component_get_extents (AtkComponent *component,
if (iface->get_extents)
(iface->get_extents) (component, real_x, real_y, real_width, real_height, coord_type);
else
{
*real_x = -1;
*real_y = -1;
*real_width = -1;
*real_height = -1;
}
}
/**
......@@ -307,6 +317,9 @@ atk_component_get_extents (AtkComponent *component,
* Gets the position of @component in the form of
* a point specifying @component's top-left corner.
*
* If the position can not be obtained (e.g. a non-embedded plug or missing
* support), x and y are set to -1.
*
* Deprecated: Since 2.12. Use atk_component_get_extents() instead.
**/
void
......@@ -334,6 +347,11 @@ atk_component_get_position (AtkComponent *component,
if (iface->get_position)
(iface->get_position) (component, real_x, real_y, coord_type);
else
{
*real_x = -1;
*real_y = -1;
}
}
/**
......@@ -344,6 +362,9 @@ atk_component_get_position (AtkComponent *component,
*
* Gets the size of the @component in terms of width and height.
*
* If the size can not be obtained (e.g. a non-embedded plug or missing
* support), width and height are set to -1.
*
* Deprecated: Since 2.12. Use atk_component_get_extents() instead.
**/
void
......@@ -372,6 +393,11 @@ atk_component_get_size (AtkComponent *component,
if (iface->get_size)
(iface->get_size) (component, real_width, real_height);
else
{
*real_width = -1;
*real_height = -1;
}
}
/**
......
......@@ -1062,6 +1062,9 @@ atk_text_set_caret_offset (AtkText *text,
*
* Get the bounding box for text within the specified range.
*
* If the extents can not be obtained (e.g. or missing support), the rectangle
* fields are set to -1.
*
* Since: 1.3
**/
void
......@@ -1081,6 +1084,13 @@ atk_text_get_range_extents (AtkText *text,
if (iface->get_range_extents)
(*(iface->get_range_extents)) (text, start_offset, end_offset, coord_type, rect);
else
{
rect->x = -1;
rect->y = -1;
rect->width = -1;
rect->height = -1;
}
}
/**
......
......@@ -547,6 +547,11 @@ atk_value_get_value_and_text (AtkValue *obj,
{
(iface->get_value_and_text) (obj, value, text);
}
else
{
*value = 0.0;
*text = NULL;
}
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment