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

Unified Diff: webrtc/modules/audio_processing/utility/delay_estimator.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 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
Index: webrtc/modules/audio_processing/utility/delay_estimator.cc
diff --git a/webrtc/modules/audio_processing/utility/delay_estimator.cc b/webrtc/modules/audio_processing/utility/delay_estimator.cc
index bc67ba1fe23af3f91e341d7280c59545f7f1f03e..34b2d600a646dd06c6b9984377ceb048cdd1fce3 100644
--- a/webrtc/modules/audio_processing/utility/delay_estimator.cc
+++ b/webrtc/modules/audio_processing/utility/delay_estimator.cc
@@ -258,39 +258,38 @@ static int RobustValidation(const BinaryDelayEstimator* self,
}
void WebRtc_FreeBinaryDelayEstimatorFarend(BinaryDelayEstimatorFarend* self) {
-
- if (self == NULL) {
+ if (self == nullptr) {
return;
}
free(self->binary_far_history);
- self->binary_far_history = NULL;
+ self->binary_far_history = nullptr;
free(self->far_bit_counts);
- self->far_bit_counts = NULL;
+ self->far_bit_counts = nullptr;
free(self);
}
BinaryDelayEstimatorFarend* WebRtc_CreateBinaryDelayEstimatorFarend(
int history_size) {
- BinaryDelayEstimatorFarend* self = NULL;
+ BinaryDelayEstimatorFarend* self = nullptr;
if (history_size > 1) {
// Sanity conditions fulfilled.
self = static_cast<BinaryDelayEstimatorFarend*>(
malloc(sizeof(BinaryDelayEstimatorFarend)));
}
- if (self == NULL) {
- return NULL;
+ if (self == nullptr) {
+ return nullptr;
}
self->history_size = 0;
- self->binary_far_history = NULL;
- self->far_bit_counts = NULL;
+ self->binary_far_history = nullptr;
+ self->far_bit_counts = nullptr;
if (WebRtc_AllocateFarendBufferMemory(self, history_size) == 0) {
WebRtc_FreeBinaryDelayEstimatorFarend(self);
- self = NULL;
+ self = nullptr;
}
return self;
}
@@ -305,7 +304,8 @@ int WebRtc_AllocateFarendBufferMemory(BinaryDelayEstimatorFarend* self,
self->far_bit_counts = static_cast<int*>(
realloc(self->far_bit_counts,
history_size * sizeof(*self->far_bit_counts)));
- if ((self->binary_far_history == NULL) || (self->far_bit_counts == NULL)) {
+ if ((self->binary_far_history == nullptr) ||
+ (self->far_bit_counts == nullptr)) {
history_size = 0;
}
// Fill with zeros if we have expanded the buffers.
@@ -378,41 +378,40 @@ void WebRtc_AddBinaryFarSpectrum(BinaryDelayEstimatorFarend* handle,
}
void WebRtc_FreeBinaryDelayEstimator(BinaryDelayEstimator* self) {
-
- if (self == NULL) {
+ if (self == nullptr) {
return;
}
free(self->mean_bit_counts);
- self->mean_bit_counts = NULL;
+ self->mean_bit_counts = nullptr;
free(self->bit_counts);
- self->bit_counts = NULL;
+ self->bit_counts = nullptr;
free(self->binary_near_history);
- self->binary_near_history = NULL;
+ self->binary_near_history = nullptr;
free(self->histogram);
- self->histogram = NULL;
+ self->histogram = nullptr;
// BinaryDelayEstimator does not have ownership of |farend|, hence we do not
// free the memory here. That should be handled separately by the user.
- self->farend = NULL;
+ self->farend = nullptr;
free(self);
}
BinaryDelayEstimator* WebRtc_CreateBinaryDelayEstimator(
BinaryDelayEstimatorFarend* farend, int max_lookahead) {
- BinaryDelayEstimator* self = NULL;
+ BinaryDelayEstimator* self = nullptr;
- if ((farend != NULL) && (max_lookahead >= 0)) {
+ if ((farend != nullptr) && (max_lookahead >= 0)) {
// Sanity conditions fulfilled.
self = static_cast<BinaryDelayEstimator*>(
malloc(sizeof(BinaryDelayEstimator)));
}
- if (self == NULL) {
- return NULL;
+ if (self == nullptr) {
+ return nullptr;
}
self->farend = farend;
@@ -424,15 +423,15 @@ BinaryDelayEstimator* WebRtc_CreateBinaryDelayEstimator(
self->lookahead = max_lookahead;
// Allocate memory for spectrum and history buffers.
- self->mean_bit_counts = NULL;
- self->bit_counts = NULL;
- self->histogram = NULL;
+ self->mean_bit_counts = nullptr;
+ self->bit_counts = nullptr;
+ self->histogram = nullptr;
self->binary_near_history = static_cast<uint32_t*>(
malloc((max_lookahead + 1) * sizeof(*self->binary_near_history)));
- if (self->binary_near_history == NULL ||
+ if (self->binary_near_history == nullptr ||
WebRtc_AllocateHistoryBufferMemory(self, farend->history_size) == 0) {
WebRtc_FreeBinaryDelayEstimator(self);
- self = NULL;
+ self = nullptr;
}
return self;
@@ -457,9 +456,8 @@ int WebRtc_AllocateHistoryBufferMemory(BinaryDelayEstimator* self,
self->histogram = static_cast<float*>(
realloc(self->histogram, (history_size + 1) * sizeof(*self->histogram)));
- if ((self->mean_bit_counts == NULL) ||
- (self->bit_counts == NULL) ||
- (self->histogram == NULL)) {
+ if ((self->mean_bit_counts == nullptr) || (self->bit_counts == nullptr) ||
+ (self->histogram == nullptr)) {
history_size = 0;
}
// Fill with zeros if we have expanded the buffers.

Powered by Google App Engine
This is Rietveld 408576698