diff options
| author | Andreas Schwab | 2007-11-23 13:27:34 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2007-11-23 13:27:34 +0000 |
| commit | 89df6fc6bd7fd4342d6c45784b845ed01de55cb6 (patch) | |
| tree | fc530f08694b33ad871bb1f9553fabb66480576c /src/editfns.c | |
| parent | dd8ff1b79baed91a61aebb8ea57ed76a11280012 (diff) | |
| download | emacs-89df6fc6bd7fd4342d6c45784b845ed01de55cb6.tar.gz emacs-89df6fc6bd7fd4342d6c45784b845ed01de55cb6.zip | |
(Fformat): Handle %c specially since it requires the
argument to be of type int.
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 9 |
1 files changed, 7 insertions, 2 deletions
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) */) | |||
| 3809 | sprintf (p, this_format, XFLOAT_DATA (args[n])); | 3809 | sprintf (p, this_format, XFLOAT_DATA (args[n])); |
| 3810 | else | 3810 | else |
| 3811 | { | 3811 | { |
| 3812 | if (sizeof (EMACS_INT) > sizeof (int)) | 3812 | if (sizeof (EMACS_INT) > sizeof (int) |
| 3813 | && format[-1] != 'c') | ||
| 3813 | { | 3814 | { |
| 3814 | /* Insert 'l' before format spec. */ | 3815 | /* Insert 'l' before format spec. */ |
| 3815 | this_format[format - this_format_start] | 3816 | this_format[format - this_format_start] |
| @@ -3820,12 +3821,16 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3820 | 3821 | ||
| 3821 | if (INTEGERP (args[n])) | 3822 | if (INTEGERP (args[n])) |
| 3822 | { | 3823 | { |
| 3823 | if (format[-1] == 'd') | 3824 | if (format[-1] == 'c') |
| 3825 | sprintf (p, this_format, (int) XINT (args[n])); | ||
| 3826 | else if (format[-1] == 'd') | ||
| 3824 | sprintf (p, this_format, XINT (args[n])); | 3827 | sprintf (p, this_format, XINT (args[n])); |
| 3825 | /* Don't sign-extend for octal or hex printing. */ | 3828 | /* Don't sign-extend for octal or hex printing. */ |
| 3826 | else | 3829 | else |
| 3827 | sprintf (p, this_format, XUINT (args[n])); | 3830 | sprintf (p, this_format, XUINT (args[n])); |
| 3828 | } | 3831 | } |
| 3832 | else if (format[-1] == 'c') | ||
| 3833 | sprintf (p, this_format, (int) XFLOAT_DATA (args[n])); | ||
| 3829 | else if (format[-1] == 'd') | 3834 | else if (format[-1] == 'd') |
| 3830 | /* Maybe we should use "%1.0f" instead so it also works | 3835 | /* Maybe we should use "%1.0f" instead so it also works |
| 3831 | for values larger than MAXINT. */ | 3836 | for values larger than MAXINT. */ |