SeekDown() now prints out an error message when failing in a certain way (instead
of just using the RETURN_ERROR() macro). Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13878 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -589,14 +589,14 @@ BPlusTree::CompareKeys(const void *key1, int keyLength1, const void *key2, int k
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BPlusTree::FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength, uint16 *index,
|
BPlusTree::FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength,
|
||||||
off_t *next)
|
uint16 *_index, off_t *_next)
|
||||||
{
|
{
|
||||||
if (node->all_key_count == 0) {
|
if (node->all_key_count == 0) {
|
||||||
if (index)
|
if (_index)
|
||||||
*index = 0;
|
*_index = 0;
|
||||||
if (next)
|
if (_next)
|
||||||
*next = node->OverflowLink();
|
*_next = node->OverflowLink();
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -622,21 +622,21 @@ BPlusTree::FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength, uin
|
|||||||
} else if (cmp > 0) {
|
} else if (cmp > 0) {
|
||||||
saveIndex = first = i + 1;
|
saveIndex = first = i + 1;
|
||||||
} else {
|
} else {
|
||||||
if (index)
|
if (_index)
|
||||||
*index = i;
|
*_index = i;
|
||||||
if (next)
|
if (_next)
|
||||||
*next = BFS_ENDIAN_TO_HOST_INT64(values[i]);
|
*_next = BFS_ENDIAN_TO_HOST_INT64(values[i]);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index)
|
if (_index)
|
||||||
*index = saveIndex;
|
*_index = saveIndex;
|
||||||
if (next) {
|
if (_next) {
|
||||||
if (saveIndex == node->NumKeys())
|
if (saveIndex == node->NumKeys())
|
||||||
*next = node->OverflowLink();
|
*_next = node->OverflowLink();
|
||||||
else
|
else
|
||||||
*next = BFS_ENDIAN_TO_HOST_INT64(values[saveIndex]);
|
*_next = BFS_ENDIAN_TO_HOST_INT64(values[saveIndex]);
|
||||||
}
|
}
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@@ -668,7 +668,7 @@ BPlusTree::SeekDown(Stack<node_and_key> &stack, const uint8 *key, uint16 keyLeng
|
|||||||
|
|
||||||
off_t nextOffset;
|
off_t nextOffset;
|
||||||
status_t status = FindKey(node, key, keyLength, &nodeAndKey.keyIndex, &nextOffset);
|
status_t status = FindKey(node, key, keyLength, &nodeAndKey.keyIndex, &nextOffset);
|
||||||
|
|
||||||
if (status == B_ENTRY_NOT_FOUND && nextOffset == nodeAndKey.nodeOffset)
|
if (status == B_ENTRY_NOT_FOUND && nextOffset == nodeAndKey.nodeOffset)
|
||||||
RETURN_ERROR(B_ERROR);
|
RETURN_ERROR(B_ERROR);
|
||||||
|
|
||||||
@@ -677,7 +677,9 @@ BPlusTree::SeekDown(Stack<node_and_key> &stack, const uint8 *key, uint16 keyLeng
|
|||||||
|
|
||||||
nodeAndKey.nodeOffset = nextOffset;
|
nodeAndKey.nodeOffset = nextOffset;
|
||||||
}
|
}
|
||||||
RETURN_ERROR(B_ERROR);
|
|
||||||
|
FATAL(("BPlusTree::SeekDown() could not open node %Ld\n", nodeAndKey.nodeOffset));
|
||||||
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user