Commit f308f542 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #28351: sdp: use range based for loops

parent ba0f2f46
...@@ -80,8 +80,8 @@ Sdp::Sdp(pj_pool_t *pool) ...@@ -80,8 +80,8 @@ Sdp::Sdp(pj_pool_t *pool)
namespace { namespace {
bool hasPayload(const std::vector<sfl::AudioCodec*> &codecs, int pt) bool hasPayload(const std::vector<sfl::AudioCodec*> &codecs, int pt)
{ {
for (std::vector<sfl::AudioCodec*>::const_iterator i = codecs.begin(); i != codecs.end(); ++i) for (const auto &i : codecs)
if (*i and (*i)->getPayloadType() == pt) if (i and i->getPayloadType() == pt)
return true; return true;
return false; return false;
} }
...@@ -377,8 +377,8 @@ void Sdp::setLocalMediaAudioCapabilities(const vector<int> &selectedCodecs) ...@@ -377,8 +377,8 @@ void Sdp::setLocalMediaAudioCapabilities(const vector<int> &selectedCodecs)
WARN("No selected codec while building local SDP offer"); WARN("No selected codec while building local SDP offer");
audio_codec_list_.clear(); audio_codec_list_.clear();
for (vector<int>::const_iterator i = selectedCodecs.begin(); i != selectedCodecs.end(); ++i) { for (const auto &i : selectedCodecs) {
sfl::AudioCodec *codec = Manager::instance().audioCodecFactory.getCodec(*i); sfl::AudioCodec *codec = Manager::instance().audioCodecFactory.getCodec(i);
if (codec) if (codec)
audio_codec_list_.push_back(codec); audio_codec_list_.push_back(codec);
...@@ -533,9 +533,9 @@ string Sdp::getLineFromSession(const pjmedia_sdp_session *sess, const string &ke ...@@ -533,9 +533,9 @@ string Sdp::getLineFromSession(const pjmedia_sdp_session *sess, const string &ke
int size = pjmedia_sdp_print(sess, buffer, sizeof buffer); int size = pjmedia_sdp_print(sess, buffer, sizeof buffer);
string sdp(buffer, size); string sdp(buffer, size);
const vector<string> tokens(split(sdp, '\n')); const vector<string> tokens(split(sdp, '\n'));
for (vector<string>::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter) for (const auto &iter : tokens)
if ((*iter).find(keyword) != string::npos) if (iter.find(keyword) != string::npos)
return *iter; return iter;
return ""; return "";
} }
...@@ -647,9 +647,8 @@ Sdp::getProfileLevelID(const pjmedia_sdp_session *session, ...@@ -647,9 +647,8 @@ Sdp::getProfileLevelID(const pjmedia_sdp_session *session,
void Sdp::addSdesAttribute(const vector<std::string>& crypto) void Sdp::addSdesAttribute(const vector<std::string>& crypto)
{ {
for (vector<std::string>::const_iterator iter = crypto.begin(); for (const auto &iter : crypto) {
iter != crypto.end(); ++iter) { pj_str_t val = { (char*) iter.c_str(), static_cast<pj_ssize_t>(iter.size()) };
pj_str_t val = { (char*)(*iter).c_str(), static_cast<pj_ssize_t>((*iter).size()) };
pjmedia_sdp_attr *attr = pjmedia_sdp_attr_create(memPool_, "crypto", &val); pjmedia_sdp_attr *attr = pjmedia_sdp_attr_create(memPool_, "crypto", &val);
for (unsigned i = 0; i < localSession_->media_count; i++) for (unsigned i = 0; i < localSession_->media_count; i++)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment