(process_arg): Fix reading of signed short and byte values from parameter list.
authordrepper <drepper>
Tue, 2 May 2006 20:25:15 +0000 (20:25 +0000)
committerdrepper <drepper>
Tue, 2 May 2006 20:25:15 +0000 (20:25 +0000)
stdio-common/vfprintf.c

index eb11ac2..53339f3 100644 (file)
@@ -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;      \