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::343; helo=mail-wm1-x343.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (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 09D12211963EE for ; Fri, 30 Nov 2018 14:45:46 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id s14so452975wmh.1 for ; Fri, 30 Nov 2018 14:45:45 -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=MpSBFKlR4smrBKLvtNuyjJGH/qSXgZ34/9H4jX8KUMw=; b=iA9bGTxSWRNC1E0X8Hg8uFrC9Q344wLYwu8vyfLiJHUtc8/Mc+/eSWK9fnQfBdoo47 cGxh6Z0tAW2WPxvmUAPAGpVrPjKbriQWVW8DBMjp+IdjuOqp2ipivJuyZV9ep7JdUYd7 /YsMKu1L6hecP57dQLKmiO4rCNcHJ9krWVtFc= 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=MpSBFKlR4smrBKLvtNuyjJGH/qSXgZ34/9H4jX8KUMw=; b=pPxkEuH5Ru0p62MVu5YoYRftW2uGulOEgHKzdQyVSEMrysSFQa3T/7Rb0RB6/rPzaY nNvAhzWm1Quy2lbvYzhr2aHTDyWhwrxFfVxlULxyvrIU6pfmC6Z1n40Y99zg/a25ageo ovcQZkYfAzLgatdIpDg93P3CR7m279sXeSBnyLUi42JKGs/ry3pJ+nsY5A3DXTHDv1ub goXW/Q9TYFnfvTNNiDh5WPyu/Vx28D+X6yOWoyZbGkzBIK+VFW4b6hUHfPbT6/jsLyBO SetwPCJ7I8BrXaRVGc+IBoUO/K+VB7v4cUMAYyaE3KPmVUiGeq8i4/XJH11jK+W06dJr 7JKA== X-Gm-Message-State: AA+aEWaeQE1GiGmOXNEC2g9c4WmPvCZf+/HnuAXhSWJrMdtTK4KjETOd TQVh7xT1TMfp9LsmNVsWuz+Veoo/Se8= X-Google-Smtp-Source: AFSGD/VhC8AB14ke0p6UvsikTJZnvqQ+mE5/lxELUUO/03id5rOopf4Ka+7Mr7VIZyFIxX0lGFnB6g== X-Received: by 2002:a1c:f605:: with SMTP id w5mr535985wmc.116.1543617944229; Fri, 30 Nov 2018 14:45:44 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:d895:e032:7b00:86cd]) by smtp.gmail.com with ESMTPSA id m6sm10561195wrv.24.2018.11.30.14.45.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Nov 2018 14:45:43 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: Ard Biesheuvel , Laszlo Ersek , Yonghong Zhu , Liming Gao , Bob Feng , Jaben Carsey Date: Fri, 30 Nov 2018 23:45:33 +0100 Message-Id: <20181130224537.18936-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181130224537.18936-1-ard.biesheuvel@linaro.org> References: <20181130224537.18936-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [PATCH v2 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: Fri, 30 Nov 2018 22:45:46 -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 Reviewed-by: Jaben Carsey --- 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 7c559bc3c222..4a28f635f3a8 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