changeset 79472:daa9b2b4d89d

(Fformat): Handle %c specially since it requires the argument to be of type int.
author Andreas Schwab <schwab@suse.de>
date Fri, 23 Nov 2007 13:27:12 +0000
parents ddf4e8b96231
children 784b0083e232
files src/editfns.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Thu Nov 22 12:45:49 2007 +0000
+++ b/src/editfns.c	Fri Nov 23 13:27:12 2007 +0000
@@ -3809,7 +3809,8 @@
 		sprintf (p, this_format, XFLOAT_DATA (args[n]));
 	      else
 		{
-		  if (sizeof (EMACS_INT) > sizeof (int))
+		  if (sizeof (EMACS_INT) > sizeof (int)
+		      && format[-1] != 'c')
 		    {
 		      /* Insert 'l' before format spec.  */
 		      this_format[format - this_format_start]
@@ -3820,12 +3821,16 @@
 
 		  if (INTEGERP (args[n]))
 		    {
-		      if (format[-1] == 'd')
+		      if (format[-1] == 'c')
+			sprintf (p, this_format, (int) XINT (args[n]));
+		      else if (format[-1] == 'd')
 			sprintf (p, this_format, XINT (args[n]));
 		      /* Don't sign-extend for octal or hex printing.  */
 		      else
 			sprintf (p, this_format, XUINT (args[n]));
 		    }
+		  else if (format[-1] == 'c')
+		    sprintf (p, this_format, (int) XFLOAT_DATA (args[n]));
 		  else if (format[-1] == 'd')
 		    /* Maybe we should use "%1.0f" instead so it also works
 		       for values larger than MAXINT.  */