Fixed bad %x handling

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3695 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2003-05-24 00:19:27 +00:00
parent 36a28c9bcd
commit d9a2ef49d6

View file

@ -43,6 +43,7 @@ static int format(
char *str; char *str;
char tmpbuf[12], pad; char tmpbuf[12], pad;
int ch, width, val, sign; int ch, width, val, sign;
unsigned int uval;
bool ok = true; bool ok = true;
tmpbuf[sizeof tmpbuf - 1] = '\0'; tmpbuf[sizeof tmpbuf - 1] = '\0';
@ -90,13 +91,13 @@ static int format(
case 'x': case 'x':
case 'X': case 'X':
val = va_arg (ap, int); uval = va_arg (ap, int);
do do
{ {
*--str = hexdigit[val & 0xf]; *--str = hexdigit[uval & 0xf];
val >>= 4; uval >>= 4;
} }
while (val > 0); while (uval);
break; break;
default: default: