[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/fileio.c,v [EMACS_22_BASE]
From: |
Jason Rumney |
Subject: |
[Emacs-diffs] Changes to emacs/src/fileio.c,v [EMACS_22_BASE] |
Date: |
Wed, 05 Mar 2008 00:19:55 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Branch: EMACS_22_BASE
Changes by: Jason Rumney <jasonr> 08/03/05 00:19:54
Index: fileio.c
===================================================================
RCS file: /sources/emacs/emacs/src/fileio.c,v
retrieving revision 1.580.2.8
retrieving revision 1.580.2.9
diff -u -b -r1.580.2.8 -r1.580.2.9
--- fileio.c 9 Feb 2008 13:21:41 -0000 1.580.2.8
+++ fileio.c 5 Mar 2008 00:19:53 -0000 1.580.2.9
@@ -1408,6 +1408,19 @@
}
}
+ /* Environment variables and pwnam entries may need decoding. */
+ if (newdir)
+ {
+ Lisp_Object orig, decoded;
+ orig = make_unibyte_string (newdir, strlen (newdir));
+ decoded = DECODE_FILE (orig);
+ if (decoded != orig)
+ {
+ newdir = SDATA (decoded);
+ multibyte = 1;
+ }
+ }
+
#ifdef DOS_NT
/* On DOS and Windows, nm is absolute if a drive name was specified;
use the drive's current directory as the prefix if needed. */
@@ -2149,11 +2162,14 @@
unsigned char *target = NULL;
int total = 0;
int substituted = 0;
+ int multibyte;
unsigned char *xnm;
Lisp_Object handler;
CHECK_STRING (filename);
+ multibyte = STRING_MULTIBYTE (filename);
+
/* If the file name has special constructs in it,
call the corresponding file handler. */
handler = Ffind_file_name_handler (filename, Qsubstitute_in_file_name);
@@ -2175,8 +2191,7 @@
again. Important with filenames like "/home/foo//:/hello///there"
which whould substitute to "/:/hello///there" rather than "/there". */
return Fsubstitute_in_file_name
- (make_specified_string (p, -1, endp - p,
- STRING_MULTIBYTE (filename)));
+ (make_specified_string (p, -1, endp - p, multibyte));
#ifdef VMS
return filename;
@@ -2227,7 +2242,10 @@
o = (unsigned char *) egetenv (target);
if (o)
{
- total += strlen (o);
+ Lisp_Object orig, decoded;
+ orig = make_unibyte_string (o, strlen (o));
+ decoded = DECODE_FILE (orig);
+ total += SBYTES (decoded);
substituted = 1;
}
else if (*p == '}')
@@ -2285,21 +2303,26 @@
*x++ = '$';
strcpy (x, target); x+= strlen (target);
}
- else if (STRING_MULTIBYTE (filename))
- {
- /* If the original string is multibyte,
- convert what we substitute into multibyte. */
- while (*o)
+ else
{
- int c = unibyte_char_to_multibyte (*o++);
- x += CHAR_STRING (c, x);
- }
+ Lisp_Object orig, decoded;
+ orig = make_unibyte_string (o, strlen (o));
+ decoded = DECODE_FILE (orig);
+ strncpy (x, SDATA (decoded), SBYTES (decoded));
+ x += SBYTES (decoded);
+
+ /* If environment variable needed decoding, return value
+ needs to be multibyte. */
+ if (decoded != orig)
+ multibyte = 1;
}
+#if 0
else
{
strcpy (x, o);
x += strlen (o);
}
+#endif
}
*x = 0;
@@ -2311,7 +2334,7 @@
need to quote some $ to $$ first. */
xnm = p;
- return make_specified_string (xnm, -1, x - xnm, STRING_MULTIBYTE (filename));
+ return make_specified_string (xnm, -1, x - xnm, multibyte);
badsubst:
error ("Bad format environment-variable substitution");
- [Emacs-diffs] Changes to emacs/src/fileio.c,v [EMACS_22_BASE],
Jason Rumney <=
- [Emacs-diffs] Changes to emacs/src/fileio.c,v [EMACS_22_BASE], Jason Rumney, 2008/03/05
- [Emacs-diffs] Changes to emacs/src/fileio.c,v [EMACS_22_BASE], Stefan Monnier, 2008/03/07
- [Emacs-diffs] Changes to emacs/src/fileio.c,v [EMACS_22_BASE], Kenichi Handa, 2008/03/10
- [Emacs-diffs] Changes to emacs/src/fileio.c,v [EMACS_22_BASE], Chong Yidong, 2008/03/31