#\r
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this 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
\r
##\r
PadByte = pack('B', 0xFF)\r
else:\r
PadByte = pack('B', 0)\r
- PadData = ''.join(PadByte for i in xrange(0, Size))\r
- Buffer.write(PadData)\r
+ for i in range(0, Size):\r
+ Buffer.write(PadByte)\r
\r
## AddToBuffer()\r
#\r
# @param BlockSize block size of region\r
# @param BlockNum How many blocks in region\r
# @param ErasePolarity Flash erase polarity\r
- # @param VtfDict VTF objects\r
# @param MacroDict macro value pair\r
# @retval string Generated FV file path\r
#\r
\r
- def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, vtfDict=None, MacroDict={}, Flag=False):\r
+ def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, MacroDict={}, Flag=False):\r
Size = self.Size\r
if not Flag:\r
GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)\r
if self.FvAddress % FvAlignValue != 0:\r
EdkLogger.error("GenFds", GENFDS_ERROR,\r
"FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))\r
- FvBuffer = BytesIO('')\r
+ FvBuffer = BytesIO()\r
FvBaseAddress = '0x%X' % self.FvAddress\r
BlockSize = None\r
BlockNum = None\r
- FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict, Flag=Flag)\r
+ FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, Flag=Flag)\r
if Flag:\r
continue\r
\r
else:\r
# region ended within current blocks\r
if self.Offset + self.Size <= End:\r
- ExpectedList.append((BlockSize, (RemindingSize + BlockSize - 1) / BlockSize))\r
+ ExpectedList.append((BlockSize, (RemindingSize + BlockSize - 1) // BlockSize))\r
break\r
# region not ended yet\r
else:\r
UsedBlockNum = BlockNum\r
# region started in middle of current blocks\r
else:\r
- UsedBlockNum = (End - self.Offset) / BlockSize\r
+ UsedBlockNum = (End - self.Offset) // BlockSize\r
Start = End\r
ExpectedList.append((BlockSize, UsedBlockNum))\r
RemindingSize -= BlockSize * UsedBlockNum\r