mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-07 08:35:16 -04:00
fixed terrible cost of calling requestDirDetails before createIndex
This commit is contained in:
parent
f58e9c1a73
commit
ca30b0da44
10 changed files with 90 additions and 35 deletions
|
@ -94,6 +94,27 @@ bool InternalFileHierarchyStorage::getIndexFromFileHash(const RsFileHash& hash,D
|
|||
return true;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::getChildIndex(DirectoryStorage::EntryIndex e,int row,DirectoryStorage::EntryIndex& c) const
|
||||
{
|
||||
if(!checkIndex(e,FileStorageNode::TYPE_DIR))
|
||||
return false ;
|
||||
|
||||
const DirEntry& d = *static_cast<DirEntry*>(mNodes[e]) ;
|
||||
|
||||
if((uint32_t)row < d.subdirs.size())
|
||||
{
|
||||
c = d.subdirs[row] ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
if((uint32_t)row < d.subdirs.size() + d.subfiles.size())
|
||||
{
|
||||
c = d.subfiles[row - (int)d.subdirs.size()] ;
|
||||
return true ;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int InternalFileHierarchyStorage::parentRow(DirectoryStorage::EntryIndex e)
|
||||
{
|
||||
if(!checkIndex(e,FileStorageNode::TYPE_DIR | FileStorageNode::TYPE_FILE) || e==0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue