emacs-devel
[Top][All Lists]
Advanced

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

Re: image file with Chinese file names


From: Kenichi Handa
Subject: Re: image file with Chinese file names
Date: Mon, 03 Apr 2006 10:26:25 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

In article <address@hidden>, Richard Stallman <address@hidden> writes:

>     I found that image.c (and image.el) doesn't pay attention to
>     filename encoding.  For instance, when I visit a file
>     "À.png", Emacs crashes in png_load() as this:

>     Program received signal SIGSEGV, Segmentation fault.
>     0x40346777 in fclose () from /lib/libc.so.6
>     (gdb) bt 10

>     As an image file name is passed from function to function, I
>     don't understand where we should put the interface between
>     decoded filename and encoded filename.

> I looked at image.c, and I think the right place for encoding is the
> end of x_find_image_file.  That is, it should return an encoded name.
> That appears correct for all calls to that function, though I could
> not perfectly understand all of the callers.

> Please try that.  (Please update the comments on x_find_image_file
> to say its value has been encoded.)

Ok, I've just committed the attache chagne.

---
Kenichi Handa
address@hidden

2006-04-03  Kenichi Handa  <address@hidden>

        * image.c: Include "charset.h" and "coding.h".
        (x_find_image_file): Return an encoded file name.

Index: image.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/image.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- image.c     16 Mar 2006 08:05:34 -0000      1.50
+++ image.c     3 Apr 2006 01:23:03 -0000       1.51
@@ -39,6 +39,8 @@
 #include "blockinput.h"
 #include "systime.h"
 #include <epaths.h>
+#include "charset.h"
+#include "coding.h"
 
 
 #ifdef HAVE_X_WINDOWS
@@ -2246,8 +2248,8 @@
 
 
 /* Find image file FILE.  Look in data-directory, then
-   x-bitmap-file-path.  Value is the full name of the file found, or
-   nil if not found.  */
+   x-bitmap-file-path.  Value is the encoded full name of the file
+   found, or nil if not found.  */
 
 Lisp_Object
 x_find_image_file (file)
@@ -2267,7 +2269,10 @@
   if (fd == -1)
     file_found = Qnil;
   else
-    close (fd);
+    {
+      file_found = ENCODE_FILE (file_found);
+      close (fd);
+    }
 
   UNGCPRO;
   return file_found;




reply via email to

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