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/fade.c (1 of 93 files). Show all

Unified · Split

src/fade.c+15−20
@@ -29,7 +29,7 @@ static st_effect_t st_fade_effect; · 28 unmodified lines
2929 /* Private data for fade file */
3030 typedef struct fadestuff
3131 { /* These are measured as samples */
32− st_size_t in_start, in_stop, out_start, out_stop, samplesdone;
32+ st_size_t in_start, in_stop, out_start, out_stop, samplesdone;
3333 char *in_stop_str, *out_start_str, *out_stop_str;
3434 char in_fadetype, out_fadetype;
3535 char do_out;
@@ -46,7 +46,7 @@ static double fade_gain(st_size_t index, st_size_t range, char fadetype); · 10 unmodified lines
4646 * The 'info' fields are not yet filled in.
4747 */
4848
49−int st_fade_getopts(eff_t effp, int n, char **argv)
49+static int st_fade_getopts(eff_t effp, int n, char **argv)
5050 {
5151
5252 fade_t fade = (fade_t) effp->priv;
@@ -143,7 +143,7 @@ int st_fade_getopts(eff_t effp, int n, char **argv) · 90 unmodified lines
143143 * Prepare processing.
144144 * Do all initializations.
145145 */
146−int st_fade_start(eff_t effp)
146+static int st_fade_start(eff_t effp)
147147 {
148148 fade_t fade = (fade_t) effp->priv;
149149
@@ -201,12 +201,11 @@ int st_fade_start(eff_t effp) · 51 unmodified lines
201201 return(ST_EOF);
202202 } /* endif fade time sanity */
203203
204− /* If lead-in is required it is handled as negative sample numbers */
205− fade->samplesdone = (fade->in_start < 0 ? fade->in_start :0);
204+ fade->samplesdone = fade->in_start;
206205
207206 fade->endpadwarned = 0;
208207
209− /* st_debug("fade: in_start = %d in_stop = %d out_start = %d out_stop = %d", fade->in_start, fade->in_stop, fade->out_start, fade->out_stop); */
208+ st_debug("fade: in_start = %d in_stop = %d out_start = %d out_stop = %d", fade->in_start, fade->in_stop, fade->out_start, fade->out_stop);
210209
211210 return(ST_SUCCESS);
212211 }
@@ -215,13 +214,14 @@ int st_fade_start(eff_t effp) · 2 unmodified lines
215214 * Processed signed long samples from ibuf to obuf.
216215 * Return number of samples processed.
217216 */
218−int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
217+static int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
219218 st_size_t *isamp, st_size_t *osamp)
220219 {
221220 fade_t fade = (fade_t) effp->priv;
222221 /* len is total samples, chcnt counts channels */
223− int len = 0, chcnt = 0, t_output = 1, more_output = 1;
222+ int len = 0, t_output = 1, more_output = 1;
224223 st_sample_t t_ibuf;
224+ st_size_t chcnt = 0;
225225
226226 len = ((*isamp > *osamp) ? *osamp : *isamp);
227227
@@ -230,7 +230,7 @@ int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 2 unmodified lines
230230
231231 for(; len && more_output; len--)
232232 {
233− t_ibuf = (fade->samplesdone < 0 ? 0 : *ibuf);
233+ t_ibuf = *ibuf;
234234
235235 if ((fade->samplesdone >= fade->in_start) &&
236236 (!fade->do_out || fade->samplesdone < fade->out_stop))
@@ -265,14 +265,8 @@ int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 28 unmodified lines
265265 t_output = 0;
266266 } /* endif something to output */
267267
268− /* samplesdone < 0 means we are inventing samples right now
269− * and so not consuming (happens when in_start < 0).
270− */
271− if (fade->samplesdone >= 0 )
272− { /* Something to input */
273− *isamp += 1;
274− ibuf++;
275− } /* endif something accepted as input */
268+ *isamp += 1;
269+ ibuf++;
276270
277271 if (t_output)
278272 { /* Output generated, update pointers and counters */
@@ -301,10 +295,11 @@ int st_fade_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 22 unmodified lines
301295 /*
302296 * Drain out remaining samples if the effect generates any.
303297 */
304−int st_fade_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
298+static int st_fade_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
305299 {
306300 fade_t fade = (fade_t) effp->priv;
307− int len, t_chan = 0;
301+ int len;
302+ st_size_t t_chan = 0;
308303
309304 len = *osamp;
310305 *osamp = 0;
@@ -341,7 +336,7 @@ int st_fade_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines
341336 * Do anything required when you stop reading samples.
342337 * (free allocated memory, etc.)
343338 */
344−int st_fade_stop(eff_t effp)
339+static int st_fade_stop(eff_t effp)
345340 {
346341 fade_t fade = (fade_t) effp->priv;
347342

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