BaseTools: remove redundant check

The RegEx matches begining and end of the string, dont then check length.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Carsey, Jaben 2018-04-04 06:34:06 +08:00 committed by Yonghong Zhu
parent 1f26f5fdb9
commit bfc8f5667a
2 changed files with 3 additions and 3 deletions

View File

@ -107,7 +107,7 @@ class IdfFileClassObject(object):
if Len == 4 and LineDetails[2] != 'TRANSPARENT':
EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'Please use the keyword "TRANSPARENT" to describe the transparency setting in Line %s of File %s.' % (LineNo, File.Path))
MatchString = gIdentifierPattern.match(LineDetails[1])
if MatchString is None or MatchString.end(0) != len(LineDetails[1]):
if MatchString is None:
EdkLogger.error('Image Definition File Parser', FORMAT_INVALID, 'The Image token name %s defined in Idf file %s contains the invalid character.' % (LineDetails[1], File.Path))
if LineDetails[1] not in self.ImageIDList:
self.ImageIDList.append(LineDetails[1])

View File

@ -352,7 +352,7 @@ class UniFileClassObject(object):
# Check the string name
if Name != '':
MatchString = gIdentifierPattern.match(Name)
if MatchString is None or MatchString.end(0) != len(Name):
if MatchString is None:
EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))
LanguageList = Item.split(u'#language ')
for IndexI in range(len(LanguageList)):
@ -522,7 +522,7 @@ class UniFileClassObject(object):
# Check the string name
if not self.IsCompatibleMode and Name != '':
MatchString = gIdentifierPattern.match(Name)
if MatchString is None or MatchString.end(0) != len(Name):
if MatchString is None:
EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))
self.AddStringToList(Name, Language, Value)
continue