emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f7748ad: Fix GDI+ image loading by file name


From: Eli Zaretskii
Subject: master f7748ad: Fix GDI+ image loading by file name
Date: Sat, 25 Apr 2020 09:40:42 -0400 (EDT)

branch: master
commit f7748ad682abca5968ce24ed488ba56d2e48ef8a
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix GDI+ image loading by file name
    
    Without a call to image_find_image, we can get a file name that
    is relative to data-directory/images/, or a file name that
    starts with "~/", in which case w32_load_image would fail.
    * src/image.c (native_image_load): Call image_find_image_file to
    resolve and encode the image file name.
    * src/w32image.c (w32_load_image): No need to encode the file
    name, as it's already encoded by native_image_load.
---
 src/image.c    | 10 ++++++----
 src/w32image.c |  1 -
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/image.c b/src/image.c
index ffe2f60..c8a192a 100644
--- a/src/image.c
+++ b/src/image.c
@@ -6308,14 +6308,16 @@ native_image_p (Lisp_Object object)
 static bool
 native_image_load (struct frame *f, struct image *img)
 {
+  Lisp_Object image_file = image_spec_value (img->spec, QCfile, NULL);
+
+  if (STRINGP (image_file))
+    image_file = image_find_image_file (image_file);
 
 # ifdef HAVE_NTGUI
-  return w32_load_image (f, img,
-                         image_spec_value (img->spec, QCfile, NULL),
+  return w32_load_image (f, img, image_file,
                          image_spec_value (img->spec, QCdata, NULL));
 # elif defined HAVE_NS
-  return ns_load_image (f, img,
-                        image_spec_value (img->spec, QCfile, NULL),
+  return ns_load_image (f, img, image_file,
                         image_spec_value (img->spec, QCdata, NULL));
 # else
   return 0;
diff --git a/src/w32image.c b/src/w32image.c
index 8d39a09..70b2eb2 100644
--- a/src/w32image.c
+++ b/src/w32image.c
@@ -414,7 +414,6 @@ w32_load_image (struct frame *f, struct image *img,
      and succeeded.  We have a valid token and GDI+ is active.  */
   if (STRINGP (spec_file))
     {
-      spec_file = ENCODE_FILE (spec_file);
       const char *fn = map_w32_filename (SSDATA (spec_file), NULL);
       wchar_t filename_w[MAX_PATH];
       filename_to_utf16 (fn, filename_w);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]