Squashed a few minor TODOs.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20205 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-02-23 02:10:51 +00:00
parent e696418178
commit 36ca5d166c
3 changed files with 24 additions and 17 deletions

View File

@ -244,7 +244,6 @@ NameIndexEntryIterator::GetCurrent(uint8 *buffer, size_t *keyLength)
Entry *entry = GetCurrent();
if (entry) {
strncpy((char*)buffer, entry->GetName(), kMaxIndexKeyLength);
// TODO: + 1 ?
*keyLength = strlen(entry->GetName());
}
return entry;

View File

@ -67,8 +67,9 @@ IndexWrapper::Type() const
off_t
IndexWrapper::GetSize() const
{
// TODO: That's not exactly what should be returned.
return (fIndex ? fIndex->CountEntries() + 1 : 0);
// Compute a fake "index size" based on the number of entries
// (1024 + 16 * entry count), so we don't need to adjust the code using it.
return 1024LL + (fIndex ? fIndex->CountEntries() : 0) * 16LL;
}
// KeySize
@ -1126,7 +1127,7 @@ Equation::PrepareQuery(Volume */*volume*/, IndexWrapper &index, IndexIterator **
status_t
Equation::GetNextMatching(Volume *volume, IndexIterator *iterator,
struct dirent *dirent, size_t /*bufferSize*/)
struct dirent *dirent, size_t bufferSize)
{
while (true) {
union value indexValue;
@ -1195,15 +1196,22 @@ Equation::GetNextMatching(Volume *volume, IndexIterator *iterator,
}
if (status == MATCH_OK) {
size_t nameLen = strlen(entry->GetName());
// check, whether the entry fits into the buffer,
// and fill it in
size_t length = (dirent->d_name + nameLen + 1) - (char*)dirent;
if (length > bufferSize)
RETURN_ERROR(B_BUFFER_OVERFLOW);
dirent->d_dev = volume->GetID();
dirent->d_ino = entry->GetNode()->GetID();
dirent->d_pdev = volume->GetID();
dirent->d_pino = entry->GetParent()->GetID();
// TODO: Check the buffer size.
strncpy(dirent->d_name, entry->GetName(), B_FILE_NAME_LENGTH);
dirent->d_name[B_FILE_NAME_LENGTH - 1] = '\0';
dirent->d_reclen = sizeof(struct dirent) + strlen(dirent->d_name);
memcpy(dirent->d_name, entry->GetName(), nameLen);
dirent->d_name[nameLen] = '\0';
dirent->d_reclen = length;
}
if (status == MATCH_OK)

View File

@ -1324,8 +1324,7 @@ PRINT((" entry: `%s'\n", name));
#endif
*count = 1;
} else {
// TODO: Check, if that's the correct behavior.
SET_ERROR(error, B_BAD_VALUE);
SET_ERROR(error, B_BUFFER_OVERFLOW);
}
} else
*count = 0;
@ -1616,8 +1615,7 @@ ramfs_read_attrdir(void *ns, void */*_node*/, void *cookie, long *count,
#endif
*count = 1;
} else {
// TODO: Check, if that's the correct behavior.
SET_ERROR(error, B_BAD_VALUE);
SET_ERROR(error, B_BUFFER_OVERFLOW);
}
} else
*count = 0;
@ -1858,8 +1856,7 @@ ramfs_read_indexdir(void *ns, void *_cookie, long *count,
#endif
*count = 1;
} else {
// TODO: Check, if that's the correct behavior.
SET_ERROR(error, B_BAD_VALUE);
SET_ERROR(error, B_BUFFER_OVERFLOW);
}
} else
*count = 0;
@ -1951,9 +1948,12 @@ ramfs_stat_index(void *ns, const char *name, struct index_info *indexInfo)
// find the index
if (Index *index = indexDir->FindIndex(name)) {
indexInfo->type = index->GetType();
indexInfo->size = 0; // TODO
indexInfo->modification_time = 0; // TODO
indexInfo->creation_time = 0; // TODO
if (index->HasFixedKeyLength())
indexInfo->size = index->GetKeyLength();
else
indexInfo->size = kMaxIndexKeyLength;
indexInfo->modification_time = 0; // TODO: index times
indexInfo->creation_time = 0; // ...
indexInfo->uid = 0; // root owns the indices
indexInfo->gid = 0; //
} else