From c166017951bbfe5855a96eccde694e1bb1dc76c4 Mon Sep 17 00:00:00 2001 From: Tristan Matthews Date: Wed, 14 Aug 2013 11:46:52 -0400 Subject: [PATCH] * #28351: daemon: rename iter to item for range-based for loops "item" correctly reflects that in these loops, the object in question is not an iterator but a reference to the actual object in the collection. --- daemon/src/account.cpp | 4 +- daemon/src/audio/mainbuffer.cpp | 32 ++++++------ daemon/src/client/dbus/networkmanager.cpp | 4 +- daemon/src/conference.cpp | 14 ++--- daemon/src/config/sfl_config.cpp | 4 +- daemon/src/config/yamlparser.cpp | 4 +- daemon/src/history/history.cpp | 8 +-- daemon/src/history/historyitem.cpp | 8 +-- daemon/src/iax/iaxvoiplink.cpp | 16 +++--- daemon/src/im/instant_messaging.cpp | 12 ++--- daemon/src/managerimpl.cpp | 64 +++++++++++------------ daemon/src/numbercleaner.cpp | 4 +- daemon/src/sip/sdes_negotiator.cpp | 4 +- daemon/src/sip/sdp.cpp | 10 ++-- daemon/src/sip/sipaccount.cpp | 22 ++++---- daemon/src/sip/sipvoiplink.cpp | 10 ++-- daemon/src/video/libav_utils.cpp | 6 +-- daemon/src/video/video_v4l2.cpp | 26 ++++----- daemon/src/video/video_v4l2_list.cpp | 4 +- 19 files changed, 128 insertions(+), 128 deletions(-) diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp index 675d2990e..363d975e3 100644 --- a/daemon/src/account.cpp +++ b/daemon/src/account.cpp @@ -236,8 +236,8 @@ void Account::setActiveAudioCodecs(const vector &list) // list contains the ordered payload of active codecs picked by the user for this account // we used the codec vector to save the order. - for (const auto &iter : list) { - int payload = std::atoi(iter.c_str()); + for (const auto &item : list) { + int payload = std::atoi(item.c_str()); audioCodecList_.push_back(payload); } diff --git a/daemon/src/audio/mainbuffer.cpp b/daemon/src/audio/mainbuffer.cpp index ad9c8aff5..329da5e37 100644 --- a/daemon/src/audio/mainbuffer.cpp +++ b/daemon/src/audio/mainbuffer.cpp @@ -47,8 +47,8 @@ MainBuffer::MainBuffer() : ringBufferMap_(), callIDMap_(), mutex_(), internalSam MainBuffer::~MainBuffer() { // delete any ring buffers that didn't get removed - for (auto &iter : ringBufferMap_) - delete iter.second; + for (auto &item : ringBufferMap_) + delete item.second; pthread_mutex_destroy(&mutex_); } @@ -230,8 +230,8 @@ void MainBuffer::unBindAll(const std::string & call_id) CallIDSet temp_set(*callid_set); - for (const auto &iter_set : temp_set) - unBindCallID(call_id, iter_set); + for (const auto &item_set : temp_set) + unBindCallID(call_id, item_set); } //void MainBuffer::putData(void *buffer, size_t toCopy, const std::string &call_id) @@ -270,8 +270,8 @@ size_t MainBuffer::getData(AudioBuffer& buffer, const std::string &call_id) size_t size = 0; AudioBuffer mixBuffer(buffer); - for (const auto &iter_id : *callid_set) { - size = getDataByID(mixBuffer, iter_id, call_id); + for (const auto &item_id : *callid_set) { + size = getDataByID(mixBuffer, item_id, call_id); if (size > 0) { buffer.mix(mixBuffer); @@ -399,15 +399,15 @@ void MainBuffer::dumpInfo() sfl::ScopedLock guard(mutex_); // print each call and bound call ids - for (const auto &iter_call : callIDMap_) { + for (const auto &item_call : callIDMap_) { std::string dbg_str(" Call: \t"); - dbg_str.append(iter_call.first); + dbg_str.append(item_call.first); dbg_str.append(" is bound to: \t"); - CallIDSet *call_id_set = iter_call.second; + CallIDSet *call_id_set = item_call.second; - for (const auto &iter : *call_id_set) { - dbg_str.append(iter); + for (const auto &item : *call_id_set) { + dbg_str.append(item); dbg_str.append(", "); } @@ -415,20 +415,20 @@ void MainBuffer::dumpInfo() } // Print ringbuffers ids and readpointers - for (const auto &iter_buffer : ringBufferMap_) { + for (const auto &item_buffer : ringBufferMap_) { std::string dbg_str(" Buffer: \t"); - dbg_str.append(iter_buffer.first); + dbg_str.append(item_buffer.first); dbg_str.append(" as read pointer: \t"); - RingBuffer* rbuffer = iter_buffer.second; + RingBuffer* rbuffer = item_buffer.second; if (rbuffer) { ReadPointer* rpointer = rbuffer->getReadPointerList(); if (rpointer) { - for (const auto &iter : *rpointer) { - dbg_str.append(iter.first); + for (const auto &item : *rpointer) { + dbg_str.append(item.first); dbg_str.append(", "); } } diff --git a/daemon/src/client/dbus/networkmanager.cpp b/daemon/src/client/dbus/networkmanager.cpp index 5b914a8eb..549552576 100644 --- a/daemon/src/client/dbus/networkmanager.cpp +++ b/daemon/src/client/dbus/networkmanager.cpp @@ -52,8 +52,8 @@ void NetworkManager::StateChanged(const uint32_t &state) void NetworkManager::PropertiesChanged(const std::map &argin0) { WARN("Properties changed: "); - for (const auto &iter : argin0) - WARN("%s", iter.first.c_str()); + for (const auto &item : argin0) + WARN("%s", item.first.c_str()); Manager::instance().registerAccounts(); } diff --git a/daemon/src/conference.cpp b/daemon/src/conference.cpp index 690651572..f252f4589 100644 --- a/daemon/src/conference.cpp +++ b/daemon/src/conference.cpp @@ -66,9 +66,9 @@ void Conference::remove(const std::string &participant_id) void Conference::bindParticipant(const std::string &participant_id) { - for (const auto &iter : participants_) - if (participant_id != iter) - Manager::instance().getMainBuffer().bindCallID(participant_id, iter); + for (const auto &item : participants_) + if (participant_id != item) + Manager::instance().getMainBuffer().bindCallID(participant_id, item); Manager::instance().getMainBuffer().bindCallID(participant_id, MainBuffer::DEFAULT_ID); } @@ -107,15 +107,15 @@ bool Conference::toggleRecording() // start recording if (startRecording) { - for (const auto &iter : participants_) - mbuffer.bindHalfDuplexOut(process_id, iter); + for (const auto &item : participants_) + mbuffer.bindHalfDuplexOut(process_id, item); mbuffer.bindHalfDuplexOut(process_id, MainBuffer::DEFAULT_ID); Recordable::recorder_.start(); } else { - for (const auto &iter : participants_) - mbuffer.unBindHalfDuplexOut(process_id, iter); + for (const auto &item : participants_) + mbuffer.unBindHalfDuplexOut(process_id, item); mbuffer.unBindHalfDuplexOut(process_id, MainBuffer::DEFAULT_ID); } diff --git a/daemon/src/config/sfl_config.cpp b/daemon/src/config/sfl_config.cpp index 01cd3f4dd..4fc4b186e 100644 --- a/daemon/src/config/sfl_config.cpp +++ b/daemon/src/config/sfl_config.cpp @@ -91,8 +91,8 @@ ConfigTree::getSections() const { std::list sections; - for (const auto &iter : sections_) - sections.push_back(iter.first); + for (const auto &item : sections_) + sections.push_back(item.first); return sections; } diff --git a/daemon/src/config/yamlparser.cpp b/daemon/src/config/yamlparser.cpp index 05ff2be96..c720e4522 100644 --- a/daemon/src/config/yamlparser.cpp +++ b/daemon/src/config/yamlparser.cpp @@ -380,8 +380,8 @@ void YamlParser::constructNativeData() { Sequence *seq = doc_.getSequence(); - for (const auto &iter : *seq) { - YamlNode *yamlNode = static_cast(iter); + for (const auto &item : *seq) { + YamlNode *yamlNode = static_cast(item); if (yamlNode == NULL) { ERROR("Could not retrieve yaml node from document sequence"); continue; diff --git a/daemon/src/history/history.cpp b/daemon/src/history/history.cpp index dab738de4..ad24587b8 100644 --- a/daemon/src/history/history.cpp +++ b/daemon/src/history/history.cpp @@ -86,8 +86,8 @@ bool History::save() std::ofstream outfile(path_.c_str()); if (outfile.fail()) return false; - for (const auto &iter : items_) - outfile << iter << std::endl; + for (const auto &item : items_) + outfile << item << std::endl; return true; } @@ -128,8 +128,8 @@ vector > History::getSerialized() { sfl::ScopedLock lock(historyItemsMutex_); vector > result; - for (const auto &iter : items_) - result.push_back(iter.toMap()); + for (const auto &item : items_) + result.push_back(item.toMap()); return result; } diff --git a/daemon/src/history/historyitem.cpp b/daemon/src/history/historyitem.cpp index 1be0e0ed4..c7419e00f 100644 --- a/daemon/src/history/historyitem.cpp +++ b/daemon/src/history/historyitem.cpp @@ -103,12 +103,12 @@ bool HistoryItem::hasPeerNumber() const void HistoryItem::print(std::ostream &o) const { // every entry starts with "[" + random integer = "]" - for (const auto &iter : entryMap_) { + for (const auto &item : entryMap_) { // if the file does not exist anymore, we do not save it - if (iter.first == RECORDING_PATH_KEY and not file_exists(iter.second)) - o << iter.first << "=" << "" << std::endl; + if (item.first == RECORDING_PATH_KEY and not file_exists(item.second)) + o << item.first << "=" << "" << std::endl; else - o << iter.first << "=" << iter.second << std::endl; + o << item.first << "=" << item.second << std::endl; } } diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp index e59c677d7..381df6eea 100644 --- a/daemon/src/iax/iaxvoiplink.cpp +++ b/daemon/src/iax/iaxvoiplink.cpp @@ -105,8 +105,8 @@ IAXVoIPLink::terminate() sfl::ScopedLock m(iaxCallMapMutex_); - for (auto &iter : iaxCallMap_) { - IAXCall *call = static_cast(iter.second); + for (auto &item : iaxCallMap_) { + IAXCall *call = static_cast(item.second); if (call) { sfl::ScopedLock lock(mutexIAX_); @@ -182,8 +182,8 @@ IAXVoIPLink::getCallIDs() void IAXVoIPLink::sendAudioFromMic() { - for (const auto &iter : iaxCallMap_) { - IAXCall *currentCall = static_cast(iter.second); + for (const auto &item : iaxCallMap_) { + IAXCall *currentCall = static_cast(item.second); if (!currentCall or currentCall->getState() != Call::ACTIVE) continue; @@ -460,8 +460,8 @@ IAXVoIPLink::clearIaxCallMap() { sfl::ScopedLock m(iaxCallMapMutex_); - for (const auto &iter : iaxCallMap_) - delete iter.second; + for (const auto &item : iaxCallMap_) + delete item.second; iaxCallMap_.clear(); @@ -539,8 +539,8 @@ IAXVoIPLink::iaxFindCallBySession(iax_session* session) { sfl::ScopedLock m(iaxCallMapMutex_); - for (const auto &iter : iaxCallMap_) { - IAXCall* call = static_cast(iter.second); + for (const auto &item : iaxCallMap_) { + IAXCall* call = static_cast(item.second); if (call and call->session == session) return call; diff --git a/daemon/src/im/instant_messaging.cpp b/daemon/src/im/instant_messaging.cpp index a3355d89a..8e1e2c3ed 100644 --- a/daemon/src/im/instant_messaging.cpp +++ b/daemon/src/im/instant_messaging.cpp @@ -99,8 +99,8 @@ void InstantMessaging::sip_send(pjsip_inv_session *session, const std::string& i void InstantMessaging::send_sip_message(pjsip_inv_session *session, const std::string &id, const std::string &message) { std::vector msgs(split_message(message)); - for (const auto &iter : msgs) - sip_send(session, id, iter); + for (const auto &item : msgs) + sip_send(session, id, item); } #if HAVE_IAX @@ -108,8 +108,8 @@ void InstantMessaging::send_iax_message(iax_session *session, const std::string { std::vector msgs(split_message(message)); - for (const auto &iter : msgs) - iax_send_text(session, iter.c_str()); + for (const auto &item : msgs) + iax_send_text(session, item.c_str()); } #endif @@ -135,8 +135,8 @@ std::string InstantMessaging::generateXmlUriList(UriList &list) "" ""; - for (auto &iter : list) - xmlbuffer += ""; + for (auto &item : list) + xmlbuffer += ""; return xmlbuffer + ""; } diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 32845a5c6..59eab5ef3 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -245,8 +245,8 @@ void ManagerImpl::finish() std::vector callList(getCallList()); DEBUG("Hangup %zu remaining call(s)", callList.size()); - for (const auto &iter : callList) - hangupCall(iter); + for (const auto &item : callList) + hangupCall(item); saveConfig(); @@ -525,8 +525,8 @@ bool ManagerImpl::hangupConference(const std::string& id) if (conf) { ParticipantSet participants(conf->getParticipantList()); - for (const auto &iter : participants) - hangupCall(iter); + for (const auto &item : participants) + hangupCall(item); } else { ERROR("No such conference %s", id.c_str()); return false; @@ -817,9 +817,9 @@ ManagerImpl::holdConference(const std::string& id) ParticipantSet participants(conf->getParticipantList()); - for (const auto &iter : participants) { - switchCall(iter); - onHoldCall(iter); + for (const auto &item : participants) { + switchCall(item); + onHoldCall(item); } conf->setState(isRec ? Conference::HOLD_REC : Conference::HOLD); @@ -845,14 +845,14 @@ ManagerImpl::unHoldConference(const std::string& id) ParticipantSet participants(conf->getParticipantList()); - for (const auto &iter : participants) { - Call *call = getCallFromCallID(iter); + for (const auto &item : participants) { + Call *call = getCallFromCallID(item); if (call) { // if one call is currently recording, the conference is in state recording isRec |= call->isRecording(); - switchCall(iter); - offHoldCall(iter); + switchCall(item); + offHoldCall(item); } } @@ -977,10 +977,10 @@ ManagerImpl::addMainParticipant(const std::string& conference_id) ParticipantSet participants(conf->getParticipantList()); - for (const auto &iter_p : participants) { - getMainBuffer().bindCallID(iter_p, MainBuffer::DEFAULT_ID); + for (const auto &item_p : participants) { + getMainBuffer().bindCallID(item_p, MainBuffer::DEFAULT_ID); // Reset ringbuffer's readpointers - getMainBuffer().flush(iter_p); + getMainBuffer().flush(item_p); } getMainBuffer().flush(MainBuffer::DEFAULT_ID); @@ -1391,12 +1391,12 @@ void ManagerImpl::saveConfig() try { Conf::YamlEmitter emitter(path_.c_str()); - for (auto &iter : SIPVoIPLink::instance()->getAccounts()) - iter.second->serialize(emitter); + for (auto &item : SIPVoIPLink::instance()->getAccounts()) + item.second->serialize(emitter); #if HAVE_IAX - for (auto &iter : IAXVoIPLink::getAccounts()) - iter.second->serialize(emitter); + for (auto &item : IAXVoIPLink::getAccounts()) + item.second->serialize(emitter); #endif preferences.serialize(emitter); @@ -1551,14 +1551,14 @@ void ManagerImpl::incomingMessage(const std::string& callID, ParticipantSet participants(conf->getParticipantList()); - for (const auto &iter_p : participants) { + for (const auto &item_p : participants) { - if (iter_p == callID) + if (item_p == callID) continue; - std::string accountId(getAccountFromCall(iter_p)); + std::string accountId(getAccountFromCall(item_p)); - DEBUG("Send message to %s, (%s)", iter_p.c_str(), accountId.c_str()); + DEBUG("Send message to %s, (%s)", item_p.c_str(), accountId.c_str()); Account *account = getAccount(accountId); @@ -1621,9 +1621,9 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string& ParticipantSet participants(conf->getParticipantList()); - for (const auto &iter_p : participants) { + for (const auto &item_p : participants) { - const std::string accountId(getAccountFromCall(iter_p)); + const std::string accountId(getAccountFromCall(item_p)); Account *account = getAccount(accountId); @@ -1632,7 +1632,7 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string& return false; } - account->getVoIPLink()->sendTextMessage(iter_p, message, from); + account->getVoIPLink()->sendTextMessage(item_p, message, from); } } else { Account *account = getAccount(getAccountFromCall(callID)); @@ -2387,20 +2387,20 @@ std::vector ManagerImpl::getAccountList() const // If no order has been set, load the default one ie according to the creation date. if (account_order.empty()) { - for (const auto &iter : allAccounts) { - if (iter.first == SIPAccount::IP2IP_PROFILE || iter.first.empty()) + for (const auto &item : allAccounts) { + if (item.first == SIPAccount::IP2IP_PROFILE || item.first.empty()) continue; - if (iter.second) - v.push_back(iter.second->getAccountID()); + if (item.second) + v.push_back(item.second->getAccountID()); } } else { - for (const auto &iter : account_order) { - if (iter == SIPAccount::IP2IP_PROFILE or iter.empty()) + for (const auto &item : account_order) { + if (item == SIPAccount::IP2IP_PROFILE or item.empty()) continue; - AccountMap::const_iterator account_iter = allAccounts.find(iter); + AccountMap::const_iterator account_iter = allAccounts.find(item); if (account_iter != allAccounts.end() and account_iter->second) v.push_back(account_iter->second->getAccountID()); diff --git a/daemon/src/numbercleaner.cpp b/daemon/src/numbercleaner.cpp index adca7416f..67b509dd7 100644 --- a/daemon/src/numbercleaner.cpp +++ b/daemon/src/numbercleaner.cpp @@ -37,8 +37,8 @@ namespace { void strip_chars(const std::string &to_strip, std::string &num) { - for (const auto &iter : to_strip) - num.erase(std::remove(num.begin(), num.end(), iter), num.end()); + for (const auto &item : to_strip) + num.erase(std::remove(num.begin(), num.end(), item), num.end()); } } diff --git a/daemon/src/sip/sdes_negotiator.cpp b/daemon/src/sip/sdes_negotiator.cpp index b6c437b83..d32597044 100644 --- a/daemon/src/sip/sdes_negotiator.cpp +++ b/daemon/src/sip/sdes_negotiator.cpp @@ -93,13 +93,13 @@ std::vector SdesNegotiator::parse() std::vector cryptoAttributeVector; - for (const auto &iter : remoteAttribute_) { + for (const auto &item : remoteAttribute_) { // Split the line into its component // that we will analyze further down. std::vector sdesLine; - *generalSyntaxPattern << iter; + *generalSyntaxPattern << item; try { sdesLine = generalSyntaxPattern->split(); diff --git a/daemon/src/sip/sdp.cpp b/daemon/src/sip/sdp.cpp index 6645cb4b9..64766b9dc 100644 --- a/daemon/src/sip/sdp.cpp +++ b/daemon/src/sip/sdp.cpp @@ -533,9 +533,9 @@ string Sdp::getLineFromSession(const pjmedia_sdp_session *sess, const string &ke int size = pjmedia_sdp_print(sess, buffer, sizeof buffer); string sdp(buffer, size); const vector tokens(split(sdp, '\n')); - for (const auto &iter : tokens) - if (iter.find(keyword) != string::npos) - return iter; + for (const auto &item : tokens) + if (item.find(keyword) != string::npos) + return item; return ""; } @@ -647,8 +647,8 @@ Sdp::getProfileLevelID(const pjmedia_sdp_session *session, void Sdp::addSdesAttribute(const vector& crypto) { - for (const auto &iter : crypto) { - pj_str_t val = { (char*) iter.c_str(), static_cast(iter.size()) }; + for (const auto &item : crypto) { + pj_str_t val = { (char*) item.c_str(), static_cast(item.size()) }; pjmedia_sdp_attr *attr = pjmedia_sdp_attr_create(memPool_, "crypto", &val); for (unsigned i = 0; i < localSession_->media_count; i++) diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp index 5109d780e..875dc2350 100644 --- a/daemon/src/sip/sipaccount.cpp +++ b/daemon/src/sip/sipaccount.cpp @@ -596,8 +596,8 @@ std::map SIPAccount::getAccountDetails() const if (hasCredentials()) { - for (const auto &vect_iter : credentials_) { - const std::string password = retrievePassword(vect_iter, username_); + for (const auto &vect_item : credentials_) { + const std::string password = retrievePassword(vect_item, username_); if (not password.empty()) a[CONFIG_ACCOUNT_PASSWORD] = password; @@ -799,8 +799,8 @@ void SIPAccount::trimCiphers() // PJSIP aborts if our cipher list exceeds 1010 characters static const int MAX_CIPHERS_STRLEN = 1010; - for (const auto &iter : ciphers_) { - sum += strlen(pj_ssl_cipher_name(iter)); + for (const auto &item : ciphers_) { + sum += strlen(pj_ssl_cipher_name(item)); if (sum > MAX_CIPHERS_STRLEN) break; @@ -1142,23 +1142,23 @@ void SIPAccount::setCredentials(const std::vector::const_iterator val = iter.find(CONFIG_ACCOUNT_PASSWORD); - const std::string password = val != iter.end() ? val->second : ""; + for (const auto &item : credentials_) { + map::const_iterator val = item.find(CONFIG_ACCOUNT_PASSWORD); + const std::string password = val != item.end() ? val->second : ""; int dataType = (md5HashingEnabled and password.length() == 32) ? PJSIP_CRED_DATA_DIGEST : PJSIP_CRED_DATA_PLAIN_PASSWD; - val = iter.find(CONFIG_ACCOUNT_USERNAME); + val = item.find(CONFIG_ACCOUNT_USERNAME); - if (val != iter.end()) + if (val != item.end()) cred_[i].username = pj_str((char*) val->second.c_str()); cred_[i].data = pj_str((char*) password.c_str()); - val = iter.find(CONFIG_ACCOUNT_REALM); + val = item.find(CONFIG_ACCOUNT_REALM); - if (val != iter.end()) + if (val != item.end()) cred_[i].realm = pj_str((char*) val->second.c_str()); cred_[i].data_type = dataType; diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index 2f17390e1..460c0a41c 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -656,10 +656,10 @@ SIPVoIPLink::getAccountIdFromNameAndServer(const std::string &userName, DEBUG("username = %s, server = %s", userName.c_str(), server.c_str()); // Try to find the account id from username and server name by full match - for (const auto &iter : sipAccountMap_) { - SIPAccount *account = static_cast(iter.second); + for (const auto &item : sipAccountMap_) { + SIPAccount *account = static_cast(item.second); if (account and account->matches(userName, server, endpt_, pool_)) - return iter.first; + return item.first; } DEBUG("Username %s or server %s doesn't match any account, using IP2IP", userName.c_str(), server.c_str()); @@ -1250,8 +1250,8 @@ SIPVoIPLink::clearSipCallMap() { sfl::ScopedLock m(sipCallMapMutex_); - for (const auto &iter : sipCallMap_) - delete iter.second; + for (const auto &item : sipCallMap_) + delete item.second; sipCallMap_.clear(); } diff --git a/daemon/src/video/libav_utils.cpp b/daemon/src/video/libav_utils.cpp index 3cdd1928d..99b18a658 100644 --- a/daemon/src/video/libav_utils.cpp +++ b/daemon/src/video/libav_utils.cpp @@ -160,14 +160,14 @@ getDefaultCodecs() const char * const DEFAULT_BITRATE = "400"; sfl_avcodec_init(); std::vector > result; - for (const auto &iter : installed_video_codecs_) { + for (const auto &item : installed_video_codecs_) { std::map codec; // FIXME: get these keys from proper place - codec["name"] = iter; + codec["name"] = item; codec["bitrate"] = DEFAULT_BITRATE; codec["enabled"] = "true"; // FIXME: make a nicer version of this - if (iter == "H264") + if (item == "H264") codec["parameters"] = DEFAULT_H264_PROFILE_LEVEL_ID; result.push_back(codec); } diff --git a/daemon/src/video/video_v4l2.cpp b/daemon/src/video/video_v4l2.cpp index 6b1f0a748..343a5d615 100644 --- a/daemon/src/video/video_v4l2.cpp +++ b/daemon/src/video/video_v4l2.cpp @@ -121,9 +121,9 @@ static const unsigned pixelformats_supported[] = { namespace { unsigned int pixelformat_score(unsigned pixelformat) { - for (const auto &iter : pixelformats_supported) - if (iter == pixelformat) - return iter; + for (const auto &item : pixelformats_supported) + if (item == pixelformat) + return item; return UINT_MAX - 1; } @@ -136,9 +136,9 @@ vector VideoV4l2Size::getRateList() { vector v; - for (const auto &iter : rates_) { + for (const auto &item : rates_) { std::stringstream ss; - ss << iter; + ss << item; v.push_back(ss.str()); } @@ -200,9 +200,9 @@ vector VideoV4l2Channel::getSizeList() const { vector v; - for (const auto &iter : sizes_) { + for (const auto &item : sizes_) { std::stringstream ss; - ss << iter.width << "x" << iter.height; + ss << item.width << "x" << item.height; v.push_back(ss.str()); } @@ -308,11 +308,11 @@ void VideoV4l2Channel::getFormat(int fd) VideoV4l2Size VideoV4l2Channel::getSize(const string &name) const { - for (const auto &iter : sizes_) { + for (const auto &item : sizes_) { std::stringstream ss; - ss << iter.width << "x" << iter.height; + ss << item.width << "x" << item.height; if (ss.str() == name) - return iter; + return item; } // fallback to last size @@ -362,9 +362,9 @@ vector VideoV4l2Device::getChannelList() const const VideoV4l2Channel & VideoV4l2Device::getChannel(const string &name) const { - for (const auto &iter : channels_) - if (iter.name == name) - return iter; + for (const auto &item : channels_) + if (item.name == name) + return item; return channels_.back(); } diff --git a/daemon/src/video/video_v4l2_list.cpp b/daemon/src/video/video_v4l2_list.cpp index dc381f6dc..8cdc80655 100644 --- a/daemon/src/video/video_v4l2_list.cpp +++ b/daemon/src/video/video_v4l2_list.cpp @@ -195,8 +195,8 @@ namespace { void giveUniqueName(VideoV4l2Device &dev, const vector &devices) { start: - for (auto &iter : devices) { - if (dev.name == iter.name) { + for (auto &item : devices) { + if (dev.name == item.name) { size_t sharp; int num = getNumber(dev.name, &sharp); if (num < 0) // not numbered