Avoid implicit type truncations by inserting explicit casts or modifying prototypes to avoid needless up- and then down-casting.

BUG=chromium:82439
TEST=none
R=henrik.lundin@webrtc.org, mflodman@webrtc.org, pthatcher@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/40569004

Cr-Commit-Position: refs/heads/master@{#8229}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8229 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pkasting@chromium.org
2015-02-02 23:54:03 +00:00
parent 19f3f71c98
commit 0e81fdf5d2
10 changed files with 62 additions and 117 deletions

View File

@ -61,7 +61,7 @@ bool AcmSendTest::RegisterCodec(int codec_type,
Packet* AcmSendTest::NextPacket() {
assert(codec_registered_);
if (filter_.test(payload_type_)) {
if (filter_.test(static_cast<size_t>(payload_type_))) {
// This payload type should be filtered out. Since the payload type is the
// same throughout the whole test run, no packet at all will be delivered.
// We can just as well signal that the test is over by returning NULL.
@ -111,7 +111,7 @@ Packet* AcmSendTest::CreatePacket() {
uint8_t* packet_memory = new uint8_t[allocated_bytes];
// Populate the header bytes.
packet_memory[0] = 0x80;
packet_memory[1] = payload_type_;
packet_memory[1] = static_cast<uint8_t>(payload_type_);
packet_memory[2] = (sequence_number_ >> 8) & 0xFF;
packet_memory[3] = (sequence_number_) & 0xFF;
packet_memory[4] = (timestamp_ >> 24) & 0xFF;

View File

@ -64,7 +64,7 @@ bool AcmSendTestOldApi::RegisterCodec(const char* payload_name,
Packet* AcmSendTestOldApi::NextPacket() {
assert(codec_registered_);
if (filter_.test(payload_type_)) {
if (filter_.test(static_cast<size_t>(payload_type_))) {
// This payload type should be filtered out. Since the payload type is the
// same throughout the whole test run, no packet at all will be delivered.
// We can just as well signal that the test is over by returning NULL.
@ -115,7 +115,7 @@ Packet* AcmSendTestOldApi::CreatePacket() {
uint8_t* packet_memory = new uint8_t[allocated_bytes];
// Populate the header bytes.
packet_memory[0] = 0x80;
packet_memory[1] = payload_type_;
packet_memory[1] = static_cast<uint8_t>(payload_type_);
packet_memory[2] = (sequence_number_ >> 8) & 0xFF;
packet_memory[3] = (sequence_number_) & 0xFF;
packet_memory[4] = (timestamp_ >> 24) & 0xFF;