summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
diff options
context:
space:
mode:
authorCarsey, Jaben <jaben.carsey@intel.com>2018-04-28 06:32:48 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-05-04 13:07:34 +0800
commitd0a0c52c221e5dcf82f24d4346c1cf52109d6dfb (patch)
tree093b255c1d0235ab8cbbea57be4ccbd0a37fecff /BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
parent31ff1c443e25d6bff758bdcd9a248a907cff651b (diff)
downloadedk2-d0a0c52c221e5dcf82f24d4346c1cf52109d6dfb.tar.gz
BaseTools: standardize GUID and pack size
currently GUID packing and pack size determination is spread throughout the code. This introduces a shared function and dict and routes all code paths through them. 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/AutoGen/ValidCheckingInfoObject.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py26
1 files changed, 4 insertions, 22 deletions
diff --git a/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py b/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
index 92c8fe2df9..64d4965e96 100644
--- a/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
+++ b/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
@@ -35,12 +35,6 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
def dump(self, dest, Phase):
- FormatMap = {}
- FormatMap[1] = "=B"
- FormatMap[2] = "=H"
- FormatMap[4] = "=L"
- FormatMap[8] = "=Q"
-
if not os.path.isabs(dest):
return
if not os.path.exists(dest):
@@ -106,19 +100,7 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
realLength += 4
Guid = var_check_tab.Guid
- b = pack('=LHHBBBBBBBB',
- Guid[0],
- Guid[1],
- Guid[2],
- Guid[3],
- Guid[4],
- Guid[5],
- Guid[6],
- Guid[7],
- Guid[8],
- Guid[9],
- Guid[10],
- )
+ b = PackByteFormatGUID(Guid)
Buffer += b
realLength += 16
@@ -156,14 +138,14 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
realLength += 1
for v_data in item.data:
if type(v_data) in (int, long):
- b = pack(FormatMap[item.StorageWidth], v_data)
+ b = pack(PACK_CODE_BY_SIZE[item.StorageWidth], v_data)
Buffer += b
realLength += item.StorageWidth
else:
- b = pack(FormatMap[item.StorageWidth], v_data[0])
+ b = pack(PACK_CODE_BY_SIZE[item.StorageWidth], v_data[0])
Buffer += b
realLength += item.StorageWidth
- b = pack(FormatMap[item.StorageWidth], v_data[1])
+ b = pack(PACK_CODE_BY_SIZE[item.StorageWidth], v_data[1])
Buffer += b
realLength += item.StorageWidth