public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Correct the error message for UPT
@ 2019-02-02  1:36 Feng, Bob C
  2019-02-14 14:30 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Feng, Bob C @ 2019-02-02  1:36 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hess Chen, Liming Gao

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-14 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-02  1:36 [Patch] BaseTools: Correct the error message for UPT Feng, Bob C
2019-02-14 14:30 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox