diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-05-02 20:28:05 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-05-02 20:28:05 +0000 |
commit | d2dc7b0816ae5901826fda33cfe19ef6f927560d (patch) | |
tree | 114880a0916f54c561278c6e9a684c934efc9fea /stdio-common/vfprintf.c | |
parent | 1863d841f524903e79710af76790fcdbf9a92b41 (diff) | |
download | glibc-d2dc7b0816ae5901826fda33cfe19ef6f927560d.tar.gz glibc-d2dc7b0816ae5901826fda33cfe19ef6f927560d.tar.xz glibc-d2dc7b0816ae5901826fda33cfe19ef6f927560d.zip |
[BZ #2509]
* stdio-common/vfprintf.c (process_arg): Fix reading of signed short and byte values from parameter list. * stdio-common/tst-printf.c (main): Add more tests. * stdio-common/tst-printf.sh: Adjust for tst-printf.c change.
Diffstat (limited to 'stdio-common/vfprintf.c')
-rw-r--r-- | stdio-common/vfprintf.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index eb11ac2806..53339f3078 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -530,14 +530,24 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) { \ if (is_long_num) \ signed_number = va_arg (ap, long int); \ - else /* `char' and `short int' will be promoted to `int'. */ \ + else if (is_char) \ + signed_number = (signed char) va_arg (ap, unsigned int); \ + else if (!is_short) \ signed_number = va_arg (ap, int); \ + else \ + signed_number = (short int) va_arg (ap, unsigned int); \ } \ else \ if (is_long_num) \ signed_number = args_value[fspec->data_arg].pa_long_int; \ - else /* `char' and `short int' will be promoted to `int'. */ \ + else if (is_char) \ + signed_number = (signed char) \ + args_value[fspec->data_arg].pa_u_int; \ + else if (!is_short) \ signed_number = args_value[fspec->data_arg].pa_int; \ + else \ + signed_number = (short int) \ + args_value[fspec->data_arg].pa_u_int; \ \ is_negative = signed_number < 0; \ number.word = is_negative ? (- signed_number) : signed_number; \ |