* [Patch] BaseTools: Fix the bug for display incorrect *M flag in report
@ 2018-03-01 5:56 Yonghong Zhu
2018-03-01 11:55 ` Gao, Liming
0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2018-03-01 5:56 UTC (permalink / raw)
To: edk2-devel
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>
---
BaseTools/Source/Python/Common/String.py | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py
index 5e50bef..696be4c 100644
--- a/BaseTools/Source/Python/Common/String.py
+++ b/BaseTools/Source/Python/Common/String.py
@@ -815,38 +815,38 @@ def GetHelpTextList(HelpTextClassList):
return List
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):
return (len(String) + 1) * 2 + 1;
elif String.startswith('L"'):
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] BaseTools: Fix the bug for display incorrect *M flag in report
2018-03-01 5:56 [Patch] BaseTools: Fix the bug for display incorrect *M flag in report Yonghong Zhu
@ 2018-03-01 11:55 ` Gao, Liming
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2018-03-01 11:55 UTC (permalink / raw)
To: Zhu, Yonghong, edk2-devel@lists.01.org
Reviewed-by: Liming Gao <liming.gao@intel.com>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu
> Sent: Thursday, March 1, 2018 1:56 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch] 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>
> ---
> BaseTools/Source/Python/Common/String.py | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py
> index 5e50bef..696be4c 100644
> --- a/BaseTools/Source/Python/Common/String.py
> +++ b/BaseTools/Source/Python/Common/String.py
> @@ -815,38 +815,38 @@ def GetHelpTextList(HelpTextClassList):
> return List
>
> 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):
> return (len(String) + 1) * 2 + 1;
> elif String.startswith('L"'):
> --
> 2.6.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] 2+ messages in thread
end of thread, other threads:[~2018-03-01 11:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-01 5:56 [Patch] BaseTools: Fix the bug for display incorrect *M flag in report Yonghong Zhu
2018-03-01 11:55 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox