]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fformat): Handle %c specially since it requires the
authorAndreas Schwab <schwab@suse.de>
Fri, 23 Nov 2007 13:27:34 +0000 (13:27 +0000)
committerAndreas Schwab <schwab@suse.de>
Fri, 23 Nov 2007 13:27:34 +0000 (13:27 +0000)
argument to be of type int.

src/ChangeLog
src/editfns.c

index 642ad1f638e41f017a6de08dcde74ce088b8dffa..918af2c6335ba76463a0e6e793a06a440b8c2504 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-23  Andreas Schwab  <schwab@suse.de>
+
+       * editfns.c (Fformat): Handle %c specially since it requires the
+       argument to be of type int.
+
 2007-11-22  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
 
        * gtkutil.c (update_frame_tool_bar): Don't call x-gtk-map-stock if
index bcfe57560342c33207f2fce8bdda1fbe6ff027c7..037efdf98e0f8e2e35061ecf238a7e815ce827ff 100644 (file)
@@ -3809,7 +3809,8 @@ usage: (format STRING &rest OBJECTS)  */)
                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 @@ usage: (format STRING &rest OBJECTS)  */)
 
                  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.  */