[-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}
This commit is contained in:
Mirko Bonadei 2021-10-03 11:26:11 +02:00 committed by WebRTC LUCI CQ
parent e3d26f534d
commit 54c90f2330
10 changed files with 47 additions and 47 deletions

View File

@ -1171,24 +1171,24 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::ParseStream(
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 @@ ParsedRtcEventLog::StoreAudioNetworkAdaptationEvent(
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 =

View File

@ -272,9 +272,9 @@ void RtcEventLogSession::WriteVideoRecvConfigs(size_t video_recv_streams,
} 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));
}
}

View File

@ -1569,17 +1569,17 @@ TEST_P(WebRtcVoiceEngineTestFake, SetSendCodecsRedFmtpAmountOfRedundancy) {
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

View File

@ -1841,16 +1841,16 @@ TEST_F(ApmTest, Process) {
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 =

View File

@ -107,10 +107,10 @@ DesktopRect GetExcludedWindowPixelBounds(CGWindowID window, float dip_to_pixel_s
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 @@ bool ScreenCapturerMac::CgBlit(const DesktopFrame& frame, const DesktopRegion& r
// 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) {

View File

@ -962,9 +962,9 @@ void StatsCollector::ExtractSessionInfo_s(SessionStats& session_stats) {
}
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);

View File

@ -128,7 +128,7 @@ struct LargeNonTrivial {
LargeNonTrivial(LargeNonTrivial&& m) {}
~LargeNonTrivial() = default;
void operator()(int& a) { a = 1; }
void operator()(int& b) { b = 1; }
};
TEST(CallbackList, LargeNonTrivialTest) {

View File

@ -308,12 +308,12 @@ void AsyncHttpsProxySocket::ProcessInput(char* data, size_t* len) {
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 @@ void AsyncSocksProxySocket::ProcessInput(char* data, size_t* len) {
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;

View File

@ -846,12 +846,12 @@ void VirtualSocketServer::CancelConnects(VirtualSocket* socket) {
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);

View File

@ -381,12 +381,12 @@ void ReceiveStatisticsProxy::UpdateHistograms(
<< " " << 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 @@ void ReceiveStatisticsProxy::UpdateHistograms(
<< " " << 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';
}
}
}