optim: changed postfixed ++ into prefix++ for non trivial operators, replaced test on std::list::size() by std::list::empty() (Patch from Phenom, modified)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7627 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-10-21 22:33:02 +00:00
parent 491a655889
commit b593a918a0
99 changed files with 571 additions and 571 deletions

View file

@ -274,7 +274,7 @@ bool p3BitDht::loadList(std::list<RsItem *>& load)
std::cerr << "p3BitDht::loadList()";
std::cerr << std::endl;
if ((load.size() == 0) || (load.size() > 1))
if (load.empty() || (load.size() > 1))
{
/* error */
std::cerr << "p3BitDht::loadList() Error only expecting 1 item";

View file

@ -1213,7 +1213,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
setPeerState(dit->second->mTransfer, *it, rate, mServiceCtrl->isPeerConnected(mFtServiceId, *it));
}
if (srcIds.size() == 0)
if (srcIds.empty())
{
#ifdef CONTROL_DEBUG
std::cerr << "ftController::FileRequest() WARNING: No Src Peers";

View file

@ -315,7 +315,7 @@ bool ftDataMultiplex::doWork()
{
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
if (mRequestQueue.size() == 0)
if (mRequestQueue.empty())
{
doRequests = false;
continue;
@ -385,7 +385,7 @@ bool ftDataMultiplex::doWork()
{
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
if (mSearchQueue.size() == 0)
if (mSearchQueue.empty())
{
/* Finished */
return true;

View file

@ -114,7 +114,7 @@ void ftExtraList::hashAFile()
{
RsStackMutex stack(extMutex);
if (mToHash.size() == 0)
if (mToHash.empty())
return;
details = mToHash.front();

View file

@ -376,7 +376,7 @@ int ftFileCreator::locked_notifyReceived(uint64_t offset, uint32_t chunk_size)
// all parts are obtained.
// - new parts arriving in the second part cannot interfere since they should come in order.
(*chunk.ref_cnt)++ ;
++(*chunk.ref_cnt) ;
#ifdef FILE_DEBUG
std::cerr << "Created two sub chunks. Ref_cnt = " << *chunk.ref_cnt << std::endl;

View file

@ -1633,7 +1633,7 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
std::string proxyIpAddress = kConfigDefaultProxyServerIpAddr;
uint16_t proxyPort = kConfigDefaultProxyServerPort;
if (load.size() == 0) {
if (load.empty()) {
std::cerr << "p3PeerMgrIMPL::loadList() list is empty, it may be a configuration problem." << std::endl;
return false;
}

View file

@ -487,13 +487,13 @@ int pqihandler::UpdateRates()
float crate_in = mod -> pqi -> getRate(true);
if (crate_in > 0.01 * avail_in || crate_in > 0.1)
{
effectiveDownloadsSm ++;
++effectiveDownloadsSm;
}
float crate_out = mod -> pqi -> getRate(false);
if (crate_out > 0.01 * avail_out || crate_out > 0.1)
{
effectiveUploadsSm ++;
++effectiveUploadsSm;
}
used_bw_in += crate_in;

View file

@ -141,7 +141,7 @@ int p3ChatService::tick()
std::vector<VisibleChatLobbyRecord> visible_lobbies_tmp ;
getListOfNearbyChatLobbies(visible_lobbies_tmp) ;
if (visible_lobbies_tmp.size()==0){
if (visible_lobbies_tmp.empty()){
last_req_chat_lobby_list = now-LOBBY_LIST_AUTO_UPDATE_TIME+MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ;
} else {
last_req_chat_lobby_list = now ;
@ -1467,7 +1467,7 @@ bool p3ChatService::getPublicChatQueue(std::list<ChatInfo> &chats)
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
// get the items from the public list.
if (publicList.size() == 0) {
if (publicList.empty()) {
return false;
}

View file

@ -777,24 +777,24 @@ void p3MsgService::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxN
initRsMIS(mit->second, mis);
if (mis.msgflags & RS_MSG_TRASH) {
if (pnTrashbox) (*pnTrashbox)++;
if (pnTrashbox) ++(*pnTrashbox);
continue;
}
switch (mis.msgflags & RS_MSG_BOXMASK) {
case RS_MSG_INBOX:
if (pnInbox) (*pnInbox)++;
if (pnInbox) ++(*pnInbox);
if ((mis.msgflags & RS_MSG_NEW) == RS_MSG_NEW) {
if (pnInboxNew) (*pnInboxNew)++;
if (pnInboxNew) ++(*pnInboxNew);
}
break;
case RS_MSG_OUTBOX:
if (pnOutbox) (*pnOutbox)++;
if (pnOutbox) ++(*pnOutbox);
break;
case RS_MSG_DRAFTBOX:
if (pnDraftbox) (*pnDraftbox)++;
if (pnDraftbox) ++(*pnDraftbox);
break;
case RS_MSG_SENTBOX:
if (pnSentbox) (*pnSentbox)++;
if (pnSentbox) ++(*pnSentbox);
break;
}
}
@ -1248,7 +1248,7 @@ bool p3MsgService::removeMessageTagType(uint32_t tagId)
if (lit != tag->tagIds.end()) {
tag->tagIds.erase(lit);
if (tag->tagIds.size() == 0) {
if (tag->tagIds.empty()) {
/* remove empty tag */
delete(tag);
@ -1360,7 +1360,7 @@ bool p3MsgService::setMessageTag(const std::string &msgId, uint32_t tagId, bool
tag->tagIds.erase(lit);
nNotifyType = NOTIFY_TYPE_DEL;
if (tag->tagIds.size() == 0) {
if (tag->tagIds.empty()) {
/* remove empty tag */
delete(tag);
mMsgTags.erase(mit);

View file

@ -42,7 +42,7 @@ RsItem *p3Service::recvItem()
{
RsStackMutex stack(srvMtx); /***** LOCK MUTEX *****/
if (recv_queue.size() == 0)
if (recv_queue.empty())
{
return NULL; /* nothing there! */
}

View file

@ -914,7 +914,7 @@ bool TcpStream::widle()
return false;
}
if ((lastWriteTF == int_wbytes()) && (inSize + inQueue.size() == 0))
if ((lastWriteTF == int_wbytes()) && (inSize == 0) && inQueue.empty())
{
wcount++;
if (wcount > ilevel)
@ -2438,7 +2438,7 @@ int TcpStream::send()
}
/* if inqueue empty, and enough window space, send partial stuff */
if ((!sent) && (inQueue.size() == 0) && (maxsend >= inSize) && (inSize))
if ((!sent) && (inQueue.empty()) && (maxsend >= inSize) && (inSize))
{
TcpPacket *pkt = new TcpPacket(inData, inSize);
#ifdef DEBUG_TCP_STREAM

View file

@ -480,8 +480,8 @@ int UdpRelayReceiver::installRelayClass_relayLocked(int &classIdx, uint32_t &ban
std::cerr << std::endl;
/* if we get here we can add one */
mClassCount[UDP_RELAY_CLASS_ALL]++;
mClassCount[classIdx]++;
++mClassCount[UDP_RELAY_CLASS_ALL];
++mClassCount[classIdx];
bandwidth = mClassBandwidth[classIdx];
return 1;

View file

@ -475,7 +475,7 @@ int p3ZeroConf::checkLocationResults()
RsStackMutex stack(mZcMtx); /****** STACK LOCK MUTEX *******/
/* check the results Queue */
if (mLocationResults.size() == 0)
if (mLocationResults.empty())
{
return 0;
}
@ -538,7 +538,7 @@ int p3ZeroConf::checkQueryResults()
RsStackMutex stack(mZcMtx); /****** STACK LOCK MUTEX *******/
/* check the results Queue */
if (mQueryResults.size() == 0)
if (mQueryResults.empty())
{
return 0;
}