]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Parser/DecParser.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Parser / DecParser.py
index a88b51d05529253f15c5254504afd3d484850596..8dfa12d8268be12ec8e558fffe2868053ca7c97f 100644 (file)
@@ -3,13 +3,7 @@
 #\r
 # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
-# This program and the accompanying materials are licensed and made available\r
-# under the terms and conditions of the BSD License which accompanies this\r
-# distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 '''\r
 DecParser\r
 '''\r
@@ -620,11 +614,11 @@ class _DecPcd(_DecBase):
         if not IsValidToken(PCD_TOKEN_PATTERN, Token):\r
             self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN % Token)\r
         elif not Token.startswith('0x') and not Token.startswith('0X'):\r
-            if long(Token) > 4294967295:\r
+            if int(Token) > 4294967295:\r
                 self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN_INT % Token)\r
-            Token = hex(long(Token))[:-1]\r
+            Token = '0x%x' % int(Token)\r
 \r
-        IntToken = long(Token, 0)\r
+        IntToken = int(Token, 0)\r
         if (Guid, IntToken) in self.TokenMap:\r
             if self.TokenMap[Guid, IntToken] != CName:\r
                 self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN_UNIQUE%(Token))\r
@@ -705,7 +699,7 @@ class _DecGuid(_DecBase):
 \r
 ## _DecUserExtension\r
 #\r
-# Parse user extention section\r
+# Parse user extension section\r
 #\r
 class _DecUserExtension(_DecBase):\r
     def __init__(self, RawData):\r
@@ -752,7 +746,7 @@ class _DecUserExtension(_DecBase):
 class Dec(_DecBase, _DecComments):\r
     def __init__(self, DecFile, Parse = True):\r
         try:\r
-            Content = ConvertSpecialChar(open(DecFile, 'rb').readlines())\r
+            Content = ConvertSpecialChar(open(DecFile, 'r').readlines())\r
         except BaseException:\r
             Logger.Error(TOOL_NAME, FILE_OPEN_FAILURE, File=DecFile,\r
                          ExtraData=ST.ERR_DECPARSE_FILEOPEN % DecFile)\r
@@ -1033,7 +1027,7 @@ class Dec(_DecBase, _DecComments):
                 SectionNames.append(SectionName)\r
             #\r
             # In DEC specification, all section headers have at most two part:\r
-            # SectionName.Arch except UserExtention\r
+            # SectionName.Arch except UserExtension\r
             #\r
             if len(ItemList) > 2:\r
                 self._LoggerError(ST.ERR_DECPARSE_SECTION_SUBTOOMANY % Item)\r