]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fixed the PcdValue trailing zero issue.
authorFeng, Bob C <bob.c.feng@intel.com>
Tue, 28 Aug 2018 10:22:45 +0000 (18:22 +0800)
committerLiming Gao <liming.gao@intel.com>
Mon, 3 Sep 2018 02:14:50 +0000 (10:14 +0800)
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>
BaseTools/Source/Python/AutoGen/GenPcdDb.py
BaseTools/Source/Python/Common/StringUtils.py

index 2176bbefeb52afdaf4e887b98db56c61a95e909c..5b260cd515df1b30eef0db438dea07898a87ddea 100644 (file)
@@ -1184,6 +1184,12 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
                 # and calculate the VariableHeadStringIndex\r
 \r
                 VariableNameStructure = StringToArray(Sku.VariableName)\r
+\r
+                #  Make pointer of VaraibleName(HII PCD) 2 bytes aligned\r
+                VariableNameStructureBytes = VariableNameStructure.lstrip("{").rstrip("}").split(",")\r
+                if len(VariableNameStructureBytes) % 2:\r
+                    VariableNameStructure = "{%s,0x00}" % ",".join(VariableNameStructureBytes)\r
+\r
                 if VariableNameStructure not in Dict['STRING_TABLE_VALUE']:\r
                     Dict['STRING_TABLE_CNAME'].append(CName)\r
                     Dict['STRING_TABLE_GUID'].append(TokenSpaceGuid)\r
index da2949dbadef0848596e7da12db48ed5a84cd4f7..d5afde7a95a5c1ad9edf317fc195dbd387bf03de 100644 (file)
@@ -835,12 +835,7 @@ def StringToArray(String):
             else:\r
                 return "{%s,0x00,0x00}" % ",".join("0x%02x" % ord(C) for C in String[1:-1])\r
     elif String.startswith('{'):\r
-        StringLen = len(String.split(","))\r
-        if StringLen % 2:\r
-            return "{%s,0x00}" % ",".join(C.strip() for C in String[1:-1].split(','))\r
-        else:\r
-            return "{%s}" % ",".join(C.strip() for C in String[1:-1].split(','))\r
-\r
+        return "{%s}" % ",".join(C.strip() for C in String[1:-1].split(','))\r
     else:\r
         if len(String.split()) % 2:\r
             return '{%s,0}' % ','.join(String.split())\r