diff options
author | Carsey, Jaben <jaben.carsey@intel.com> | 2018-04-28 06:32:15 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-05-04 13:02:57 +0800 |
commit | bff747501b98d2685782dc742db5f32d8490c99e (patch) | |
tree | affcdef03ef1feb851639ea426838c59654545cd /BaseTools/Source/Python/GenFds/FdfParser.py | |
parent | ebafede928b6402b90a1ac2bc5175e50f1a60884 (diff) | |
download | edk2-bff747501b98d2685782dc742db5f32d8490c99e.tar.gz edk2-bff747501b98d2685782dc742db5f32d8490c99e.tar.bz2 edk2-bff747501b98d2685782dc742db5f32d8490c99e.zip |
BaseTools: FdfParser - update to remove duplicate constant value
PCD size by type is shared so this change both removes duplication
and makes the function work for all numeric PCD types.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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/GenFds/FdfParser.py')
-rw-r--r-- | BaseTools/Source/Python/GenFds/FdfParser.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 49ed4041a2..223b453e7e 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1134,21 +1134,20 @@ class FdfParser: @staticmethod
def __Verify(Name, Value, Scope):
- if Scope in [TAB_UINT64, TAB_UINT8]:
- ValueNumber = 0
- try:
- ValueNumber = int (Value, 0)
- except:
- EdkLogger.error("FdfParser", FORMAT_INVALID, "The value is not valid dec or hex number for %s." % Name)
- if ValueNumber < 0:
- EdkLogger.error("FdfParser", FORMAT_INVALID, "The value can't be set to negative value for %s." % Name)
- if Scope == TAB_UINT64:
- if ValueNumber >= 0x10000000000000000:
- EdkLogger.error("FdfParser", FORMAT_INVALID, "Too large value for %s." % Name)
- if Scope == TAB_UINT8:
- if ValueNumber >= 0x100:
- EdkLogger.error("FdfParser", FORMAT_INVALID, "Too large value for %s." % Name)
- return True
+ # value verification only applies to numeric values.
+ if scope not in TAB_PCD_NUMERIC_TYPES:
+ return
+
+ ValueNumber = 0
+ try:
+ ValueNumber = int(Value, 0)
+ except:
+ EdkLogger.error("FdfParser", FORMAT_INVALID, "The value is not valid dec or hex number for %s." % Name)
+ if ValueNumber < 0:
+ EdkLogger.error("FdfParser", FORMAT_INVALID, "The value can't be set to negative value for %s." % Name)
+ if ValueNumber > MAX_VAL_TYPE[Scope]:
+ EdkLogger.error("FdfParser", FORMAT_INVALID, "Too large value for %s." % Name)
+ return True
## __UndoToken() method
#
|