From: Andreas Schwab Date: Fri, 23 Nov 2007 13:27:34 +0000 (+0000) Subject: (Fformat): Handle %c specially since it requires the X-Git-Tag: emacs-pretest-22.1.90~325 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=89df6fc6bd7fd4342d6c45784b845ed01de55cb6;p=emacs.git (Fformat): Handle %c specially since it requires the argument to be of type int. --- diff --git a/src/ChangeLog b/src/ChangeLog index 642ad1f638e..918af2c6335 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2007-11-23 Andreas Schwab + + * editfns.c (Fformat): Handle %c specially since it requires the + argument to be of type int. + 2007-11-22 Jan Dj,Ad(Brv * gtkutil.c (update_frame_tool_bar): Don't call x-gtk-map-stock if diff --git a/src/editfns.c b/src/editfns.c index bcfe5756034..037efdf98e0 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -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. */