Optimized some small things in TransferDialog and SearchDialog.

Changed the parameter of the constructor of ftFileCreator and ftFileProvider and some methods of ftTransferModule from "std::string" to "const std::string&"

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4045 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-02-20 00:59:47 +00:00
parent 61b57ede65
commit db19db7e60
8 changed files with 40 additions and 33 deletions

View file

@ -95,7 +95,7 @@ ftTransferModule::~ftTransferModule()
{}
bool ftTransferModule::setFileSources(std::list<std::string> peerIds)
bool ftTransferModule::setFileSources(const std::list<std::string>& peerIds)
{
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
@ -106,7 +106,7 @@ bool ftTransferModule::setFileSources(std::list<std::string> peerIds)
std::cerr << " List of peers: " ;
#endif
std::list<std::string>::iterator it;
std::list<std::string>::const_iterator it;
for(it = peerIds.begin(); it != peerIds.end(); it++)
{
@ -136,7 +136,7 @@ bool ftTransferModule::getFileSources(std::list<std::string> &peerIds)
return true;
}
bool ftTransferModule::addFileSource(std::string peerId)
bool ftTransferModule::addFileSource(const std::string& peerId)
{
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
std::map<std::string,peerInfo>::iterator mit;
@ -167,7 +167,7 @@ bool ftTransferModule::addFileSource(std::string peerId)
return true;
}
bool ftTransferModule::removeFileSource(std::string peerId)
bool ftTransferModule::removeFileSource(const std::string& peerId)
{
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
std::map<std::string,peerInfo>::iterator mit;
@ -189,7 +189,7 @@ bool ftTransferModule::removeFileSource(std::string peerId)
return true;
}
bool ftTransferModule::setPeerState(std::string peerId,uint32_t state,uint32_t maxRate)
bool ftTransferModule::setPeerState(const std::string& peerId,uint32_t state,uint32_t maxRate)
{
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
#ifdef FT_DEBUG
@ -237,7 +237,7 @@ bool ftTransferModule::setPeerState(std::string peerId,uint32_t state,uint32_t m
}
bool ftTransferModule::getPeerState(std::string peerId,uint32_t &state,uint32_t &tfRate)
bool ftTransferModule::getPeerState(const std::string& peerId,uint32_t &state,uint32_t &tfRate)
{
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
std::map<std::string,peerInfo>::iterator mit;
@ -257,7 +257,7 @@ bool ftTransferModule::getPeerState(std::string peerId,uint32_t &state,uint32_t
return true;
}
uint32_t ftTransferModule::getDataRate(std::string peerId)
uint32_t ftTransferModule::getDataRate(const std::string& peerId)
{
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
std::map<std::string,peerInfo>::iterator mit;
@ -277,7 +277,7 @@ uint32_t ftTransferModule::getDataRate(std::string peerId)
//interface to client module
bool ftTransferModule::recvFileData(std::string peerId, uint64_t offset, uint32_t chunk_size, void *data)
bool ftTransferModule::recvFileData(const std::string& peerId, uint64_t offset, uint32_t chunk_size, void *data)
{
#ifdef FT_DEBUG
std::cerr << "ftTransferModule::recvFileData()";
@ -316,7 +316,7 @@ bool ftTransferModule::recvFileData(std::string peerId, uint64_t offset, uint32_
return ok;
}
void ftTransferModule::requestData(std::string peerId, uint64_t offset, uint32_t chunk_size)
void ftTransferModule::requestData(const std::string& peerId, uint64_t offset, uint32_t chunk_size)
{
#ifdef FT_DEBUG
std::cerr << "ftTransferModule::requestData()";