From 84989de15bd2d9d8ac5abfed21e672b525f9d1b3 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 7 Jul 2011 11:34:31 +0200 Subject: [PATCH] GenericIndexIterator::SetTo(): Find fuzzily Use TwoKeyAVLTree::FindFirstClosest() instead of FindFirst(), so, if the value isn't in the index, we find the closest greater value. That's the semantics Index::InternalFind() is expected to have. --- src/add-ons/kernel/file_systems/packagefs/IndexImpl.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/file_systems/packagefs/IndexImpl.h b/src/add-ons/kernel/file_systems/packagefs/IndexImpl.h index cb01f8a7c0..7bd84b4fe7 100644 --- a/src/add-ons/kernel/file_systems/packagefs/IndexImpl.h +++ b/src/add-ons/kernel/file_systems/packagefs/IndexImpl.h @@ -148,10 +148,12 @@ GenericIndexIterator::SetTo(Index* index, const Value& value, return false; typename NodeTree::Iterator iterator; - if (ignoreValue) + if (ignoreValue) { Policy::GetNodeTree(fIndex)->GetIterator(&iterator); - else if (Policy::GetNodeTree(fIndex)->FindFirst(value, &iterator) == NULL) + } else if (Policy::GetNodeTree(fIndex)->FindFirstClosest(value, false, + &iterator) == NULL) { return false; + } fNextTreeNode = iterator.CurrentNode(); return fNextTreeNode != NULL;