From b4d14910f51ee93b6a2d17afbc46ff73240f9334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 25 Feb 2003 02:50:28 +0000 Subject: [PATCH] Fixed some warnings, and some minor style issues. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2836 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/bfs/BPlusTree.cpp | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp index 1d3c038d45..27170f77ba 100644 --- a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp @@ -529,8 +529,7 @@ status_t BPlusTree::FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength, uint16 *index, off_t *next) { - if (node->all_key_count == 0) - { + if (node->all_key_count == 0) { if (index) *index = 0; if (next) @@ -539,11 +538,10 @@ BPlusTree::FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength, uin } off_t *values = node->Values(); - int16 saveIndex; + int16 saveIndex = -1; // binary search in the key array - for (int16 first = 0,last = node->all_key_count - 1;first <= last;) - { + for (int16 first = 0, last = node->all_key_count - 1; first <= last;) { uint16 i = (first + last) >> 1; uint16 searchLength; @@ -555,17 +553,12 @@ BPlusTree::FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength, uin } int32 cmp = CompareKeys(key, keyLength, searchKey, searchLength); - if (cmp < 0) - { + if (cmp < 0) { last = i - 1; saveIndex = i; - } - else if (cmp > 0) - { + } else if (cmp > 0) { saveIndex = first = i + 1; - } - else - { + } else { if (index) *index = i; if (next) @@ -576,8 +569,7 @@ BPlusTree::FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength, uin if (index) *index = saveIndex; - if (next) - { + if (next) { if (saveIndex == node->all_key_count) *next = node->overflow_link; else @@ -2020,7 +2012,7 @@ int32 bplustree_node::FragmentsUsed(uint32 nodeSize) { uint32 used = 0; - for (int32 i = 0;i < nodeSize / ((NUM_FRAGMENT_VALUES + 1) * sizeof(off_t));i++) { + for (uint32 i = 0; i < nodeSize / ((NUM_FRAGMENT_VALUES + 1) * sizeof(off_t)); i++) { duplicate_array *array = FragmentAt(i); if (array->count > 0 && ++used > 1) return used;