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

Side by Side Diff: webrtc/common_audio/wav_file.cc

Issue 2719733002: Replace NULL with nullptr or null in webrtc/audio/ and common_audio/. (Closed)
Patch Set: Fixing test. Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « webrtc/common_audio/vad/vad_core_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 chunk = ReadSamples(chunk, isamples); 100 chunk = ReadSamples(chunk, isamples);
101 for (size_t j = 0; j < chunk; ++j) 101 for (size_t j = 0; j < chunk; ++j)
102 samples[i + j] = isamples[j]; 102 samples[i + j] = isamples[j];
103 read += chunk; 103 read += chunk;
104 } 104 }
105 return read; 105 return read;
106 } 106 }
107 107
108 void WavReader::Close() { 108 void WavReader::Close() {
109 RTC_CHECK_EQ(0, fclose(file_handle_)); 109 RTC_CHECK_EQ(0, fclose(file_handle_));
110 file_handle_ = NULL; 110 file_handle_ = nullptr;
111 } 111 }
112 112
113 WavWriter::WavWriter(const std::string& filename, int sample_rate, 113 WavWriter::WavWriter(const std::string& filename, int sample_rate,
114 size_t num_channels) 114 size_t num_channels)
115 : sample_rate_(sample_rate), 115 : sample_rate_(sample_rate),
116 num_channels_(num_channels), 116 num_channels_(num_channels),
117 num_samples_(0), 117 num_samples_(0),
118 file_handle_(fopen(filename.c_str(), "wb")) { 118 file_handle_(fopen(filename.c_str(), "wb")) {
119 RTC_CHECK(file_handle_) << "Could not open wav file for writing."; 119 RTC_CHECK(file_handle_) << "Could not open wav file for writing.";
120 RTC_CHECK(CheckWavParameters(num_channels_, sample_rate_, kWavFormat, 120 RTC_CHECK(CheckWavParameters(num_channels_, sample_rate_, kWavFormat,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 } 164 }
165 165
166 void WavWriter::Close() { 166 void WavWriter::Close() {
167 RTC_CHECK_EQ(0, fseek(file_handle_, 0, SEEK_SET)); 167 RTC_CHECK_EQ(0, fseek(file_handle_, 0, SEEK_SET));
168 uint8_t header[kWavHeaderSize]; 168 uint8_t header[kWavHeaderSize];
169 WriteWavHeader(header, num_channels_, sample_rate_, kWavFormat, 169 WriteWavHeader(header, num_channels_, sample_rate_, kWavFormat,
170 kBytesPerSample, num_samples_); 170 kBytesPerSample, num_samples_);
171 RTC_CHECK_EQ(1, fwrite(header, kWavHeaderSize, 1, file_handle_)); 171 RTC_CHECK_EQ(1, fwrite(header, kWavHeaderSize, 1, file_handle_));
172 RTC_CHECK_EQ(0, fclose(file_handle_)); 172 RTC_CHECK_EQ(0, fclose(file_handle_));
173 file_handle_ = NULL; 173 file_handle_ = nullptr;
174 } 174 }
175 175
176 } // namespace webrtc 176 } // namespace webrtc
177 177
178 rtc_WavWriter* rtc_WavOpen(const char* filename, 178 rtc_WavWriter* rtc_WavOpen(const char* filename,
179 int sample_rate, 179 int sample_rate,
180 size_t num_channels) { 180 size_t num_channels) {
181 return reinterpret_cast<rtc_WavWriter*>( 181 return reinterpret_cast<rtc_WavWriter*>(
182 new webrtc::WavWriter(filename, sample_rate, num_channels)); 182 new webrtc::WavWriter(filename, sample_rate, num_channels));
183 } 183 }
(...skipping 12 matching lines...) Expand all
196 return reinterpret_cast<const webrtc::WavWriter*>(wf)->sample_rate(); 196 return reinterpret_cast<const webrtc::WavWriter*>(wf)->sample_rate();
197 } 197 }
198 198
199 size_t rtc_WavNumChannels(const rtc_WavWriter* wf) { 199 size_t rtc_WavNumChannels(const rtc_WavWriter* wf) {
200 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_channels(); 200 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_channels();
201 } 201 }
202 202
203 size_t rtc_WavNumSamples(const rtc_WavWriter* wf) { 203 size_t rtc_WavNumSamples(const rtc_WavWriter* wf) {
204 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_samples(); 204 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_samples();
205 } 205 }
OLDNEW
« no previous file with comments | « webrtc/common_audio/vad/vad_core_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698