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

Unified Diff: webrtc/common_audio/signal_processing/min_max_operations.c

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 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/common_audio/signal_processing/min_max_operations.c
diff --git a/webrtc/common_audio/signal_processing/min_max_operations.c b/webrtc/common_audio/signal_processing/min_max_operations.c
index f6de072a221c27ebac87b9a678568d52e5914dd3..22ce765455ba0f39dead6a523a1ec43bade5df63 100644
--- a/webrtc/common_audio/signal_processing/min_max_operations.c
+++ b/webrtc/common_audio/signal_processing/min_max_operations.c
@@ -33,10 +33,11 @@
// TODO(kma): Move the next six functions into min_max_operations_c.c.
// Maximum absolute value of word16 vector. C version for generic platforms.
-int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, int length) {
- int i = 0, absolute = 0, maximum = 0;
+int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, size_t length) {
+ size_t i = 0;
+ int absolute = 0, maximum = 0;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return -1;
}
@@ -57,14 +58,14 @@ int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, int length) {
}
// Maximum absolute value of word32 vector. C version for generic platforms.
-int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, int length) {
+int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, size_t length) {
// Use uint32_t for the local variables, to accommodate the return value
// of abs(0x80000000), which is 0x80000000.
uint32_t absolute = 0, maximum = 0;
- int i = 0;
+ size_t i = 0;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return -1;
}
@@ -81,11 +82,11 @@ int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, int length) {
}
// Maximum value of word16 vector. C version for generic platforms.
-int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, int length) {
+int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, size_t length) {
int16_t maximum = WEBRTC_SPL_WORD16_MIN;
- int i = 0;
+ size_t i = 0;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return maximum;
}
@@ -97,11 +98,11 @@ int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, int length) {
}
// Maximum value of word32 vector. C version for generic platforms.
-int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, int length) {
+int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, size_t length) {
int32_t maximum = WEBRTC_SPL_WORD32_MIN;
- int i = 0;
+ size_t i = 0;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return maximum;
}
@@ -113,11 +114,11 @@ int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, int length) {
}
// Minimum value of word16 vector. C version for generic platforms.
-int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, int length) {
+int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, size_t length) {
int16_t minimum = WEBRTC_SPL_WORD16_MAX;
- int i = 0;
+ size_t i = 0;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return minimum;
}
@@ -129,11 +130,11 @@ int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, int length) {
}
// Minimum value of word32 vector. C version for generic platforms.
-int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, int length) {
+int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, size_t length) {
int32_t minimum = WEBRTC_SPL_WORD32_MAX;
- int i = 0;
+ size_t i = 0;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return minimum;
}
@@ -145,12 +146,13 @@ int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, int length) {
}
// Index of maximum absolute value in a word16 vector.
-int WebRtcSpl_MaxAbsIndexW16(const int16_t* vector, int length) {
+int WebRtcSpl_MaxAbsIndexW16(const int16_t* vector, size_t length) {
// Use type int for local variables, to accomodate the value of abs(-32768).
- int i = 0, absolute = 0, maximum = 0, index = 0;
+ size_t i = 0, index = 0;
+ int absolute = 0, maximum = 0;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return -1;
}
@@ -163,15 +165,15 @@ int WebRtcSpl_MaxAbsIndexW16(const int16_t* vector, int length) {
}
}
- return index;
+ return (int)index;
}
// Index of maximum value in a word16 vector.
-int WebRtcSpl_MaxIndexW16(const int16_t* vector, int length) {
- int i = 0, index = 0;
+int WebRtcSpl_MaxIndexW16(const int16_t* vector, size_t length) {
+ size_t i = 0, index = 0;
int16_t maximum = WEBRTC_SPL_WORD16_MIN;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return -1;
}
@@ -182,15 +184,15 @@ int WebRtcSpl_MaxIndexW16(const int16_t* vector, int length) {
}
}
- return index;
+ return (int)index;
}
// Index of maximum value in a word32 vector.
-int WebRtcSpl_MaxIndexW32(const int32_t* vector, int length) {
- int i = 0, index = 0;
+int WebRtcSpl_MaxIndexW32(const int32_t* vector, size_t length) {
+ size_t i = 0, index = 0;
int32_t maximum = WEBRTC_SPL_WORD32_MIN;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return -1;
}
@@ -201,15 +203,15 @@ int WebRtcSpl_MaxIndexW32(const int32_t* vector, int length) {
}
}
- return index;
+ return (int)index;
}
// Index of minimum value in a word16 vector.
-int WebRtcSpl_MinIndexW16(const int16_t* vector, int length) {
- int i = 0, index = 0;
+int WebRtcSpl_MinIndexW16(const int16_t* vector, size_t length) {
+ size_t i = 0, index = 0;
int16_t minimum = WEBRTC_SPL_WORD16_MAX;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return -1;
}
@@ -220,15 +222,15 @@ int WebRtcSpl_MinIndexW16(const int16_t* vector, int length) {
}
}
- return index;
+ return (int)index;
}
// Index of minimum value in a word32 vector.
-int WebRtcSpl_MinIndexW32(const int32_t* vector, int length) {
- int i = 0, index = 0;
+int WebRtcSpl_MinIndexW32(const int32_t* vector, size_t length) {
+ size_t i = 0, index = 0;
int32_t minimum = WEBRTC_SPL_WORD32_MAX;
- if (vector == NULL || length <= 0) {
+ if (vector == NULL || length == 0) {
return -1;
}
@@ -239,5 +241,5 @@ int WebRtcSpl_MinIndexW32(const int32_t* vector, int length) {
}
}
- return index;
+ return (int)index;
}

Powered by Google App Engine
This is Rietveld 408576698