diff options
author | Zhaozh1x <zhiqiangx.zhao@intel.com> | 2018-10-18 10:42:34 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2018-10-22 15:19:27 +0800 |
commit | 073891a3e74059e996258e32b56b3f0770c6fe55 (patch) | |
tree | c7a85868eea824160e20ce4af124eb5e1f74f956 /BaseTools/Source/Python/Workspace/DscBuildData.py | |
parent | 32be12235d68c0bf20337f8eed9386c4835d408a (diff) | |
download | edk2-073891a3e74059e996258e32b56b3f0770c6fe55.tar.gz edk2-073891a3e74059e996258e32b56b3f0770c6fe55.tar.bz2 edk2-073891a3e74059e996258e32b56b3f0770c6fe55.zip |
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>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Workspace/DscBuildData.py')
-rw-r--r-- | BaseTools/Source/Python/Workspace/DscBuildData.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 17e6f62cac..b0e88a93ce 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2878,6 +2878,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
|