mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-08 22:52:54 -04:00
- added some optimization to RequestDirDetails internal functions
- improved sorting/selection in shared files flat mode *W* Needs full recompilation. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4121 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f9c896c3ac
commit
6c2bdbe214
12 changed files with 115 additions and 47 deletions
|
@ -1216,6 +1216,16 @@ int FileIndex::searchBoolExp(Expression * exp, std::list<FileEntry *> &results)
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t FileIndex::getType(void *ref)
|
||||
{
|
||||
if(ref == NULL)
|
||||
return DIR_TYPE_ROOT ;
|
||||
|
||||
if(!isValid(ref))
|
||||
return DIR_TYPE_ROOT ;
|
||||
|
||||
return static_cast<FileEntry*>(ref)->type() ;
|
||||
}
|
||||
bool FileIndex::extractData(void *ref,DirDetails& details)
|
||||
{
|
||||
if(!isValid(ref))
|
||||
|
@ -1227,7 +1237,7 @@ bool FileIndex::extractData(void *ref,DirDetails& details)
|
|||
}
|
||||
|
||||
FileEntry *file = static_cast<FileEntry *>(ref);
|
||||
DirEntry *dir = dynamic_cast<DirEntry *>(file);
|
||||
DirEntry *dir = (file->hash.empty())?static_cast<DirEntry *>(file):NULL ; // This is a hack to avoid doing a dynamic_cast
|
||||
|
||||
details.children = std::list<DirStub>() ;
|
||||
time_t now = time(NULL) ;
|
||||
|
@ -1304,7 +1314,7 @@ bool FileIndex::extractData(void *ref,DirDetails& details)
|
|||
FileEntry *f ;
|
||||
for(f=file;f->parent!=NULL;f=f->parent) ;
|
||||
|
||||
details.id = dynamic_cast<PersonEntry*>(f)->id;
|
||||
details.id = static_cast<PersonEntry*>(f)->id; // The topmost parent is necessarily a personEntrY, so we can avoid a dynamic_cast.
|
||||
|
||||
#ifdef FI_DEBUG
|
||||
assert(details.parent != details.ref) ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue