MOBI Output: When generating joint KF8/MOBI6 .mobi files set the text length field in the MOBI 6 header correctly. Fixes #1003489 (Calibre .52. MOBI 6 created with KF8 Plugin crashes at the last ncx item.)

This commit is contained in:
Kovid Goyal 2012-05-23 23:57:53 +05:30
parent cd8236c1d1
commit 5c61a2da48
2 changed files with 2 additions and 0 deletions

View File

@ -377,6 +377,7 @@ class MOBIHeader(object): # {{{
a('Compression: %s'%self.compression)
a('Unused: %r'%self.unused)
a('Text length: %d'%self.text_length)
a('Number of text records: %d'%self.number_of_text_records)
a('Text record size: %d'%self.text_record_size)
a('Encryption: %s'%self.encryption_type)

View File

@ -411,6 +411,7 @@ class MobiWriter(object):
header_fields['fdst_count'] = 1 # Why not 0? Kindlegen uses 1
header_fields['flis_record'] = flis_number
header_fields['fcis_record'] = fcis_number
header_fields['text_length'] = self.text_length
extra_data_flags = 0b1 # Has multibyte overlap bytes
if self.primary_index_record_idx is not None:
extra_data_flags |= 0b10