summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/GenC.py
diff options
context:
space:
mode:
authorYunhua Feng <yunhuax.feng@intel.com>2018-10-11 11:20:59 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-10-13 09:54:07 +0800
commit86e6cf98a8493574878286522078050ac4dd505d (patch)
treeca47729eab67c9f90e0dac5a14dc5ca14ef22ef1 /BaseTools/Source/Python/AutoGen/GenC.py
parenta09f4c91f785e36f0987aa3a6d7656ba51e6aeda (diff)
downloadedk2-86e6cf98a8493574878286522078050ac4dd505d.tar.gz
edk2-86e6cf98a8493574878286522078050ac4dd505d.tar.bz2
edk2-86e6cf98a8493574878286522078050ac4dd505d.zip
BaseTools: Handle the bytes and str difference
Deal with bytes and str is different, remove the unicode() Using utcfromtimestamp instead of fromtimestamp. 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>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenC.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenC.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index c189269d4d..28539d8239 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1795,7 +1795,7 @@ def CreateIdfFileCode(Info, AutoGenC, StringH, IdfGenCFlag, IdfGenBinBuffer):
TempBuffer += Buffer
elif File.Ext.upper() == '.JPG':
ImageType, = struct.unpack('4s', Buffer[6:10])
- if ImageType != 'JFIF':
+ if ImageType != b'JFIF':
EdkLogger.error("build", FILE_TYPE_MISMATCH, "The file %s is not a standard JPG file." % File.Path)
TempBuffer = pack('B', EFI_HII_IIBT_IMAGE_JPEG)
TempBuffer += pack('I', len(Buffer))
@@ -1895,7 +1895,7 @@ def CreateIdfFileCode(Info, AutoGenC, StringH, IdfGenCFlag, IdfGenBinBuffer):
def BmpImageDecoder(File, Buffer, PaletteIndex, TransParent):
ImageType, = struct.unpack('2s', Buffer[0:2])
- if ImageType!= 'BM': # BMP file type is 'BM'
+ if ImageType!= b'BM': # BMP file type is 'BM'
EdkLogger.error("build", FILE_TYPE_MISMATCH, "The file %s is not a standard BMP file." % File.Path)
BMP_IMAGE_HEADER = collections.namedtuple('BMP_IMAGE_HEADER', ['bfSize', 'bfReserved1', 'bfReserved2', 'bfOffBits', 'biSize', 'biWidth', 'biHeight', 'biPlanes', 'biBitCount', 'biCompression', 'biSizeImage', 'biXPelsPerMeter', 'biYPelsPerMeter', 'biClrUsed', 'biClrImportant'])
BMP_IMAGE_HEADER_STRUCT = struct.Struct('IHHIIIIHHIIIIII')
@@ -1967,7 +1967,7 @@ def BmpImageDecoder(File, Buffer, PaletteIndex, TransParent):
for Index in range(0, len(PaletteBuffer)):
if Index % 4 == 3:
continue
- PaletteTemp += PaletteBuffer[Index]
+ PaletteTemp += bytes([PaletteBuffer[Index]])
PaletteBuffer = PaletteTemp[1:]
return ImageBuffer, PaletteBuffer