mirror of https://github.com/acidanthera/audk.git
BaseTools:ord() don't match in py2 and py3
In python2, the FvHeaderBuffer Type is a str In python3, the FvHeaderBuffer Type is a bytes Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
parent
4a3773e578
commit
7fa0e68afd
|
@ -71,6 +71,9 @@ class FvImageSection(FvImageSectionClassObject):
|
|||
# PI FvHeader is 0x48 byte
|
||||
FvHeaderBuffer = FvFileObj.read(0x48)
|
||||
# FV alignment position.
|
||||
if isinstance(FvHeaderBuffer[0x2E], str):
|
||||
FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
|
||||
else:
|
||||
FvAlignmentValue = 1 << (FvHeaderBuffer[0x2E] & 0x1F)
|
||||
FvFileObj.close()
|
||||
if FvAlignmentValue > MaxFvAlignment:
|
||||
|
@ -121,7 +124,10 @@ class FvImageSection(FvImageSectionClassObject):
|
|||
# PI FvHeader is 0x48 byte
|
||||
FvHeaderBuffer = FvFileObj.read(0x48)
|
||||
# FV alignment position.
|
||||
FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
|
||||
if isinstance(FvHeaderBuffer[0x2E], str):
|
||||
FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
|
||||
else:
|
||||
FvAlignmentValue = 1 << (FvHeaderBuffer[0x2E] & 0x1F)
|
||||
# FvAlignmentValue is larger than or equal to 1K
|
||||
if FvAlignmentValue >= 0x400:
|
||||
if FvAlignmentValue >= 0x100000:
|
||||
|
|
Loading…
Reference in New Issue