summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-08-19 15:44:28 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-08-19 16:05:34 +0200
commitba14b9fcac523e6cc76bebea0656b6625a1c36f9 (patch)
tree80e08bc521b51d1b39254131a89fc3fd175a6798
parentd7ba87962aed2e19804bbc1924187258f6a5b616 (diff)
downloadatk-ba14b9fcac523e6cc76bebea0656b6625a1c36f9.tar.gz
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. This is a follow-up for 9118d44778e4 ("Make sure returned values are initialized")
-rw-r--r--atk/atkimage.c6
-rw-r--r--atk/atktext.c11
2 files changed, 13 insertions, 4 deletions
diff --git a/atk/atkimage.c b/atk/atkimage.c
index 5080150..3a7bdc7 100644
--- a/atk/atkimage.c
+++ b/atk/atkimage.c
@@ -97,6 +97,9 @@ atk_image_get_image_description (AtkImage *image)
* Get the width and height in pixels for the specified image.
* The values of @width and @height are returned as -1 if the
* values cannot be obtained (for instance, if the object is not onscreen).
+ *
+ * If the size can not be obtained (e.g. missing support), x and y are set
+ * to -1.
**/
void
atk_image_get_image_size (AtkImage *image,
@@ -171,6 +174,9 @@ atk_image_set_image_description (AtkImage *image,
*
* Gets the position of the image in the form of a point specifying the
* images top-left corner.
+ *
+ * If the position can not be obtained (e.g. missing support), x and y are set
+ * to -1.
**/
void
atk_image_get_image_position (AtkImage *image,
diff --git a/atk/atktext.c b/atk/atktext.c
index 8f2e498..fec90b0 100644
--- a/atk/atktext.c
+++ b/atk/atktext.c
@@ -665,6 +665,9 @@ atk_text_get_caret_offset (AtkText *text)
* @height: (out) (optional): Pointer for the height of the bounding box
* @coords: specify whether coordinates are relative to the screen or widget window
*
+ * If the extent can not be obtained (e.g. missing support), all of x, y, width,
+ * height are set to -1.
+ *
* Get the bounding box containing the glyph representing the character at
* a particular text offset.
**/
@@ -700,10 +703,10 @@ atk_text_get_character_extents (AtkText *text,
else
real_height = &local_height;
- *real_x = 0;
- *real_y = 0;
- *real_width = 0;
- *real_height = 0;
+ *real_x = -1;
+ *real_y = -1;
+ *real_width = -1;
+ *real_height = -1;
if (offset < 0)
return;