]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Rename long() to int()
authorYunhua Feng <yunhuax.feng@intel.com>
Wed, 10 Oct 2018 03:00:31 +0000 (11:00 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sat, 13 Oct 2018 01:50:42 +0000 (09:50 +0800)
Because the long() function was not exist in Python3.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
BaseTools/Source/Python/Common/Misc.py
BaseTools/Source/Python/GenFds/AprioriSection.py
BaseTools/Source/Python/GenFds/FdfParser.py
BaseTools/Source/Python/GenFds/GenFds.py
BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py

index edd40a1498ffd4ffc8c5d6247d087479127c22d1..6ddf38fd0d8a405edd4016bb7c9c88a0f229aacc 100644 (file)
@@ -57,7 +57,7 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
                 itemIndex += 1\r
                 realLength += 5\r
                 for v_data in item.data:\r
-                    if type(v_data) in (int, long):\r
+                    if isinstance(v_data, int):\r
                         realLength += item.StorageWidth\r
                     else:\r
                         realLength += item.StorageWidth\r
@@ -137,7 +137,7 @@ class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
                 Buffer += b\r
                 realLength += 1\r
                 for v_data in item.data:\r
-                    if type(v_data) in (int, long):\r
+                    if isinstance(v_data, int):\r
                         b = pack(PACK_CODE_BY_SIZE[item.StorageWidth], v_data)\r
                         Buffer += b\r
                         realLength += item.StorageWidth\r
index 502f607f8d8c4e9adb125402ef72d2a7fa4ec51a..40c0105a3c4c92510c63d230510677bc5ae50921 100644 (file)
@@ -1591,7 +1591,7 @@ def CheckPcdDatum(Type, Value):
         if Value and int(Value, 0) < 0:\r
             return False, "PCD can't be set to negative value[%s] for datum type [%s]" % (Value, Type)\r
         try:\r
-            Value = long(Value, 0)\r
+            Value = int(Value, 0)\r
             if Value > MAX_VAL_TYPE[Type]:\r
                 return False, "Too large PCD value[%s] for datum type [%s]" % (Value, Type)\r
         except:\r
@@ -2081,7 +2081,7 @@ def PackRegistryFormatGuid(Guid):
 #   @retval     Value    The integer value that the input represents\r
 #\r
 def GetIntegerValue(Input):\r
-    if type(Input) in (int, long):\r
+    if isinstance(Input, int):\r
         return Input\r
     String = Input\r
     if String.endswith("U"):\r
index aaa919d7a8b5ae1a02517c1fd60a28072234d3e7..c50a0c5b022b37cdeccba8cb353e71ee338b732a 100644 (file)
@@ -96,7 +96,7 @@ class AprioriSection (AprioriSectionClassObject):
 \r
 \r
             GuidPart = Guid.split('-')\r
-            Buffer.write(pack('I', long(GuidPart[0], 16)))\r
+            Buffer.write(pack('I', int(GuidPart[0], 16)))\r
             Buffer.write(pack('H', int(GuidPart[1], 16)))\r
             Buffer.write(pack('H', int(GuidPart[2], 16)))\r
 \r
index d18b0a332830afda467b1dab4e377c73b3a4f98d..cbdc893cdf19c41b0968e5fbeaa351fa6500f1e5 100644 (file)
@@ -1615,7 +1615,7 @@ class FdfParser:
                 self.SetPcdLocalation(pcdPair)\r
                 FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
                 self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple\r
-            Obj.Size = long(Size, 0)\r
+            Obj.Size = int(Size, 0)\r
             return True\r
 \r
         if self.__IsKeyword( "ErasePolarity"):\r
@@ -1651,7 +1651,7 @@ class FdfParser:
             if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():\r
                 raise Warning("expected address", self.FileName, self.CurrentLineNumber)\r
 \r
-            BsAddress = long(self.__Token, 0)\r
+            BsAddress = int(self.__Token, 0)\r
             Obj.BsBaseAddress = BsAddress\r
 \r
         if self.__IsKeyword("RtBaseAddress"):\r
@@ -1661,7 +1661,7 @@ class FdfParser:
             if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():\r
                 raise Warning("expected address", self.FileName, self.CurrentLineNumber)\r
 \r
-            RtAddress = long(self.__Token, 0)\r
+            RtAddress = int(self.__Token, 0)\r
             Obj.RtBaseAddress = RtAddress\r
 \r
     ## __GetBlockStatements() method\r
@@ -1709,7 +1709,7 @@ class FdfParser:
             self.SetPcdLocalation(PcdPair)\r
             FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
             self.Profile.PcdFileLineDict[PcdPair] = FileLineTuple\r
-        BlockSize = long(BlockSize, 0)\r
+        BlockSize = int(BlockSize, 0)\r
 \r
         BlockNumber = None\r
         if self.__IsKeyword( "NumBlocks"):\r
@@ -1719,7 +1719,7 @@ class FdfParser:
             if not self.__GetNextDecimalNumber() and not self.__GetNextHexNumber():\r
                 raise Warning("expected block numbers", self.FileName, self.CurrentLineNumber)\r
 \r
-            BlockNumber = long(self.__Token, 0)\r
+            BlockNumber = int(self.__Token, 0)\r
 \r
         Obj.BlockSizeList.append((BlockSize, BlockNumber, BlockSizePcd))\r
         return True\r
@@ -1828,7 +1828,7 @@ class FdfParser:
             Expr += CurCh\r
             self.__GetOneChar()\r
         try:\r
-            return long(\r
+            return int(\r
                 ValueExpression(Expr,\r
                                 self.__CollectMacroPcd()\r
                                 )(True), 0)\r
@@ -1876,7 +1876,7 @@ class FdfParser:
                            RegionOffsetPcdPattern.match(self.__CurrentLine()[self.CurrentOffsetWithinLine:]))\r
             if IsRegionPcd:\r
                 RegionObj.PcdOffset = self.__GetNextPcdSettings()\r
-                self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + long(Fd.BaseAddress, 0))\r
+                self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + int(Fd.BaseAddress, 0))\r
                 self.SetPcdLocalation(RegionObj.PcdOffset)\r
                 self.__PcdDict['%s.%s' % (RegionObj.PcdOffset[1], RegionObj.PcdOffset[0])] = "0x%x" % RegionObj.Offset\r
                 FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
