Ejemplo n.º 1
/*!	\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.
ItemIterator::FindRightMost(const VKey *k, Item *item)
	// 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);
	if (error == B_OK) {
		VKey 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;
	return error;