mirror of https://github.com/acidanthera/audk.git
BaseTools: Fixed the PcdValue trailing zero issue.
1. Not append trailing zero for PcdValue 2. make sure the point to Variable Name in PCD DataBase 2 bytes aligned. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
7c19378762
commit
4cf022f2f1
|
@ -1184,6 +1184,12 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||||
# and calculate the VariableHeadStringIndex
|
# and calculate the VariableHeadStringIndex
|
||||||
|
|
||||||
VariableNameStructure = StringToArray(Sku.VariableName)
|
VariableNameStructure = StringToArray(Sku.VariableName)
|
||||||
|
|
||||||
|
# Make pointer of VaraibleName(HII PCD) 2 bytes aligned
|
||||||
|
VariableNameStructureBytes = VariableNameStructure.lstrip("{").rstrip("}").split(",")
|
||||||
|
if len(VariableNameStructureBytes) % 2:
|
||||||
|
VariableNameStructure = "{%s,0x00}" % ",".join(VariableNameStructureBytes)
|
||||||
|
|
||||||
if VariableNameStructure not in Dict['STRING_TABLE_VALUE']:
|
if VariableNameStructure not in Dict['STRING_TABLE_VALUE']:
|
||||||
Dict['STRING_TABLE_CNAME'].append(CName)
|
Dict['STRING_TABLE_CNAME'].append(CName)
|
||||||
Dict['STRING_TABLE_GUID'].append(TokenSpaceGuid)
|
Dict['STRING_TABLE_GUID'].append(TokenSpaceGuid)
|
||||||
|
|
|
@ -835,12 +835,7 @@ def StringToArray(String):
|
||||||
else:
|
else:
|
||||||
return "{%s,0x00,0x00}" % ",".join("0x%02x" % ord(C) for C in String[1:-1])
|
return "{%s,0x00,0x00}" % ",".join("0x%02x" % ord(C) for C in String[1:-1])
|
||||||
elif String.startswith('{'):
|
elif String.startswith('{'):
|
||||||
StringLen = len(String.split(","))
|
|
||||||
if StringLen % 2:
|
|
||||||
return "{%s,0x00}" % ",".join(C.strip() for C in String[1:-1].split(','))
|
|
||||||
else:
|
|
||||||
return "{%s}" % ",".join(C.strip() for C in String[1:-1].split(','))
|
return "{%s}" % ",".join(C.strip() for C in String[1:-1].split(','))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if len(String.split()) % 2:
|
if len(String.split()) % 2:
|
||||||
return '{%s,0}' % ','.join(String.split())
|
return '{%s,0}' % ','.join(String.split())
|
||||||
|
|
Loading…
Reference in New Issue