From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 88A2321B02822 for ; Fri, 1 Feb 2019 17:36:17 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Feb 2019 17:36:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,550,1539673200"; d="scan'208";a="113079815" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga006.jf.intel.com with ESMTP; 01 Feb 2019 17:36:15 -0800 From: "Feng, Bob C" To: edk2-devel@lists.01.org Cc: Hess Chen , Liming Gao Date: Sat, 2 Feb 2019 09:36:08 +0800 Message-Id: <20190202013608.6060-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Subject: [Patch] BaseTools: Correct the error message for UPT X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Feb 2019 01:36:17 -0000 Content-Transfer-Encoding: 8bit This patch is going to correct the error message for UPT. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hess Chen Cc: Liming Gao --- .../Python/UPT/Library/UniClassObject.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py b/BaseTools/Source/Python/UPT/Library/UniClassObject.py index cd575d5a34..7a056b349f 100644 --- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py +++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py @@ -1,9 +1,9 @@ ## @file # Collect all defined strings in multiple uni files. # -# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
# # This program and the accompanying materials are licensed and made available # under the terms and conditions of the BSD License which accompanies this # distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php @@ -593,10 +593,19 @@ class UniFileClassObject(object): StringEntryExistsFlag = 1 if not Line.endswith('"'): EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData='''The line %s misses '"' at the end of it in file %s''' % (LineCount, File.Path)) + + # + # Check the situation that there has more than 2 '"' for the language entry + # + if Line.strip() and Line.replace(u'\\"', '').count(u'"') > 2: + EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, + ExtraData='''The line %s has more than 2 '"' for language entry in file %s''' + % (LineCount, File.Path)) + elif Line.startswith(u'#language'): if StringEntryExistsFlag == 2: EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, Message=ST.ERR_UNI_MISS_STRING_ENTRY % Line, ExtraData=File.Path) StringEntryExistsFlag = 0 @@ -741,17 +750,10 @@ class UniFileClassObject(object): NewLines.append((Line[:Line.find(u'"')]).strip()) NewLines.append((Line[Line.find(u'"'):]).strip()) else: EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path) elif Line.startswith(u'"'): - # - # Check the situation that there has more than 2 '"' for the language entry - # - if Line.replace(u'\\"', '').count(u'"') > 2: - EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, - ExtraData='''The line %s has more than 2 '"' for language entry in file %s''' - % (LineCount, File.Path)) if u'#string' in Line or u'#language' in Line: EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path) NewLines.append(Line) else: print(Line) -- 2.19.1.windows.1