summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Common/Misc.py
diff options
context:
space:
mode:
authorFeng, YunhuaX </o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Feng, YunhuaX4e1>2018-02-02 17:01:52 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-02-04 11:19:39 +0800
commit0e6b86731e5792a2fe89b595268a817f0cd989cc (patch)
treeff0cc81999b962190fd2d92d599d78f34fbe6e2f /BaseTools/Source/Python/Common/Misc.py
parentbee0f2f167e6e982e665c851d605cd50e7748e08 (diff)
downloadedk2-0e6b86731e5792a2fe89b595268a817f0cd989cc.tar.gz
edk2-0e6b86731e5792a2fe89b595268a817f0cd989cc.tar.bz2
edk2-0e6b86731e5792a2fe89b595268a817f0cd989cc.zip
BaseTools: Update Expression.py for VOID* to support L'a' and 'a'
Original VOID* type support L"string" and "string" format, now we also add support for single quote string that without null terminator. Type VOID* support L'a' and 'a', the value transfer to c style value. L'a' --> {0x61, 0x00} L'ab' --> {0x61, 0x00, 0x62, 0x00} 'a' --> {0x61} 'ab' --> {0x61, 0x62} when the value is L'' or '' that not include any character, tool will report error. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Common/Misc.py')
-rw-r--r--BaseTools/Source/Python/Common/Misc.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index b34cb4c3be..d80f645d2e 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1572,6 +1572,8 @@ def ParseFieldValue (Value):
if Value.startswith("L'") and Value.endswith("'"):
# Unicode Character Constant
List = list(Value[2:-1])
+ if len(List) == 0:
+ raise BadExpression('Length %s is %s' % (Value, len(List)))
List.reverse()
Value = 0
for Char in List:
@@ -1580,6 +1582,8 @@ def ParseFieldValue (Value):
if Value.startswith("'") and Value.endswith("'"):
# Character constant
List = list(Value[1:-1])
+ if len(List) == 0:
+ raise BadExpression('Length %s is %s' % (Value, len(List)))
List.reverse()
Value = 0
for Char in List: