mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #566
This commit is contained in:
parent
6b9f555cbb
commit
8169d08052
@ -90,7 +90,7 @@ class BookHeader(object):
|
|||||||
self.doctype = raw[16:20]
|
self.doctype = raw[16:20]
|
||||||
self.length, self.type, self.codepage, self.unique_id, self.version = \
|
self.length, self.type, self.codepage, self.unique_id, self.version = \
|
||||||
struct.unpack('>LLLLL', raw[20:40])
|
struct.unpack('>LLLLL', raw[20:40])
|
||||||
|
|
||||||
if ident == 'TEXTREAD':
|
if ident == 'TEXTREAD':
|
||||||
self.codepage = 1252
|
self.codepage = 1252
|
||||||
|
|
||||||
@ -103,17 +103,15 @@ class BookHeader(object):
|
|||||||
print '[WARNING] Unknown codepage %d. Assuming cp-1252'%self.codepage
|
print '[WARNING] Unknown codepage %d. Assuming cp-1252'%self.codepage
|
||||||
self.codec = 'cp1252'
|
self.codec = 'cp1252'
|
||||||
|
|
||||||
if ident == 'TEXTREAD' or self.length < 0xF4:
|
if ident == 'TEXTREAD' or self.length != 0xE4:
|
||||||
self.extra_flags = 0
|
self.extra_flags = 0
|
||||||
else:
|
else:
|
||||||
self.extra_flags, = struct.unpack('>L', raw[0xF0:0xF4])
|
self.extra_flags, = struct.unpack('>L', raw[0xF0:0xF4])
|
||||||
|
|
||||||
|
|
||||||
if self.compression_type == 'DH':
|
if self.compression_type == 'DH':
|
||||||
self.huff_offset, self.huff_number = struct.unpack('>LL', raw[0x70:0x78])
|
self.huff_offset, self.huff_number = struct.unpack('>LL', raw[0x70:0x78])
|
||||||
|
|
||||||
self.exth_flag, = struct.unpack('>L', raw[0x80:0x84])
|
self.exth_flag, = struct.unpack('>L', raw[0x80:0x84])
|
||||||
|
|
||||||
self.exth = None
|
self.exth = None
|
||||||
if self.exth_flag & 0x40:
|
if self.exth_flag & 0x40:
|
||||||
self.exth = EXTHHeader(raw[16+self.length:], self.codec)
|
self.exth = EXTHHeader(raw[16+self.length:], self.codec)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user