(Fformat): Handle %c specially since it requires the

argument to be of type int.
This commit is contained in:
Andreas Schwab 2007-11-23 13:27:46 +00:00
parent 8cd39fb3c4
commit ff6e6ac839
2 changed files with 25 additions and 15 deletions

View 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-23 Markus Triska <markus.triska@gmx.at>
* emacs.c (main): Call init_editfns before init_process, since

View file

@ -3807,7 +3807,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]
@ -3816,21 +3817,25 @@ usage: (format STRING &rest OBJECTS) */)
this_format[format - this_format_start + 1] = 0;
}
if (INTEGERP (args[n]))
{
if (format[-1] == 'd')
sprintf (p, this_format, XINT (args[n]));
if (INTEGERP (args[n]))
{
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. */
sprintf (p, this_format, (EMACS_INT) XFLOAT_DATA (args[n]));
else
/* Don't sign-extend for octal or hex printing. */
else
sprintf (p, this_format, XUINT (args[n]));
}
else if (format[-1] == 'd')
/* Maybe we should use "%1.0f" instead so it also works
for values larger than MAXINT. */
sprintf (p, this_format, (EMACS_INT) XFLOAT_DATA (args[n]));
else
/* Don't sign-extend for octal or hex printing. */
sprintf (p, this_format, (EMACS_UINT) XFLOAT_DATA (args[n]));
sprintf (p, this_format, (EMACS_UINT) XFLOAT_DATA (args[n]));
}
if (p > buf