Optimized parameter "hash" of method RsFiles::FileDetails from "std::string" to "const std::string&"

Removed compiler warning of FileEntry.
Recompile of the GUI needed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3703 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-10-27 20:01:31 +00:00
parent 5809e25a60
commit ab5b2a3851
16 changed files with 25 additions and 24 deletions

View File

@ -80,7 +80,7 @@ class FileEntry
{ {
public: public:
FileEntry() FileEntry()
:parent(NULL), row(0) ,size(0),modtime(0),pop(0),updtime(0) : size(0), modtime(0), pop(0), updtime(0), parent(NULL), row(0)
{ return; } { return; }
virtual ~FileEntry() { return; } virtual ~FileEntry() { return; }

View File

@ -190,11 +190,12 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
lockData(); lockData();
if(ref != NULL && !FileIndex::isValid(ref)) // checked by FileIndex::extractData
{ // if(ref != NULL && !FileIndex::isValid(ref))
unlockData() ; // {
return false ; // unlockData() ;
} // return false ;
// }
/* so cast *ref to a DirEntry */ /* so cast *ref to a DirEntry */
/* root case */ /* root case */

View File

@ -1544,7 +1544,7 @@ std::string ftController::getPartialsDirectory()
return mPartialsPath; return mPartialsPath;
} }
bool ftController::FileDetails(std::string hash, FileInfo &info) bool ftController::FileDetails(const std::string &hash, FileInfo &info)
{ {
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/ RsStackMutex stack(ctrlMutex); /******* LOCKED ********/

View File

@ -173,7 +173,7 @@ class ftController: public CacheTransfer, public RsThread, public pqiMonitor, pu
bool setPartialsDirectory(std::string path); bool setPartialsDirectory(std::string path);
std::string getDownloadDirectory(); std::string getDownloadDirectory();
std::string getPartialsDirectory(); std::string getPartialsDirectory();
bool FileDetails(std::string hash, FileInfo &info); bool FileDetails(const std::string &hash, FileInfo &info);
bool moveFile(const std::string& source,const std::string& dest) ; bool moveFile(const std::string& source,const std::string& dest) ;
bool copyFile(const std::string& source,const std::string& dest) ; bool copyFile(const std::string& source,const std::string& dest) ;

View File

@ -121,7 +121,7 @@ bool ftDataMultiplex::FileDownloads(std::list<std::string> &hashs)
} }
bool ftDataMultiplex::FileDetails(std::string hash, uint32_t hintsflag, FileInfo &info) bool ftDataMultiplex::FileDetails(const std::string &hash, uint32_t hintsflag, FileInfo &info)
{ {
#ifdef MPLEX_DEBUG #ifdef MPLEX_DEBUG
std::cerr << "ftDataMultiplex::FileDetails("; std::cerr << "ftDataMultiplex::FileDetails(";

View File

@ -94,7 +94,7 @@ class ftDataMultiplex: public ftDataRecv, public RsQueueThread
/* get Details of File Transfers */ /* get Details of File Transfers */
bool FileUploads(std::list<std::string> &hashs); bool FileUploads(std::list<std::string> &hashs);
bool FileDownloads(std::list<std::string> &hashs); bool FileDownloads(std::list<std::string> &hashs);
bool FileDetails(std::string hash, uint32_t hintsflag, FileInfo &info); bool FileDetails(const std::string &hash, uint32_t hintsflag, FileInfo &info);
void deleteUnusedServers() ; void deleteUnusedServers() ;

View File

@ -37,7 +37,7 @@ ftFiStore::ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3
return; return;
} }
bool ftFiStore::search(std::string hash, uint32_t hintflags, FileInfo &info) const bool ftFiStore::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const
{ {
/* could use hintflags to specify which bits of fileinfo to use additionally. /* could use hintflags to specify which bits of fileinfo to use additionally.
eg. hintflags & FT_SEARCH_PEER_ID, then only return matching peers + hash. eg. hintflags & FT_SEARCH_PEER_ID, then only return matching peers + hash.
@ -125,7 +125,7 @@ ftFiMonitor::ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cached
return; return;
} }
bool ftFiMonitor::search(std::string hash, uint32_t hintflags, FileInfo &info) const bool ftFiMonitor::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const
{ {
uint64_t fsize; uint64_t fsize;
std::string path; std::string path;
@ -271,7 +271,7 @@ ftCacheStrapper::ftCacheStrapper(p3ConnectMgr *cm)
} }
/* overloaded search function */ /* overloaded search function */
bool ftCacheStrapper::search(std::string hash, uint32_t hintflags, FileInfo &info) const bool ftCacheStrapper::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const
{ {
#ifdef DB_DEBUG #ifdef DB_DEBUG
std::cerr << "ftCacheStrapper::search(" << hash << "," << hintflags; std::cerr << "ftCacheStrapper::search(" << hash << "," << hintflags;

View File

@ -51,7 +51,7 @@ class ftFiStore: public FileIndexStore, public ftSearch
RsPeerId ownid, std::string cachedir); RsPeerId ownid, std::string cachedir);
/* overloaded search function */ /* overloaded search function */
virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const;
}; };
class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config
@ -60,7 +60,7 @@ class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config
ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cachedir, std::string pid); ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cachedir, std::string pid);
/* overloaded search function */ /* overloaded search function */
virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const;
/* overloaded set dirs enables config indication */ /* overloaded set dirs enables config indication */
virtual void setSharedDirectories(const std::list<SharedDirInfo>& dirList); virtual void setSharedDirectories(const std::list<SharedDirInfo>& dirList);
@ -84,7 +84,7 @@ class ftCacheStrapper: public CacheStrapper, public ftSearch
ftCacheStrapper(p3ConnectMgr *cm); ftCacheStrapper(p3ConnectMgr *cm);
/* overloaded search function */ /* overloaded search function */
virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const;
}; };

