Fixing warning C4267 on Win (more_configs).

This is a follow-up of https://webrtc-review.googlesource.com/c/src/+/12921.

Bug: chromium:759980
Change-Id: Ifd39adb6541c0c7e0337f587a8b34b84a07331ed
Reviewed-on: https://webrtc-review.googlesource.com/13122
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20341}
This commit is contained in:
Mirko Bonadei
2017-10-19 09:00:17 +02:00
committed by Commit Bot
parent 117c48291c
commit 737e073f8d
16 changed files with 70 additions and 43 deletions

View File

@ -9,6 +9,7 @@
*/
#include "modules/audio_coding/neteq/audio_vector.h"
#include "rtc_base/safe_conversions.h"
#include <assert.h>
#include <stdlib.h>
@ -25,7 +26,7 @@ class AudioVectorTest : public ::testing::Test {
virtual void SetUp() {
// Populate test array.
for (size_t i = 0; i < array_length(); ++i) {
array_[i] = i;
array_[i] = rtc::checked_cast<int16_t>(i);
}
}
@ -253,7 +254,7 @@ TEST_F(AudioVectorTest, InsertAtEnd) {
for (int i = 0; i < kNewLength; ++i) {
new_array[i] = 100 + i;
}
int insert_position = array_length();
int insert_position = rtc::checked_cast<int>(array_length());
vec.InsertAt(new_array, kNewLength, insert_position);
// Verify that the vector looks as follows:
// {0, 1, ..., kLength - 1, 100, 101, ..., 100 + kNewLength - 1 }.
@ -282,7 +283,8 @@ TEST_F(AudioVectorTest, InsertBeyondEnd) {
for (int i = 0; i < kNewLength; ++i) {
new_array[i] = 100 + i;
}
int insert_position = array_length() + 10; // Too large.
int insert_position = rtc::checked_cast<int>(
array_length() + 10); // Too large.
vec.InsertAt(new_array, kNewLength, insert_position);
// Verify that the vector looks as follows:
// {0, 1, ..., kLength - 1, 100, 101, ..., 100 + kNewLength - 1 }.
@ -338,7 +340,7 @@ TEST_F(AudioVectorTest, OverwriteBeyondEnd) {
for (int i = 0; i < kNewLength; ++i) {
new_array[i] = 100 + i;
}
int insert_position = array_length() - 2;
int insert_position = rtc::checked_cast<int>(array_length() - 2);
vec.OverwriteAt(new_array, kNewLength, insert_position);
ASSERT_EQ(array_length() - 2u + kNewLength, vec.Size());
// Verify that the vector looks as follows: