]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix the bug for display incorrect *M flag in report
authorYonghong Zhu <yonghong.zhu@intel.com>
Thu, 1 Mar 2018 05:48:31 +0000 (13:48 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 2 Mar 2018 02:06:21 +0000 (10:06 +0800)
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>
BaseTools/Source/Python/Common/String.py

index 5e50beff5cc39539a0eab1684d0281b0533b9918..696be4c1f0b2edda292a2dfb8db1a2dc03df14e2 100644 (file)
@@ -817,34 +817,34 @@ def GetHelpTextList(HelpTextClassList):
 def StringToArray(String):\r
     if isinstance(String, unicode):\r
         if len(unicode) == 0:\r
-            return "{0x00, 0x00}"\r
-        return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String])\r
+            return "{0x00,0x00}"\r
+        return "{%s,0x00,0x00}" % ",".join(["0x%02x,0x00" % ord(C) for C in String])\r
     elif String.startswith('L"'):\r
         if String == "L\"\"":\r
-            return "{0x00, 0x00}"\r
+            return "{0x00,0x00}"\r
         else:\r
-            return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String[2:-1]])\r
+            return "{%s,0x00,0x00}" % ",".join(["0x%02x,0x00" % ord(C) for C in String[2:-1]])\r
     elif String.startswith('"'):\r
         if String == "\"\"":\r
             return "{0x00,0x00}"\r
         else:\r
             StringLen = len(String[1:-1])\r
             if StringLen % 2:\r
-                return "{%s, 0x00}" % ", ".join(["0x%02x" % ord(C) for C in String[1:-1]])\r
+                return "{%s,0x00}" % ",".join(["0x%02x" % ord(C) for C in String[1:-1]])\r
             else:\r
-                return "{%s, 0x00,0x00}" % ", ".join(["0x%02x" % ord(C) for C in String[1:-1]])\r
+                return "{%s,0x00,0x00}" % ",".join(["0x%02x" % ord(C) for C in String[1:-1]])\r
     elif String.startswith('{'):\r
         StringLen = len(String.split(","))\r
         if StringLen % 2:\r
-            return "{%s, 0x00}" % ", ".join([ C for C in String[1:-1].split(',')])\r
+            return "{%s,0x00}" % ",".join([ C.strip() for C in String[1:-1].split(',')])\r
         else:\r
-            return "{%s}" % ", ".join([ C for C in String[1:-1].split(',')])\r
+            return "{%s}" % ",".join([ C.strip() for C in String[1:-1].split(',')])\r
         \r
     else:\r
         if len(String.split()) % 2:\r
-            return '{%s, 0}' % ', '.join(String.split())\r
+            return '{%s,0}' % ','.join(String.split())\r
         else:\r
-            return '{%s, 0,0}' % ', '.join(String.split())\r
+            return '{%s,0,0}' % ','.join(String.split())\r
 \r
 def StringArrayLength(String):\r
     if isinstance(String, unicode):\r