mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 10:54:22 -05:00
compilation fix
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2159 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8e5b1dca64
commit
d6ebef77fb
@ -182,9 +182,6 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* so cast *ref to a DirEntry */
|
/* so cast *ref to a DirEntry */
|
||||||
FileEntry *file = (FileEntry *) ref;
|
|
||||||
DirEntry *dir = dynamic_cast<DirEntry *>(file);
|
|
||||||
PersonEntry *person;
|
|
||||||
/* root case */
|
/* root case */
|
||||||
|
|
||||||
#ifdef FIS_DEBUG
|
#ifdef FIS_DEBUG
|
||||||
@ -195,40 +192,12 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!ref)
|
if (ref == NULL)
|
||||||
{
|
{
|
||||||
#ifdef FIS_DEBUG
|
#ifdef FIS_DEBUG
|
||||||
std::cerr << "FileIndexStore::RequestDirDetails() ref=NULL (root)" << std::endl;
|
std::cerr << "FileIndexStore::RequestDirDetails() ref=NULL (root)" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (flags & DIR_FLAGS_LOCAL)
|
|
||||||
{
|
|
||||||
/* local only */
|
|
||||||
if (localindex)
|
|
||||||
{
|
|
||||||
DirStub stub;
|
|
||||||
stub.type = DIR_TYPE_PERSON;
|
|
||||||
stub.name = localindex->root->name;
|
|
||||||
stub.ref = localindex->root;
|
|
||||||
details.children.push_back(stub);
|
|
||||||
details.count = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
details.count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
details.parent = NULL;
|
|
||||||
details.prow = 0;
|
|
||||||
details.ref = NULL;
|
|
||||||
details.type = DIR_TYPE_ROOT;
|
|
||||||
details.name = "";
|
|
||||||
details.hash = "";
|
|
||||||
details.path = "";
|
|
||||||
details.age = 0;
|
|
||||||
details.flags = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* get remote root entries */
|
/* get remote root entries */
|
||||||
for(pit = indices.begin(); pit != indices.end(); pit++)
|
for(pit = indices.begin(); pit != indices.end(); pit++)
|
||||||
{
|
{
|
||||||
@ -242,7 +211,7 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
|
|||||||
details.children.push_back(stub);
|
details.children.push_back(stub);
|
||||||
}
|
}
|
||||||
details.parent = NULL;
|
details.parent = NULL;
|
||||||
details.prow = 0;
|
details.prow = -1;
|
||||||
details.ref = NULL;
|
details.ref = NULL;
|
||||||
details.type = DIR_TYPE_ROOT;
|
details.type = DIR_TYPE_ROOT;
|
||||||
details.name = "";
|
details.name = "";
|
||||||
@ -251,114 +220,15 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
|
|||||||
details.count = indices.size();
|
details.count = indices.size();
|
||||||
details.age = 0;
|
details.age = 0;
|
||||||
details.flags = 0;
|
details.flags = 0;
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (dir) /* has children --- fill */
|
|
||||||
{
|
|
||||||
#ifdef FIS_DEBUG
|
|
||||||
std::cerr << "FileIndexStore::RequestDirDetails() ref=dir" << std::endl;
|
|
||||||
#endif
|
|
||||||
std::map<std::string, FileEntry *>::iterator fit;
|
|
||||||
std::map<std::string, DirEntry *>::iterator dit;
|
|
||||||
/* extract all the entries */
|
|
||||||
for(dit = dir->subdirs.begin();
|
|
||||||
dit != dir->subdirs.end(); dit++)
|
|
||||||
{
|
|
||||||
DirStub stub;
|
|
||||||
stub.type = DIR_TYPE_DIR;
|
|
||||||
stub.name = (dit->second) -> name;
|
|
||||||
stub.ref = (dit->second);
|
|
||||||
|
|
||||||
details.children.push_back(stub);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(fit = dir->files.begin();
|
|
||||||
fit != dir->files.end(); fit++)
|
|
||||||
{
|
|
||||||
DirStub stub;
|
|
||||||
stub.type = DIR_TYPE_FILE;
|
|
||||||
stub.name = (fit->second) -> name;
|
|
||||||
stub.ref = (fit->second);
|
|
||||||
|
|
||||||
details.children.push_back(stub);
|
|
||||||
}
|
|
||||||
|
|
||||||
details.type = DIR_TYPE_DIR;
|
|
||||||
details.hash = "";
|
|
||||||
details.count = dir->subdirs.size() +
|
|
||||||
dir->files.size();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef FIS_DEBUG
|
|
||||||
std::cerr << "FileIndexStore::RequestDirDetails() ref=file" << std::endl;
|
|
||||||
#endif
|
|
||||||
details.type = DIR_TYPE_FILE;
|
|
||||||
details.count = file->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FIS_DEBUG
|
|
||||||
std::cerr << "FileIndexStore::RequestDirDetails() name: " << file->name << std::endl;
|
|
||||||
#endif
|
|
||||||
details.ref = file;
|
|
||||||
details.name = file->name;
|
|
||||||
details.hash = file->hash;
|
|
||||||
details.age = time(NULL) - file->modtime;
|
|
||||||
details.flags = 0;//file->pop;
|
|
||||||
|
|
||||||
/* find parent pointer, and row */
|
|
||||||
DirEntry *parent = file->parent;
|
|
||||||
if (!parent) /* then must be root */
|
|
||||||
{
|
|
||||||
details.parent = NULL;
|
|
||||||
details.prow = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
details.parent = parent;
|
|
||||||
details.prow = parent->row;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find peer id */
|
|
||||||
parent = dir;
|
|
||||||
if (!dir)
|
|
||||||
{
|
|
||||||
/* cannot be null -> no files at root level */
|
|
||||||
parent=file->parent;
|
|
||||||
}
|
|
||||||
// Well, yes, it can be null, beleive me. In such a case it may be that
|
|
||||||
// file is a person entry.
|
|
||||||
|
|
||||||
if(parent==NULL)
|
|
||||||
{
|
|
||||||
if(NULL == (person = dynamic_cast<PersonEntry *>(file)))
|
|
||||||
{
|
|
||||||
std::cerr << "Major Error- Not PersonEntry!";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* NEW add path (to dir - if dir, or parent dir - if file? */
|
|
||||||
details.path = parent->path;
|
|
||||||
|
|
||||||
while(parent->parent)
|
|
||||||
parent = parent->parent;
|
|
||||||
|
|
||||||
/* we should end up on the PersonEntry */
|
|
||||||
if (NULL == (person = dynamic_cast<PersonEntry *>(parent)))
|
|
||||||
{
|
|
||||||
std::cerr << "Major Error- Not PersonEntry!";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
details.id = person->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
unlockData();
|
unlockData();
|
||||||
return found;
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool b = FileIndex::extractData(ref,details) ;
|
||||||
|
|
||||||
|
unlockData();
|
||||||
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -433,7 +303,7 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Di
|
|||||||
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
||||||
{
|
{
|
||||||
DirDetails dd;
|
DirDetails dd;
|
||||||
(pit->second)->RequestDirDetails(*rit, dd, 0);
|
FileIndex::extractData(*rit, dd);
|
||||||
results.push_back(dd);
|
results.push_back(dd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,7 +318,7 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Di
|
|||||||
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
||||||
{
|
{
|
||||||
DirDetails dd;
|
DirDetails dd;
|
||||||
(pit->second)->RequestDirDetails(*rit, dd, 0);
|
FileIndex::extractData(*rit, dd);
|
||||||
dd.id = "Local";
|
dd.id = "Local";
|
||||||
results.push_back(dd);
|
results.push_back(dd);
|
||||||
}
|
}
|
||||||
@ -482,7 +352,7 @@ int FileIndexStore::searchBoolExp(Expression * exp, std::list<DirDetails> &resul
|
|||||||
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
||||||
{
|
{
|
||||||
DirDetails dd;
|
DirDetails dd;
|
||||||
(pit->second)->RequestDirDetails(*rit, dd, 0);
|
FileIndex::extractData(*rit, dd);
|
||||||
results.push_back(dd);
|
results.push_back(dd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,7 +369,7 @@ int FileIndexStore::searchBoolExp(Expression * exp, std::list<DirDetails> &resul
|
|||||||
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
||||||
{
|
{
|
||||||
DirDetails dd;
|
DirDetails dd;
|
||||||
(pit->second)->RequestDirDetails(*rit, dd, 0);
|
FileIndex::extractData(*rit, dd);
|
||||||
dd.id = "Local";
|
dd.id = "Local";
|
||||||
results.push_back(dd);
|
results.push_back(dd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user