 Chromium Code Reviews
 Chromium Code Reviews Issue 1227203003:
  Update audio code to use size_t more correctly, webrtc/common_audio/ portion.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc@master
    
  
    Issue 1227203003:
  Update audio code to use size_t more correctly, webrtc/common_audio/ portion.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc@master| Index: webrtc/common_audio/fft4g.c | 
| diff --git a/webrtc/common_audio/fft4g.c b/webrtc/common_audio/fft4g.c | 
| index 24d45eb6b31ab650cfad278808b0354ce82689e1..4bb1301a2b23a8711dda5cf3850a97c829189ae4 100644 | 
| --- a/webrtc/common_audio/fft4g.c | 
| +++ b/webrtc/common_audio/fft4g.c | 
| @@ -286,18 +286,20 @@ Appendix : | 
| w[] and ip[] are compatible with all routines. | 
| */ | 
| -static void makewt(int nw, int *ip, float *w); | 
| -static void makect(int nc, int *ip, float *c); | 
| -static void bitrv2(int n, int *ip, float *a); | 
| +#include <stddef.h> | 
| + | 
| +static void makewt(size_t nw, size_t *ip, float *w); | 
| 
Andrew MacDonald
2015/07/24 19:01:55
It's not totally clear to me that this "work area
 
Peter Kasting
2015/07/27 23:23:39
The type of *ip has to match the type of |n| in th
 
Andrew MacDonald
2015/07/28 07:20:05
OK thanks for the explanation.
 | 
| +static void makect(size_t nc, size_t *ip, float *c); | 
| +static void bitrv2(size_t n, size_t *ip, float *a); | 
| #if 0 // Not used. | 
| static void bitrv2conj(int n, int *ip, float *a); | 
| #endif | 
| -static void cftfsub(int n, float *a, float *w); | 
| -static void cftbsub(int n, float *a, float *w); | 
| -static void cft1st(int n, float *a, float *w); | 
| -static void cftmdl(int n, int l, float *a, float *w); | 
| -static void rftfsub(int n, float *a, int nc, float *c); | 
| -static void rftbsub(int n, float *a, int nc, float *c); | 
| +static void cftfsub(size_t n, float *a, float *w); | 
| +static void cftbsub(size_t n, float *a, float *w); | 
| +static void cft1st(size_t n, float *a, float *w); | 
| +static void cftmdl(size_t n, size_t l, float *a, float *w); | 
| +static void rftfsub(size_t n, float *a, size_t nc, float *c); | 
| +static void rftbsub(size_t n, float *a, size_t nc, float *c); | 
| #if 0 // Not used. | 
| static void dctsub(int n, float *a, int nc, float *c) | 
| static void dstsub(int n, float *a, int nc, float *c) | 
| @@ -325,9 +327,9 @@ void WebRtc_cdft(int n, int isgn, float *a, int *ip, float *w) | 
| #endif | 
| -void WebRtc_rdft(int n, int isgn, float *a, int *ip, float *w) | 
| +void WebRtc_rdft(size_t n, int isgn, float *a, size_t *ip, float *w) | 
| { | 
| - int nw, nc; | 
| + size_t nw, nc; | 
| float xi; | 
| nw = ip[0]; | 
| @@ -643,9 +645,9 @@ static void dfst(int n, float *a, float *t, int *ip, float *w) | 
| #include <math.h> | 
| -static void makewt(int nw, int *ip, float *w) | 
| +static void makewt(size_t nw, size_t *ip, float *w) | 
| { | 
| - int j, nwh; | 
| + size_t j, nwh; | 
| float delta, x, y; | 
| ip[0] = nw; | 
| @@ -672,9 +674,9 @@ static void makewt(int nw, int *ip, float *w) | 
| } | 
| -static void makect(int nc, int *ip, float *c) | 
| +static void makect(size_t nc, size_t *ip, float *c) | 
| { | 
| - int j, nch; | 
| + size_t j, nch; | 
| float delta; | 
| ip[1] = nc; | 
| @@ -694,9 +696,9 @@ static void makect(int nc, int *ip, float *c) | 
| /* -------- child routines -------- */ | 
| -static void bitrv2(int n, int *ip, float *a) | 
| +static void bitrv2(size_t n, size_t *ip, float *a) | 
| { | 
| - int j, j1, k, k1, l, m, m2; | 
| + size_t j, j1, k, k1, l, m, m2; | 
| float xr, xi, yr, yi; | 
| ip[0] = 0; | 
| @@ -903,9 +905,9 @@ static void bitrv2conj(int n, int *ip, float *a) | 
| } | 
| #endif | 
| -static void cftfsub(int n, float *a, float *w) | 
| +static void cftfsub(size_t n, float *a, float *w) | 
| { | 
| - int j, j1, j2, j3, l; | 
| + size_t j, j1, j2, j3, l; | 
| float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; | 
| l = 2; | 
| @@ -953,9 +955,9 @@ static void cftfsub(int n, float *a, float *w) | 
| } | 
| -static void cftbsub(int n, float *a, float *w) | 
| +static void cftbsub(size_t n, float *a, float *w) | 
| { | 
| - int j, j1, j2, j3, l; | 
| + size_t j, j1, j2, j3, l; | 
| float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; | 
| l = 2; | 
| @@ -1003,9 +1005,9 @@ static void cftbsub(int n, float *a, float *w) | 
| } | 
| -static void cft1st(int n, float *a, float *w) | 
| +static void cft1st(size_t n, float *a, float *w) | 
| { | 
| - int j, k1, k2; | 
| + size_t j, k1, k2; | 
| float wk1r, wk1i, wk2r, wk2i, wk3r, wk3i; | 
| float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; | 
| @@ -1108,9 +1110,9 @@ static void cft1st(int n, float *a, float *w) | 
| } | 
| -static void cftmdl(int n, int l, float *a, float *w) | 
| +static void cftmdl(size_t n, size_t l, float *a, float *w) | 
| { | 
| - int j, j1, j2, j3, k, k1, k2, m, m2; | 
| + size_t j, j1, j2, j3, k, k1, k2, m, m2; | 
| float wk1r, wk1i, wk2r, wk2i, wk3r, wk3i; | 
| float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; | 
| @@ -1235,9 +1237,9 @@ static void cftmdl(int n, int l, float *a, float *w) | 
| } | 
| -static void rftfsub(int n, float *a, int nc, float *c) | 
| +static void rftfsub(size_t n, float *a, size_t nc, float *c) | 
| { | 
| - int j, k, kk, ks, m; | 
| + size_t j, k, kk, ks, m; | 
| float wkr, wki, xr, xi, yr, yi; | 
| m = n >> 1; | 
| @@ -1260,9 +1262,9 @@ static void rftfsub(int n, float *a, int nc, float *c) | 
| } | 
| -static void rftbsub(int n, float *a, int nc, float *c) | 
| +static void rftbsub(size_t n, float *a, size_t nc, float *c) | 
| { | 
| - int j, k, kk, ks, m; | 
| + size_t j, k, kk, ks, m; | 
| float wkr, wki, xr, xi, yr, yi; | 
| a[1] = -a[1]; |