diff options
| author | Stefan Kangas | 2022-09-09 02:32:08 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-09-09 03:07:44 +0200 |
| commit | 816106b7e6a930d55e723e7c4d9d5f664ecd5520 (patch) | |
| tree | 1ae240941ebce9127c4a5ba602498185d3344cb9 /src | |
| parent | ef17ba83709794fe0342743397f0e68b90ea1f69 (diff) | |
| download | emacs-816106b7e6a930d55e723e7c4d9d5f664ecd5520.tar.gz emacs-816106b7e6a930d55e723e7c4d9d5f664ecd5520.zip | |
Display librsvg error when loading bad SVG
* src/image.c (svg_load_image): Display the error message from librsvg
when parsing a bad SVG image file.
* test/manual/image-tests.el
(image-tests-load-image/svg-invalid): New test.
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/image.c b/src/image.c index f5004c2c4c7..549fe30ef7c 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Functions for image support on window system. | 1 | /* Functions for image support on window system. |
| 2 | 2 | ||
| 3 | Copyright (C) 1989, 1992-2022 Free Software Foundation, Inc. | 3 | Copyright (C) 1989-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -11491,7 +11491,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents, | |||
| 11491 | if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) | 11491 | if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) |
| 11492 | { | 11492 | { |
| 11493 | g_object_unref (pixbuf); | 11493 | g_object_unref (pixbuf); |
| 11494 | return 0; | 11494 | return false; |
| 11495 | } | 11495 | } |
| 11496 | 11496 | ||
| 11497 | init_color_table (); | 11497 | init_color_table (); |
| @@ -11536,7 +11536,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents, | |||
| 11536 | image_put_x_image (f, img, ximg, 0); | 11536 | image_put_x_image (f, img, ximg, 0); |
| 11537 | } | 11537 | } |
| 11538 | 11538 | ||
| 11539 | return 1; | 11539 | return true; |
| 11540 | 11540 | ||
| 11541 | rsvg_error: | 11541 | rsvg_error: |
| 11542 | if (rsvg_handle) | 11542 | if (rsvg_handle) |
| @@ -11547,11 +11547,11 @@ svg_load_image (struct frame *f, struct image *img, char *contents, | |||
| 11547 | if (css && !STRINGP (lcss)) | 11547 | if (css && !STRINGP (lcss)) |
| 11548 | xfree (css); | 11548 | xfree (css); |
| 11549 | #endif | 11549 | #endif |
| 11550 | /* FIXME: Use error->message so the user knows what is the actual | 11550 | image_error ("Error parsing SVG image: %s", |
| 11551 | problem with the image. */ | 11551 | /* The -1 removes an extra newline. */ |
| 11552 | image_error ("Error parsing SVG image"); | 11552 | make_string (err->message, strlen (err->message) - 1)); |
| 11553 | g_clear_error (&err); | 11553 | g_clear_error (&err); |
| 11554 | return 0; | 11554 | return false; |
| 11555 | } | 11555 | } |
| 11556 | 11556 | ||
| 11557 | #endif /* defined (HAVE_RSVG) */ | 11557 | #endif /* defined (HAVE_RSVG) */ |