]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/CommonLib: use explicit 64-bit type in Strtoi()
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 29 Nov 2018 12:13:32 +0000 (13:13 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 5 Dec 2018 08:03:23 +0000 (09:03 +0100)
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 <ard.biesheuvel@linaro.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/C/Common/CommonLib.c

index 7c559bc3c222869a1a822a9935a62a376e9642ee..4a28f635f3a8529d506893592b80e225aac3ce55 100644 (file)
@@ -2252,9 +2252,9 @@ Strtoi (
   )\r
 {\r
   if (IsHexStr (Str)) {\r
   )\r
 {\r
   if (IsHexStr (Str)) {\r
-    return StrHexToUintn (Str);\r
+    return (UINTN)StrHexToUint64 (Str);\r
   } else {\r
   } else {\r
-    return StrDecimalToUintn (Str);\r
+    return (UINTN)StrDecimalToUint64 (Str);\r
   }\r
 }\r
 \r
   }\r
 }\r
 \r