]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: remove redundant check
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Tue, 3 Apr 2018 22:34:06 +0000 (06:34 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sun, 8 Apr 2018 07:34:12 +0000 (15:34 +0800)
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>
BaseTools/Source/Python/AutoGen/IdfClassObject.py
BaseTools/Source/Python/AutoGen/UniClassObject.py

index a028aceee927af6d2a4edf040e44d96864817351..6953854a52475b9610a8af095df71a7babd7a738 100644 (file)
@@ -107,7 +107,7 @@ class IdfFileClassObject(object):
                 if Len == 4 and LineDetails[2] != 'TRANSPARENT':\r
                     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))\r
                 MatchString = gIdentifierPattern.match(LineDetails[1])\r
-                if MatchString is None or MatchString.end(0) != len(LineDetails[1]):\r
+                if MatchString is None:\r
                     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))\r
                 if LineDetails[1] not in self.ImageIDList:\r
                     self.ImageIDList.append(LineDetails[1])\r
index 8b0c563a8c8880a1b8e1905d43b5606888ee0a8f..5b879d784d9c29b0ee9920ec7d11d643d8dd366f 100644 (file)
@@ -352,7 +352,7 @@ class UniFileClassObject(object):
         # Check the string name\r
         if Name != '':\r
             MatchString = gIdentifierPattern.match(Name)\r
-            if MatchString is None or MatchString.end(0) != len(Name):\r
+            if MatchString is None:\r
                 EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))\r
         LanguageList = Item.split(u'#language ')\r
         for IndexI in range(len(LanguageList)):\r
@@ -522,7 +522,7 @@ class UniFileClassObject(object):
                 # Check the string name\r
                 if not self.IsCompatibleMode and Name != '':\r
                     MatchString = gIdentifierPattern.match(Name)\r
-                    if MatchString is None or MatchString.end(0) != len(Name):\r
+                    if MatchString is None:\r
                         EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))\r
                 self.AddStringToList(Name, Language, Value)\r
                 continue\r