Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(704)

Unified Diff: webrtc/common_audio/wav_file.cc

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/common_audio/wav_file.h ('k') | webrtc/common_audio/wav_header.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_audio/wav_file.cc
diff --git a/webrtc/common_audio/wav_file.cc b/webrtc/common_audio/wav_file.cc
index a0c792c54a6fab246dd66afca5af860cdb53a7f8..8dae7d6e98cb2fe17145bb435620c0de65ce453d 100644
--- a/webrtc/common_audio/wav_file.cc
+++ b/webrtc/common_audio/wav_file.cc
@@ -39,16 +39,16 @@ class ReadableWavFile : public ReadableWav {
WavReader::WavReader(const std::string& filename)
: file_handle_(fopen(filename.c_str(), "rb")) {
- CHECK(file_handle_ && "Could not open wav file for reading.");
+ RTC_CHECK(file_handle_ && "Could not open wav file for reading.");
ReadableWavFile readable(file_handle_);
WavFormat format;
int bytes_per_sample;
- CHECK(ReadWavHeader(&readable, &num_channels_, &sample_rate_, &format,
- &bytes_per_sample, &num_samples_));
+ RTC_CHECK(ReadWavHeader(&readable, &num_channels_, &sample_rate_, &format,
+ &bytes_per_sample, &num_samples_));
num_samples_remaining_ = num_samples_;
- CHECK_EQ(kWavFormat, format);
- CHECK_EQ(kBytesPerSample, bytes_per_sample);
+ RTC_CHECK_EQ(kWavFormat, format);
+ RTC_CHECK_EQ(kBytesPerSample, bytes_per_sample);
}
WavReader::~WavReader() {
@@ -65,8 +65,8 @@ size_t WavReader::ReadSamples(size_t num_samples, int16_t* samples) {
const size_t read =
fread(samples, sizeof(*samples), num_samples, file_handle_);
// If we didn't read what was requested, ensure we've reached the EOF.
- CHECK(read == num_samples || feof(file_handle_));
- CHECK_LE(read, num_samples_remaining_);
+ RTC_CHECK(read == num_samples || feof(file_handle_));
+ RTC_CHECK_LE(read, num_samples_remaining_);
num_samples_remaining_ -= rtc::checked_cast<uint32_t>(read);
return read;
}
@@ -86,7 +86,7 @@ size_t WavReader::ReadSamples(size_t num_samples, float* samples) {
}
void WavReader::Close() {
- CHECK_EQ(0, fclose(file_handle_));
+ RTC_CHECK_EQ(0, fclose(file_handle_));
file_handle_ = NULL;
}
@@ -96,17 +96,14 @@ WavWriter::WavWriter(const std::string& filename, int sample_rate,
num_channels_(num_channels),
num_samples_(0),
file_handle_(fopen(filename.c_str(), "wb")) {
- CHECK(file_handle_ && "Could not open wav file for writing.");
- CHECK(CheckWavParameters(num_channels_,
- sample_rate_,
- kWavFormat,
- kBytesPerSample,
- num_samples_));
+ RTC_CHECK(file_handle_ && "Could not open wav file for writing.");
+ RTC_CHECK(CheckWavParameters(num_channels_, sample_rate_, kWavFormat,
+ kBytesPerSample, num_samples_));
// Write a blank placeholder header, since we need to know the total number
// of samples before we can fill in the real data.
static const uint8_t blank_header[kWavHeaderSize] = {0};
- CHECK_EQ(1u, fwrite(blank_header, kWavHeaderSize, 1, file_handle_));
+ RTC_CHECK_EQ(1u, fwrite(blank_header, kWavHeaderSize, 1, file_handle_));
}
WavWriter::~WavWriter() {
@@ -119,10 +116,10 @@ void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) {
#endif
const size_t written =
fwrite(samples, sizeof(*samples), num_samples, file_handle_);
- CHECK_EQ(num_samples, written);
+ RTC_CHECK_EQ(num_samples, written);
num_samples_ += static_cast<uint32_t>(written);
- CHECK(written <= std::numeric_limits<uint32_t>::max() ||
- num_samples_ >= written); // detect uint32_t overflow
+ RTC_CHECK(written <= std::numeric_limits<uint32_t>::max() ||
+ num_samples_ >= written); // detect uint32_t overflow
}
void WavWriter::WriteSamples(const float* samples, size_t num_samples) {
@@ -136,12 +133,12 @@ void WavWriter::WriteSamples(const float* samples, size_t num_samples) {
}
void WavWriter::Close() {
- CHECK_EQ(0, fseek(file_handle_, 0, SEEK_SET));
+ RTC_CHECK_EQ(0, fseek(file_handle_, 0, SEEK_SET));
uint8_t header[kWavHeaderSize];
WriteWavHeader(header, num_channels_, sample_rate_, kWavFormat,
kBytesPerSample, num_samples_);
- CHECK_EQ(1u, fwrite(header, kWavHeaderSize, 1, file_handle_));
- CHECK_EQ(0, fclose(file_handle_));
+ RTC_CHECK_EQ(1u, fwrite(header, kWavHeaderSize, 1, file_handle_));
+ RTC_CHECK_EQ(0, fclose(file_handle_));
file_handle_ = NULL;
}
« no previous file with comments | « webrtc/common_audio/wav_file.h ('k') | webrtc/common_audio/wav_header.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698