BaseTools: Refactor to share GUID packing function

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>
This commit is contained in:
Carsey, Jaben 2018-04-28 06:32:41 +08:00 committed by Yonghong Zhu
parent a2e721704b
commit d3054be59e
1 changed files with 2 additions and 15 deletions

View File

@ -21,6 +21,7 @@ from Common.VariableAttributes import VariableAttributes
import copy
from struct import unpack
from Common.DataType import *
from GenVar import PackGUID
DATABASE_VERSION = 7
@ -287,21 +288,7 @@ class DbItemList:
#
def PackGuid(GuidStructureValue):
GuidString = GuidStructureStringToGuidString(GuidStructureValue)
Guid = GuidString.split('-')
Buffer = pack('=LHHBBBBBBBB',
int(Guid[0], 16),
int(Guid[1], 16),
int(Guid[2], 16),
int(Guid[3][-4:-2], 16),
int(Guid[3][-2:], 16),
int(Guid[4][-12:-10], 16),
int(Guid[4][-10:-8], 16),
int(Guid[4][-8:-6], 16),
int(Guid[4][-6:-4], 16),
int(Guid[4][-4:-2], 16),
int(Guid[4][-2:], 16)
)
return Buffer
return PackGUID(GuidString.split('-'))
if self.ItemSize == 8:
PackStr = "=Q"