Fixed wrong sign extension in printf on 64 bit

This patch fixes printf errors caused by sign extension of values that
were supposed to be unsigned. Fixes #6. Also handles the case where
sizeof(long long) != sizeof(long).
This commit is contained in:
Julian Stecklina 2012-02-13 20:31:55 +01:00 committed by Norman Feske
parent 38ab3c50a5
commit 9508cc0ed5
1 changed files with 4 additions and 2 deletions

View File

@ -275,7 +275,8 @@ void Console::vprintf(const char *format, va_list list)
case Format_command::LONG:
numeric_arg = va_arg(list, long);
numeric_arg = (cmd.type == Format_command::UINT) ?
va_arg(list, unsigned long) : va_arg(list, long);
break;
case Format_command::SIZE_T:
@ -285,7 +286,8 @@ void Console::vprintf(const char *format, va_list list)
case Format_command::DEFAULT:
numeric_arg = va_arg(list, int);
numeric_arg = (cmd.type == Format_command::UINT) ?
va_arg(list, unsigned int) : va_arg(list, int);
break;
}
}