RTC_[D]CHECK_op: Remove superfluous casts

There's no longer any need to make the two arguments have the same
signedness, so we can remove a bunch of superfluous (and sometimes
dangerous) casts.

It turned out I also had to fix the safe_cmp functions to properly handle
enums that are implicitly convertible to integers.

NOPRESUBMIT=true
BUG=webrtc:6645

Review-Url: https://codereview.webrtc.org/2534683002
Cr-Commit-Position: refs/heads/master@{#15281}
This commit is contained in:
kwiberg
2016-11-28 15:58:53 -08:00
committed by Commit bot
parent af476c737f
commit 352444fcac
30 changed files with 140 additions and 74 deletions

View File

@ -69,12 +69,11 @@ void DownSampler::Initialize(int sample_rate_hz) {
void DownSampler::DownSample(rtc::ArrayView<const float> in,
rtc::ArrayView<float> out) {
data_dumper_->DumpWav("lc_down_sampler_input", in, sample_rate_hz_, 1);
RTC_DCHECK_EQ(static_cast<size_t>(sample_rate_hz_ *
AudioProcessing::kChunkSizeMs / 1000),
RTC_DCHECK_EQ(sample_rate_hz_ * AudioProcessing::kChunkSizeMs / 1000,
in.size());
RTC_DCHECK_EQ(static_cast<size_t>(AudioProcessing::kSampleRate8kHz *
AudioProcessing::kChunkSizeMs / 1000),
out.size());
RTC_DCHECK_EQ(
AudioProcessing::kSampleRate8kHz * AudioProcessing::kChunkSizeMs / 1000,
out.size());
const size_t kMaxNumFrames =
AudioProcessing::kSampleRate48kHz * AudioProcessing::kChunkSizeMs / 1000;
float x[kMaxNumFrames];

View File

@ -129,7 +129,7 @@ void SignalClassifier::Initialize(int sample_rate_hz) {
void SignalClassifier::Analyze(const AudioBuffer& audio,
SignalType* signal_type) {
RTC_DCHECK_EQ(audio.num_frames(), static_cast<size_t>(sample_rate_hz_ / 100));
RTC_DCHECK_EQ(audio.num_frames(), sample_rate_hz_ / 100);
// Compute the signal power spectrum.
float downsampled_frame[80];