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>
This commit is contained in:
committed by
Yonghong Zhu
parent
4231a8193e
commit
0944818a19
@ -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)
|
||||
#
|
||||
|
Reference in New Issue
Block a user