mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
Removed unnecessary loops for debug output in CacheStrapper::loadList without debug enabled.
Changed parameter of RsDirUtil::cleanupDirectory from "std::list<std::string> keepFiles" to "const std::list<std::string> &keepFiles". git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3925 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5bc8e68059
commit
ab42691a31
@ -914,7 +914,10 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
||||
|
||||
/* assemble a list of dirs to clean (union of cache dirs) */
|
||||
std::list<std::string> cacheDirs;
|
||||
std::list<std::string>::iterator dit, fit;
|
||||
std::list<std::string>::iterator dit;
|
||||
#ifdef CS_DEBUG
|
||||
std::list<std::string>::iterator fit;
|
||||
#endif
|
||||
std::map<uint16_t, CachePair>::iterator cit;
|
||||
for(cit = caches.begin(); cit != caches.end(); cit++)
|
||||
{
|
||||
@ -936,18 +939,16 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
||||
std::cerr << "CacheStrapper::loadList() Files To Save:" << std::endl;
|
||||
#endif
|
||||
|
||||
#ifdef CS_DEBUG
|
||||
for(sit = saveFiles.begin(); sit != saveFiles.end(); sit++)
|
||||
{
|
||||
#ifdef CS_DEBUG
|
||||
std::cerr << "CacheStrapper::loadList() Files To Save in dir: <" << sit->first << ">" << std::endl;
|
||||
#endif
|
||||
for(fit = (sit->second).begin(); fit != (sit->second).end(); fit++)
|
||||
{
|
||||
#ifdef CS_DEBUG
|
||||
std::cerr << "\tFile: " << *fit << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
std::list<std::string> emptyList;
|
||||
for(dit = cacheDirs.begin(); dit != cacheDirs.end(); dit++)
|
||||
@ -958,12 +959,12 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
||||
sit = saveFiles.find(*dit);
|
||||
if (sit != saveFiles.end())
|
||||
{
|
||||
#ifdef CS_DEBUG
|
||||
for(fit = (sit->second).begin(); fit != (sit->second).end(); fit++)
|
||||
{
|
||||
#ifdef CS_DEBUG
|
||||
std::cerr << "CacheStrapper::loadList() Keeping File: " << *fit << std::endl;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
RsDirUtil::cleanupDirectory(*dit, sit->second);
|
||||
}
|
||||
else
|
||||
|
@ -534,7 +534,7 @@ bool RsDirUtil::checkCreateDirectory(const std::string& dir)
|
||||
//#include <fcntl.h>
|
||||
//#include <unistd.h>
|
||||
|
||||
bool RsDirUtil::cleanupDirectory(const std::string& cleandir, std::list<std::string> keepFiles)
|
||||
bool RsDirUtil::cleanupDirectory(const std::string& cleandir, const std::list<std::string> &keepFiles)
|
||||
{
|
||||
|
||||
/* check for the dir existance */
|
||||
@ -552,7 +552,7 @@ bool RsDirUtil::cleanupDirectory(const std::string& cleandir, std::list<std::st
|
||||
while(NULL != (dent = readdir(dir)))
|
||||
{
|
||||
/* check entry type */
|
||||
std::string fname = dent -> d_name;
|
||||
const std::string &fname = dent -> d_name;
|
||||
std::string fullname = cleandir + "/" + fname;
|
||||
|
||||
if (-1 != stat(fullname.c_str(), &buf))
|
||||
|
@ -63,7 +63,7 @@ bool copyFile(const std::string& source,const std::string& dest);
|
||||
bool checkFile(const std::string& filename);
|
||||
bool checkDirectory(const std::string& dir);
|
||||
bool checkCreateDirectory(const std::string& dir);
|
||||
bool cleanupDirectory(const std::string& dir, std::list<std::string> keepFiles);
|
||||
bool cleanupDirectory(const std::string& dir, const std::list<std::string> &keepFiles);
|
||||
|
||||
bool hashFile(const std::string& filepath,
|
||||
std::string &name, std::string &hash, uint64_t &size);
|
||||
|
Loading…
Reference in New Issue
Block a user