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.31; helo=mga06.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 568772117D271 for ; Wed, 24 Oct 2018 00:26:37 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 00:26:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,419,1534834800"; d="scan'208";a="90793553" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 24 Oct 2018 00:26:36 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 00:26:36 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 00:26:35 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.102]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.199]) with mapi id 14.03.0415.000; Wed, 24 Oct 2018 15:26:27 +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: AQHUZqC9ESLGwhUbFUyJaP8kmnsSxKUuCG5g Date: Wed, 24 Oct 2018 07:26:27 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D15FFE5F48@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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTkzNzg3MDMtMjUzNC00MDY2LTk2ZjMtM2Q0OWQ1ZmI2NWU2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNlNIc0FBRlwvQTJwKyt6Z2VtUDEwcFJmdTRtMGpZbHpXOUh6OXQ1OUJGdjRPQm9RQXRYQmhhdmJqWGgyZVhOaGUifQ== 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: Wed, 24 Oct 2018 07:26:37 -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