View File

@ -329,7 +329,7 @@ bool ftExtraList::hashExtraFileDone(std::string path, FileInfo &info)
* Search Function - used by File Transfer * Search Function - used by File Transfer
* *
**/ **/
bool ftExtraList::search(std::string hash, uint32_t hintflags, FileInfo &info) const bool ftExtraList::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const
{ {
#ifdef DEBUG_ELIST #ifdef DEBUG_ELIST

View File

@ -138,7 +138,7 @@ bool hashExtraFileDone(std::string path, FileInfo &info);
* implementation of ftSearch. * implementation of ftSearch.
* *
**/ **/
virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const;
/*** /***
* Thread Main Loop * Thread Main Loop

View File

@ -75,7 +75,7 @@ bool ftFileSearch::addSearchMode(ftSearch *search, uint32_t hintflags)
return false; return false;
} }
bool ftFileSearch::search(std::string hash, uint32_t hintflags, FileInfo &info) const bool ftFileSearch::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const
{ {
uint32_t hints, i; uint32_t hints, i;

View File

@ -45,7 +45,7 @@ class ftFileSearch: public ftSearch
ftFileSearch(); ftFileSearch();
bool addSearchMode(ftSearch *search, uint32_t hintflags); bool addSearchMode(ftSearch *search, uint32_t hintflags);
virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const;
private: private:

View File

@ -43,7 +43,7 @@ class ftSearch
ftSearch() { return; } ftSearch() { return; }
virtual ~ftSearch() { return; } virtual ~ftSearch() { return; }
virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const = 0; virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const = 0;
}; };

View File

@ -429,7 +429,7 @@ bool ftServer::FileUploads(std::list<std::string> &hashs)
return mFtDataplex->FileUploads(hashs); return mFtDataplex->FileUploads(hashs);
} }
bool ftServer::FileDetails(std::string hash, uint32_t hintflags, FileInfo &info) bool ftServer::FileDetails(const std::string &hash, uint32_t hintflags, FileInfo &info)
{ {
if (hintflags & RS_FILE_HINTS_DOWNLOAD) if (hintflags & RS_FILE_HINTS_DOWNLOAD)
if(mFtController->FileDetails(hash, info)) if(mFtController->FileDetails(hash, info))

View File

@ -148,7 +148,7 @@ virtual bool clearDownload(const std::string hash);
***/ ***/
virtual bool FileDownloads(std::list<std::string> &hashs); virtual bool FileDownloads(std::list<std::string> &hashs);
virtual bool FileUploads(std::list<std::string> &hashs); virtual bool FileUploads(std::list<std::string> &hashs);
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info); virtual bool FileDetails(const std::string &hash, uint32_t hintflags, FileInfo &info);
virtual bool FileDownloadChunksDetails(const std::string& hash,FileChunksInfo& info) ; virtual bool FileDownloadChunksDetails(const std::string& hash,FileChunksInfo& info) ;
virtual bool FileUploadChunksDetails(const std::string& hash,const std::string& peer_id,CompressedChunkMap& map) ; virtual bool FileUploadChunksDetails(const std::string& hash,const std::string& peer_id,CompressedChunkMap& map) ;

View File

@ -133,7 +133,7 @@ class RsFiles
***/ ***/
virtual bool FileDownloads(std::list<std::string> &hashs) = 0; virtual bool FileDownloads(std::list<std::string> &hashs) = 0;
virtual bool FileUploads(std::list<std::string> &hashs) = 0; virtual bool FileUploads(std::list<std::string> &hashs) = 0;
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info) = 0; virtual bool FileDetails(const std::string &hash, uint32_t hintflags, FileInfo &info) = 0;
/// Gives chunk details about the downloaded file with given hash. /// Gives chunk details about the downloaded file with given hash.
virtual bool FileDownloadChunksDetails(const std::string& hash,FileChunksInfo& info) = 0 ; virtual bool FileDownloadChunksDetails(const std::string& hash,FileChunksInfo& info) = 0 ;