[librsvg/librsvg-2.44] rsvg-dimensions.c: Be clear on whether a fragment is not found, or whether its position/dimensions c
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.44] rsvg-dimensions.c: Be clear on whether a fragment is not found, or whether its position/dimensions c
- Date: Wed, 26 Sep 2018 12:21:23 +0000 (UTC)
commit 0d9f397d4f64c586219d3f0137534056b1a8348a
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 25 17:02:29 2018 -0500
rsvg-dimensions.c: Be clear on whether a fragment is not found, or whether its position/dimensions could
not be computed
tools/rsvg-dimensions.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/tools/rsvg-dimensions.c b/tools/rsvg-dimensions.c
index 5869c474..e3c5203d 100644
--- a/tools/rsvg-dimensions.c
+++ b/tools/rsvg-dimensions.c
@@ -85,18 +85,34 @@ main (int argc,
}
if (fragment && handle) {
- gboolean have_fragment = FALSE;
- have_fragment |= rsvg_handle_get_dimensions_sub (handle,
- &dimensions, fragment);
- have_fragment |= rsvg_handle_get_position_sub (handle,
- &position, fragment);
- if (!have_fragment) {
+ if (!rsvg_handle_has_sub (handle, fragment)) {
g_warning ("%s: fragment `'%s' not found.",
file, fragment);
exit_code = EXIT_FAILURE;
goto bail;
}
+ gboolean have_position, have_dimensions;
+
+ have_dimensions = rsvg_handle_get_dimensions_sub (handle,
+ &dimensions, fragment);
+ have_position = rsvg_handle_get_position_sub (handle,
+ &position, fragment);
+ if (!have_dimensions) {
+ g_warning ("%s: could not compute position for fragment `'%s'.",
+ file, fragment);
+ }
+
+ if (!have_position) {
+ g_warning ("%s: could not compute dimensions for fragment `'%s'.",
+ file, fragment);
+ }
+
+ if (!have_position || !have_dimensions) {
+ exit_code = EXIT_FAILURE;
+ goto bail;
+ }
+
printf ("%s, fragment `%s': x=%d, y=%d, %dx%d, em=%f, ex=%f\n",
file, fragment,
position.x, position.y,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]