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:
Axel Dörfler
2005-08-02 12:12:23 +00:00
parent c50cfe23dd
commit 8c52ae3e96
@@ -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;
} }
@@ -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;
} }