提交 b99acd9a authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Use always pre-increment (++it)

上级 adf5288e
......@@ -33,7 +33,7 @@ void DepOpenSSL::ClassInit()
DepOpenSSL::numMutexes = CRYPTO_num_locks();
for (uint32_t i = 0; i < DepOpenSSL::numMutexes; i++)
for (uint32_t i = 0; i < DepOpenSSL::numMutexes; ++i)
{
int err = uv_mutex_init(&DepOpenSSL::mutexes[i]);
if (err)
......@@ -69,7 +69,7 @@ void DepOpenSSL::ClassDestroy()
sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
// Free mutexes.
for (uint32_t i = 0; i < DepOpenSSL::numMutexes; i++)
for (uint32_t i = 0; i < DepOpenSSL::numMutexes; ++i)
{
uv_mutex_destroy(&DepOpenSSL::mutexes[i]);
}
......
......@@ -380,7 +380,7 @@ namespace RTC
#endif
// Set the "use_srtp" DTLS extension.
for (auto it = DtlsTransport::srtpProfiles.begin(); it != DtlsTransport::srtpProfiles.end(); it++)
for (auto it = DtlsTransport::srtpProfiles.begin(); it != DtlsTransport::srtpProfiles.end(); ++it)
{
if (it != DtlsTransport::srtpProfiles.begin())
ssl_srtp_profiles += ":";
......@@ -417,7 +417,7 @@ namespace RTC
{
MS_TRACE();
for (auto it = DtlsTransport::string2FingerprintAlgorithm.begin(); it != DtlsTransport::string2FingerprintAlgorithm.end(); it++)
for (auto it = DtlsTransport::string2FingerprintAlgorithm.begin(); it != DtlsTransport::string2FingerprintAlgorithm.end(); ++it)
{
std::string algorithm_str = it->first;
FingerprintAlgorithm algorithm = it->second;
......@@ -456,7 +456,7 @@ namespace RTC
}
// Convert to hexadecimal format in lowecase without colons.
for (unsigned int i = 0; i < size; i++)
for (unsigned int i = 0; i < size; ++i)
{
std::sprintf(hex_fingerprint + (i * 2), "%.2x", binary_fingerprint[i]);
}
......@@ -1016,7 +1016,7 @@ namespace RTC
}
// Convert to hexadecimal format in lowecase without colons.
for (unsigned int i = 0; i < size; i++)
for (unsigned int i = 0; i < size; ++i)
{
std::sprintf(hex_fingerprint + (i * 2), "%.2x", binary_fingerprint[i]);
}
......@@ -1137,7 +1137,7 @@ namespace RTC
}
// Get the negotiated SRTP profile.
for (auto it = DtlsTransport::srtpProfiles.begin(); it != DtlsTransport::srtpProfiles.end(); it++)
for (auto it = DtlsTransport::srtpProfiles.begin(); it != DtlsTransport::srtpProfiles.end(); ++it)
{
SrtpProfileMapEntry* profile_entry = &(*it);
......
......@@ -200,7 +200,7 @@ namespace RTC
RTC::TransportTuple* removed_tuple = nullptr;
// Find the removed tuple.
for (; it != this->tuples.end(); it++)
for (; it != this->tuples.end(); ++it)
{
RTC::TransportTuple* stored_tuple = std::addressof(*it);
......@@ -455,7 +455,7 @@ namespace RTC
return this->selectedTuple;
// Otherwise check other stored tuples.
for (auto it = this->tuples.begin(); it != this->tuples.end(); it++)
for (auto it = this->tuples.begin(); it != this->tuples.end(); ++it)
{
RTC::TransportTuple* stored_tuple = std::addressof(*it);
......
......@@ -480,7 +480,7 @@ namespace RTC
{
MS_TRACE();
for (auto it = this->rtpSenders.begin(); it != this->rtpSenders.end(); it++)
for (auto it = this->rtpSenders.begin(); it != this->rtpSenders.end(); ++it)
{
auto rtpSender = it->second;
auto rtpParameters = rtpSender->GetParameters();
......@@ -488,7 +488,7 @@ namespace RTC
if (!rtpParameters)
continue;
for (auto it2 = rtpParameters->encodings.begin(); it2 != rtpParameters->encodings.end(); it2++)
for (auto it2 = rtpParameters->encodings.begin(); it2 != rtpParameters->encodings.end(); ++it2)
{
auto& encoding = *it2;
......@@ -513,12 +513,12 @@ namespace RTC
// - Request every Sender and Receiver of such transport their RTCP data.
// - Send the CompoundPacket.
for (auto it = this->transports.begin(); it != this->transports.end(); it++)
for (auto it = this->transports.begin(); it != this->transports.end(); ++it)
{
RTC::RTCP::CompoundPacket packet;
RTC::Transport* transport = it->second;
for (auto it = this->rtpSenders.begin(); it != this->rtpSenders.end(); it++)
for (auto it = this->rtpSenders.begin(); it != this->rtpSenders.end(); ++it)
{
RTC::RtpSender* rtpSender = it->second;
......@@ -540,7 +540,7 @@ namespace RTC
}
}
for (auto it = this->rtpReceivers.begin(); it != this->rtpReceivers.end(); it++)
for (auto it = this->rtpReceivers.begin(); it != this->rtpReceivers.end(); ++it)
{
RTC::RtpReceiver* rtpReceiver = it->second;
......@@ -684,7 +684,7 @@ namespace RTC
{
auto it = this->capabilities.codecs.begin();
for (; it != this->capabilities.codecs.end(); it++)
for (; it != this->capabilities.codecs.end(); ++it)
{
auto& codecCapability = *it;
......@@ -736,7 +736,7 @@ namespace RTC
RTCP::ReceiverReportPacket* rr = static_cast<RTCP::ReceiverReportPacket*>(packet);
RTCP::ReceiverReportPacket::Iterator it = rr->Begin();
for (; it != rr->End(); it++)
for (; it != rr->End(); ++it)
{
auto& report = (*it);
RTC::RtpSender* rtpSender = this->GetRtpSender(report->GetSsrc());
......@@ -784,7 +784,7 @@ namespace RTC
RTCP::SenderReportPacket::Iterator it = sr->Begin();
// Even if Sender Report packet can only contain one report..
for (; it != sr->End(); it++)
for (; it != sr->End(); ++it)
{
auto& report = (*it);
// Get the receiver associated to the SSRC indicated in the report.
......@@ -804,7 +804,7 @@ namespace RTC
RTCP::SdesPacket* sdes = static_cast<RTCP::SdesPacket*>(packet);
RTCP::SdesPacket::Iterator it = sdes->Begin();
for (; it != sdes->End(); it++)
for (; it != sdes->End(); ++it)
{
auto& chunk = (*it);
// Get the receiver associated to the SSRC indicated in the chunk.
......
......@@ -76,7 +76,7 @@ namespace RTC { namespace RTCP
// 32 bits padding.
size_t padding = (-offset) & 3;
for (size_t i = 0; i < padding; i++)
for (size_t i = 0; i < padding; ++i)
{
buffer[offset+i] = 0;
}
......
......@@ -47,7 +47,7 @@ namespace RTC { namespace RTCP
header->length += (sizeof(ReceiverReport::Header) * this->receiverReportPacket.GetCount()) / 4;
ReceiverReportPacket::Iterator it = this->receiverReportPacket.Begin();
for (; it != this->receiverReportPacket.End(); it++)
for (; it != this->receiverReportPacket.End(); ++it)
{
ReceiverReport* report = (*it);
......@@ -83,7 +83,7 @@ namespace RTC { namespace RTCP
{
ReceiverReportPacket::Iterator it = this->receiverReportPacket.Begin();
for (; it != this->receiverReportPacket.End(); it++)
for (; it != this->receiverReportPacket.End(); ++it)
{
(*it)->Dump();
}
......
......@@ -76,7 +76,7 @@ namespace RTC { namespace RTCP
std::memcpy(this->header->bit_string, bit_string, length);
// Fill padding.
for (size_t i = 0; i < padding; i++)
for (size_t i = 0; i < padding; ++i)
{
this->raw[sizeof(Header)+i-1] = 0;
}
......
......@@ -54,7 +54,7 @@ namespace RTC { namespace RTCP
// 32 bits padding.
size_t padding = (-offset) & 3;
for (size_t i = 0; i < padding; i++)
for (size_t i = 0; i < padding; ++i)
{
buffer[offset+i] = 0;
}
......
......@@ -172,7 +172,7 @@ namespace RTC { namespace RTCP
// 32 bits padding.
size_t padding = (-offset) & 3;
for (size_t i = 0; i < padding; i++)
for (size_t i = 0; i < padding; ++i)
{
buffer[offset+i] = 0;
}
......
......@@ -76,7 +76,7 @@ namespace RTC
std::vector<RTC::RtpCodecParameters> mediaCodecs;
for (Json::UInt i = 0; i < json_mediaCodecs.size(); i++)
for (Json::UInt i = 0; i < json_mediaCodecs.size(); ++i)
{
RTC::RtpCodecParameters mediaCodec(json_mediaCodecs[i], RTC::Scope::ROOM_CAPABILITY);
......@@ -395,7 +395,7 @@ namespace RTC
while (dynamicPayloadTypeIt != dynamicPayloadTypes.end())
{
payloadType = *dynamicPayloadTypeIt;
dynamicPayloadTypeIt++;
++dynamicPayloadTypeIt;
if (roomPayloadTypes.find(payloadType) == roomPayloadTypes.end())
{
......@@ -446,7 +446,7 @@ namespace RTC
auto& peerCodecCapability = *it;
auto it2 = this->capabilities.codecs.begin();
for (; it2 != this->capabilities.codecs.end(); it2++)
for (; it2 != this->capabilities.codecs.end(); ++it2)
{
auto& roomCodecCapability = *it2;
......@@ -455,7 +455,7 @@ namespace RTC
}
if (it2 != this->capabilities.codecs.end())
it++;
++it;
else
it = capabilities->codecs.erase(it);
}
......@@ -634,13 +634,13 @@ namespace RTC
{
RTC::RTCP::FeedbackRtpNackPacket* nackPacket = static_cast<RTC::RTCP::FeedbackRtpNackPacket*>(packet);
for (auto it = nackPacket->Begin(); it != nackPacket->End(); it++)
for (auto it = nackPacket->Begin(); it != nackPacket->End(); ++it)
{
RTC::RTCP::NackItem* item = *it;
rtpReceiver->RequestRtpRetransmission(item->GetPacketId(), item->GetLostPacketBitmask(), this->rtpRetransmissionContainer);
for (auto it = this->rtpRetransmissionContainer.begin(); it != this->rtpRetransmissionContainer.end(); it++)
for (auto it = this->rtpRetransmissionContainer.begin(); it != this->rtpRetransmissionContainer.end(); ++it)
{
RTC::RtpPacket* packet = *it;
......@@ -697,7 +697,7 @@ namespace RTC
MS_TRACE();
// Tell all the peers but the one in the argument to generate and send their RTCP.
for (auto it = this->peers.begin(); it != this->peers.end(); it++)
for (auto it = this->peers.begin(); it != this->peers.end(); ++it)
{
RTC::Peer* current_peer = it->second;
......
......@@ -72,7 +72,7 @@ namespace RTC
MS_ASSERT(data.isObject(), "data is not a JSON object");
for (Json::Value::iterator it = data.begin(); it != data.end(); it++)
for (Json::Value::iterator it = data.begin(); it != data.end(); ++it)
{
std::string key = it.key().asString();
Json::Value value = (*it);
......@@ -120,7 +120,7 @@ namespace RTC
std::vector<int32_t> arrayOfIntegers;
bool isValid = true;
for (Json::UInt i = 0; i < value.size() && isValid; i++)
for (Json::UInt i = 0; i < value.size() && isValid; ++i)
{
auto& entry = value[i];
......
......@@ -23,7 +23,7 @@ namespace RTC
{
auto& json_codecs = data[k_codecs];
for (Json::UInt i = 0; i < json_codecs.size(); i++)
for (Json::UInt i = 0; i < json_codecs.size(); ++i)
{
RtpCodecParameters codec(json_codecs[i], scope);
......@@ -37,7 +37,7 @@ namespace RTC
{
auto& json_array = data[k_headerExtensions];
for (Json::UInt i = 0; i < json_array.size(); i++)
for (Json::UInt i = 0; i < json_array.size(); ++i)
{
RtpHeaderExtension headerExtension(json_array[i]);
......@@ -51,7 +51,7 @@ namespace RTC
{
auto& json_array = data[k_fecMechanisms];
for (Json::UInt i = 0; i < json_array.size(); i++)
for (Json::UInt i = 0; i < json_array.size(); ++i)
{
if (!json_array[i].isString())
MS_THROW_ERROR("invalid RtpCapabilities.fecMechanisms");
......
......@@ -96,7 +96,7 @@ namespace RTC
{
auto& json_rtcpFeedback = data[k_rtcpFeedback];
for (Json::UInt i = 0; i < json_rtcpFeedback.size(); i++)
for (Json::UInt i = 0; i < json_rtcpFeedback.size(); ++i)
{
RTC::RtcpFeedback rtcpFeedback(json_rtcpFeedback[i]);
......
......@@ -77,7 +77,7 @@ namespace RTC
{
auto& json_array = data[k_dependencyEncodingIds];
for (Json::UInt i = 0; i < json_array.size(); i++)
for (Json::UInt i = 0; i < json_array.size(); ++i)
{
auto& entry = json_array[i];
......
......@@ -35,7 +35,7 @@ namespace RTC
{
auto& json_codecs = data[k_codecs];
for (Json::UInt i = 0; i < json_codecs.size(); i++)
for (Json::UInt i = 0; i < json_codecs.size(); ++i)
{
RTC::RtpCodecParameters codec(json_codecs[i], RTC::Scope::RECEIVE);
......@@ -53,7 +53,7 @@ namespace RTC
{
auto& json_array = data[k_encodings];
for (Json::UInt i = 0; i < json_array.size(); i++)
for (Json::UInt i = 0; i < json_array.size(); ++i)
{
RTC::RtpEncodingParameters encoding(json_array[i]);
......@@ -67,7 +67,7 @@ namespace RTC
{
auto& json_array = data[k_headerExtensions];
for (Json::UInt i = 0; i < json_array.size(); i++)
for (Json::UInt i = 0; i < json_array.size(); ++i)
{
RTC::RtpHeaderExtensionParameters headerExtension(json_array[i]);
......@@ -187,7 +187,7 @@ namespace RTC
int32_t apt = codec.parameters.GetInteger(k_apt);
auto it = this->codecs.begin();
for (; it != this->codecs.end(); it++)
for (; it != this->codecs.end(); ++it)
{
auto codec = *it;
......@@ -223,7 +223,7 @@ namespace RTC
{
auto it = this->codecs.begin();
for (; it != this->codecs.end(); it++)
for (; it != this->codecs.end(); ++it)
{
auto& codec = *it;
......@@ -266,7 +266,7 @@ namespace RTC
{
auto it = this->codecs.begin();
for (; it != this->codecs.end(); it++)
for (; it != this->codecs.end(); ++it)
{
auto codec = *it;
......
......@@ -195,7 +195,7 @@ namespace RTC
{
auto it = rtpParameters->encodings.begin();
for (; it != rtpParameters->encodings.end(); it++)
for (; it != rtpParameters->encodings.end(); ++it)
{
auto& encoding = *it;
......@@ -242,7 +242,7 @@ namespace RTC
if (it->second == rtpReceiver)
it = this->ssrcTable.erase(it);
else
it++;
++it;
}
for (auto it = this->muxIdTable.begin(); it != this->muxIdTable.end();)
......@@ -250,7 +250,7 @@ namespace RTC
if (it->second == rtpReceiver)
it = this->muxIdTable.erase(it);
else
it++;
++it;
}
for (auto it = this->ptTable.begin(); it != this->ptTable.end();)
......@@ -258,7 +258,7 @@ namespace RTC
if (it->second == rtpReceiver)
it = this->ptTable.erase(it);
else
it++;
++it;
}
}
......
......@@ -169,7 +169,7 @@ namespace RTC
auto it = this->rtpParameters->codecs.begin();
for (; it != this->rtpParameters->codecs.end(); it++)
for (; it != this->rtpParameters->codecs.end(); ++it)
{
auto& codec = *it;
......
......@@ -142,7 +142,7 @@ namespace RTC
auto& codec = *it;
auto it2 = this->peerCapabilities->codecs.begin();
for (; it2 != this->peerCapabilities->codecs.end(); it2++)
for (; it2 != this->peerCapabilities->codecs.end(); ++it2)
{
auto& codecCapability = *it2;
......@@ -153,7 +153,7 @@ namespace RTC
if (it2 != this->peerCapabilities->codecs.end())
{
supportedPayloadTypes.insert(codec.payloadType);
it++;
++it;
}
else
{
......@@ -168,7 +168,7 @@ namespace RTC
if (supportedPayloadTypes.find(encoding.codecPayloadType) != supportedPayloadTypes.end())
{
it++;
++it;
}
else
{
......@@ -259,7 +259,7 @@ namespace RTC
{
auto it = this->peerCapabilities->codecs.begin();
for (; it != this->peerCapabilities->codecs.end(); it++)
for (; it != this->peerCapabilities->codecs.end(); ++it)
{
auto& codecCapability = *it;
......
......@@ -119,7 +119,7 @@ namespace RTC
{
if (requested)
{
for (; buffer_it != this->buffer.end(); buffer_it++)
for (; buffer_it != this->buffer.end(); ++buffer_it)
{
auto current_seq32 = (*buffer_it).seq32;
......@@ -138,7 +138,7 @@ namespace RTC
requested = (bitmask & 1) ? true : false;
bitmask >>= 1;
seq32++;
++seq32;
}
while (bitmask != 0);
......@@ -283,7 +283,7 @@ namespace RTC
// Iterate the buffer in reverse order and find the proper place to store the
// packet.
auto buffer_it_r = this->buffer.rbegin();
for (; buffer_it_r != this->buffer.rend(); buffer_it_r++)
for (; buffer_it_r != this->buffer.rend(); ++buffer_it_r)
{
auto current_seq32 = (*buffer_it_r).seq32;
......
......@@ -263,7 +263,7 @@ namespace RTC
MS_DEBUG_DEV(" %s with unknown method %#.3x", klass.c_str(), (uint16_t)this->method);
MS_DEBUG_DEV(" size: %zu bytes", this->size);
char transaction_id[25];
for (int i=0; i<12; i++)
for (int i=0; i<12; ++i)
{
// NOTE: n must be 3 because snprintf adds a \0 after printed chars.
std::snprintf(transaction_id+(i*2), 3, "%.2x", this->transactionId[i]);
......@@ -293,7 +293,7 @@ namespace RTC
if (this->messageIntegrity)
{
char message_integrity[41];
for (int i=0; i<20; i++)
for (int i=0; i<20; ++i)
{
std::snprintf(message_integrity+(i*2), 3, "%.2x", this->messageIntegrity[i]);
}
......
......@@ -115,7 +115,7 @@ namespace RTC
// Fail also after bind() fails N times in theorically available ports.
while (true)
{
attempt++;
++attempt;
// Increase the iterate port) within the range of RTC TCP ports.
if (iterating_port < RTC::TcpServer::maxPort)
......@@ -150,7 +150,7 @@ namespace RTC
}
// Try to bind on it.
bind_attempt++;
++bind_attempt;
uvHandle = new uv_tcp_t();
......
......@@ -114,11 +114,11 @@ namespace RTC
// Fail also after bind() fails N times in theorically available ports.
while (true)
{
attempt++;
++attempt;
// Increase the iterate port within the range of RTC UDP ports.
if (iterating_port < RTC::UdpSocket::maxPort)
iterating_port++;
++iterating_port;
else
iterating_port = RTC::UdpSocket::minPort;
......@@ -149,7 +149,7 @@ namespace RTC
}
// Try to bind on it.
bind_attempt++;
++bind_attempt;
uvHandle = new uv_udp_t();
......
......@@ -263,7 +263,7 @@ void Settings::SetDefaultRtcListenIP(int requested_family)
if (err)
MS_ABORT("uv_interface_addresses() failed: %s", uv_strerror(err));
for (int i = 0; i < num_addresses; i++)
for (int i = 0; i < num_addresses; ++i)
{
uv_interface_address_t address = addresses[i];
......@@ -496,7 +496,7 @@ void Settings::SetLogTags(Json::Value& json)
std::vector<std::string> tags;
for (Json::UInt i = 0; i < json.size(); i++)
for (Json::UInt i = 0; i < json.size(); ++i)
{
Json::Value entry = json[i];
......
......@@ -144,7 +144,7 @@ void TcpServer::Close()
{
MS_DEBUG_DEV("closing %zu active connections", this->connections.size());
for (auto it = this->connections.begin(); it != this->connections.end(); it++)
for (auto it = this->connections.begin(); it != this->connections.end(); ++it)
{
TcpConnection* connection = *it;
connection->Close();
......
......@@ -144,7 +144,7 @@ void ignoreSignals()
if (err)
MS_THROW_ERROR("sigfillset() failed: %s", std::strerror(errno));
for (auto it = ignored_signals.begin(); it != ignored_signals.end(); it++)
for (auto it = ignored_signals.begin(); it != ignored_signals.end(); ++it)
{
auto& sig_name = it->first;
int sig_id = it->second;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论