@@ -3231,9 +3231,9 @@ class FdfParser:
                     if FdfParser.__Verify(Name, Value, 'UINT64'):\r
                         FmpData.MonotonicCount = Value\r
                         if FmpData.MonotonicCount.upper().startswith('0X'):\r
-                            FmpData.MonotonicCount = (long)(FmpData.MonotonicCount, 16)\r
+                            FmpData.MonotonicCount = (int)(FmpData.MonotonicCount, 16)\r
                         else:\r
-                            FmpData.MonotonicCount = (long)(FmpData.MonotonicCount)\r
+                            FmpData.MonotonicCount = (int)(FmpData.MonotonicCount)\r
             if not self.__GetNextToken():\r
                 break\r
         else:\r
index 5c22755bb70a9e0bfe87c0c3e67f921b298ef8f9..904bd840891d185898d966834bb920e15a0502f6 100644 (file)
@@ -557,9 +557,9 @@ class GenFds :
         GenFdsGlobalVariable.InfLogger('\nFV Space Information')\r
         for FvSpaceInfo in FvSpaceInfoList:\r
             Name = FvSpaceInfo[0]\r
-            TotalSizeValue = long(FvSpaceInfo[1], 0)\r
-            UsedSizeValue = long(FvSpaceInfo[2], 0)\r
-            FreeSizeValue = long(FvSpaceInfo[3], 0)\r
+            TotalSizeValue = int(FvSpaceInfo[1], 0)\r
+            UsedSizeValue = int(FvSpaceInfo[2], 0)\r
+            FreeSizeValue = int(FvSpaceInfo[3], 0)\r
             if UsedSizeValue == TotalSizeValue:\r
                 Percentage = '100'\r
             else:\r
@@ -585,7 +585,7 @@ class GenFds :
         if PcdValue == '':\r
             return\r
 \r
-        Int64PcdValue = long(PcdValue, 0)\r
+        Int64PcdValue = int(PcdValue, 0)\r
         if Int64PcdValue == 0 or Int64PcdValue < -1:\r
             return\r
 \r
index 47677cc28ede0737c48f07c7b5ee3759975cd317..c48425d0cd3386be31f7012caaca44f132c0e36f 100644 (file)
@@ -140,11 +140,11 @@ if __name__ == '__main__':
 \r
   try:\r
     if args.MonotonicCountStr.upper().startswith('0X'):\r
-      args.MonotonicCountValue = (long)(args.MonotonicCountStr, 16)\r
+      args.MonotonicCountValue = (int)(args.MonotonicCountStr, 16)\r
     else:\r
-      args.MonotonicCountValue = (long)(args.MonotonicCountStr)\r
+      args.MonotonicCountValue = (int)(args.MonotonicCountStr)\r
   except:\r
-    args.MonotonicCountValue = (long)(0)\r
+    args.MonotonicCountValue = (int)(0)\r
 \r
   if args.Encode:\r
     #\r
@@ -250,9 +250,9 @@ if __name__ == '__main__':
       sys.exit(1)\r
     else:\r
       if args.SignatureSizeStr.upper().startswith('0X'):\r
-        SignatureSize = (long)(args.SignatureSizeStr, 16)\r
+        SignatureSize = (int)(args.SignatureSizeStr, 16)\r
       else:\r
-        SignatureSize = (long)(args.SignatureSizeStr)\r
+        SignatureSize = (int)(args.SignatureSizeStr)\r
     if SignatureSize < 0:\r
         print("ERROR: The value of option --signature-size can't be set to negative value!")\r
         sys.exit(1)\r
index 50a442dd4ae85ccaa9368653144b87c1bb81b588..285635963100fe7b8fdae62c71e720667ba10bcf 100644 (file)
@@ -162,9 +162,9 @@ if __name__ == '__main__':
   if args.MonotonicCountStr:\r
     try:\r
       if args.MonotonicCountStr.upper().startswith('0X'):\r
-        args.MonotonicCountValue = (long)(args.MonotonicCountStr, 16)\r
+        args.MonotonicCountValue = (int)(args.MonotonicCountStr, 16)\r
       else:\r
-        args.MonotonicCountValue = (long)(args.MonotonicCountStr)\r
+        args.MonotonicCountValue = (int)(args.MonotonicCountStr)\r
     except:\r
         pass\r
 \r