public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] PATCH-add "0X" hexadecimal prefix to simple_strtoul
@ 2011-02-08 16:38 Rob Alexander
  2011-02-08 19:14 ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Alexander @ 2011-02-08 16:38 UTC (permalink / raw)
  To: u-boot

Added support to simple_strtoul to support the standard 0X hex notation. This issue
was causing operational bug in U-boot console commands where "0X" hex numbers were being
misinterpreted as decimal.

Signed-off-by: Rob Alexander<robert.b.alexander@motorola.com>
--- vsprintf.org.c	2011-02-08 10:12:35.954644500 -0600
+++ vsprintf.c	2011-02-08 10:26:01.708224300 -0600
@@ -41,8 +41,9 @@
  	unsigned long result = 0,value;

  	if (*cp == '0') {
-		cp++;
-		if ((*cp == 'x')&&  isxdigit(cp[1])) {
+		cp++;
+		//support both 0X and 0x notation
+		if ((tolower(*cp) == 'x')&&  isxdigit(cp[1])) {
  			base = 16;
  			cp++;
  		}
@@ -99,7 +100,8 @@

  	if (*cp == '0') {
  		cp++;
-		if ((*cp == 'x')&&  isxdigit (cp[1])) {
+    //support both 0X and 0x notation
+		if ((tolower(*cp) == 'x')&&  isxdigit(cp[1]))
  			base = 16;
  			cp++;
  		}

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-02-10  6:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-08 16:38 [U-Boot] PATCH-add "0X" hexadecimal prefix to simple_strtoul Rob Alexander
2011-02-08 19:14 ` Wolfgang Denk
2011-02-09  6:19   ` Chris Moore
2011-02-09  6:40     ` Albert ARIBAUD
2011-02-09 21:17       ` Scott Wood
2011-02-10  6:16         ` [U-Boot] Thunderbird bug (was PATCH-add "0X" hexadecimal prefix to simple_strtoul) Chris Moore
2011-02-10  6:22           ` Chris Moore
2011-02-10  6:28             ` Reinhard Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox