mirror of
https://github.com/elliotnunn/machfs.git
synced 2024-11-22 04:31:37 +00:00
Fix bug in B*-tree size calculation
This commit is contained in:
parent
829d3a5189
commit
67edf73321
@ -183,14 +183,15 @@ def make_btree(records, bthKeyLen, blksize):
|
||||
most_recent[node.ndType] = i
|
||||
bthFNode = most_recent.get(0xFF, 0)
|
||||
|
||||
bthFree = bitmanip.pad_up(len(nodelist), nodemult) - len(nodelist)
|
||||
bthNNodes = len(nodelist) + bthFree
|
||||
|
||||
# Populate the first (header) record of the header node
|
||||
bthNodeSize = 512
|
||||
bthNNodes = len(nodelist); bthFree = 0
|
||||
headnode.records[0] = struct.pack('>HLLLLHHLL76x',
|
||||
bthDepth, bthRoot, bthNRecs, bthFNode, bthLNode,
|
||||
bthNodeSize, bthKeyLen, bthNNodes, bthFree)
|
||||
|
||||
slop_nodes = bitmanip.pad_up(len(nodelist), nodemult) - len(nodelist)
|
||||
nodelist.append(512 * slop_nodes)
|
||||
nodelist.append(512 * bthFree)
|
||||
|
||||
return b''.join(bytes(node) for node in nodelist)
|
||||
|
Loading…
Reference in New Issue
Block a user