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=jaben.carsey@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 2F09A21A07A80 for ; Thu, 18 Oct 2018 07:16:31 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Oct 2018 07:16:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,396,1534834800"; d="scan'208";a="272399876" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 18 Oct 2018 07:16:31 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 18 Oct 2018 07:16:30 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.16]) by FMSMSX154.amr.corp.intel.com ([169.254.6.126]) with mapi id 14.03.0319.002; Thu, 18 Oct 2018 07:16:30 -0700 From: "Carsey, Jaben" To: "Zhao, ZhiqiangX" , "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [edk2] [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if value type diff Thread-Index: AQHUZqDAFfBq5lhY9UOwvkHo9rxYGaUlDQtA Date: Thu, 18 Oct 2018 14:16:29 +0000 Message-ID: References: <20181018050919.69276-1-zhiqiangx.zhao@intel.com> In-Reply-To: <20181018050919.69276-1-zhiqiangx.zhao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTA3NDk1M2YtMjY3Ny00NmNjLTgzM2UtM2RkYTFiNjhkMWNhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTDJLRHVQN2xxQ3o2a29mRGVRZTN6MzRIQk5sYlN2S2pxZkhBTk0zU0ZzOElVYUxPeGJEVFNmSlpcL1ZzdTdSMjcifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.1.200.106] 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: Thu, 18 Oct 2018 14:16:32 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Zhaozh1x > Sent: Wednesday, October 17, 2018 10:09 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [edk2] [PATCH V2] BaseTools: Convert "Unicode string" to "byte > array" if value type diff >=20 > 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. >=20 > 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". >=20 > 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(+) >=20 > 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] >=20 > + #For the same one VOID* pcd, if the default value type of one SK= U is > "Unicode string", > + #the other SKUs are "OtherVOID*"(ASCII string or byte array),The= n > 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.startswith(('L"',"L'")) else "OtherVOID*") > + if len(PcdValueTypeSet) > 1: > + for sku in pcd.SkuInfoList.values(): > + sku.DefaultValue =3D StringToArray(sku.DefaultValue)= if > sku.DefaultValue.startswith(('L"',"L'")) else sku.DefaultValue >=20 > map(self.FilterSkuSettings, Pcds.values()) > return Pcds > -- > 2.14.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel