From patchwork Thu Nov 29 12:31:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 152398 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2320730ljp; Thu, 29 Nov 2018 04:31:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/VY1d8z2hmnzovd68kjPs9AZG01wKvG8I0ZGkY4TY2kXt0zqDg6MowxTl1J3bVoI+7cgVds X-Received: by 2002:a17:902:f44:: with SMTP id 62mr1322656ply.38.1543494704553; Thu, 29 Nov 2018 04:31:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543494704; cv=none; d=google.com; s=arc-20160816; b=xN/BcBNlSWMQnDq0JDRLEpvWpQXAoT3iVnE4DpOOSQegxWsHDG+XuS5jJTk2GuUPwb Bejj05a2LQN76tYDOSChzAC85o5IR2nSHZ/ImbLETrevNuW3DnSBts3BksS6f4yAcrpO MV7f3qiiwcG4KUq3tDWP0gNwBI+Z7JJQzoIh/MN34q/UtmIz4wA1JKhZPP+ENUpvop1R 8NiH6EoRz9R5wikZ2NYdEUrKsnoR0aLmgkFlYPD1H1RXXIbPaggwAXSbN7S0STz3N+tk w7sjngAfavxcqCCG+Q7U+ot3pL5zMlKOy08bFJ0tFVzZg6qyvmV0QCNZThwGiXoIpXKz cpOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=u8tPd7jv9G37Cu3Y0YapLZJEBIjdRdutguF+qilXbiY=; b=F32rBL1XYbK0tXRoIV4JFfc4FLdUwXOpJDvXaFCqVRA9DkwcWQp0LwkMeHhjDP15RO Bn0ac2EUkG7OJKoflotiTascpe6zYDWsUoqKdcqG5+fsPbXIJfjXQ4gt+G7REdcHX7r8 sgLbMSzvJnlBn+Y8+l99xp6io3eBOD09dDULxhZa9SqYWYI5M+r5HlNZ3ZTsePCmflWR fmfaiIFyk0C79jfhlBUkVpo/u1FSsCLTUE5S1xyuqgkp9NYfvdlzE2uzqdVj+Cg6zXvx sGHEgUWHKrZ46o72J6GymP0ezHPZwfWeB1tK/+NLjxStHeK6Uf4Zo/ifba2QQ0CiJwH/ IMMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YawALtlw; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id z15si1934962pgi.304.2018.11.29.04.31.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 04:31:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YawALtlw; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9F0EE211963F2; Thu, 29 Nov 2018 04:31:41 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: Laszlo Ersek , Liming Gao Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.19.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Jaben Carsey 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); } }