From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::344; helo=mail-wm1-x344.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 95D2D21B02822 for ; Thu, 29 Nov 2018 04:31:38 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id g67so2052634wmd.2 for ; Thu, 29 Nov 2018 04:31:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SBt8rSHiUuncO+fe24SMlG0ee6qdCagt6QnFlvwTqdo=; b=YawALtlwWj1V8dAhMVlCpQXyxQGpUOr2Oet1xLdn6juApLx7dgjM6NUIH/vVS4nxWZ oPpiNBjEziPaO5KYcQ6129JvQxs1zC/FCLpKGeKia4g8ICsIumgAyRnlaLppV2BK5E+J TKcm/fJeJbWBbBhPFvAy7JQQ6Fm6BTZftERJ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SBt8rSHiUuncO+fe24SMlG0ee6qdCagt6QnFlvwTqdo=; b=jgPvRJjKYi8ZdMKqhQjMoZqYC4pb+y8s44/aYLE7JvRr+MuN9scy8m9DQ6xlzIm0AG 9+4DE3PWz6vaYpUP3frWOSq4EGRzGAXLDt8xhVyc2dkXVEZq0UwZ5ZZvJTzNkfOvcGAh 7TMEMxjxJ3auZfv4bL8BEq6pRSKsqH7N263F12bfCMh11KHB6HnvFqs9q6P8ct/mbAjH UsqgwRJNItbTxcDW/cV83boGkpe0DTxrx2KphtpA9gFrkBwhfMUVIWvVPJvAJdQykJKE EpDt5HKOjBVNjY+/6c/id3Zd3XGU0DUD+DDY08zovbUjG7L83oKhZbdIdRwbq4fp31hf DbVg== X-Gm-Message-State: AA+aEWaM9KpwuMw7Fa/gklISr0htxSxDnIfcs8jp1F9jJi4CfZuvp1ah uPcYIvaPa9fFkxui1iFzsGQcylKPwqU= X-Google-Smtp-Source: AFSGD/XxNJArcwB7wHSup++Rog1rplgxK6tZkogXwXyWOdpxWF0y0udahhqeI1T4oI/VMPz2YIL9pg== X-Received: by 2002:a1c:5604:: with SMTP id k4mr881970wmb.107.1543494696821; Thu, 29 Nov 2018 04:31:36 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:3580:6f80:40a7:5bdd]) by smtp.gmail.com with ESMTPSA id c7sm3089525wre.64.2018.11.29.04.31.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 04:31:36 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: Ard Biesheuvel , Laszlo Ersek , Yonghong Zhu , Liming Gao , Bob Feng Date: Thu, 29 Nov 2018 13:31:25 +0100 Message-Id: <20181129123129.25095-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181129123129.25095-1-ard.biesheuvel@linaro.org> References: <20181129123129.25095-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [PATCH 2/6] BaseTools/CommonLib: use explicit 64-bit type in Strtoi() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2018 12:31:39 -0000 Content-Transfer-Encoding: 8bit Don't use the native word size string to number parsing routines, but instead, use the 64-bit one and cast to UINTN. Currently, the only user is in Source/C/DevicePath/DevicePathFromText.c which takes care to use Strtoi64 () unless it assumes the value fits in 32-bit, so this change is a no-op even on 32-bit build hosts. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- BaseTools/Source/C/Common/CommonLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c index bea6af0a45b1..c5e32b1292e0 100644 --- a/BaseTools/Source/C/Common/CommonLib.c +++ b/BaseTools/Source/C/Common/CommonLib.c @@ -2252,9 +2252,9 @@ Strtoi ( ) { if (IsHexStr (Str)) { - return StrHexToUintn (Str); + return (UINTN)StrHexToUint64 (Str); } else { - return StrDecimalToUintn (Str); + return (UINTN)StrDecimalToUint64 (Str); } } -- 2.19.1