From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74606: 31.0.50; Another rsvg API change Date: Sun, 01 Dec 2024 14:09:26 +0100 Message-ID: <87plmbsg6x.fsf@ledu-giraud.fr> References: <877c8m9el0.fsf@ledu-giraud.fr> <86zflh6kw0.fsf@gnu.org> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9824"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74606@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 01 14:10:21 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tHjiO-0002Od-MQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 14:10:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHji9-0000eE-HI; Sun, 01 Dec 2024 08:10:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHji7-0000cn-7z for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 08:10:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHji6-0007dG-W5 for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 08:10:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=i2k4ziszBec17jFG3VjagzoT9LCaOheagv6hRYRcgEA=; b=LR4v+F80m3eGoNzPwa3yUse+Gx4vVFCMo2/jtM8zrxmbCMcK9BfgfBj+JFSTyxhxf/9i2z6qxCmU62AUDTzXzRUXlm8wFDOmyOcUwVELpeUwPgkCEjxe9x7tdVjaq1caX8B3ude8Yxnw15gEoXqH+axAGtLmWu6ClKoZcs4VCYS9uiiCZ42mow4t9C0mEmd1D3os+c899KLRUVUwZoat7Mx8c+zVlWX7iI5gj6UYp11XfF4Zin4fgtsz6AxONZdJYGlpjZAYVdNE3PKXtI5nWNA9mhHIF1tOnoM38JVCCLHJeXkrj4Aqaekp88nXleC25ATlFIuoD75g1V/fE7OnLg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHji6-0008Oh-Hu for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 08:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2024 13:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74606 X-GNU-PR-Package: emacs Original-Received: via spool by 74606-submit@debbugs.gnu.org id=B74606.173305857332223 (code B ref 74606); Sun, 01 Dec 2024 13:10:02 +0000 Original-Received: (at 74606) by debbugs.gnu.org; 1 Dec 2024 13:09:33 +0000 Original-Received: from localhost ([127.0.0.1]:50675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHjhc-0008Nc-UY for submit@debbugs.gnu.org; Sun, 01 Dec 2024 08:09:33 -0500 Original-Received: from ledu-giraud.fr ([51.159.28.247]:13094) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHjhZ-0008NS-HL for 74606@debbugs.gnu.org; Sun, 01 Dec 2024 08:09:31 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=HJoR+Jdg 0NRLlHu3icWDzSjQDH+g+iylMsmOabB/dQU=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=/lxMs66yM+IDHvKi4CtoGgunhHN4AB Ci9DKkhdcE5Phd50QZ30rAx1uPBNp7isu6ogEeXr/epetojKFBctRNBg== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=HJoR+Jdg0NRLlHu3 icWDzSjQDH+g+iylMsmOabB/dQU=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=DqjTQPKx62U8JLbIPQLQr4WaEU05mH8CelUms3 mzYqYOoFjWSBlGO8JYCqcudr25GQOwl8FigJpRD3wFN89Tw3IPLicmS8h2nEUoQHg/eK5k k+riQPca7RDCcbAqCiH41bCBoLBzMo0Vqyd2tI1YFjxIBbV0djGCtQs453V/vMC6iP1VPX 0UVeayz2UXI+V0qh0SpGDvUPrNki7TeW83GHRF9oaDDmcfqViWhbFovQyl95dB6UV+JH4S yS6u9H250RY73NTTRD62an1WHaE307rVy+fZFyQicw2KzxEpeif1lqS4ine0WYi+vI5Xn0 7fQXzWj3WPWRtIBjMrcrWjNw== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id cc6ddbb7 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 1 Dec 2024 14:09:27 +0100 (CET) In-Reply-To: <86zflh6kw0.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 30 Nov 2024 13:06:39 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296248 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii 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" >> >> 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Update-to-version-2.58-of-librsvg-API-bug-74606.patch >From 767bef2e8355c1e3ac514fa1f3a342a36f643316 Mon Sep 17 00:00:00 2001 From: Manuel Giraud 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 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=--