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.93; helo=mga11.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 32CFF21173C75 for ; Sun, 21 Oct 2018 03:48:13 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Oct 2018 03:48:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,407,1534834800"; d="scan'208";a="79705610" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga007.fm.intel.com with ESMTP; 21 Oct 2018 03:48:12 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 21 Oct 2018 03:48:12 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 21 Oct 2018 03:48:12 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.46]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.21]) with mapi id 14.03.0319.002; Sun, 21 Oct 2018 18:48:10 +0800 From: "Feng, Bob C" To: "Zhao, ZhiqiangX" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if value type diff Thread-Index: AQHUZqC9ESLGwhUbFUyJaP8kmnsSxKUpicoA Date: Sun, 21 Oct 2018 10:48:09 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D15FFC3094@SHSMSX101.ccr.corp.intel.com> References: <20181018050919.69276-1-zhiqiangx.zhao@intel.com> In-Reply-To: <20181018050919.69276-1-zhiqiangx.zhao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTEwZmRmNzYtZWRiOS00MDdmLTkyMTUtOGZlNjQxYzcwNzZiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRmF6enQrY2V3eWs5ejdrNGplbjdkV2FmS2gzQ1JVbDd4R1wvcnptMzFhZ3Fua0Y1RGdEcHNDbDFldytBZlhJdVgifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: Sun, 21 Oct 2018 10:48:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Zhao, ZhiqiangX=20 Sent: Thursday, October 18, 2018 1:09 PM To: edk2-devel@lists.01.org Cc: Zhao, ZhiqiangX ; Gao, Liming ; Zhu, Yonghong ; Feng, Bob C Subject: [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if = value type diff 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 "Unicod= e 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.SkuI= nfoList: del pcd.SkuInfoList[TAB_COMMON] =20 + #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 =3D set() + for sku in pcd.SkuInfoList.values(): + PcdValueTypeSet.add("UnicodeString" if sku.DefaultValue.st= artswith(('L"',"L'")) else "OtherVOID*") + if len(PcdValueTypeSet) > 1: + for sku in pcd.SkuInfoList.values(): + sku.DefaultValue =3D StringToArray(sku.DefaultValue)=20 + if sku.DefaultValue.startswith(('L"',"L'")) else sku.DefaultValue =20 map(self.FilterSkuSettings, Pcds.values()) return Pcds -- 2.14.1.windows.1