unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: mjchan@myrealbox.com, emacs-devel@gnu.org
Subject: Re: image file with Chinese file names
Date: Mon, 03 Apr 2006 10:26:25 +0900	[thread overview]
Message-ID: <E1FQDpp-0001SN-00@etlken> (raw)
In-Reply-To: <E1FPA2F-0001vR-23@fencepost.gnu.org> (message from Richard Stallman on Thu, 30 Mar 2006 22:10:51 -0500)

In article <E1FPA2F-0001vR-23@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> 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
handa@m17n.org

2006-04-03  Kenichi Handa  <handa@m17n.org>

	* 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	other threads:[~2006-04-03  1:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1FKja3-0001Jl-Ow@lists.gnu.org>
2006-03-29  1:21 ` image file with Chinese file names Kenichi Handa
2006-03-31  3:10   ` Richard Stallman
2006-04-03  1:26     ` Kenichi Handa [this message]

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=E1FQDpp-0001SN-00@etlken \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    --cc=mjchan@myrealbox.com \
    /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).