* Reverted r27196 and solved it differently (in a more robust way): instead of

guessing that the first attribute will be a name attribute, fCurrentSmallData
  now takes hidden attributes into account.
* I haven't tested this change, though, so if it messes things up again, please
  yell at me :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27441 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-09-12 09:25:17 +00:00
parent 2e2bff94a9
commit c4b2fd5be3
1 changed files with 12 additions and 21 deletions

View File

@ -2599,16 +2599,13 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type,
RecursiveLocker _(&fInode->SmallDataLock());
int32 i = 0;
for (;;item = item->Next()) {
if (item->IsLast(node))
break;
int32 index = 0;
for (; !item->IsLast(node); item = item->Next(), index++) {
if (item->NameSize() == FILE_NAME_NAME_LENGTH
&& *item->Name() == FILE_NAME_NAME)
continue;
if (i++ == fCurrentSmallData)
if (index >= fCurrentSmallData)
break;
}
@ -2618,15 +2615,12 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type,
*_length = item->NameSize();
*_id = (ino_t)fCurrentSmallData;
fCurrentSmallData = i;
}
else {
// stop traversing the small_data section
fCurrentSmallData = -1;
fCurrentSmallData = index;
return B_OK;
}
if (fCurrentSmallData != -1)
return B_OK;
// stop traversing the small_data section
fCurrentSmallData = -1;
}
// read attributes out of the attribute directory
@ -2676,11 +2670,8 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type,
void
AttributeIterator::Update(uint16 index, int8 change)
{
// fCurrentSmallData points already to the next item. OTOH, index is always
// the position when considering the special name attribute while the
// attribute iterators do ignore that (they always start at the second
// position in the small data section, not the first).
if (index <= fCurrentSmallData)
// fCurrentSmallData points already to the next item
if (index < fCurrentSmallData)
fCurrentSmallData += change;
}