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.120; helo=mga04.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 92FD32116821E for ; Wed, 17 Oct 2018 11:48:47 -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 fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2018 11:48:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,393,1534834800"; d="scan'208";a="96100541" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 17 Oct 2018 11:48:46 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 17 Oct 2018 11:48:46 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.16]) by FMSMSX113.amr.corp.intel.com ([169.254.13.112]) with mapi id 14.03.0319.002; Wed, 17 Oct 2018 11:48:46 -0700 From: "Carsey, Jaben" To: Laszlo Ersek , "Zhao, ZhiqiangX" CC: "edk2-devel@lists.01.org" , "Gao, Liming" Thread-Topic: [edk2] [PATCH] BaseTools: covert "unicode string" to "byte array" if value type diff. Thread-Index: AQHUZgm/JmBZYWv6A0+ntei0R3AP7qUkOhQA//+NrMA= Date: Wed, 17 Oct 2018 18:48:45 +0000 Message-ID: References: <20181017110822.62976-1-zhiqiangx.zhao@intel.com> <341b8d54-3e4f-93f5-006b-8ea455652c75@redhat.com> In-Reply-To: <341b8d54-3e4f-93f5-006b-8ea455652c75@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWQ2NmY3YzgtMzllZi00MDYxLTg1NzEtYTJhOTk3NWMyNTJjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRlhCMEFaUGM0aW9BaGp0WDM2ckdKTTRiVW9mcWl5TFVIdzN3dzlEcDRmWFZPaGx3OGtXaFMrcGN6ajEydER0dyJ9 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] BaseTools: covert "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: Wed, 17 Oct 2018 18:48:47 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Laszlo Ersek > Sent: Wednesday, October 17, 2018 11:37 AM > To: Zhao, ZhiqiangX > Cc: edk2-devel@lists.01.org; Gao, Liming > Subject: Re: [edk2] [PATCH] BaseTools: covert "unicode string" to "byte > array" if value type diff. >=20 > Hi, >=20 > On 10/17/18 13:08, Zhaozh1x wrote: > > 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 covert "unicode string" to "byte array". > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: ZhiqiangX Zhao > > Cc: Liming Gao > > Cc: Yonghong Zhu > > Reviewed-by: 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..9b783de84b 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),T= hen > covert "unicode string" to "byte array". > > + for pcd in Pcds.values(): > > + PcdValueTypeList =3D [] > > + for sku in pcd.SkuInfoList.values(): > > + PcdValueTypeList.append("UnicodeString" if > sku.DefaultValue.startswith("L") else "OtherVOID*") > > + if "UnicodeString" in PcdValueTypeList and "OtherVOID*" in > PcdValueTypeList: If you use a set instead of a list here, it will save memory any then inste= ad of testing for both items being there, you could just check the length b= eing > 1 which would also be faster than 2 "in" tests. > > + for sku in pcd.SkuInfoList.values(): > > + sku.DefaultValue =3D StringToArray(sku.DefaultValu= e) if > sku.DefaultValue.startswith("L") else sku.DefaultValue > > > > map(self.FilterSkuSettings, Pcds.values()) > > return Pcds > > >=20 > no comments on the code change, just a superficial one on the subject > line: please replace "covert" with "convert". >=20 > There are two more instances of the typo in the patch: in the commit > message, and in the new code too. (Three occurrences in total.) >=20 > Normally I shouldn't obsess about such small typos, in case they don't > obscure the intended meaning. However, "covert" did confuse me, because > it is an existent word, and it has a specific meaning in computing: >=20 > https://en.wikipedia.org/wiki/Covert_channel >=20 > Thanks! > Laszlo > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel