From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3336C22423834 for ; Wed, 28 Feb 2018 21:50:23 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2018 21:56:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,407,1515484800"; d="scan'208";a="30601468" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by FMSMGA003.fm.intel.com with ESMTP; 28 Feb 2018 21:56:30 -0800 From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Thu, 1 Mar 2018 13:56:27 +0800 Message-Id: <1519883787-11988-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools: Fix the bug for display incorrect *M flag in report X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2018 05:50:25 -0000 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 --- 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