From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7ABDB208F7AAF for ; Sun, 4 Mar 2018 22:01:13 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2018 22:07:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,426,1515484800"; d="scan'208";a="22937477" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by orsmga006.jf.intel.com with ESMTP; 04 Mar 2018 22:07:24 -0800 From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Mon, 5 Mar 2018 14:07:22 +0800 Message-Id: <1520230042-3088-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools: Fix a bug that HII type pcd value display extra 0x00 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 06:01:14 -0000 Fix a bug that HII type Pcd value display in the report will have an extra 0x00, because original code use StringToArray function and it will judge whether the value length is a multiplier of 2, if not, it will change the value in Pcd Object and add an extra 0x00. Cc: Bob Feng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +- BaseTools/Source/Python/Workspace/DscBuildData.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 439e360..485d932 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1329,11 +1329,11 @@ class PlatformAutoGen(AutoGen): continue if len(Sku.VariableName) > 0: VariableGuidStructure = Sku.VariableGuidValue VariableGuid = GuidStructureStringToGuidString(VariableGuidStructure) for StorageName in Sku.DefaultStoreDict: - VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuName, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableOffset, Sku.VariableAttribute , Sku.HiiDefaultValue,Sku.DefaultStoreDict[StorageName],Pcd.DatumType)) + VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuName, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableOffset, Sku.VariableAttribute , StringToArray(Sku.HiiDefaultValue), StringToArray(Sku.DefaultStoreDict[StorageName]),Pcd.DatumType)) Index += 1 return VariableInfo def UpdateNVStoreMaxSize(self,OrgVpdFile): if self.VariableInfo: diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 9d78770..fc7a307 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2513,17 +2513,13 @@ class DscBuildData(PlatformBuildClassObject): else: MaxSize = 0 if pcd.DatumType not in ['BOOLEAN','UINT8','UINT16','UINT32','UINT64']: for (_, skuobj) in pcd.SkuInfoList.items(): datalen = 0 - skuobj.HiiDefaultValue = StringToArray(skuobj.HiiDefaultValue) - datalen = len(skuobj.HiiDefaultValue.split(",")) + datalen = len((StringToArray(skuobj.HiiDefaultValue)).split(",")) if datalen > MaxSize: MaxSize = datalen - for defaultst in skuobj.DefaultStoreDict: - skuobj.DefaultStoreDict[defaultst] = StringToArray(skuobj.DefaultStoreDict[defaultst]) - pcd.DefaultValue = StringToArray(pcd.DefaultValue) pcd.MaxDatumSize = str(MaxSize) rt, invalidhii = self.CheckVariableNameAssignment(Pcds) if not rt: invalidpcd = ",".join(invalidhii) EdkLogger.error('build', PCD_VARIABLE_INFO_ERROR, Message='The same HII PCD must map to the same EFI variable for all SKUs', File=self.MetaFile, ExtraData=invalidpcd) -- 2.6.1.windows.1