From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=zhiqiangx.zhao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 65F412194D387 for ; Wed, 17 Oct 2018 22:09:24 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2018 22:09:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,395,1534834800"; d="scan'208";a="96223901" Received: from tiano-zzq.ccr.corp.intel.com ([10.239.49.19]) by fmsmga002.fm.intel.com with ESMTP; 17 Oct 2018 22:09:22 -0700 From: Zhaozh1x To: edk2-devel@lists.01.org Cc: Zhaozh1x , Liming Gao , Yonghong Zhu , Bob Feng Date: Thu, 18 Oct 2018 13:09:19 +0800 Message-Id: <20181018050919.69276-1-zhiqiangx.zhao@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if value type diff X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2018 05:09:24 -0000 V2: Fixed 3 typo. Use startswith(('L"',"L'")) to check if a string is Unicode string. Use a set PcdValueTypeSet instead of a list PcdValueTypeList to save memory. V1: For the same one VOID* pcd, if the default value type of one SKU is "Unicode string", the other SKUs are "OtherVOID*"(ASCII string or byte array),Then convert "Unicode string" to "byte array". Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: ZhiqiangX Zhao Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng --- BaseTools/Source/Python/Workspace/DscBuildData.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 7854e71db6..9b9ace9b56 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2877,6 +2877,15 @@ class DscBuildData(PlatformBuildClassObject): elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList: del pcd.SkuInfoList[TAB_COMMON] + #For the same one VOID* pcd, if the default value type of one SKU is "Unicode string", + #the other SKUs are "OtherVOID*"(ASCII string or byte array),Then convert "Unicode string" to "byte array". + for pcd in Pcds.values(): + PcdValueTypeSet = set() + for sku in pcd.SkuInfoList.values(): + PcdValueTypeSet.add("UnicodeString" if sku.DefaultValue.startswith(('L"',"L'")) else "OtherVOID*") + if len(PcdValueTypeSet) > 1: + for sku in pcd.SkuInfoList.values(): + sku.DefaultValue = StringToArray(sku.DefaultValue) if sku.DefaultValue.startswith(('L"',"L'")) else sku.DefaultValue map(self.FilterSkuSettings, Pcds.values()) return Pcds -- 2.14.1.windows.1