public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Carsey, Jaben" <jaben.carsey@intel.com>
To: "Zhao, ZhiqiangX" <zhiqiangx.zhao@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if value type diff
Date: Thu, 18 Oct 2018 14:16:29 +0000	[thread overview]
Message-ID: <CB6E33457884FA40993F35157061515CA4169DDC@FMSMSX103.amr.corp.intel.com> (raw)
In-Reply-To: <20181018050919.69276-1-zhiqiangx.zhao@intel.com>

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----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 <liming.gao@intel.com>
> Subject: [edk2] [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
> "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 <zhiqiangx.zhao@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> ---
>  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
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2018-10-18 14:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18  5:09 [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if value type diff Zhaozh1x
2018-10-18 14:16 ` Carsey, Jaben [this message]
2018-10-21 10:48 ` Feng, Bob C
2018-10-24  7:26 ` Feng, Bob C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CB6E33457884FA40993F35157061515CA4169DDC@FMSMSX103.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox