mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
AZW3 Output: Fix a typo that could prevent conversion of some files
This commit is contained in:
parent
37ba626af4
commit
7b57d6e4d5
@ -36,7 +36,8 @@ class Header(OrderedDict):
|
|||||||
|
|
||||||
for line in self.DEFINITION.splitlines():
|
for line in self.DEFINITION.splitlines():
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if not line or line.startswith('#'): continue
|
if not line or line.startswith('#'):
|
||||||
|
continue
|
||||||
name, val = [x.strip() for x in line.partition('=')[0::2]]
|
name, val = [x.strip() for x in line.partition('=')[0::2]]
|
||||||
if val:
|
if val:
|
||||||
val = eval(val, {'zeroes':zeroes, 'NULL':NULL, 'DYN':None,
|
val = eval(val, {'zeroes':zeroes, 'NULL':NULL, 'DYN':None,
|
||||||
@ -66,7 +67,7 @@ class Header(OrderedDict):
|
|||||||
if val is None:
|
if val is None:
|
||||||
raise ValueError('Dynamic field %r not set'%name)
|
raise ValueError('Dynamic field %r not set'%name)
|
||||||
if isinstance(val, (int, long)):
|
if isinstance(val, (int, long)):
|
||||||
fmt = 'H' if name in self.SHORT_FIELDS else 'I'
|
fmt = b'H' if name in self.SHORT_FIELDS else b'I'
|
||||||
val = pack(b'>'+fmt, val)
|
val = pack(b'>'+fmt, val)
|
||||||
buf.write(val)
|
buf.write(val)
|
||||||
|
|
||||||
@ -79,8 +80,8 @@ class Header(OrderedDict):
|
|||||||
ans = align_block(ans)
|
ans = align_block(ans)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
def format_value(self, name, val):
|
def format_value(self, name, val):
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user