[-Wshadow] - Fix some warnings.
First CL to try to understand the extent of the cleanup needed in
order to remove -Wno-shadow and follow Chromium on enabling this
diagnostic.
Bug: webrtc:13219
Change-Id: Ie699762da50fe3dbc08b1fd92220962d4b7da86b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/233641
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35134}
diff --git a/logging/rtc_event_log/rtc_event_log_parser.cc b/logging/rtc_event_log/rtc_event_log_parser.cc
index 6ae4bde..f778498 100644
--- a/logging/rtc_event_log/rtc_event_log_parser.cc
+++ b/logging/rtc_event_log/rtc_event_log_parser.cc
@@ -1171,24 +1171,24 @@
const int64_t timestamp_us = incoming.rtcp.timestamp.us();
const uint8_t* packet_begin = incoming.rtcp.raw_data.data();
const uint8_t* packet_end = packet_begin + incoming.rtcp.raw_data.size();
- auto status = StoreRtcpBlocks(
+ auto store_rtcp_status = StoreRtcpBlocks(
timestamp_us, packet_begin, packet_end, &incoming_sr_, &incoming_rr_,
&incoming_xr_, &incoming_remb_, &incoming_nack_, &incoming_fir_,
&incoming_pli_, &incoming_bye_, &incoming_transport_feedback_,
&incoming_loss_notification_);
- RTC_RETURN_IF_ERROR(status);
+ RTC_RETURN_IF_ERROR(store_rtcp_status);
}
for (const auto& outgoing : outgoing_rtcp_packets_) {
const int64_t timestamp_us = outgoing.rtcp.timestamp.us();
const uint8_t* packet_begin = outgoing.rtcp.raw_data.data();
const uint8_t* packet_end = packet_begin + outgoing.rtcp.raw_data.size();
- auto status = StoreRtcpBlocks(
+ auto store_rtcp_status = StoreRtcpBlocks(
timestamp_us, packet_begin, packet_end, &outgoing_sr_, &outgoing_rr_,
&outgoing_xr_, &outgoing_remb_, &outgoing_nack_, &outgoing_fir_,
&outgoing_pli_, &outgoing_bye_, &outgoing_transport_feedback_,
&outgoing_loss_notification_);
- RTC_RETURN_IF_ERROR(status);
+ RTC_RETURN_IF_ERROR(store_rtcp_status);
}
// Store first and last timestamp events that might happen before the call is
@@ -3165,12 +3165,12 @@
runtime_config.frame_length_ms = signed_frame_length_ms;
}
if (uplink_packet_loss_fraction_values[i].has_value()) {
- float uplink_packet_loss_fraction;
+ float uplink_packet_loss_fraction2;
RTC_PARSE_CHECK_OR_RETURN(ParsePacketLossFractionFromProtoFormat(
rtc::checked_cast<uint32_t>(
uplink_packet_loss_fraction_values[i].value()),
- &uplink_packet_loss_fraction));
- runtime_config.uplink_packet_loss_fraction = uplink_packet_loss_fraction;
+ &uplink_packet_loss_fraction2));
+ runtime_config.uplink_packet_loss_fraction = uplink_packet_loss_fraction2;
}
if (enable_fec_values[i].has_value()) {
runtime_config.enable_fec =
diff --git a/logging/rtc_event_log/rtc_event_log_unittest.cc b/logging/rtc_event_log/rtc_event_log_unittest.cc
index a494d9e..72e15fc 100644
--- a/logging/rtc_event_log/rtc_event_log_unittest.cc
+++ b/logging/rtc_event_log/rtc_event_log_unittest.cc
@@ -272,9 +272,9 @@
} while (SsrcUsed(ssrc, incoming_extensions_));
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
incoming_extensions_.emplace_back(ssrc, extensions);
- auto event = gen_.NewVideoReceiveStreamConfig(ssrc, extensions);
- event_log->Log(event->Copy());
- video_recv_config_list_.push_back(std::move(event));
+ auto new_event = gen_.NewVideoReceiveStreamConfig(ssrc, extensions);
+ event_log->Log(new_event->Copy());
+ video_recv_config_list_.push_back(std::move(new_event));
}
}
diff --git a/media/engine/webrtc_voice_engine_unittest.cc b/media/engine/webrtc_voice_engine_unittest.cc
index 8007210..088dba2 100644
--- a/media/engine/webrtc_voice_engine_unittest.cc
+++ b/media/engine/webrtc_voice_engine_unittest.cc
@@ -1569,17 +1569,17 @@
for (int i = 1; i < 32; i++) {
parameters.codecs[0].params[""] += "/111";
SetSendParameters(parameters);
- const auto& send_codec_spec = *GetSendStreamConfig(kSsrcX).send_codec_spec;
- EXPECT_EQ(111, send_codec_spec.payload_type);
- EXPECT_STRCASEEQ("opus", send_codec_spec.format.name.c_str());
- EXPECT_EQ(112, send_codec_spec.red_payload_type);
+ const auto& send_codec_spec2 = *GetSendStreamConfig(kSsrcX).send_codec_spec;
+ EXPECT_EQ(111, send_codec_spec2.payload_type);
+ EXPECT_STRCASEEQ("opus", send_codec_spec2.format.name.c_str());
+ EXPECT_EQ(112, send_codec_spec2.red_payload_type);
}
parameters.codecs[0].params[""] += "/111";
SetSendParameters(parameters);
- const auto& send_codec_spec2 = *GetSendStreamConfig(kSsrcX).send_codec_spec;
- EXPECT_EQ(111, send_codec_spec2.payload_type);
- EXPECT_STRCASEEQ("opus", send_codec_spec2.format.name.c_str());
- EXPECT_EQ(absl::nullopt, send_codec_spec2.red_payload_type);
+ const auto& send_codec_spec3 = *GetSendStreamConfig(kSsrcX).send_codec_spec;
+ EXPECT_EQ(111, send_codec_spec3.payload_type);
+ EXPECT_STRCASEEQ("opus", send_codec_spec3.format.name.c_str());
+ EXPECT_EQ(absl::nullopt, send_codec_spec3.red_payload_type);
}
// Test that WebRtcVoiceEngine reconfigures, rather than recreates its
diff --git a/modules/audio_processing/audio_processing_unittest.cc b/modules/audio_processing/audio_processing_unittest.cc
index e763b78..100a3c0 100644
--- a/modules/audio_processing/audio_processing_unittest.cc
+++ b/modules/audio_processing/audio_processing_unittest.cc
@@ -1841,16 +1841,16 @@
const int kStatsAggregationFrameNum = 100; // 1 second.
if (frame_count % kStatsAggregationFrameNum == 0) {
// Get echo and delay metrics.
- AudioProcessingStats stats = apm_->GetStatistics();
+ AudioProcessingStats stats2 = apm_->GetStatistics();
// Echo metrics.
- const float echo_return_loss = stats.echo_return_loss.value_or(-1.0f);
+ const float echo_return_loss = stats2.echo_return_loss.value_or(-1.0f);
const float echo_return_loss_enhancement =
- stats.echo_return_loss_enhancement.value_or(-1.0f);
+ stats2.echo_return_loss_enhancement.value_or(-1.0f);
const float residual_echo_likelihood =
- stats.residual_echo_likelihood.value_or(-1.0f);
+ stats2.residual_echo_likelihood.value_or(-1.0f);
const float residual_echo_likelihood_recent_max =
- stats.residual_echo_likelihood_recent_max.value_or(-1.0f);
+ stats2.residual_echo_likelihood_recent_max.value_or(-1.0f);
if (!absl::GetFlag(FLAGS_write_apm_ref_data)) {
const audioproc::Test::EchoMetrics& reference =
diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm
index 701d444..f10111a 100644
--- a/modules/desktop_capture/mac/screen_capturer_mac.mm
+++ b/modules/desktop_capture/mac/screen_capturer_mac.mm
@@ -107,10 +107,10 @@
CFArrayRef window_array = CGWindowListCreateDescriptionFromArray(window_id_array);
if (CFArrayGetCount(window_array) > 0) {
- CFDictionaryRef window =
+ CFDictionaryRef win =
reinterpret_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(window_array, 0));
CFDictionaryRef bounds_ref =
- reinterpret_cast<CFDictionaryRef>(CFDictionaryGetValue(window, kCGWindowBounds));
+ reinterpret_cast<CFDictionaryRef>(CFDictionaryGetValue(win, kCGWindowBounds));
CGRectMakeWithDictionaryRepresentation(bounds_ref, &rect);
}
@@ -374,13 +374,13 @@
// Copy the dirty region from the display buffer into our desktop buffer.
uint8_t* out_ptr = frame.GetFrameDataAtPos(display_bounds.top_left());
- for (DesktopRegion::Iterator i(copy_region); !i.IsAtEnd(); i.Advance()) {
+ for (DesktopRegion::Iterator it(copy_region); !it.IsAtEnd(); it.Advance()) {
CopyRect(display_base_address,
src_bytes_per_row,
out_ptr,
frame.stride(),
DesktopFrame::kBytesPerPixel,
- i.rect());
+ it.rect());
}
if (excluded_image) {
diff --git a/pc/stats_collector.cc b/pc/stats_collector.cc
index cad9cf6..113716c 100644
--- a/pc/stats_collector.cc
+++ b/pc/stats_collector.cc
@@ -962,9 +962,9 @@
}
for (const auto& channel_iter : transport.stats.channel_stats) {
- StatsReport::Id id(
+ StatsReport::Id channel_stats_id(
StatsReport::NewComponentId(transport.name, channel_iter.component));
- StatsReport* channel_report = reports_.ReplaceOrAddNew(id);
+ StatsReport* channel_report = reports_.ReplaceOrAddNew(channel_stats_id);
channel_report->set_timestamp(stats_gathering_started_);
channel_report->AddInt(StatsReport::kStatsValueNameComponent,
channel_iter.component);
diff --git a/rtc_base/callback_list_unittest.cc b/rtc_base/callback_list_unittest.cc
index 665d779..23dfff0 100644
--- a/rtc_base/callback_list_unittest.cc
+++ b/rtc_base/callback_list_unittest.cc
@@ -128,7 +128,7 @@
LargeNonTrivial(LargeNonTrivial&& m) {}
~LargeNonTrivial() = default;
- void operator()(int& a) { a = 1; }
+ void operator()(int& b) { b = 1; }
};
TEST(CallbackList, LargeNonTrivialTest) {
diff --git a/rtc_base/socket_adapters.cc b/rtc_base/socket_adapters.cc
index ee8ec87..c6cd196 100644
--- a/rtc_base/socket_adapters.cc
+++ b/rtc_base/socket_adapters.cc
@@ -308,12 +308,12 @@
if (data[pos++] != '\n')
continue;
- size_t len = pos - start - 1;
- if ((len > 0) && (data[start + len - 1] == '\r'))
- --len;
+ size_t length = pos - start - 1;
+ if ((length > 0) && (data[start + length - 1] == '\r'))
+ --length;
- data[start + len] = 0;
- ProcessLine(data + start, len);
+ data[start + length] = 0;
+ ProcessLine(data + start, length);
start = pos;
}
@@ -566,9 +566,9 @@
return;
RTC_LOG(LS_VERBOSE) << "Bound on " << addr << ":" << port;
} else if (atyp == 3) {
- uint8_t len;
+ uint8_t length;
std::string addr;
- if (!response.ReadUInt8(&len) || !response.ReadString(&addr, len) ||
+ if (!response.ReadUInt8(&length) || !response.ReadString(&addr, length) ||
!response.ReadUInt16(&port))
return;
RTC_LOG(LS_VERBOSE) << "Bound on " << addr << ":" << port;
diff --git a/rtc_base/virtual_socket_server.cc b/rtc_base/virtual_socket_server.cc
index d2bf56e..bcda9cd 100644
--- a/rtc_base/virtual_socket_server.cc
+++ b/rtc_base/virtual_socket_server.cc
@@ -846,12 +846,12 @@
MessageAddress* data = static_cast<MessageAddress*>(it->pdata);
SocketAddress local_addr = socket->GetLocalAddress();
// Lookup remote side.
- VirtualSocket* socket = LookupConnection(local_addr, data->addr);
- if (socket) {
+ VirtualSocket* lookup_socket = LookupConnection(local_addr, data->addr);
+ if (lookup_socket) {
// Server socket, remote side is a socket retreived by
// accept. Accepted sockets are not bound so we will not
// find it by looking in the bindings table.
- Disconnect(socket);
+ Disconnect(lookup_socket);
RemoveConnection(local_addr, data->addr);
} else {
Disconnect(data->addr);
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index eb4a37a..422f148 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -381,12 +381,12 @@
<< " " << media_bitrate_kbps << '\n';
}
- int num_total_frames =
+ int num_total_frames2 =
stats.frame_counts.key_frames + stats.frame_counts.delta_frames;
- if (num_total_frames >= kMinRequiredSamples) {
+ if (num_total_frames2 >= kMinRequiredSamples) {
int num_key_frames = stats.frame_counts.key_frames;
int key_frames_permille =
- (num_key_frames * 1000 + num_total_frames / 2) / num_total_frames;
+ (num_key_frames * 1000 + num_total_frames2 / 2) / num_total_frames2;
RTC_HISTOGRAM_COUNTS_SPARSE_1000(
uma_prefix + ".KeyFramesReceivedInPermille" + uma_suffix,
key_frames_permille);
@@ -394,12 +394,12 @@
<< " " << key_frames_permille << '\n';
}
- absl::optional<int> qp = stats.qp_counter.Avg(kMinRequiredSamples);
- if (qp) {
+ absl::optional<int> qp2 = stats.qp_counter.Avg(kMinRequiredSamples);
+ if (qp2) {
RTC_HISTOGRAM_COUNTS_SPARSE_200(
- uma_prefix + ".Decoded.Vp8.Qp" + uma_suffix, *qp);
+ uma_prefix + ".Decoded.Vp8.Qp" + uma_suffix, *qp2);
log_stream << uma_prefix << ".Decoded.Vp8.Qp" << uma_suffix << " "
- << *qp << '\n';
+ << *qp2 << '\n';
}
}
}