public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if value type diff
@ 2018-10-18  5:09 Zhaozh1x
  2018-10-18 14:16 ` Carsey, Jaben
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zhaozh1x @ 2018-10-18  5:09 UTC (permalink / raw)
  To: edk2-devel; +Cc: Zhaozh1x, Liming Gao, Yonghong Zhu, Bob Feng

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if value type diff
  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
  2018-10-21 10:48 ` Feng, Bob C
  2018-10-24  7:26 ` Feng, Bob C
  2 siblings, 0 replies; 4+ messages in thread
From: Carsey, Jaben @ 2018-10-18 14:16 UTC (permalink / raw)
  To: Zhao, ZhiqiangX, edk2-devel@lists.01.org; +Cc: Gao, Liming

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if value type diff
  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
@ 2018-10-21 10:48 ` Feng, Bob C
  2018-10-24  7:26 ` Feng, Bob C
  2 siblings, 0 replies; 4+ messages in thread
From: Feng, Bob C @ 2018-10-21 10:48 UTC (permalink / raw)
  To: Zhao, ZhiqiangX, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Zhao, ZhiqiangX 
Sent: Thursday, October 18, 2018 1:09 PM
To: edk2-devel@lists.01.org
Cc: Zhao, ZhiqiangX <zhiqiangx.zhao@intel.com>; Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
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 "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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] BaseTools: Convert "Unicode string" to "byte array" if value type diff
  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
  2018-10-21 10:48 ` Feng, Bob C
@ 2018-10-24  7:26 ` Feng, Bob C
  2 siblings, 0 replies; 4+ messages in thread
From: Feng, Bob C @ 2018-10-24  7:26 UTC (permalink / raw)
  To: Zhao, ZhiqiangX, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Zhao, ZhiqiangX 
Sent: Thursday, October 18, 2018 1:09 PM
To: edk2-devel@lists.01.org
Cc: Zhao, ZhiqiangX <zhiqiangx.zhao@intel.com>; Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
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 "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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-24  7:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-10-21 10:48 ` Feng, Bob C
2018-10-24  7:26 ` Feng, Bob C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox