summaryrefslogtreecommitdiff
path: root/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openembedded.org>2007-08-09 08:41:19 +0000
committerMarcin Juszkiewicz <hrw@openembedded.org>2007-08-09 08:41:19 +0000
commit9d829ed05c295df608b4fc108eb1c628fd06fd39 (patch)
treec1b27cfe4498f8abef1a61325922906f3e6a32ff /packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch
parent1434b204e16e87b7f59f074f3036d5dcbcf0116f (diff)
parent6ccac10beeaaa02a86081bd6179fd57c208ad6b1 (diff)
merge of '76e1e69496801009ea0aa69c84f76e858978ab99'
and 'db976a98427dd6a195e2cf167e225de2d0206aea'
Diffstat (limited to 'packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch')
-rw-r--r--packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch b/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch
new file mode 100644
index 0000000000..a88e94b006
--- /dev/null
+++ b/packages/uboot/u-boot-mkimage-openmoko-native/uboot-strtoul.patch
@@ -0,0 +1,43 @@
+Make simple_strtoul work with upper-case hex numbers.
+
+Signed-off-by: Harald Welte <laforge@openmoko.org>
+
+Index: u-boot/lib_generic/vsprintf.c
+===================================================================
+--- u-boot.orig/lib_generic/vsprintf.c
++++ u-boot/lib_generic/vsprintf.c
+@@ -25,21 +25,22 @@ unsigned long simple_strtoul(const char
+ {
+ unsigned long result = 0,value;
+
+- if (*cp == '0') {
+- cp++;
+- if ((*cp == 'x') && isxdigit(cp[1])) {
+- base = 16;
+- cp++;
+- }
+- if (!base) {
+- base = 8;
+- }
+- }
+ if (!base) {
+ base = 10;
++ if (*cp == '0') {
++ base = 8;
++ cp++;
++ if ((toupper(*cp) == 'X') && isxdigit(cp[1])) {
++ cp++;
++ base = 16;
++ }
++ }
++ } else if (base == 16) {
++ if (cp[0] == '0' && toupper(cp[1]) == 'X')
++ cp += 2;
+ }
+- while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
+- ? toupper(*cp) : *cp)-'A'+10) < base) {
++ while (isxdigit(*cp) &&
++ (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) {
+ result = result*base + value;
+ cp++;
+ }