unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 35548@debbugs.gnu.org
Subject: bug#35548: image.c uses deprecated rsvg_handle_write etc.
Date: Thu, 04 Jul 2019 12:14:08 +0900	[thread overview]
Message-ID: <wlsgrm8pa7.wl-mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <ce4a8384-f6a8-ec4e-cb48-5a339fb861c7@cs.ucla.edu>

On Sat, 04 May 2019 04:23:32 +0900,
Paul Eggert wrote:
> 
> I just upgraded my Emacs build platform to Fedora 30 and found that
> Emacs wouldn't build when configured with --enable-gcc-warnings. The
> problem is that starting in librsvg 2.45.1, the librsvg functions
> rsvg_handle_write and rsvg_handle_close are deprecated, and Emacs calls
> those functions. Although I pacified GCC by installing the attached
> patch into Emacs master, the underlying problem is still there and an
> rsvg expert should take a look at this at some point.

If we omit Windows DLL stuff, then the patch would be as simple as
below.  But Eli may dislike this (even with DLL support) for the very
reasons he dislikes the patch for Bug#36315 the other participants
prefer:

  1. If Windows DLL support is completed, then it will add to a new
     entry to dynamic-library-alist for libgio that librsvg is using
     as a sub-library.
     (See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36315#62)

  2. It just looks like we are using libgio and not librsvg.
     (See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36315#56)

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

diff --git a/src/image.c b/src/image.c
index 6ead12166b6..6d065d66f0f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9490,6 +9490,21 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   g_type_init ();
 #endif
 
+#if LIBRSVG_CHECK_VERSION (2, 32, 0) && !defined WINDOWSNT
+  /* In order to replace rsvg_handle_write and rsvg_handle_close that
+     are deprecated in librsvg 2.45.1 (Bug#35548), we need
+     rsvg_handle_new_from_stream_sync that requires librsvg
+     2.32.0.  */
+  GInputStream *input_stream = g_memory_input_stream_new_from_data (contents,
+								    size, NULL);
+  GFile *base_file = g_file_new_for_path (filename);
+  rsvg_handle = rsvg_handle_new_from_stream_sync (input_stream, base_file,
+						  RSVG_HANDLE_FLAGS_NONE,
+						  NULL, &err);
+  g_object_unref (base_file);
+  g_object_unref (input_stream);
+  if (err) goto rsvg_error;
+#else
   /* Make a handle to a new rsvg object.  */
   rsvg_handle = rsvg_handle_new ();
 
@@ -9499,17 +9514,6 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
   if (filename)
     rsvg_handle_set_base_uri (rsvg_handle, filename);
 
-  /* Suppress GCC deprecation warnings starting in librsvg 2.45.1 for
-     rsvg_handle_write and rsvg_handle_close.  FIXME: Use functions
-     like rsvg_handle_new_from_gfile_sync on newer librsvg versions,
-     and remove this hack.  */
-  #if GNUC_PREREQ (4, 6, 0)
-   #pragma GCC diagnostic push
-  #endif
-  #if LIBRSVG_CHECK_VERSION (2, 45, 1) && GNUC_PREREQ (4, 2, 0)
-   #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-  #endif
-
   /* Parse the contents argument and fill in the rsvg_handle.  */
   rsvg_handle_write (rsvg_handle, (unsigned char *) contents, size, &err);
   if (err) goto rsvg_error;
@@ -9518,10 +9522,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
      for further writes.  */
   rsvg_handle_close (rsvg_handle, &err);
   if (err) goto rsvg_error;
-
-  #if GNUC_PREREQ (4, 6, 0)
-   #pragma GCC diagnostic pop
-  #endif
+#endif
 
   rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
   if (! check_image_size (f, dimension_data.width, dimension_data.height))






  reply	other threads:[~2019-07-04  3:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 19:23 bug#35548: image.c uses deprecated rsvg_handle_write etc Paul Eggert
2019-07-04  3:14 ` YAMAMOTO Mitsuharu [this message]
2019-07-04  4:19   ` YAMAMOTO Mitsuharu
2019-07-10 19:44     ` Paul Eggert
2019-07-11 12:18       ` Andy Moreton
2019-07-11 12:52         ` Andy Moreton
2019-07-11 13:30         ` Eli Zaretskii
2019-07-11 14:28           ` Andy Moreton
2019-07-04 12:53   ` 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=wlsgrm8pa7.wl-mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=35548@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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).