mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fix InternalFileHierarchyStorage::check, error_string will never be
shown as always return true.
This commit is contained in:
parent
bf0777fd9e
commit
9672fe33d0
@ -720,9 +720,9 @@ bool InternalFileHierarchyStorage::check(std::string& error_string) // checks co
|
|||||||
{
|
{
|
||||||
// recurs go through all entries, check that all
|
// recurs go through all entries, check that all
|
||||||
|
|
||||||
|
error_string = "";
|
||||||
std::vector<uint32_t> hits(mNodes.size(),0) ; // count hits of children. Should be 1 for all in the end. Otherwise there's an error.
|
std::vector<uint32_t> hits(mNodes.size(),0) ; // count hits of children. Should be 1 for all in the end. Otherwise there's an error.
|
||||||
hits[0] = 1 ; // because 0 is never the child of anyone
|
hits[0] = 1 ; // because 0 is never the child of anyone
|
||||||
std::map<RsFileHash,DirectoryStorage::EntryIndex> tmp_hashes ;
|
|
||||||
|
|
||||||
for(uint32_t i=0;i<mNodes.size();++i)
|
for(uint32_t i=0;i<mNodes.size();++i)
|
||||||
if(mNodes[i] != NULL && mNodes[i]->type() == FileStorageNode::TYPE_DIR)
|
if(mNodes[i] != NULL && mNodes[i]->type() == FileStorageNode::TYPE_DIR)
|
||||||
@ -734,13 +734,13 @@ bool InternalFileHierarchyStorage::check(std::string& error_string) // checks co
|
|||||||
{
|
{
|
||||||
if(de.subdirs[j] >= mNodes.size())
|
if(de.subdirs[j] >= mNodes.size())
|
||||||
{
|
{
|
||||||
error_string += " - Node child out of tab!" ;
|
error_string += " - Node child dir out of tab!" ;
|
||||||
de.subdirs[j] = de.subdirs.back() ;
|
de.subdirs[j] = de.subdirs.back() ;
|
||||||
de.subdirs.pop_back();
|
de.subdirs.pop_back();
|
||||||
}
|
}
|
||||||
else if(hits[de.subdirs[j]] != 0)
|
else if(hits[de.subdirs[j]] != 0)
|
||||||
{
|
{
|
||||||
error_string += " - Double hit on a single node" ;
|
error_string += " - Double hit on a single node dir." ;
|
||||||
de.subdirs[j] = de.subdirs.back() ;
|
de.subdirs[j] = de.subdirs.back() ;
|
||||||
de.subdirs.pop_back();
|
de.subdirs.pop_back();
|
||||||
}
|
}
|
||||||
@ -754,13 +754,13 @@ bool InternalFileHierarchyStorage::check(std::string& error_string) // checks co
|
|||||||
{
|
{
|
||||||
if(de.subfiles[j] >= mNodes.size())
|
if(de.subfiles[j] >= mNodes.size())
|
||||||
{
|
{
|
||||||
error_string += " - Node child out of tab!" ;
|
error_string += " - Node child file out of tab!" ;
|
||||||
de.subfiles[j] = de.subfiles.back() ;
|
de.subfiles[j] = de.subfiles.back() ;
|
||||||
de.subfiles.pop_back();
|
de.subfiles.pop_back();
|
||||||
}
|
}
|
||||||
else if(hits[de.subfiles[j]] != 0)
|
else if(hits[de.subfiles[j]] != 0)
|
||||||
{
|
{
|
||||||
error_string += " - Double hit on a single node" ;
|
error_string += " - Double hit on a single node file." ;
|
||||||
de.subfiles[j] = de.subfiles.back() ;
|
de.subfiles[j] = de.subfiles.back() ;
|
||||||
de.subfiles.pop_back();
|
de.subfiles.pop_back();
|
||||||
}
|
}
|
||||||
@ -780,7 +780,7 @@ bool InternalFileHierarchyStorage::check(std::string& error_string) // checks co
|
|||||||
mNodes[i] = NULL ;
|
mNodes[i] = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return error_string.empty();;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InternalFileHierarchyStorage::print() const
|
void InternalFileHierarchyStorage::print() const
|
||||||
|
Loading…
Reference in New Issue
Block a user