Пример #1
0
/*!	\brief Finds the rightmost item that starts with the supplied key.

	The method finds the rightmost item whose left delimiting key is equal
	to the supplied key.

	\param key The key to be found.
	\param item Pointer to a pre-allocated Item that shall be set
		   to the found item.
	\return \c B_OK, if everything went fine.
*/
status_t
ItemIterator::FindRightMost(const VKey *k, Item *item)
{
//TFUNCTION_START();
	// find the first item with a greater or equal key, and check whether the
	// key is equal
	Item closeItem;
	status_t error = FindRightMostClose(k, &closeItem);
//REPORT_ERROR(error);
	if (error == B_OK) {
		VKey itemKey;
		closeItem.GetHeader()->GetKey(&itemKey);
		if (*k == itemKey) {
			if (item)
				*item = closeItem;
		} else
{
//PRINT(("keys not equal: dirID: %lu, objectID: %lu, offset: %Lu, type: %hu\n",
//itemKey.GetDirID(), itemKey.GetObjectID(), itemKey.GetOffset(), itemKey.GetType()));
			error = B_ENTRY_NOT_FOUND;
}
	}
//REPORT_ERROR(error);
	return error;
}