mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-23 13:54:27 -04:00
changed post fixed operator++ into prefixed. More efficient on some systems. Patch from Phenom.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7630 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
880efee332
commit
d547cb6fdb
82 changed files with 717 additions and 718 deletions
|
@ -242,7 +242,7 @@ bool CacheSource::cachesAvailable(const RsPeerId& pid, std::map<CacheId, RsCa
|
|||
|
||||
/* can overwrite for more control! */
|
||||
CacheSet::iterator it;
|
||||
for(it = caches.begin(); it != caches.end(); it++)
|
||||
for(it = caches.begin(); it != caches.end(); ++it)
|
||||
{
|
||||
ids[(it->second).cid] = it->second;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ bool CacheSource::findCache(const RsFileHash &hash, RsCacheData &data) const
|
|||
|
||||
bool found = false;
|
||||
CacheSet::const_iterator it;
|
||||
for(it = caches.begin(); it != caches.end(); it++)
|
||||
for(it = caches.begin(); it != caches.end(); ++it)
|
||||
{
|
||||
if (hash == (it->second).hash)
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ void CacheSource::listCaches(std::ostream &out)
|
|||
out << "CacheSource::listCaches() [" << getCacheType();
|
||||
out << "] Total: " << caches.size() << std::endl;
|
||||
int i;
|
||||
for(i = 0, it = caches.begin(); it != caches.end(); it++, i++)
|
||||
for(i = 0, it = caches.begin(); it != caches.end(); ++it, ++i)
|
||||
{
|
||||
out << "\tC[" << i << "] : " << it->second << std::endl;
|
||||
}
|
||||
|
@ -341,12 +341,12 @@ void CacheStore::listCaches(std::ostream &out)
|
|||
out << "CacheStore::listCaches() [" << getCacheType();
|
||||
out << "] Total People: " << caches.size();
|
||||
out << std::endl;
|
||||
for(pit = caches.begin(); pit != caches.end(); pit++)
|
||||
for(pit = caches.begin(); pit != caches.end(); ++pit)
|
||||
{
|
||||
CacheSet::iterator it;
|
||||
out << "\tTotal for [" << pit->first << "] : " << (pit->second).size();
|
||||
out << std::endl;
|
||||
for(it = (pit->second).begin(); it != (pit->second).end(); it++)
|
||||
for(it = (pit->second).begin(); it != (pit->second).end(); ++it)
|
||||
{
|
||||
out << "\t\t" << it->second;
|
||||
out << std::endl;
|
||||
|
@ -416,12 +416,12 @@ bool CacheStore::getAllStoredCaches(std::list<RsCacheData> &data)
|
|||
lockData(); /* LOCK MUTEX */
|
||||
|
||||
std::map<RsPeerId, CacheSet>::iterator pit;
|
||||
for(pit = caches.begin(); pit != caches.end(); pit++)
|
||||
for(pit = caches.begin(); pit != caches.end(); ++pit)
|
||||
{
|
||||
CacheSet::iterator cit;
|
||||
/* look for subid */
|
||||
for(cit = (pit->second).begin();
|
||||
cit != (pit->second).end(); cit++)
|
||||
cit != (pit->second).end(); ++cit)
|
||||
{
|
||||
data.push_back(cit->second);
|
||||
}
|
||||
|
@ -638,7 +638,7 @@ void CacheStrapper::addCachePair(CachePair set)
|
|||
void CacheStrapper::statusChange(const std::list<pqiServicePeer> &plist)
|
||||
{
|
||||
std::list<pqiServicePeer>::const_iterator it;
|
||||
for(it = plist.begin(); it != plist.end(); it++)
|
||||
for(it = plist.begin(); it != plist.end(); ++it)
|
||||
{
|
||||
if(it->actions & RS_SERVICE_PEER_CONNECTED)
|
||||
{
|
||||
|
@ -650,7 +650,7 @@ void CacheStrapper::statusChange(const std::list<pqiServicePeer> &plist)
|
|||
handleCacheQuery(it->id, hashs);
|
||||
|
||||
RsStackMutex stack(csMtx); /******* LOCK STACK MUTEX *********/
|
||||
for(cit = hashs.begin(); cit != hashs.end(); cit++)
|
||||
for(cit = hashs.begin(); cit != hashs.end(); ++cit)
|
||||
{
|
||||
mCacheUpdates.push_back(std::make_pair(it->id, cit->second));
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ void CacheStrapper::handleCacheQuery(const RsPeerId& id, std::map<CacheId,RsC
|
|||
*/
|
||||
|
||||
std::map<uint16_t, CachePair>::iterator it;
|
||||
for(it = caches.begin(); it != caches.end(); it++)
|
||||
for(it = caches.begin(); it != caches.end(); ++it)
|
||||
{
|
||||
(it->second).source -> cachesAvailable(id, hashs);
|
||||
}
|
||||
|
@ -768,7 +768,7 @@ void CacheStrapper::listCaches(std::ostream &out)
|
|||
out << "CacheStrapper::listCaches() [" << mServiceCtrl->getOwnId();
|
||||
out << "] " << " Total Caches: " << caches.size();
|
||||
out << std::endl;
|
||||
for(it = caches.begin(); it != caches.end(); it++)
|
||||
for(it = caches.begin(); it != caches.end(); ++it)
|
||||
{
|
||||
out << "CacheType: " << it->first;
|
||||
out << std::endl;
|
||||
|
@ -787,7 +787,7 @@ void CacheStrapper::listPeerStatus(std::ostream & /* out */)
|
|||
out << "CacheStrapper::listPeerStatus() [" << ownId;
|
||||
out << "] Total Peers: " << status.size() << " Total Caches: " << caches.size();
|
||||
out << std::endl;
|
||||
for(it = status.begin(); it != status.end(); it++)
|
||||
for(it = status.begin(); it != status.end(); ++it)
|
||||
{
|
||||
out << "Peer: " << it->first;
|
||||
out << " Query: " << (it->second).query;
|
||||
|
@ -803,7 +803,7 @@ bool CacheStrapper::findCache(const RsFileHash& hash, RsCacheData &data) cons
|
|||
{
|
||||
/* can overwrite for more control! */
|
||||
std::map<uint16_t, CachePair>::const_iterator it;
|
||||
for(it = caches.begin(); it != caches.end(); it++)
|
||||
for(it = caches.begin(); it != caches.end(); ++it)
|
||||
{
|
||||
if ((it->second).source->findCache(hash, data))
|
||||
{
|
||||
|
@ -861,21 +861,21 @@ bool CacheStrapper::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||
const RsPeerId& ownId = mServiceCtrl->getOwnId();
|
||||
|
||||
std::map<uint16_t, CachePair>::iterator it;
|
||||
for(it = caches.begin(); it != caches.end(); it++)
|
||||
for(it = caches.begin(); it != caches.end(); ++it)
|
||||
{
|
||||
std::map<CacheId, RsCacheData>::iterator tit;
|
||||
std::map<CacheId, RsCacheData> ownTmp;
|
||||
(it->second).source -> cachesAvailable(ownId, ownTmp);
|
||||
(it->second).store -> getAllStoredCaches(remoteCaches);
|
||||
|
||||
for(tit = ownTmp.begin(); tit != ownTmp.end(); tit++)
|
||||
for(tit = ownTmp.begin(); tit != ownTmp.end(); ++tit)
|
||||
{
|
||||
if(CacheExist(tit->second))
|
||||
ownCaches.push_back(tit->second);
|
||||
}
|
||||
}
|
||||
|
||||
for(cit = ownCaches.begin(); cit != ownCaches.end(); cit++)
|
||||
for(cit = ownCaches.begin(); cit != ownCaches.end(); ++cit)
|
||||
{
|
||||
RsCacheConfig *rscc = new RsCacheConfig();
|
||||
|
||||
|
@ -896,7 +896,7 @@ bool CacheStrapper::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||
saveData.push_back(rscc);
|
||||
}
|
||||
|
||||
for(cit = remoteCaches.begin(); cit != remoteCaches.end(); cit++)
|
||||
for(cit = remoteCaches.begin(); cit != remoteCaches.end(); ++cit)
|
||||
{
|
||||
if (cit->pid == ownId)
|
||||
{
|
||||
|
@ -947,7 +947,7 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
|||
std::map<std::string, std::set<std::string> > saveFiles;
|
||||
std::map<std::string, std::set<std::string> >::iterator sit;
|
||||
|
||||
for(it = load.begin(); it != load.end(); it++)
|
||||
for(it = load.begin(); it != load.end(); ++it)
|
||||
{
|
||||
/* switch on type */
|
||||
if (NULL != (rscc = dynamic_cast<RsCacheConfig *>(*it)))
|
||||
|
@ -1060,7 +1060,7 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
|||
std::set<std::string>::iterator fit;
|
||||
#endif
|
||||
std::map<uint16_t, CachePair>::iterator cit;
|
||||
for(cit = caches.begin(); cit != caches.end(); cit++)
|
||||
for(cit = caches.begin(); cit != caches.end(); ++cit)
|
||||
{
|
||||
std::string lcdir = (cit->second).source->getCacheDir();
|
||||
std::string rcdir = (cit->second).store->getCacheDir();
|
||||
|
@ -1081,10 +1081,10 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
|||
#endif
|
||||
|
||||
#ifdef CS_DEBUG
|
||||
for(sit = saveFiles.begin(); sit != saveFiles.end(); sit++)
|
||||
for(sit = saveFiles.begin(); sit != saveFiles.end(); ++sit)
|
||||
{
|
||||
std::cerr << "CacheStrapper::loadList() Files To Save in dir: <" << sit->first << ">" << std::endl;
|
||||
for(fit = (sit->second).begin(); fit != (sit->second).end(); fit++)
|
||||
for(fit = (sit->second).begin(); fit != (sit->second).end(); ++fit)
|
||||
{
|
||||
std::cerr << "\tFile: " << *fit << std::endl;
|
||||
}
|
||||
|
@ -1092,7 +1092,7 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
|||
#endif
|
||||
|
||||
std::set<std::string> emptySet;
|
||||
for(dit = cacheDirs.begin(); dit != cacheDirs.end(); dit++)
|
||||
for(dit = cacheDirs.begin(); dit != cacheDirs.end(); ++dit)
|
||||
{
|
||||
#ifdef CS_DEBUG
|
||||
std::cerr << "CacheStrapper::loadList() Cleaning cache dir: <" << *dit << ">" << std::endl;
|
||||
|
@ -1102,7 +1102,7 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
|||
if (sit != saveFiles.end())
|
||||
{
|
||||
#ifdef CS_DEBUG
|
||||
for(fit = (sit->second).begin(); fit != (sit->second).end(); fit++)
|
||||
for(fit = (sit->second).begin(); fit != (sit->second).end(); ++fit)
|
||||
{
|
||||
std::cerr << "CacheStrapper::loadList() Keeping File: " << *fit << std::endl;
|
||||
}
|
||||
|
@ -1141,7 +1141,7 @@ bool CacheTransfer::RequestCache(RsCacheData &data, CacheStore *cbStore)
|
|||
std::map<RsFileHash, RsCacheData>::iterator dit;
|
||||
std::map<RsFileHash, CacheStore *>::iterator sit;
|
||||
|
||||
for(dit = cbData.begin(); dit != cbData.end(); dit++)
|
||||
for(dit = cbData.begin(); dit != cbData.end(); ++dit)
|
||||
{
|
||||
if (((dit->second).pid == data.pid) &&
|
||||
((dit->second).cid.type == data.cid.type) &&
|
||||
|
|
|
@ -627,7 +627,7 @@ void FileIndexMonitor::run()
|
|||
while(isRunning())
|
||||
{
|
||||
int i=0 ;
|
||||
for(;;i++)
|
||||
for(;;++i)
|
||||
{
|
||||
if(!isRunning())
|
||||
return;
|
||||
|
@ -781,7 +781,7 @@ void FileIndexMonitor::updateCycle()
|
|||
std::map<std::string, FileEntry *>::iterator fit;
|
||||
|
||||
/* flag existing subdirs as old */
|
||||
for(dit = olddir->subdirs.begin(); dit != olddir->subdirs.end(); dit++)
|
||||
for(dit = olddir->subdirs.begin(); dit != olddir->subdirs.end(); ++dit)
|
||||
{
|
||||
fe.name = (dit->second)->name;
|
||||
/* set the age as out-of-date so that it gets checked */
|
||||
|
@ -1409,7 +1409,7 @@ void FileIndexMonitor::setSharedDirectories(const std::list<SharedDirInfo>& d
|
|||
std::cerr << "FileIndexMonitor::setSharedDirectories() :\n";
|
||||
#endif
|
||||
|
||||
for(it = dirs.begin(); it != dirs.end(); it++)
|
||||
for(it = dirs.begin(); it != dirs.end(); ++it)
|
||||
{
|
||||
|
||||
#ifdef FIM_DEBUG
|
||||
|
@ -1462,7 +1462,7 @@ void FileIndexMonitor::getSharedDirectories(std::list<SharedDirInfo> &dirs)
|
|||
/* get actual list (not pending stuff) */
|
||||
std::map<std::string, SharedDirInfo>::const_iterator it;
|
||||
|
||||
for(it = directoryMap.begin(); it != directoryMap.end(); it++)
|
||||
for(it = directoryMap.begin(); it != directoryMap.end(); ++it)
|
||||
dirs.push_back(it->second) ;
|
||||
}
|
||||
}
|
||||
|
@ -1522,7 +1522,7 @@ bool FileIndexMonitor::internal_setSharedDirectories()
|
|||
/* iterate through the directories */
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
std::map<std::string, SharedDirInfo>::const_iterator cit;
|
||||
for(it = pendingDirList.begin(); it != pendingDirList.end(); it++)
|
||||
for(it = pendingDirList.begin(); it != pendingDirList.end(); ++it)
|
||||
{
|
||||
/* get the head directory */
|
||||
std::string root_dir = (*it).filename;
|
||||
|
@ -1533,7 +1533,7 @@ bool FileIndexMonitor::internal_setSharedDirectories()
|
|||
|
||||
/* if unique -> add, else add modifier */
|
||||
bool unique = false;
|
||||
for(i = 0; !unique; i++)
|
||||
for(i = 0; !unique; ++i)
|
||||
{
|
||||
std::string tst_dir = top_dir;
|
||||
if (i > 0)
|
||||
|
@ -1560,7 +1560,7 @@ bool FileIndexMonitor::internal_setSharedDirectories()
|
|||
* fileIndex
|
||||
*/
|
||||
std::list<std::string> topdirs;
|
||||
for(cit = directoryMap.begin(); cit != directoryMap.end(); cit++)
|
||||
for(cit = directoryMap.begin(); cit != directoryMap.end(); ++cit)
|
||||
{
|
||||
topdirs.push_back(cit->first);
|
||||
}
|
||||
|
|
|
@ -77,14 +77,14 @@ DirEntry::~DirEntry()
|
|||
std::map<std::string, DirEntry *>::iterator dit;
|
||||
std::map<std::string, FileEntry *>::iterator fit;
|
||||
|
||||
for(dit = subdirs.begin(); dit != subdirs.end(); dit++)
|
||||
for(dit = subdirs.begin(); dit != subdirs.end(); ++dit)
|
||||
{
|
||||
FileIndex::unregisterEntry((void*)dit->second) ;
|
||||
delete (dit->second);
|
||||
}
|
||||
subdirs.clear();
|
||||
|
||||
for(fit = files.begin(); fit != files.end(); fit++)
|
||||
for(fit = files.begin(); fit != files.end(); ++fit)
|
||||
{
|
||||
FileIndex::unregisterEntry((void*)fit->second) ;
|
||||
delete (fit->second);
|
||||
|
@ -98,7 +98,7 @@ int DirEntry::checkParentPointers()
|
|||
#ifdef FI_DEBUG
|
||||
updateChildRows();
|
||||
std::map<std::string, DirEntry *>::iterator dit;
|
||||
for(dit = subdirs.begin(); dit != subdirs.end(); dit++)
|
||||
for(dit = subdirs.begin(); dit != subdirs.end(); ++dit)
|
||||
{
|
||||
/* debug check */
|
||||
(dit->second)->checkParentPointers();
|
||||
|
@ -115,7 +115,7 @@ int DirEntry::updateChildRows()
|
|||
std::map<std::string, DirEntry *>::iterator dit;
|
||||
std::map<std::string, FileEntry *>::iterator fit;
|
||||
int i = 0;
|
||||
for(dit = subdirs.begin(); dit != subdirs.end(); dit++)
|
||||
for(dit = subdirs.begin(); dit != subdirs.end(); ++dit)
|
||||
{
|
||||
#ifdef FI_DEBUG
|
||||
/* debug check */
|
||||
|
@ -130,7 +130,7 @@ int DirEntry::updateChildRows()
|
|||
(dit->second)->row = i++;
|
||||
}
|
||||
|
||||
for(fit = files.begin(); fit != files.end(); fit++)
|
||||
for(fit = files.begin(); fit != files.end(); ++fit)
|
||||
{
|
||||
#ifdef FI_DEBUG
|
||||
/* debug check */
|
||||
|
@ -254,7 +254,7 @@ int DirEntry::removeOldEntries(time_t old, bool recursive)
|
|||
/* get all dirs with old time */
|
||||
std::list<DirEntry *> removeList;
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = subdirs.begin(); it != subdirs.end(); it++)
|
||||
for(it = subdirs.begin(); it != subdirs.end(); ++it)
|
||||
{
|
||||
if ((it->second)->updtime < old)
|
||||
{
|
||||
|
@ -266,7 +266,7 @@ int DirEntry::removeOldEntries(time_t old, bool recursive)
|
|||
|
||||
/* now remove the old entries */
|
||||
std::list<DirEntry *>::iterator rit;
|
||||
for(rit = removeList.begin(); rit != removeList.end(); rit++)
|
||||
for(rit = removeList.begin(); rit != removeList.end(); ++rit)
|
||||
{
|
||||
removeDir((*rit)->name);
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ int DirEntry::removeOldEntries(time_t old, bool recursive)
|
|||
if (recursive)
|
||||
{
|
||||
/* now handle children */
|
||||
for(it = subdirs.begin(); it != subdirs.end(); it++)
|
||||
for(it = subdirs.begin(); it != subdirs.end(); ++it)
|
||||
{
|
||||
count += (it->second)->removeOldEntries(old, recursive);
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ int DirEntry::removeOldEntries(time_t old, bool recursive)
|
|||
/* now handle files similarly */
|
||||
std::list<FileEntry *> removeFileList;
|
||||
std::map<std::string, FileEntry *>::iterator fit;
|
||||
for(fit = files.begin(); fit != files.end(); fit++)
|
||||
for(fit = files.begin(); fit != files.end(); ++fit)
|
||||
{
|
||||
if ((fit->second)->updtime < old)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ int DirEntry::removeOldEntries(time_t old, bool recursive)
|
|||
|
||||
/* now remove the old entries */
|
||||
std::list<FileEntry *>::iterator rfit;
|
||||
for(rfit = removeFileList.begin(); rfit != removeFileList.end(); rfit++)
|
||||
for(rfit = removeFileList.begin(); rfit != removeFileList.end(); ++rfit)
|
||||
{
|
||||
removeFile((*rfit)->name);
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ DirEntry *DirEntry::findOldDirectory(time_t old)
|
|||
|
||||
/* get all dirs with old time */
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = subdirs.begin(); it != subdirs.end(); it++)
|
||||
for(it = subdirs.begin(); it != subdirs.end(); ++it)
|
||||
{
|
||||
if ((it->second)->updtime < old)
|
||||
{
|
||||
|
@ -323,7 +323,7 @@ DirEntry *DirEntry::findOldDirectory(time_t old)
|
|||
* else check chlidren.
|
||||
*/
|
||||
|
||||
for(it = subdirs.begin(); it != subdirs.end(); it++)
|
||||
for(it = subdirs.begin(); it != subdirs.end(); ++it)
|
||||
{
|
||||
DirEntry *olddir = (it->second)->findOldDirectory(old);
|
||||
if (olddir)
|
||||
|
@ -512,12 +512,12 @@ int DirEntry::print(std::string &out)
|
|||
rs_sprintf_append(out, "dir %03d [%ld] : %s\n", row, updtime, path.c_str());
|
||||
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = subdirs.begin(); it != subdirs.end(); it++)
|
||||
for(it = subdirs.begin(); it != subdirs.end(); ++it)
|
||||
{
|
||||
(it->second)->print(out);
|
||||
}
|
||||
std::map<std::string, FileEntry *>::iterator fit;
|
||||
for(fit = files.begin(); fit != files.end(); fit++)
|
||||
for(fit = files.begin(); fit != files.end(); ++fit)
|
||||
{
|
||||
(fit->second)->print(out);
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ int FileIndex::setRootDirectories(const std::list<std::string> &inlist, time_t u
|
|||
{
|
||||
/* set update time to zero */
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); it++)
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); ++it)
|
||||
{
|
||||
(it->second)->updtime = 0;
|
||||
}
|
||||
|
@ -549,7 +549,7 @@ int FileIndex::setRootDirectories(const std::list<std::string> &inlist, time_t u
|
|||
std::list<std::string>::const_iterator ait;
|
||||
FileEntry fe;
|
||||
time_t utime = 1;
|
||||
for(ait = inlist.begin(); ait != inlist.end(); ait++)
|
||||
for(ait = inlist.begin(); ait != inlist.end(); ++ait)
|
||||
{
|
||||
fe.name = (*ait);
|
||||
|
||||
|
@ -561,7 +561,7 @@ int FileIndex::setRootDirectories(const std::list<std::string> &inlist, time_t u
|
|||
int cleanedCount = root->removeOldEntries(utime, false);
|
||||
|
||||
/* now flag remaining directories with correct update time */
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); it++)
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); ++it)
|
||||
{
|
||||
(it->second)->updtime = updtime;
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ int FileIndex::getRootDirectories(std::list<std::string> &outlist)
|
|||
{
|
||||
/* set update time to zero */
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); it++)
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); ++it)
|
||||
{
|
||||
outlist.push_back(it->first);
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ int FileIndex::cleanOldEntries(time_t old) /* removes entries older than old */
|
|||
int count = 0;
|
||||
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); it++)
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); ++it)
|
||||
{
|
||||
count += (it->second)->removeOldEntries(old, true);
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ int FileIndex::loadIndex(const std::string& filename, const RsFileHash& expected
|
|||
// delete sha_ctx;
|
||||
//
|
||||
// std::string tmpout;
|
||||
// for(int i = 0; i < SHA_DIGEST_LENGTH; i++)
|
||||
// for(int i = 0; i < SHA_DIGEST_LENGTH; ++i)
|
||||
// {
|
||||
// rs_sprintf_append(tmpout, "%02x", (unsigned int) (sha_buf[i]));
|
||||
// }
|
||||
|
@ -885,7 +885,7 @@ int FileIndex::loadIndex(const std::string& filename, const RsFileHash& expected
|
|||
/* must reset parent pointers now */
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = root->subdirs.begin();
|
||||
it != root->subdirs.end(); it++)
|
||||
it != root->subdirs.end(); ++it)
|
||||
{
|
||||
(it->second)->parent = root;
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ int FileIndex::loadIndex(const std::string& filename, const RsFileHash& expected
|
|||
std::cerr << "loadIndex error parsing saved file: " << filename;
|
||||
std::cerr << " File token count wrong: " << tokens.size();
|
||||
std::cerr << std::endl;
|
||||
for(unsigned int i = 0; i < tokens.size(); i++)
|
||||
for(unsigned int i = 0; i < tokens.size(); ++i)
|
||||
{
|
||||
std::cerr << "\tToken[" << i << "]:" << tokens[i];
|
||||
std::cerr << std::endl;
|
||||
|
@ -1015,7 +1015,7 @@ int FileIndex::saveIndex(const std::string& filename, RsFileHash &fileHash, uint
|
|||
root->writeDirInfo(s) ;
|
||||
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); it++)
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); ++it)
|
||||
{
|
||||
#ifdef FI_DEBUG
|
||||
std::cout << "writting root directory: name=" << it->second->name << ", path=" << it->second->path << std::endl ;
|
||||
|
@ -1067,7 +1067,7 @@ int FileIndex::saveIndex(const std::string& filename, RsFileHash &fileHash, uint
|
|||
// SHA1_Final(&sha_buf[0], sha_ctx);
|
||||
// delete sha_ctx;
|
||||
//
|
||||
// for(int i = 0; i < SHA_DIGEST_LENGTH; i++)
|
||||
// for(int i = 0; i < SHA_DIGEST_LENGTH; ++i)
|
||||
// {
|
||||
// rs_sprintf_append(fileHash, "%02x", (unsigned int) (sha_buf[i]));
|
||||
// }
|
||||
|
@ -1115,7 +1115,7 @@ std::string FixName(const std::string& _in)
|
|||
{
|
||||
/* replace any , with _ */
|
||||
std::string in(_in) ;
|
||||
for(unsigned int i = 0; i < in.length(); i++)
|
||||
for(unsigned int i = 0; i < in.length(); ++i)
|
||||
{
|
||||
if (in[i] == FILE_CACHE_SEPARATOR_CHAR)
|
||||
{
|
||||
|
@ -1141,7 +1141,7 @@ void DirEntry::writeFileInfo(std::string& s)
|
|||
{
|
||||
/* print file info */
|
||||
std::map<std::string, FileEntry *>::iterator fit;
|
||||
for(fit = files.begin(); fit != files.end(); fit++)
|
||||
for(fit = files.begin(); fit != files.end(); ++fit)
|
||||
{
|
||||
rs_sprintf_append(s, "f%s%c%s%c%lld%c%ld%c%d%c%ld%c\n",
|
||||
FixName((fit->second)->name).c_str(), FILE_CACHE_SEPARATOR_CHAR,
|
||||
|
@ -1159,7 +1159,7 @@ int DirEntry::saveEntry(std::string &s)
|
|||
writeDirInfo(s) ;
|
||||
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = subdirs.begin(); it != subdirs.end(); it++)
|
||||
for(it = subdirs.begin(); it != subdirs.end(); ++it)
|
||||
{
|
||||
(it->second)->saveEntry(s);
|
||||
}
|
||||
|
@ -1195,14 +1195,14 @@ int FileIndex::searchHash(const RsFileHash& hash, std::list<FileEntry *> &result
|
|||
dirlist.pop_back();
|
||||
/* add subdirs to stack */
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = ndir->subdirs.begin(); it != ndir->subdirs.end(); it++)
|
||||
for(it = ndir->subdirs.begin(); it != ndir->subdirs.end(); ++it)
|
||||
{
|
||||
dirlist.push_back(it->second);
|
||||
}
|
||||
|
||||
std::map<std::string, FileEntry *>::iterator fit;
|
||||
/* search in current dir */
|
||||
for(fit = ndir->files.begin(); fit != ndir->files.end(); fit++)
|
||||
for(fit = ndir->files.begin(); fit != ndir->files.end(); ++fit)
|
||||
{
|
||||
if (hash == (fit->second)->hash)
|
||||
{
|
||||
|
@ -1236,12 +1236,12 @@ int FileIndex::searchTerms(const std::list<std::string>& terms, std::list<FileEn
|
|||
{
|
||||
ndir = dirlist.back();
|
||||
dirlist.pop_back();
|
||||
for(it = ndir->subdirs.begin(); it != ndir->subdirs.end(); it++)
|
||||
for(it = ndir->subdirs.begin(); it != ndir->subdirs.end(); ++it)
|
||||
{
|
||||
dirlist.push_back(it->second);
|
||||
}
|
||||
|
||||
for (iter = terms.begin(); iter != terms.end(); iter ++) {
|
||||
for (iter = terms.begin(); iter != terms.end(); ++iter) {
|
||||
std::string::const_iterator it2;
|
||||
const std::string &str1 = ndir->name;
|
||||
const std::string &str2 = *iter;
|
||||
|
@ -1249,7 +1249,7 @@ int FileIndex::searchTerms(const std::list<std::string>& terms, std::list<FileEn
|
|||
if (it2 != str1.end()) {
|
||||
/* first search to see if its parent is in the results list */
|
||||
bool addDir = true;
|
||||
for (std::list<FileEntry *>::iterator rit(results.begin()); rit != results.end() && addDir; rit ++) {
|
||||
for (std::list<FileEntry *>::iterator rit(results.begin()); rit != results.end() && addDir; ++rit) {
|
||||
DirEntry *de = dynamic_cast<DirEntry *>(*rit);
|
||||
if (de && (de == root))
|
||||
continue;
|
||||
|
@ -1263,10 +1263,10 @@ int FileIndex::searchTerms(const std::list<std::string>& terms, std::list<FileEn
|
|||
}
|
||||
}
|
||||
|
||||
for(fit = ndir->files.begin(); fit != ndir->files.end(); fit++)
|
||||
for(fit = ndir->files.begin(); fit != ndir->files.end(); ++fit)
|
||||
{
|
||||
/* cycle through terms */
|
||||
for(iter = terms.begin(); iter != terms.end(); iter++)
|
||||
for(iter = terms.begin(); iter != terms.end(); ++iter)
|
||||
{
|
||||
/* always ignore case */
|
||||
std::string::const_iterator it2 ;
|
||||
|
@ -1309,12 +1309,12 @@ int FileIndex::searchBoolExp(Expression * exp, std::list<FileEntry *> &results)
|
|||
{
|
||||
ndir = dirlist.back();
|
||||
dirlist.pop_back();
|
||||
for(it = ndir->subdirs.begin(); it != ndir->subdirs.end(); it++)
|
||||
for(it = ndir->subdirs.begin(); it != ndir->subdirs.end(); ++it)
|
||||
{
|
||||
dirlist.push_back(it->second);
|
||||
}
|
||||
|
||||
for(fit = ndir->files.begin(); fit != ndir->files.end(); fit++)
|
||||
for(fit = ndir->files.begin(); fit != ndir->files.end(); ++fit)
|
||||
{
|
||||
/*Evaluate the boolean expression and add it to the results if its true*/
|
||||
bool ret = exp->eval(fit->second);
|
||||
|
|
|
@ -148,7 +148,7 @@ int FileIndexStore::loadCache(const RsCacheData &data)
|
|||
|
||||
/* need to correct indices(row) for the roots of the FileIndex */
|
||||
int i = 0;
|
||||
for(it = indices.begin(); it != indices.end(); it++)
|
||||
for(it = indices.begin(); it != indices.end(); ++it)
|
||||
{
|
||||
(it->second)->root->row = i++;
|
||||
it->second->FileIndex::updateMaxModTime() ;
|
||||
|
@ -232,7 +232,7 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, FileSearch
|
|||
|
||||
#ifdef FIS_DEBUG
|
||||
std::cerr << "FileIndexStore::RequestDirDetails() CHKS" << std::endl;
|
||||
for(pit = indices.begin(); pit != indices.end(); pit++)
|
||||
for(pit = indices.begin(); pit != indices.end(); ++pit)
|
||||
{
|
||||
(pit->second)->root->checkParentPointers();
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, FileSearch
|
|||
#endif
|
||||
|
||||
/* get remote root entries */
|
||||
for(pit = indices.begin(); pit != indices.end(); pit++)
|
||||
for(pit = indices.begin(); pit != indices.end(); ++pit)
|
||||
{
|
||||
/*
|
||||
*/
|
||||
|
@ -301,7 +301,7 @@ int FileIndexStore::SearchHash(const RsFileHash& hash, std::list<FileDetail> &re
|
|||
#ifdef FIS_DEBUG
|
||||
std::cerr << "FileIndexStore::SearchHash()" << std::endl;
|
||||
#endif
|
||||
for(pit = indices.begin(); pit != indices.end(); pit++)
|
||||
for(pit = indices.begin(); pit != indices.end(); ++pit)
|
||||
{
|
||||
#ifdef FIS_DEBUG
|
||||
std::cerr << "FileIndexStore::SearchHash() Searching: Peer ";
|
||||
|
@ -311,7 +311,7 @@ int FileIndexStore::SearchHash(const RsFileHash& hash, std::list<FileDetail> &re
|
|||
|
||||
(pit->second)->searchHash(hash, firesults);
|
||||
/* translate results */
|
||||
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
||||
for(rit = firesults.begin(); rit != firesults.end(); ++rit)
|
||||
{
|
||||
FileDetail fd;
|
||||
fd.id = pit->first;
|
||||
|
@ -351,13 +351,13 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Di
|
|||
std::cerr << "FileIndexStore::SearchKeywords()" << std::endl;
|
||||
#endif
|
||||
if(flags & RS_FILE_HINTS_REMOTE)
|
||||
for(pit = indices.begin(); pit != indices.end(); pit++)
|
||||
for(pit = indices.begin(); pit != indices.end(); ++pit)
|
||||
{
|
||||
firesults.clear();
|
||||
|
||||
(pit->second)->searchTerms(keywords, firesults);
|
||||
/* translate results */
|
||||
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
||||
for(rit = firesults.begin(); rit != firesults.end(); ++rit)
|
||||
{
|
||||
DirDetails dd;
|
||||
|
||||
|
@ -375,7 +375,7 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Di
|
|||
|
||||
localindex->searchTerms(keywords, firesults);
|
||||
/* translate results */
|
||||
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
||||
for(rit = firesults.begin(); rit != firesults.end(); ++rit)
|
||||
{
|
||||
DirDetails dd;
|
||||
|
||||
|
@ -403,14 +403,14 @@ int FileIndexStore::searchBoolExp(Expression * exp, std::list<DirDetails> &resul
|
|||
#ifdef FIS_DEBUG
|
||||
std::cerr << "FileIndexStore::searchBoolExp()" << std::endl;
|
||||
#endif
|
||||
for(pit = indices.begin(); pit != indices.end(); pit++)
|
||||
for(pit = indices.begin(); pit != indices.end(); ++pit)
|
||||
{
|
||||
firesults.clear();
|
||||
|
||||
(pit->second)->searchBoolExp(exp, firesults);
|
||||
|
||||
/* translate results */
|
||||
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
||||
for(rit = firesults.begin(); rit != firesults.end(); ++rit)
|
||||
{
|
||||
DirDetails dd;
|
||||
FileIndex::extractData(*rit, dd);
|
||||
|
@ -427,7 +427,7 @@ int FileIndexStore::searchBoolExp(Expression * exp, std::list<DirDetails> &resul
|
|||
localindex->searchBoolExp(exp, firesults);
|
||||
|
||||
/* translate results */
|
||||
for(rit = firesults.begin(); rit != firesults.end(); rit++)
|
||||
for(rit = firesults.begin(); rit != firesults.end(); ++rit)
|
||||
{
|
||||
DirDetails dd;
|
||||
FileIndex::extractData(*rit, dd);
|
||||
|
|
|
@ -135,7 +135,7 @@ bool StringExpression :: evalStr ( const std::string &str ){
|
|||
std::list<std::string>::iterator iter;
|
||||
switch (Op) {
|
||||
case ContainsAllStrings:
|
||||
for ( iter = terms.begin(); iter != terms.end(); iter++ ) {
|
||||
for ( iter = terms.begin(); iter != terms.end(); ++iter ) {
|
||||
if ( StrContains (str, *iter, IgnoreCase) == false ){
|
||||
return false;
|
||||
}
|
||||
|
@ -143,14 +143,14 @@ bool StringExpression :: evalStr ( const std::string &str ){
|
|||
return true;
|
||||
break;
|
||||
case ContainsAnyStrings:
|
||||
for ( iter = terms.begin(); iter != terms.end(); iter++ ) {
|
||||
for ( iter = terms.begin(); iter != terms.end(); ++iter ) {
|
||||
if ( StrContains (str,*iter, IgnoreCase) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EqualsString:
|
||||
for ( iter = terms.begin(); iter != terms.end(); iter++ ) {
|
||||
for ( iter = terms.begin(); iter != terms.end(); ++iter ) {
|
||||
if ( StrEquals (str,*iter, IgnoreCase) == true ) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue