History

Fix read and write return types: now st_size_t, like the size inputs.

To support this change, turn on lots more compiler warnings, and fix all the warnings generated.

rrt committed 19 years ago

Commit 4d743c41 parent ce1f8f393 files · +875 −1236Browse files

Showing the changes to src/filter.c (1 of 93 files). Show all

Unified · Split

src/filter.c+9−9
@@ -54,7 +54,7 @@ static void FiltWin(filter_t f, long Nx); · 53 unmodified lines
54/*54/*
55 * Process options55 * Process options
56 */56 */
57int st_filter_getopts(eff_t effp, int n, char **argv)57static int st_filter_getopts(eff_t effp, int n, char **argv)
58{58{
59 filter_t f = (filter_t) effp->priv;59 filter_t f = (filter_t) effp->priv;
60 60
@@ -104,7 +104,7 @@ int st_filter_getopts(eff_t effp, int n, char **argv) · 43 unmodified lines
104/*104/*
105 * Prepare processing.105 * Prepare processing.
106 */106 */
107int st_filter_start(eff_t effp)107static int st_filter_start(eff_t effp)
108{108{
109 filter_t f = (filter_t) effp->priv;109 filter_t f = (filter_t) effp->priv;
110 double *Fp0, *Fp1;110 double *Fp0, *Fp1;
@@ -114,7 +114,7 @@ int st_filter_start(eff_t effp) · 3 unmodified lines
114 f->rate = effp->ininfo.rate;114 f->rate = effp->ininfo.rate;
115 115
116 /* adjust upper frequency to Nyquist if necessary */116 /* adjust upper frequency to Nyquist if necessary */
117 if (f->freq1 > f->rate/2 || f->freq1 <= 0)117 if (f->freq1 > (st_sample_t)f->rate/2 || f->freq1 <= 0)
118 f->freq1 = f->rate/2;118 f->freq1 = f->rate/2;
119 119
120 if ((f->freq0 < 0) || (f->freq0 > f->freq1))120 if ((f->freq0 < 0) || (f->freq0 > f->freq1))
@@ -126,7 +126,7 @@ int st_filter_start(eff_t effp) · 5 unmodified lines
126 126
127 Xh = f->Nwin/2;127 Xh = f->Nwin/2;
128 Fp0 = (double *) malloc(sizeof(double) * (Xh + 2)) + 1;128 Fp0 = (double *) malloc(sizeof(double) * (Xh + 2)) + 1;
129 if (f->freq0 > f->rate/200) {129 if (f->freq0 > (st_sample_t)f->rate/200) {
130 Xh0 = makeFilter(Fp0, Xh, 2.0*(double)f->freq0/f->rate, f->beta, 1, 0);130 Xh0 = makeFilter(Fp0, Xh, 2.0*(double)f->freq0/f->rate, f->beta, 1, 0);
131 if (Xh0 <= 1)131 if (Xh0 <= 1)
132 {132 {
@@ -138,7 +138,7 @@ int st_filter_start(eff_t effp) · 5 unmodified lines
138 }138 }
139 Fp1 = (double *) malloc(sizeof(double) * (Xh + 2)) + 1;139 Fp1 = (double *) malloc(sizeof(double) * (Xh + 2)) + 1;
140 /* need Fp[-1] and Fp[Xh] for makeFilter */140 /* need Fp[-1] and Fp[Xh] for makeFilter */
141 if (f->freq1 < f->rate/2) {141 if (f->freq1 < (st_sample_t)f->rate/2) {
142 Xh1 = makeFilter(Fp1, Xh, 2.0*(double)f->freq1/f->rate, f->beta, 1, 0);142 Xh1 = makeFilter(Fp1, Xh, 2.0*(double)f->freq1/f->rate, f->beta, 1, 0);
143 if (Xh1 <= 1)143 if (Xh1 <= 1)
144 {144 {
@@ -182,11 +182,11 @@ int st_filter_start(eff_t effp) · 37 unmodified lines
182 * Processed signed long samples from ibuf to obuf.182 * Processed signed long samples from ibuf to obuf.
183 * Return number of samples processed.183 * Return number of samples processed.
184 */184 */
185int st_filter_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, 185static int st_filter_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
186 st_size_t *isamp, st_size_t *osamp)186 st_size_t *isamp, st_size_t *osamp)
187{187{
188 filter_t f = (filter_t) effp->priv;188 filter_t f = (filter_t) effp->priv;
189 long i, Nx, Nproc;189 st_size_t i, Nx, Nproc;
190 190
191 /* constrain amount we actually process */191 /* constrain amount we actually process */
192 /* st_debug("Xh %d, Xt %d, isamp %d, ",f->Xh, f->Xt, *isamp); */192 /* st_debug("Xh %d, Xt %d, isamp %d, ",f->Xh, f->Xt, *isamp); */
@@ -234,7 +234,7 @@ int st_filter_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 41 unmodified lines
234/*234/*
235 * Process tail of input samples.235 * Process tail of input samples.
236 */236 */
237int st_filter_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)237static int st_filter_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
238{238{
239 filter_t f = (filter_t) effp->priv;239 filter_t f = (filter_t) effp->priv;
240 long isamp_res, osamp_res;240 long isamp_res, osamp_res;
@@ -271,7 +271,7 @@ int st_filter_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines
271 * Do anything required when you stop reading samples. 271 * Do anything required when you stop reading samples.
272 * Don't close input file! 272 * Don't close input file!
273 */273 */
274int st_filter_stop(eff_t effp)274static int st_filter_stop(eff_t effp)
275{275{
276 filter_t f = (filter_t) effp->priv;276 filter_t f = (filter_t) effp->priv;
277 277

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t