public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rob Alexander <w04893@motorola.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] PATCH-add "0X" hexadecimal prefix to simple_strtoul
Date: Tue, 08 Feb 2011 10:38:05 -0600	[thread overview]
Message-ID: <4D51716D.3060002@motorola.com> (raw)

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++;
  		}

             reply	other threads:[~2011-02-08 16:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08 16:38 Rob Alexander [this message]
2011-02-08 19:14 ` [U-Boot] PATCH-add "0X" hexadecimal prefix to simple_strtoul 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D51716D.3060002@motorola.com \
    --to=w04893@motorola.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox