From abf215c1e3e6b52a5ef521be271821117b88d598 Mon Sep 17 00:00:00 2001
From: hniksic <devnull@localhost>
Date: Tue, 4 Dec 2001 04:44:58 -0800
Subject: [PATCH] [svn] snprintf.c (dopr): Use `unsigned int' as the second
 argument to va_arg when casting to `unsigned short' is intended. Submitted by
 Ian Abbott in <3C0CB09F.21762.34A1F1@localhost>.

---
 src/ChangeLog  | 5 +++++
 src/snprintf.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 6ad6e599..d98835e8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2001-12-04  Ian Abbott <abbotti@mev.co.uk>
+
+	* snprintf.c (dopr): Use `unsigned int' as the second argument to
+	va_arg when casting to `unsigned short' is intended.
+
 2001-12-04  Herold Heiko  <Heiko.Herold@previnet.it>
 
 	* gen_sslfunc.c: on windows provide ssl crypto random 
diff --git a/src/snprintf.c b/src/snprintf.c
index ea8d5002..4d1c3dd5 100644
--- a/src/snprintf.c
+++ b/src/snprintf.c
@@ -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 = (short int)va_arg (args, int);
+	  value = (unsigned short int)va_arg (args, unsigned 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 = (unsigned short int)va_arg (args, int);
+	  value = (unsigned short int)va_arg (args, unsigned 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 = (short int)va_arg (args, int);
+	  value = (unsigned short int)va_arg (args, unsigned int);
 	else if (cflags == DP_C_LONG)
 	  value = va_arg (args, unsigned long int);
 	else if (cflags == DP_C_LLONG)