MOBI output: Write the correct value for record UID field in the palmdb header

This commit is contained in:
Kovid Goyal 2011-07-30 13:03:56 -06:00
parent 80e7b3e52e
commit ee1fdd3d0c
2 changed files with 2 additions and 2 deletions

View File

@ -1634,7 +1634,7 @@ class MobiWriter(object):
now = int(time.time())
nrecords = len(self._records)
self._write(title, pack('>HHIIIIII', 0, 0, now, now, 0, 0, 0, 0),
'BOOK', 'MOBI', pack('>IIH', nrecords, 0, nrecords))
'BOOK', 'MOBI', pack('>IIH', (2*nrecords)-1, 0, nrecords))
offset = self._tell() + (8 * nrecords) + 2
for i, record in enumerate(self._records):
self._write(pack('>I', offset), '\0', pack('>I', 2*i)[1:])

View File

@ -550,7 +550,7 @@ class MobiWriter(object):
now = int(time.time())
nrecords = len(self.records)
self.write(title, pack(b'>HHIIIIII', 0, 0, now, now, 0, 0, 0, 0),
b'BOOK', b'MOBI', pack(b'>IIH', nrecords, 0, nrecords))
b'BOOK', b'MOBI', pack(b'>IIH', (2*nrecords)-1, 0, nrecords))
offset = self.tell() + (8 * nrecords) + 2
for i, record in enumerate(self.records):
self.write(pack(b'>I', offset), b'\0', pack(b'>I', 2*i)[1:])