From: "Feng, Bob C" <bob.c.feng@intel.com>
To: edk2-devel@lists.01.org
Cc: Hess Chen <hess.chen@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: Correct the error message for UPT
Date: Sat, 2 Feb 2019 09:36:08 +0800 [thread overview]
Message-ID: <20190202013608.6060-1-bob.c.feng@intel.com> (raw)
This patch is going to correct the error message
for UPT.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hess Chen <hess.chen@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
.../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.<BR>
+# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
#
# 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
next reply other threads:[~2019-02-02 1:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-02 1:36 Feng, Bob C [this message]
2019-02-14 14:30 ` [Patch] BaseTools: Correct the error message for UPT Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190202013608.6060-1-bob.c.feng@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox