From 79f868cd0ffe36048f3b24fd4532d637839d86ba Mon Sep 17 00:00:00 2001 From: hniksic Date: Mon, 3 Dec 2001 11:31:17 -0800 Subject: [PATCH] [svn] Cast va_arg(..., int) to short if a short value is expected. Published in . --- src/ChangeLog | 5 +++++ src/snprintf.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3bdb9fa8..2ed0bd4a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-12-03 Hrvoje Niksic + + * snprintf.c (dopr): Cast the result of va_arg to short int and + short unsigned int where these types are expected to be used. + 2001-12-03 Hrvoje Niksic * snprintf.c (dopr): Replace `short int' and `unsigned short int' diff --git a/src/snprintf.c b/src/snprintf.c index 237ba5d4..ea8d5002 100644 --- a/src/snprintf.c +++ b/src/snprintf.c @@ -309,7 +309,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) case 'd': case 'i': if (cflags == DP_C_SHORT) - value = va_arg (args, int); + value = (short int)va_arg (args, int); else if (cflags == DP_C_LONG) value = va_arg (args, long int); else if (cflags == DP_C_LLONG) @@ -321,7 +321,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) case 'o': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) - value = va_arg (args, int); + value = (short int)va_arg (args, int); else if (cflags == DP_C_LONG) value = va_arg (args, unsigned long int); else if (cflags == DP_C_LLONG) @@ -333,7 +333,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) case 'u': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) - value = va_arg (args, int); + value = (unsigned short int)va_arg (args, int); else if (cflags == DP_C_LONG) value = va_arg (args, unsigned long int); else if (cflags == DP_C_LLONG) @@ -347,7 +347,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) case 'x': flags |= DP_F_UNSIGNED; if (cflags == DP_C_SHORT) - value = va_arg (args, int); + value = (short int)va_arg (args, int); else if (cflags == DP_C_LONG) value = va_arg (args, unsigned long int); else if (cflags == DP_C_LLONG)