unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 74606@debbugs.gnu.org
Subject: bug#74606: 31.0.50; Another rsvg API change
Date: Sun, 01 Dec 2024 14:09:26 +0100	[thread overview]
Message-ID: <87plmbsg6x.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <86zflh6kw0.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 30 Nov 2024 13:06:39 +0200")

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Fri, 29 Nov 2024 17:42:19 +0100
>> From:  Manuel Giraud via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> This is not a bug (yet) per se but here is a new warning I get from
>> compiling Emacs with librsvg version 2.59.2:
>> 
>>   CC       image.o
>> image.c: In function 'svg_load_image':
>> image.c:12360:3: warning: 'rsvg_handle_get_pixbuf' is deprecated: Use 'rsvg_handle_get_pixbuf_and_error' instead [-Wdeprecated-declarations]
>> 12360 |   pixbuf = rsvg_handle_get_pixbuf (rsvg_handle);
>>       |   ^~~~~~
>> In file included from /usr/local/include/librsvg-2.0/librsvg/rsvg.h:1332,
>>                  from image.c:11652:
>> /usr/local/include/librsvg-2.0/librsvg/rsvg-pixbuf.h:55:12: note: declared here
>>    55 | GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle *handle);
>>       |            ^~~~~~~~~~~~~~~~~~~~~~
>
> The way to fix this is to add code conditioned on librsvg version that
> uses rsvg_handle_get_pixbuf_and_error when available.

Ok.  According to this:
https://gitlab.gnome.org/GNOME/librsvg/-/blob/main/include/librsvg/rsvg-pixbuf.h?ref_type=heads#L52

this API is deprecated since 2.58 so here is the patch for this change.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Update-to-version-2.58-of-librsvg-API-bug-74606.patch --]
[-- Type: text/x-patch, Size: 3064 bytes --]

From 767bef2e8355c1e3ac514fa1f3a342a36f643316 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Sun, 1 Dec 2024 13:50:05 +0100
Subject: [PATCH] Update to version 2.58 of librsvg API (bug#74606)

* src/image.c (init_svg_functions): Declare new function.
(svg_load_image): Use it.
---
 src/image.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/image.c b/src/image.c
index db7f6acd171..88b0f91413e 100644
--- a/src/image.c
+++ b/src/image.c
@@ -11706,7 +11706,11 @@ DEF_DLL_FN (void, rsvg_handle_get_dimensions,
 DEF_DLL_FN (gboolean, rsvg_handle_set_stylesheet,
 	    (RsvgHandle *, const guint8 *, gsize, GError **));
 #  endif
+#  if LIBRSVG_CHECK_VERSION (2, 58, 0)
+DEF_DLL_FN (GdkPixbuf *, rsvg_handle_get_pixbuf_and_error, (RsvgHandle *, GError **));
+#  else
 DEF_DLL_FN (GdkPixbuf *, rsvg_handle_get_pixbuf, (RsvgHandle *));
+#  endif
 DEF_DLL_FN (int, gdk_pixbuf_get_width, (const GdkPixbuf *));
 DEF_DLL_FN (int, gdk_pixbuf_get_height, (const GdkPixbuf *));
 DEF_DLL_FN (guchar *, gdk_pixbuf_get_pixels, (const GdkPixbuf *));
@@ -11765,8 +11769,11 @@ init_svg_functions (void)
 #if LIBRSVG_CHECK_VERSION (2, 48, 0)
   LOAD_DLL_FN (library, rsvg_handle_set_stylesheet);
 #endif
+#if LIBRSVG_CHECK_VERSION (2, 58, 0)
+  LOAD_DLL_FN (library, rsvg_handle_get_pixbuf_and_error);
+#else
   LOAD_DLL_FN (library, rsvg_handle_get_pixbuf);
-
+#endif
   LOAD_DLL_FN (gdklib, gdk_pixbuf_get_width);
   LOAD_DLL_FN (gdklib, gdk_pixbuf_get_height);
   LOAD_DLL_FN (gdklib, gdk_pixbuf_get_pixels);
@@ -11811,7 +11818,11 @@ init_svg_functions (void)
 #  if LIBRSVG_CHECK_VERSION (2, 48, 0)
 #   undef rsvg_handle_set_stylesheet
 #  endif
-#  undef rsvg_handle_get_pixbuf
+#  if LIBRSVG_CHECK_VERSION (2, 58, 0)
+#   undef rsvg_handle_get_pixbuf_and_error
+#  else
+#   undef rsvg_handle_get_pixbuf
+#  endif
 #  if LIBRSVG_CHECK_VERSION (2, 32, 0)
 #   undef g_file_new_for_path
 #   undef g_memory_input_stream_new_from_data
@@ -11852,7 +11863,11 @@ init_svg_functions (void)
 #  if LIBRSVG_CHECK_VERSION (2, 48, 0)
 #   define rsvg_handle_set_stylesheet fn_rsvg_handle_set_stylesheet
 #  endif
-#  define rsvg_handle_get_pixbuf fn_rsvg_handle_get_pixbuf
+#  if LIBRSVG_CHECK_VERSION (2, 58, 0)
+#   define rsvg_handle_get_pixbuf_and_error fn_rsvg_handle_get_pixbuf_and_error
+#  else
+#   define rsvg_handle_get_pixbuf fn_rsvg_handle_get_pixbuf
+#  endif
 #  if LIBRSVG_CHECK_VERSION (2, 32, 0)
 #   define g_file_new_for_path fn_g_file_new_for_path
 #   define g_memory_input_stream_new_from_data \
@@ -12357,8 +12372,13 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
 
   /* We can now get a valid pixel buffer from the svg file, if all
      went ok.  */
+#if LIBRSVG_CHECK_VERSION (2, 58, 0)
+  pixbuf = rsvg_handle_get_pixbuf_and_error (rsvg_handle, &err);
+  if (err) goto rsvg_error;
+#else
   pixbuf = rsvg_handle_get_pixbuf (rsvg_handle);
   if (!pixbuf) goto rsvg_error;
+#endif
   g_object_unref (rsvg_handle);
   xfree (wrapped_contents);
 
-- 
2.47.0


[-- Attachment #3: Type: text/plain, Size: 18 bytes --]

-- 
Manuel Giraud

  reply	other threads:[~2024-12-01 13:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-29 16:42 bug#74606: 31.0.50; Another rsvg API change Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 11:06 ` Eli Zaretskii
2024-12-01 13:09   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-01 14:55     ` Eli Zaretskii
2024-12-02 11:58       ` Osama Rebach
2024-12-02 13:45         ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-02 14:06           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-02 14:14             ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-02 14:41               ` Eli Zaretskii
2024-12-02 15:02                 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-02 15:11                   ` Eli Zaretskii
2024-12-02 16:03                     ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-02 16:24                       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87plmbsg6x.fsf@ledu-giraud.fr \
    --to=bug-gnu-emacs@gnu.org \
    --cc=74606@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).