0

Add explicit type conversions where necessary: net/

These are cases that are implicitly narrowing today, and must do so
explicitly in order to enable -Wc++11-narrowing.  No behavior change
intended.

Bug: 1216696
Change-Id: I1e4747391cbfb7e3f4d38669c493b387faa9c9fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2947889
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#890835}
This commit is contained in:
Peter Kasting
2021-06-09 17:24:58 +00:00
committed by Chromium LUCI CQ
parent 1ba786c9b6
commit 241e6d261d
4 changed files with 9 additions and 9 deletions

@ -1361,7 +1361,7 @@ TEST(HttpStreamParser, Http09PortTests) {
get_runner.response_info()->headers->GetStatusLine());
EXPECT_EQ(0, get_runner.parser()->received_bytes());
int read_lengths[] = {kResponse.size(), 0};
int read_lengths[] = {static_cast<int>(kResponse.size()), 0};
get_runner.ReadBody(kResponse.size(), read_lengths);
EXPECT_EQ(kResponse.size(),
static_cast<size_t>(get_runner.parser()->received_bytes()));
@ -1386,7 +1386,7 @@ TEST(HttpStreamParser, Http09PortTests) {
get_runner.response_info()->headers->GetStatusLine());
EXPECT_EQ(0, get_runner.parser()->received_bytes());
int read_lengths[] = {kShoutcastResponse.size(), 0};
int read_lengths[] = {static_cast<int>(kShoutcastResponse.size()), 0};
get_runner.ReadBody(kShoutcastResponse.size(), read_lengths);
EXPECT_EQ(kShoutcastResponse.size(),
static_cast<size_t>(get_runner.parser()->received_bytes()));

@ -23,7 +23,7 @@ QuicIpAddress TestLoopbackImpl() {
}
QuicIpAddress TestLoopbackImpl(int index) {
const char kLocalhostIPv4[] = {127, 0, 0, index};
const char kLocalhostIPv4[] = {127, 0, 0, static_cast<char>(index)};
QuicIpAddress address;
address.FromPackedString(kLocalhostIPv4, 4);
return address;

@ -941,11 +941,11 @@ class QuicNetworkTransactionTest
GetNthClientInitiatedBidirectionalStreamId(n);
EXPECT_LT(cancelled_stream_id, 63u);
const unsigned char opcode = 0x40;
const char opcode = 0x40;
if (create_stream) {
return {0x03, opcode | static_cast<unsigned char>(cancelled_stream_id)};
return {0x03, static_cast<char>(opcode | cancelled_stream_id)};
} else {
return {opcode | static_cast<unsigned char>(cancelled_stream_id)};
return {static_cast<char>(opcode | cancelled_stream_id)};
}
}

@ -835,11 +835,11 @@ class QuicStreamFactoryTestBase : public WithTaskEnvironment {
GetNthClientInitiatedBidirectionalStreamId(n);
EXPECT_LT(cancelled_stream_id, 63u);
const unsigned char opcode = 0x40;
const char opcode = 0x40;
if (create_stream) {
return {0x03, opcode | static_cast<unsigned char>(cancelled_stream_id)};
return {0x03, static_cast<char>(opcode | cancelled_stream_id)};
} else {
return {opcode | static_cast<unsigned char>(cancelled_stream_id)};
return {static_cast<char>(opcode | cancelled_stream_id)};
}
}