From patchwork Tue Feb 8 16:38:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Alexander X-Patchwork-Id: 82362 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 4FE29B712E for ; Wed, 9 Feb 2011 04:44:14 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AA75528201; Tue, 8 Feb 2011 18:44:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LI8oQwFZdmD8; Tue, 8 Feb 2011 18:44:11 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2210D281CB; Tue, 8 Feb 2011 18:44:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 224D6281CB for ; Tue, 8 Feb 2011 18:44:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Il09dWEi98wN for ; Tue, 8 Feb 2011 18:44:06 +0100 (CET) X-Greylist: delayed 3947 seconds by postgrey-1.27 at theia; Tue, 08 Feb 2011 18:44:00 CET X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from exprod5og104.obsmtp.com (exprod5og104.obsmtp.com [64.18.0.178]) by theia.denx.de (Postfix) with ESMTPS id 080DA281A8 for ; Tue, 8 Feb 2011 18:43:59 +0100 (CET) Received: from source ([144.188.21.13]) (using TLSv1) by exprod5ob104.postini.com ([64.18.4.12]) with SMTP ID DSNKTVGA3S3sTgEu6ZUkS7+PkkBjspwqc1wi@postini.com; Tue, 08 Feb 2011 09:44:02 PST Received: from il93mgrg01.am.mot-mobility.com ([10.176.130.20]) by il93mgrg01.am.mot-mobility.com (8.14.3/8.14.3) with ESMTP id p18GbEJr002511 for ; Tue, 8 Feb 2011 11:37:14 -0500 (EST) Received: from mail-yi0-f42.google.com (mail-yi0-f42.google.com [209.85.218.42]) by il93mgrg01.am.mot-mobility.com (8.14.3/8.14.3) with ESMTP id p18GUiCC028752 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=OK) for ; Tue, 8 Feb 2011 11:37:14 -0500 (EST) Received: by mail-yi0-f42.google.com with SMTP id 28so3518937yia.15 for ; Tue, 08 Feb 2011 08:38:08 -0800 (PST) Received: by 10.236.95.141 with SMTP id p13mr10840818yhf.98.1297183088160; Tue, 08 Feb 2011 08:38:08 -0800 (PST) Received: from [127.0.0.1] ([144.188.24.27]) by mx.google.com with ESMTPS id a11sm3853766yhd.36.2011.02.08.08.38.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 08 Feb 2011 08:38:07 -0800 (PST) Message-ID: <4D51716D.3060002@motorola.com> Date: Tue, 08 Feb 2011 10:38:05 -0600 From: Rob Alexander User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.16) Gecko/20101125 Thunderbird/3.0.11 MIME-Version: 1.0 To: u-boot@lists.denx.de X-CFilter-Loop: Reflected Cc: wd@denxx.de Subject: [U-Boot] PATCH-add "0X" hexadecimal prefix to simple_strtoul X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@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++; }