diff options
| author | Andreas Schwab | 2007-11-23 13:27:46 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2007-11-23 13:27:46 +0000 |
| commit | ff6e6ac8392ae8a5b6a6c190c2d1efb33d239580 (patch) | |
| tree | 4e65051801f56b52ce8d91ef278a17ae04b2286c /src | |
| parent | 8cd39fb3c4cf47d2464f00eaa69c587e17dd11cc (diff) | |
| download | emacs-ff6e6ac8392ae8a5b6a6c190c2d1efb33d239580.tar.gz emacs-ff6e6ac8392ae8a5b6a6c190c2d1efb33d239580.zip | |
(Fformat): Handle %c specially since it requires the
argument to be of type int.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/editfns.c | 35 |
2 files changed, 25 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7b3fc9bb833..3527506b20a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-11-23 Andreas Schwab <schwab@suse.de> | ||
| 2 | |||
| 3 | * editfns.c (Fformat): Handle %c specially since it requires the | ||
| 4 | argument to be of type int. | ||
| 5 | |||
| 1 | 2007-11-23 Markus Triska <markus.triska@gmx.at> | 6 | 2007-11-23 Markus Triska <markus.triska@gmx.at> |
| 2 | 7 | ||
| 3 | * emacs.c (main): Call init_editfns before init_process, since | 8 | * emacs.c (main): Call init_editfns before init_process, since |
diff --git a/src/editfns.c b/src/editfns.c index 008cc3a95bf..f5b71f2aa18 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3807,7 +3807,8 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3807 | sprintf (p, this_format, XFLOAT_DATA (args[n])); | 3807 | sprintf (p, this_format, XFLOAT_DATA (args[n])); |
| 3808 | else | 3808 | else |
| 3809 | { | 3809 | { |
| 3810 | if (sizeof (EMACS_INT) > sizeof (int)) | 3810 | if (sizeof (EMACS_INT) > sizeof (int) |
| 3811 | && format[-1] != 'c') | ||
| 3811 | { | 3812 | { |
| 3812 | /* Insert 'l' before format spec. */ | 3813 | /* Insert 'l' before format spec. */ |
| 3813 | this_format[format - this_format_start] | 3814 | this_format[format - this_format_start] |
| @@ -3816,21 +3817,25 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3816 | this_format[format - this_format_start + 1] = 0; | 3817 | this_format[format - this_format_start + 1] = 0; |
| 3817 | } | 3818 | } |
| 3818 | 3819 | ||
| 3819 | if (INTEGERP (args[n])) | 3820 | if (INTEGERP (args[n])) |
| 3820 | { | 3821 | { |
| 3821 | if (format[-1] == 'd') | 3822 | if (format[-1] == 'c') |
| 3822 | sprintf (p, this_format, XINT (args[n])); | 3823 | sprintf (p, this_format, (int) XINT (args[n])); |
| 3824 | else if (format[-1] == 'd') | ||
| 3825 | sprintf (p, this_format, XINT (args[n])); | ||
| 3826 | /* Don't sign-extend for octal or hex printing. */ | ||
| 3827 | else | ||
| 3828 | sprintf (p, this_format, XUINT (args[n])); | ||
| 3829 | } | ||
| 3830 | else if (format[-1] == 'c') | ||
| 3831 | sprintf (p, this_format, (int) XFLOAT_DATA (args[n])); | ||
| 3832 | else if (format[-1] == 'd') | ||
| 3833 | /* Maybe we should use "%1.0f" instead so it also works | ||
| 3834 | for values larger than MAXINT. */ | ||
| 3835 | sprintf (p, this_format, (EMACS_INT) XFLOAT_DATA (args[n])); | ||
| 3836 | else | ||
| 3823 | /* Don't sign-extend for octal or hex printing. */ | 3837 | /* Don't sign-extend for octal or hex printing. */ |
| 3824 | else | 3838 | sprintf (p, this_format, (EMACS_UINT) XFLOAT_DATA (args[n])); |
| 3825 | sprintf (p, this_format, XUINT (args[n])); | ||
| 3826 | } | ||
| 3827 | else if (format[-1] == 'd') | ||
| 3828 | /* Maybe we should use "%1.0f" instead so it also works | ||
| 3829 | for values larger than MAXINT. */ | ||
| 3830 | sprintf (p, this_format, (EMACS_INT) XFLOAT_DATA (args[n])); | ||
| 3831 | else | ||
| 3832 | /* Don't sign-extend for octal or hex printing. */ | ||
| 3833 | sprintf (p, this_format, (EMACS_UINT) XFLOAT_DATA (args[n])); | ||
| 3834 | } | 3839 | } |
| 3835 | 3840 | ||
| 3836 | if (p > buf | 3841 | if (p > buf |