summaryrefslogtreecommitdiff
path: root/firmware/common/sprintf.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-05-24 00:19:27 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-05-24 00:19:27 +0000
commitd9a2ef49d67592a92c610901d4b12e6d593ce010 (patch)
treea5448db3ac2bd979ccd4209d247332d1650502ab /firmware/common/sprintf.c
parent36a28c9bcdf6c001b747d2ed38032ad415bf7850 (diff)
downloadrockbox-d9a2ef49d67592a92c610901d4b12e6d593ce010.tar.gz
rockbox-d9a2ef49d67592a92c610901d4b12e6d593ce010.zip
Fixed bad %x handling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3695 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common/sprintf.c')
-rw-r--r--firmware/common/sprintf.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/firmware/common/sprintf.c b/firmware/common/sprintf.c
index 5dd86b77d6..00084acf0a 100644
--- a/firmware/common/sprintf.c
+++ b/firmware/common/sprintf.c
@@ -43,6 +43,7 @@ static int format(
43 char *str; 43 char *str;
44 char tmpbuf[12], pad; 44 char tmpbuf[12], pad;
45 int ch, width, val, sign; 45 int ch, width, val, sign;
46 unsigned int uval;
46 bool ok = true; 47 bool ok = true;
47 48
48 tmpbuf[sizeof tmpbuf - 1] = '\0'; 49 tmpbuf[sizeof tmpbuf - 1] = '\0';
@@ -90,13 +91,13 @@ static int format(
90 91
91 case 'x': 92 case 'x':
92 case 'X': 93 case 'X':
93 val = va_arg (ap, int); 94 uval = va_arg (ap, int);
94 do 95 do
95 { 96 {
96 *--str = hexdigit[val & 0xf]; 97 *--str = hexdigit[uval & 0xf];
97 val >>= 4; 98 uval >>= 4;
98 } 99 }
99 while (val > 0); 100 while (uval);
100 break; 101 break;
101 102
102 default: 103 default: