* include <stdio.h> for NULL.
* added support and test cases for long long.
* don't declare argument types to (v)snprintf if stdarg is not used.
+ * use int instead of short int as 2nd arg to va_arg.
*
**************************************************************/
}
break;
case DP_S_MIN:
- if (ISDIGIT(ch))
+ if ('0' <= ch && ch <= '9')
{
min = 10*min + char_to_int (ch);
ch = *format++;
state = DP_S_MOD;
break;
case DP_S_MAX:
- if (ISDIGIT(ch))
+ if ('0' <= ch && ch <= '9')
{
if (max < 0)
max = 0;
case 'd':
case 'i':
if (cflags == DP_C_SHORT)
- value = va_arg (args, short 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)
case 'o':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
- value = va_arg (args, unsigned short 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)
case 'u':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
- value = va_arg (args, unsigned short 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)
case 'x':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
- value = va_arg (args, unsigned short 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)