From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Alexander Date: Tue, 08 Feb 2011 10:38:05 -0600 Subject: [U-Boot] PATCH-add "0X" hexadecimal prefix to simple_strtoul Message-ID: <4D51716D.3060002@motorola.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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++; }