diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-03-01 13:48:31 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-03-02 10:06:21 +0800 |
commit | 6ee9c68912324b4053cfa15fd06b02af1c1c74d9 (patch) | |
tree | 13f89992dad6f1d37122295941b6f0a834e44601 /BaseTools/Source/Python/Common/String.py | |
parent | 4faf13222edead307109bf8c747200ea3fb617c0 (diff) | |
download | edk2-6ee9c68912324b4053cfa15fd06b02af1c1c74d9.tar.gz edk2-6ee9c68912324b4053cfa15fd06b02af1c1c74d9.tar.bz2 edk2-6ee9c68912324b4053cfa15fd06b02af1c1c74d9.zip |
BaseTools: Fix the bug for display incorrect *M flag in report
The root cause is the byte array value in the driver Pcd, some bytes
have additional space character, while the value in DSC file doesn't
have this space, it cause the string compare return false, so we remove
the extra space.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Common/String.py')
-rw-r--r-- | BaseTools/Source/Python/Common/String.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py index 5e50beff5c..696be4c1f0 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -817,34 +817,34 @@ def GetHelpTextList(HelpTextClassList): def StringToArray(String):
if isinstance(String, unicode):
if len(unicode) == 0:
- return "{0x00, 0x00}"
- return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String])
+ return "{0x00,0x00}"
+ return "{%s,0x00,0x00}" % ",".join(["0x%02x,0x00" % ord(C) for C in String])
elif String.startswith('L"'):
if String == "L\"\"":
- return "{0x00, 0x00}"
+ return "{0x00,0x00}"
else:
- return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String[2:-1]])
+ return "{%s,0x00,0x00}" % ",".join(["0x%02x,0x00" % ord(C) for C in String[2:-1]])
elif String.startswith('"'):
if String == "\"\"":
return "{0x00,0x00}"
else:
StringLen = len(String[1:-1])
if StringLen % 2:
- return "{%s, 0x00}" % ", ".join(["0x%02x" % ord(C) for C in String[1:-1]])
+ return "{%s,0x00}" % ",".join(["0x%02x" % ord(C) for C in String[1:-1]])
else:
- return "{%s, 0x00,0x00}" % ", ".join(["0x%02x" % ord(C) for C in String[1:-1]])
+ return "{%s,0x00,0x00}" % ",".join(["0x%02x" % ord(C) for C in String[1:-1]])
elif String.startswith('{'):
StringLen = len(String.split(","))
if StringLen % 2:
- return "{%s, 0x00}" % ", ".join([ C for C in String[1:-1].split(',')])
+ return "{%s,0x00}" % ",".join([ C.strip() for C in String[1:-1].split(',')])
else:
- return "{%s}" % ", ".join([ C for C in String[1:-1].split(',')])
+ return "{%s}" % ",".join([ C.strip() for C in String[1:-1].split(',')])
else:
if len(String.split()) % 2:
- return '{%s, 0}' % ', '.join(String.split())
+ return '{%s,0}' % ','.join(String.split())
else:
- return '{%s, 0,0}' % ', '.join(String.split())
+ return '{%s,0,0}' % ','.join(String.split())
def StringArrayLength(String):
if isinstance(String, unicode):
|