changeset 80296:7a2d0126392f

(Fsubstitute_in_file_name): Fix up computation of maximum size of resulting string.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 07 Mar 2008 15:42:30 +0000
parents 60443150f1b2
children e9a07fb3b138
files src/ChangeLog src/fileio.c
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Mar 07 03:54:03 2008 +0000
+++ b/src/ChangeLog	Fri Mar 07 15:42:30 2008 +0000
@@ -1,3 +1,8 @@
+2008-03-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* fileio.c (Fsubstitute_in_file_name): Fix up computation of maximum
+	size of resulting string.
+
 2008-03-05  Jason Rumney  <jasonr@gnu.org>
 
 	* dispnew.c (adjust_glyph_matrix): Initialize window_height.
--- a/src/fileio.c	Fri Mar 07 03:54:03 2008 +0000
+++ b/src/fileio.c	Fri Mar 07 15:42:30 2008 +0000
@@ -2226,8 +2226,8 @@
 	/* Get variable value */
 	o = (unsigned char *) egetenv (target);
 	if (o)
-	  {
-	    total += strlen (o);
+	  { /* Eight-bit chars occupy upto 2 bytes in multibyte.  */
+	    total += strlen (o) * (STRING_MULTIBYTE (filename) ? 2 : 1);
 	    substituted = 1;
 	  }
 	else if (*p == '}')