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>
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
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
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
# @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
\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
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
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
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
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
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
Expr += CurCh\r
self.__GetOneChar()\r
try:\r
- return long(\r
+ return int(\r
ValueExpression(Expr,\r
self.__CollectMacroPcd()\r
)(True), 0)\r
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
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
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
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
\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
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
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