summaryrefslogtreecommitdiffstats
path: root/meta/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch')
-rw-r--r--meta/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch
new file mode 100644
index 0000000000..a88e94b006
--- /dev/null
+++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch
@@ -0,0 +1,43 @@
1Make simple_strtoul work with upper-case hex numbers.
2
3Signed-off-by: Harald Welte <laforge@openmoko.org>
4
5Index: u-boot/lib_generic/vsprintf.c
6===================================================================
7--- u-boot.orig/lib_generic/vsprintf.c
8+++ u-boot/lib_generic/vsprintf.c
9@@ -25,21 +25,22 @@ unsigned long simple_strtoul(const char
10 {
11 unsigned long result = 0,value;
12
13- if (*cp == '0') {
14- cp++;
15- if ((*cp == 'x') && isxdigit(cp[1])) {
16- base = 16;
17- cp++;
18- }
19- if (!base) {
20- base = 8;
21- }
22- }
23 if (!base) {
24 base = 10;
25+ if (*cp == '0') {
26+ base = 8;
27+ cp++;
28+ if ((toupper(*cp) == 'X') && isxdigit(cp[1])) {
29+ cp++;
30+ base = 16;
31+ }
32+ }
33+ } else if (base == 16) {
34+ if (cp[0] == '0' && toupper(cp[1]) == 'X')
35+ cp += 2;
36 }
37- while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
38- ? toupper(*cp) : *cp)-'A'+10) < base) {
39+ while (isxdigit(*cp) &&
40+ (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) {
41 result = result*base + value;
42 cp++;
43 }