EXPORT_C TBool MBtreeLeafOrg::Search(const TAny* aNode,const TAny* aKey,const MBtreeKey& aComp,TBool aLast,TInt& aPos) const // // Default to using a binary search through the node, using KeyAt and the key's comparison. // if aLast is 1, aEntry is the first > the key, return true if previous entry is a match // if aLast is 0, aEntry is the first entry >= the key, return true is current entry is a match // { TInt match=EFalse; TInt rr=LastEntry(aNode)-1; TInt ll=0; __ASSERT_DEBUG(rr>=-1,Panic(EBadEntryCount)); while (ll<=rr) { TInt mm=(rr+ll)>>1; TInt res=aComp.Compare(aKey,aComp.Key(EntryPtr(aNode,mm))); if (res==0) match=ETrue; if (res+aLast<=0) rr=mm-1; // compare < 0 or match and aLast=0 else ll=mm+1; // compare > 0 or match and aLast=1 } aPos=ll; return match; }
EXPORT_C TBool MBtreeIndexOrg::Search(const TAny* aNode,const TAny* aKey,const MBtreeKey& aComp,TBool aLast,TInt& aPos) const // // Default to using a binary search through the node, using KeyAt and the key's comparison. // if aLast is 1, aEntry is the first > the key // if aLast is 0, aEntry is the first entry >= the key // { TInt rr=LastEntry(aNode); TInt ll=-1; __ASSERT_DEBUG(rr>0,Panic(EBadEntryCount)); while (rr>ll+1) { TInt mm=(rr+ll)>>1; if (aComp.Compare(aKey,EntryPtr(aNode,mm))+aLast<=0) rr=mm; // compare < 0 or match and aLast=0 else ll=mm; // compare > 0 or match and aLast=1 } aPos=rr; return EFalse; // return not used }
void VolumeWorker::_Work() { list_collection collection; fVolumeWatcher->GetSecureEntries(collection); if (collection.createdList->size() == 0 && collection.deletedList->size() == 0 && collection.modifiedList->size() == 0 && collection.movedList->size() == 0) return; _SetBusy(true); for (unsigned int i = 0; i < collection.createdList->size() || Stopped(); i++) AnalyseEntry((*collection.createdList)[i]); collection.createdList->clear(); for (unsigned int i = 0; i < collection.deletedList->size() || Stopped(); i++) DeleteEntry((*collection.deletedList)[i]); collection.deletedList->clear(); for (unsigned int i = 0; i < collection.modifiedList->size() || Stopped(); i++) AnalyseEntry((*collection.modifiedList)[i]); collection.modifiedList->clear(); for (unsigned int i = 0; i < collection.movedList->size() || Stopped(); i++) MoveEntry((*collection.movedFromList)[i], (*collection.movedList)[i]); collection.movedList->clear(); collection.movedFromList->clear(); LastEntry(); PostMessage(kTriggerWork); _SetBusy(false); }