[readability-container-size-empty] Use empty() to check for emptiness.

Bug: None
Change-Id: If3cefd0f50521357a7fadef661954d2845246db6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146718
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28683}
This commit is contained in:
Mirko Bonadei
2019-07-25 15:28:14 +02:00
committed by Commit Bot
parent 733a78157d
commit 1f1731509c
3 changed files with 6 additions and 6 deletions

View File

@ -80,7 +80,7 @@ std::string SsrcToString(uint32_t ssrc) {
// Checks whether an SSRC is contained in the list of desired SSRCs.
// Note that an empty SSRC list matches every SSRC.
bool MatchingSsrc(uint32_t ssrc, const std::vector<uint32_t>& desired_ssrc) {
if (desired_ssrc.size() == 0)
if (desired_ssrc.empty())
return true;
return std::find(desired_ssrc.begin(), desired_ssrc.end(), ssrc) !=
desired_ssrc.end();
@ -707,7 +707,7 @@ void EventLogAnalyzer::CreateIncomingPacketLossGraph(Plot* plot) {
const std::vector<LoggedRtpPacketIncoming>& packets =
stream.incoming_packets;
// Filter on SSRC.
if (!MatchingSsrc(stream.ssrc, desired_ssrc_) || packets.size() == 0) {
if (!MatchingSsrc(stream.ssrc, desired_ssrc_) || packets.empty()) {
continue;
}

View File

@ -88,7 +88,7 @@ void Plot::AppendIntervalSeries(IntervalSeries&& interval_series) {
}
void Plot::AppendTimeSeriesIfNotEmpty(TimeSeries&& time_series) {
if (time_series.points.size() > 0) {
if (!time_series.points.empty()) {
series_list_.emplace_back(std::move(time_series));
}
}

View File

@ -39,7 +39,7 @@ void PythonPlot::Draw() {
printf("\n# === Series: %s ===\n", series_list_[i].label.c_str());
// List x coordinates
printf("x%zu = [", i);
if (series_list_[i].points.size() > 0)
if (!series_list_[i].points.empty())
printf("%.3f", series_list_[i].points[0].x);
for (size_t j = 1; j < series_list_[i].points.size(); j++)
printf(", %.3f", series_list_[i].points[j].x);
@ -47,7 +47,7 @@ void PythonPlot::Draw() {
// List y coordinates
printf("y%zu = [", i);
if (series_list_[i].points.size() > 0)
if (!series_list_[i].points.empty())
printf("%G", series_list_[i].points[0].y);
for (size_t j = 1; j < series_list_[i].points.size(); j++)
printf(", %G", series_list_[i].points[j].y);
@ -114,7 +114,7 @@ void PythonPlot::Draw() {
printf("\n# === IntervalSeries: %s ===\n",
interval_list_[i].label.c_str());
printf("ival%zu = [", i);
if (interval_list_[i].intervals.size() > 0) {
if (!interval_list_[i].intervals.empty()) {
printf("(%G, %G)", interval_list_[i].intervals[0].begin,
interval_list_[i].intervals[0].end);
}