summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/PatchPcdValue
diff options
context:
space:
mode:
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>2018-03-29 08:02:17 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-03-30 09:16:01 +0800
commit0944818a1972b07b09b53a2a1e88295cd92361cf (patch)
treeab76f64fc90b43c8f5d69b57edeaab2ae1de6ca9 /BaseTools/Source/Python/PatchPcdValue
parent4231a8193ec0d52df7e0a101d96c51b1a2b7a996 (diff)
downloadedk2-0944818a1972b07b09b53a2a1e88295cd92361cf.tar.gz
edk2-0944818a1972b07b09b53a2a1e88295cd92361cf.tar.bz2
edk2-0944818a1972b07b09b53a2a1e88295cd92361cf.zip
BaseTools: no need to do int() API work for it
int() with base=0 will already auto determine base from preceeding 0x/0X Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/PatchPcdValue')
-rw-r--r--BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
index 0c8009cb0b..0664d6a90f 100644
--- a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
+++ b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
@@ -110,10 +110,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
ValueNumber = 1
elif ValueString == 'FALSE':
ValueNumber = 0
- elif ValueString.startswith('0X'):
- ValueNumber = int (ValueString, 16)
- else:
- ValueNumber = int (ValueString)
+ ValueNumber = int (ValueString, 0)
if ValueNumber != 0:
ValueNumber = 1
except:
@@ -127,10 +124,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
# Get PCD value for UINT* data type
#
try:
- if ValueString.startswith('0X'):
- ValueNumber = int (ValueString, 16)
- else:
- ValueNumber = int (ValueString)
+ ValueNumber = int (ValueString, 0)
except:
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." % (ValueString)
#