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

Unified · Split

93 files
  1. src/8svx.c +11 −14
  2. src/FFT.c +2 −2
  3. src/Makefile.in +10 −5
  4. src/adpcm.c +7 −10
  5. src/adpcm.h +1 −2
  6. src/aiff.c +16 −18
  7. src/alsa.c +13 −18
  8. src/au.c +9 −9
  9. src/auto.c +2 −2
  10. src/avg.c +4 −4
  11. src/avr.c +4 −4
  12. src/band.c +4 −4
  13. src/bandpass.c +2 −2
  14. src/breject.c +2 −2
  15. src/cdr.c +6 −6
  16. src/chorus.c +5 −5
  17. src/compand.c +8 −8
  18. src/copy.c +4 −14
  19. src/cvsd.c +11 −11
  20. src/dat.c +14 −26
  21. src/dcshift.c +4 −4
  22. src/deemphas.c +4 −40
  23. src/earwax.c +12 −28
  24. src/echo.c +6 −6
  25. src/echos.c +7 −7
  26. src/equalizer.c +20 −20
  27. src/fade.c +15 −20
  28. src/filter.c +9 −9
  29. src/flac.c +9 −10
  30. src/flanger.c +34 −34
  31. src/g72x.c +2 −2
  32. src/gsm.c +9 −9
  33. src/handlers.c +1 −1
  34. src/hcom.c +6 −6
  35. src/highp.c +4 −14
  36. src/highpass.c +2 −5
  37. src/ima_rw.c +5 −7
  38. src/libgsm/Makefile.in +10 −5
  39. src/libgsm/code.c +5 −7
  40. src/libgsm/decode.c +1 −1
  41. src/libgsm/long_term.c +0 −3
  42. src/libgsm/lpc.c +0 −1
  43. src/libgsm/preprocess.c +1 −1
  44. src/libgsm/private.h +1 −5
  45. src/libgsm/rpe.c +0 −5
  46. src/lowp.c +4 −14
  47. src/lowpass.c +2 −2
  48. src/mask.c +2 −2
  49. src/maud.c +11 −40
  50. src/mcompand.c +13 −12
  51. src/misc.c +58 −21
  52. src/mp3.c +32 −31
  53. src/noiseprof.c +10 −10
  54. src/noisered.c +13 −13
  55. src/nulfile.c +5 −5
  56. src/oss.c +5 −5
  57. src/pan.c +5 −12
  58. src/phaser.c +5 −5
  59. src/pitch.c +5 −5
  60. src/polyphas.c +13 −13
  61. src/prc.c +10 −15
  62. src/raw.c +36 −42
  63. src/repeat.c +5 −5
  64. src/resample.c +1 −2
  65. src/reverb.c +11 −11
  66. src/reverse.c +5 −19
  67. src/sf.c +4 −4
  68. src/silence.c +8 −8
  69. src/smp.c +10 −19
  70. src/sndrtool.c +31 −84
  71. src/sox.c +15 −15
  72. src/speed.c +5 −5
  73. src/sphere.c +9 −11
  74. src/st.h +13 −10
  75. src/st_i.h +18 −20
  76. src/stat.c +5 −5
  77. src/stconfig.h.in +5 −5
  78. src/stio.c +8 −8
  79. src/stretch.c +19 −27
  80. src/sunaudio.c +5 −5
  81. src/swap.c +5 −25
  82. src/synth.c +9 −29
  83. src/trim.c +5 −5
  84. src/tx16w.c +8 −17
  85. src/util.c +3 −3
  86. src/vibro.c +3 −13
  87. src/voc.c +41 −51
  88. src/vol.c +4 −4
  89. src/vorbis.c +13 −13
  90. src/vox.c +26 −50
  91. src/wav.c +39 −87
  92. src/wve.c +7 −7
  93. src/xa.c +4 −6
src/8svx.c+11−14
@@ -26,7 +26,7 @@ static void svxwriteheader(ft_t, st_size_t); · 25 unmodified lines
2626 /* 8SVXSTARTREAD */
2727 /*======================================================================*/
2828
29−int st_svxstartread(ft_t ft)
29+static int st_svxstartread(ft_t ft)
3030 {
3131 svx_t p = (svx_t ) ft->priv;
3232
@@ -211,11 +211,10 @@ int st_svxstartread(ft_t ft) · 178 unmodified lines
211211 /*======================================================================*/
212212 /* 8SVXREAD */
213213 /*======================================================================*/
214−st_ssize_t st_svxread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
214+static st_size_t st_svxread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
215215 {
216216 unsigned char datum;
217− int done = 0;
218− int i;
217+ size_t done = 0, i;
219218
220219 svx_t p = (svx_t ) ft->priv;
221220
@@ -236,9 +235,9 @@ st_ssize_t st_svxread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 14 unmodified lines
236235 /*======================================================================*/
237236 /* 8SVXSTOPREAD */
238237 /*======================================================================*/
239−int st_svxstopread(ft_t ft)
238+static int st_svxstopread(ft_t ft)
240239 {
241− int i;
240+ size_t i;
242241
243242 svx_t p = (svx_t ) ft->priv;
244243
@@ -252,10 +251,10 @@ int st_svxstopread(ft_t ft) · 7 unmodified lines
252251 /*======================================================================*/
253252 /* 8SVXSTARTWRITE */
254253 /*======================================================================*/
255−int st_svxstartwrite(ft_t ft)
254+static int st_svxstartwrite(ft_t ft)
256255 {
257256 svx_t p = (svx_t ) ft->priv;
258− int i;
257+ size_t i;
259258
260259 /* 8svx is in big endian format. Swaps wahst
261260 * read in on little endian machines.
@@ -288,13 +287,12 @@ int st_svxstartwrite(ft_t ft) · 26 unmodified lines
288287 /* 8SVXWRITE */
289288 /*======================================================================*/
290289
291−st_ssize_t st_svxwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
290+static st_size_t st_svxwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
292291 {
293292 svx_t p = (svx_t ) ft->priv;
294293
295294 unsigned char datum;
296− int done = 0;
297− int i;
295+ size_t done = 0, i;
298296
299297 p->nsamples += len;
300298
@@ -313,12 +311,11 @@ st_ssize_t st_svxwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 12 unmodified lines
313311 /* 8SVXSTOPWRITE */
314312 /*======================================================================*/
315313
316−int st_svxstopwrite(ft_t ft)
314+static int st_svxstopwrite(ft_t ft)
317315 {
318316 svx_t p = (svx_t ) ft->priv;
319317
320− int i;
321− int len;
318+ size_t i, len;
322319 char svxbuf[512];
323320
324321 /* append all channel pieces to channel 0 */
src/FFT.c+2−2
@@ -62,7 +62,7 @@ const int MaxFastBits = 16; · 61 unmodified lines
6262 static int IsPowerOfTwo(int x);
6363 static int NumberOfBitsNeeded(int PowerOfTwo);
6464 static int ReverseBits(int index, int NumBits);
65−static void InitFFT();
65+static void InitFFT(void);
6666
6767 int IsPowerOfTwo(int x)
6868 {
@@ -103,7 +103,7 @@ int ReverseBits(int index, int NumBits) · 34 unmodified lines
103103 * freed, to use as a lookup table for bit-reversal. The good news is that
104104 * we bascially need this until the very end, so the fact that it's not freed
105105 * is OK. */
106−void InitFFT()
106+void InitFFT(void)
107107 {
108108 int len, b;
109109
src/Makefile.in+10−5
@@ -139,6 +139,7 @@ EGREP = @EGREP@ · 138 unmodified lines
139139 EXEEXT = @EXEEXT@
140140 GETOPT_LONG_FALSE = @GETOPT_LONG_FALSE@
141141 GETOPT_LONG_TRUE = @GETOPT_LONG_TRUE@
142+GREP = @GREP@
142143 INSTALL_DATA = @INSTALL_DATA@
143144 INSTALL_PROGRAM = @INSTALL_PROGRAM@
144145 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -166,9 +167,6 @@ SHELL = @SHELL@ · 21 unmodified lines
166167 STRIP = @STRIP@
167168 VERSION = @VERSION@
168169 ac_ct_CC = @ac_ct_CC@
169−ac_ct_RANLIB = @ac_ct_RANLIB@
170−ac_ct_STRIP = @ac_ct_STRIP@
171−ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
172170 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
173171 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
174172 am__include = @am__include@
@@ -179,19 +177,26 @@ am__untar = @am__untar@ · 4 unmodified lines
179177 bindir = @bindir@
180178 build_alias = @build_alias@
181179 datadir = @datadir@
180+datarootdir = @datarootdir@
181+docdir = @docdir@
182+dvidir = @dvidir@
182183 exec_prefix = @exec_prefix@
183184 host_alias = @host_alias@
185+htmldir = @htmldir@
184186 includedir = @includedir@
185187 infodir = @infodir@
186188 install_sh = @install_sh@
187189 libdir = @libdir@
188190 libexecdir = @libexecdir@
191+localedir = @localedir@
189192 localstatedir = @localstatedir@
190193 mandir = @mandir@
191194 mkdir_p = @mkdir_p@
192195 oldincludedir = @oldincludedir@
196+pdfdir = @pdfdir@
193197 prefix = @prefix@
194198 program_transform_name = @program_transform_name@
199+psdir = @psdir@
195200 sbindir = @sbindir@
196201 sharedstatedir = @sharedstatedir@
197202 sysconfdir = @sysconfdir@
@@ -230,9 +235,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) · 32 unmodified lines
230235 exit 1;; \
231236 esac; \
232237 done; \
233− echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
238+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
234239 cd $(top_srcdir) && \
235− $(AUTOMAKE) --foreign src/Makefile
240+ $(AUTOMAKE) --gnu src/Makefile
236241 .PRECIOUS: Makefile
237242 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
238243 @case '$?' in \
src/adpcm.c+7−10
@@ -72,7 +72,7 @@ const short iCoef[7][2] = { · 71 unmodified lines
7272 { 392,-232}
7373 };
7474
75−inline st_sample_t AdpcmDecode(st_sample_t c, MsState_t *state,
75+static inline st_sample_t AdpcmDecode(st_sample_t c, MsState_t *state,
7676 st_sample_t sample1, st_sample_t sample2)
7777 {
7878 st_sample_t vlin;
@@ -248,14 +248,13 @@ static int AdpcmMashS( · 169 unmodified lines
248248 return (int) sqrt(d2);
249249 }
250250
251−inline void AdpcmMashChannel(
251+static inline void AdpcmMashChannel(
252252 int ch, /* channel number to encode, REQUIRE 0 <= ch < chans */
253253 int chans, /* total channels */
254254 const SAMPL *ip, /* ip[] is interleaved input samples */
255255 int n, /* samples to encode PER channel, REQUIRE */
256256 int *st, /* input/output steps, 16<=st[i] */
257− unsigned char *obuff, /* output buffer[blockAlign] */
258− int opt /* non-zero allows some cpu-intensive code to improve output */
257+ unsigned char *obuff /* output buffer[blockAlign] */
259258 )
260259 {
261260 SAMPL v[2];
@@ -305,8 +304,7 @@ void AdpcmBlockMashI( · 43 unmodified lines
305304 int n, /* samples to encode PER channel */
306305 int *st, /* input/output steps, 16<=st[i] */
307306 unsigned char *obuff, /* output buffer[blockAlign] */
308− int blockAlign, /* >= 7*chans + chans*(n-2)/2.0 */
309− int opt /* non-zero allows some cpu-intensive code to improve output */
307+ int blockAlign /* >= 7*chans + chans*(n-2)/2.0 */
310308 )
311309 {
312310 int ch;
@@ -318,7 +316,7 @@ void AdpcmBlockMashI( · 5 unmodified lines
318316 for (p=obuff+7*chans; p<obuff+blockAlign; p++) *p=0;
319317
320318 for (ch=0; ch<chans; ch++)
321− AdpcmMashChannel(ch, chans, ip, n, st+ch, obuff, opt);
319+ AdpcmMashChannel(ch, chans, ip, n, st+ch, obuff);
322320 }
323321
324322 /*
@@ -334,8 +332,7 @@ st_size_t AdpcmSamplesIn( · 9 unmodified lines
334332 unsigned short chans,
335333 unsigned short blockAlign,
336334 unsigned short samplesPerBlock
337−)
338−{
335+){
339336 st_size_t m, n;
340337
341338 if (samplesPerBlock) {
@@ -345,7 +342,7 @@ st_size_t AdpcmSamplesIn( · 3 unmodified lines
345342 n = 0;
346343 m = blockAlign;
347344 }
348− if (m >= 7*chans) {
345+ if (m >= (size_t)(7*chans)) {
349346 m -= 7*chans; /* bytes beyond block-header */
350347 m = (2*m)/chans + 2; /* nibbles/chans + 2 in header */
351348 if (samplesPerBlock && m > samplesPerBlock) m = samplesPerBlock;
src/adpcm.h+1−2
@@ -26,8 +26,7 @@ extern void AdpcmBlockMashI( · 25 unmodified lines
2626 int n, /* samples to encode PER channel, REQUIRE */
2727 int *st, /* input/output steps, 16<=st[i] */
2828 unsigned char *obuff, /* output buffer[blockAlign] */
29− int blockAlign, /* >= 7*chans + n/2 */
30− int opt /* non-zero allows some cpu-intensive code to improve output */
29+ int blockAlign /* >= 7*chans + n/2 */
3130 );
3231
3332 /* Some helper functions for computing samples/block and blockalign */
src/aiff.c+16−18
@@ -74,7 +74,7 @@ static int textChunk(char **text, char *chunkDescription, ft_t ft); · 73 unmodified lines
7474 static int commentChunk(char **text, char *chunkDescription, ft_t ft);
7575 static void reportInstrument(ft_t ft);
7676
77−int st_aiffseek(ft_t ft, st_size_t offset)
77+static int st_aiffseek(ft_t ft, st_size_t offset)
7878 {
7979 aiff_t aiff = (aiff_t ) ft->priv;
8080 st_size_t new_offset, channel_block, alignment;
@@ -99,7 +99,7 @@ int st_aiffseek(ft_t ft, st_size_t offset) · 18 unmodified lines
9999 return(ft->st_errno);
100100 }
101101
102−int st_aiffstartread(ft_t ft)
102+static int st_aiffstartread(ft_t ft)
103103 {
104104 aiff_t aiff = (aiff_t ) ft->priv;
105105 char buf[5];
@@ -408,7 +408,7 @@ int st_aiffstartread(ft_t ft) · 302 unmodified lines
408408 if (foundcomm) {
409409 ft->info.channels = channels;
410410 ft->info.rate = rate;
411− if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2)
411+ if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_SIGN2)
412412 st_report("AIFF only supports signed data. Forcing to signed.");
413413 ft->info.encoding = ST_ENCODING_SIGN2;
414414 if (bits <= 8)
@@ -441,9 +441,9 @@ int st_aiffstartread(ft_t ft) · 26 unmodified lines
441441 return(ST_EOF);
442442 }
443443 } else {
444− if ((ft->info.channels == -1)
444+ if ((ft->info.channels == 0)
445445 || (ft->info.rate == 0)
446− || (ft->info.encoding == -1)
446+ || (ft->info.encoding == ST_ENCODING_UNKNOWN)
447447 || (ft->info.size == -1)) {
448448 st_report("You must specify # channels, sample rate, signed/unsigned,");
449449 st_report("and 8/16 on the command line.");
@@ -633,7 +633,7 @@ static int commentChunk(char **text, char *chunkDescription, ft_t ft) · 183 unmodified lines
633633 st_debug("%-10s \"%s\"", chunkDescription, *text);
634634 /* make sure we read the whole chunk */
635635 if (totalReadLength < chunksize) {
636− int i;
636+ size_t i;
637637 char c;
638638 for (i=0; i < chunksize - totalReadLength; i++ ) {
639639 st_readbuf(ft, &c, 1, 1);
@@ -642,14 +642,12 @@ static int commentChunk(char **text, char *chunkDescription, ft_t ft) · 2 unmodified lines
642642 return(ST_SUCCESS);
643643 }
644644
645−st_ssize_t st_aiffread(ft_t ft, st_sample_t *buf, st_size_t len)
645+static st_size_t st_aiffread(ft_t ft, st_sample_t *buf, st_size_t len)
646646 {
647647 aiff_t aiff = (aiff_t ) ft->priv;
648648 st_ssize_t done;
649649
650− if (len < 0)
651− return ST_EOF;
652− else if ((st_size_t)len > aiff->nsamples)
650+ if ((st_size_t)len > aiff->nsamples)
653651 len = aiff->nsamples;
654652 done = st_rawread(ft, buf, len);
655653 if (done == 0 && aiff->nsamples != 0)
@@ -658,7 +656,7 @@ st_ssize_t st_aiffread(ft_t ft, st_sample_t *buf, st_size_t len) · 2 unmodified lines
658656 return done;
659657 }
660658
661−int st_aiffstopread(ft_t ft)
659+static int st_aiffstopread(ft_t ft)
662660 {
663661 char buf[5];
664662 uint32_t chunksize;
@@ -701,7 +699,7 @@ int st_aiffstopread(ft_t ft) · 36 unmodified lines
701699 Strictly spoken this is not legal, but the playaiff utility
702700 will still be able to play the resulting file. */
703701
704−int st_aiffstartwrite(ft_t ft)
702+static int st_aiffstartwrite(ft_t ft)
705703 {
706704 aiff_t aiff = (aiff_t ) ft->priv;
707705 int rc;
@@ -726,7 +724,7 @@ int st_aiffstartwrite(ft_t ft) · 18 unmodified lines
726724 ft->info.encoding = ST_ENCODING_SIGN2;
727725 ft->info.size = ST_SIZE_WORD;
728726 }
729− if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2)
727+ if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_SIGN2)
730728 st_report("AIFF only supports signed data. Forcing to signed.");
731729 ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */
732730
@@ -739,7 +737,7 @@ int st_aiffstartwrite(ft_t ft) · 6 unmodified lines
739737 return(aiffwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels)));
740738 }
741739
742−st_ssize_t st_aiffwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
740+static st_size_t st_aiffwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
743741 {
744742 aiff_t aiff = (aiff_t ) ft->priv;
745743 aiff->nsamples += len;
@@ -747,7 +745,7 @@ st_ssize_t st_aiffwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 1 unmodified line
747745 return(len);
748746 }
749747
750−int st_aiffstopwrite(ft_t ft)
748+static int st_aiffstopwrite(ft_t ft)
751749 {
752750 aiff_t aiff = (aiff_t ) ft->priv;
753751 int rc;
@@ -914,7 +912,7 @@ static int aiffwriteheader(ft_t ft, st_size_t nframes) · 160 unmodified lines
914912 return(ST_SUCCESS);
915913 }
916914
917−int st_aifcstartwrite(ft_t ft)
915+static int st_aifcstartwrite(ft_t ft)
918916 {
919917 aiff_t aiff = (aiff_t ) ft->priv;
920918 int rc;
@@ -939,7 +937,7 @@ int st_aifcstartwrite(ft_t ft) · 18 unmodified lines
939937 ft->info.encoding = ST_ENCODING_SIGN2;
940938 ft->info.size = ST_SIZE_WORD;
941939 }
942− if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2)
940+ if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_SIGN2)
943941 st_report("AIFC only supports signed data. Forcing to signed.");
944942 ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */
945943
@@ -952,7 +950,7 @@ int st_aifcstartwrite(ft_t ft) · 6 unmodified lines
952950 return(aifcwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels)));
953951 }
954952
955−int st_aifcstopwrite(ft_t ft)
953+static int st_aifcstopwrite(ft_t ft)
956954 {
957955 aiff_t aiff = (aiff_t ) ft->priv;
958956 int rc;
src/alsa.c+13−18
@@ -23,13 +23,13 @@ · 22 unmodified lines
2323 typedef struct alsa_priv
2424 {
2525 snd_pcm_t *pcm_handle;
26− void *buf;
27− st_ssize_t buf_size;
26+ char *buf;
27+ st_size_t buf_size;
2828 } *alsa_priv_t;
2929
3030 static int get_format(ft_t ft, snd_pcm_format_mask_t *fmask, int *fmt);
3131
32−int st_alsasetup(ft_t ft, snd_pcm_stream_t mode)
32+static int st_alsasetup(ft_t ft, snd_pcm_stream_t mode)
3333 {
3434 int fmt = SND_PCM_FORMAT_S16;
3535 int err;
@@ -85,7 +85,7 @@ int st_alsasetup(ft_t ft, snd_pcm_stream_t mode) · 49 unmodified lines
8585
8686 snd_pcm_hw_params_get_channels_min(hw_params, &min_chan);
8787 snd_pcm_hw_params_get_channels_max(hw_params, &max_chan);
88− if (ft->info.channels == -1)
88+ if (ft->info.channels == 0)
8989 ft->info.channels = min_chan;
9090 else
9191 if (ft->info.channels > max_chan)
@@ -113,11 +113,8 @@ int st_alsasetup(ft_t ft, snd_pcm_stream_t mode) · 21 unmodified lines
113113 snd_pcm_hw_params_get_rate_min(hw_params, &min_rate, &dir);
114114 snd_pcm_hw_params_get_rate_max(hw_params, &max_rate, &dir);
115115
116− if (min_rate != -1 && rate < min_rate)
117− rate = min_rate;
118− else
119− if (max_rate != -1 && rate > max_rate)
120− rate = max_rate;
116+ rate = max(rate, min_rate);
117+ rate = min(rate, max_rate);
121118 if (rate != ft->info.rate)
122119 {
123120 st_report("alsa: Hardware does not support %d. Forcing sample rate to %d.", ft->info.rate, rate);
@@ -288,12 +285,12 @@ static int xrun_recovery(snd_pcm_t *handle, int err) · 164 unmodified lines
288285 * size and encoding of samples,
289286 * mono/stereo/quad.
290287 */
291−int st_alsastartread(ft_t ft)
288+static int st_alsastartread(ft_t ft)
292289 {
293290 return st_alsasetup(ft, SND_PCM_STREAM_CAPTURE);
294291 }
295292
296−st_ssize_t st_alsaread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
293+static st_size_t st_alsaread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
297294 {
298295 st_size_t len;
299296 int err;
@@ -364,8 +361,7 @@ st_ssize_t st_alsaread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 64 unmodified lines
364361 return len;
365362 }
366363
367−int st_alsastopread(ft)
368−ft_t ft;
364+static int st_alsastopread(ft_t ft)
369365 {
370366 alsa_priv_t alsa = (alsa_priv_t)ft->priv;
371367
@@ -376,12 +372,12 @@ ft_t ft; · 4 unmodified lines
376372 return ST_SUCCESS;
377373 }
378374
379−int st_alsastartwrite(ft_t ft)
375+static int st_alsastartwrite(ft_t ft)
380376 {
381377 return st_alsasetup(ft, SND_PCM_STREAM_PLAYBACK);
382378 }
383379
384−st_ssize_t st_alsawrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
380+static st_size_t st_alsawrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
385381 {
386382 st_size_t len;
387383 int err;
@@ -452,8 +448,7 @@ st_ssize_t st_alsawrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) · 64 unmodified lines
452448 }
453449
454450
455−int st_alsastopwrite(ft)
456−ft_t ft;
451+static int st_alsastopwrite(ft_t ft)
457452 {
458453 alsa_priv_t alsa = (alsa_priv_t)ft->priv;
459454
@@ -472,7 +467,7 @@ static int get_format(ft_t ft, snd_pcm_format_mask_t *fmask, int *fmt) · 12 unmodified lines
472467 if (ft->info.size == -1)
473468 ft->info.size = ST_SIZE_WORD;
474469
475− if (ft->info.encoding == -1)
470+ if (ft->info.encoding == ST_ENCODING_UNKNOWN)
476471 {
477472 if (ft->info.size == ST_SIZE_WORD)
478473 ft->info.encoding = ST_ENCODING_SIGN2;
src/au.c+9−9
@@ -107,7 +107,7 @@ static int st_auencodingandsize(int sun_encoding, st_encoding_t * encoding, sign · 106 unmodified lines
107107 return(ST_SUCCESS);
108108 }
109109
110−int st_auseek(ft_t ft, st_size_t offset)
110+static int st_auseek(ft_t ft, st_size_t offset)
111111 {
112112 au_t au = (au_t ) ft->priv;
113113
@@ -137,7 +137,7 @@ int st_auseek(ft_t ft, st_size_t offset) · 23 unmodified lines
137137 return(ft->st_errno);
138138 }
139139
140−int st_austartread(ft_t ft)
140+static int st_austartread(ft_t ft)
141141 {
142142 /* The following 6 variables represent a Sun sound header on disk.
143143 The numbers are written as big-endians.
@@ -245,8 +245,8 @@ int st_austartread(ft_t ft) · 101 unmodified lines
245245
246246 /* Read the number of channels */
247247 st_readdw(ft, &channels);
248− if (ft->info.channels == -1 || ft->info.channels == (int) channels)
249− ft->info.channels = (int) channels;
248+ if (ft->info.channels == 0 || ft->info.channels == channels)
249+ ft->info.channels = channels;
250250 else
251251 st_report("User options overriding channels read in .au header");
252252
@@ -297,7 +297,7 @@ int st_austartread(ft_t ft) · 44 unmodified lines
297297 if it is not, the unspecified size remains in the header
298298 (this is legal). */
299299
300−int st_austartwrite(ft_t ft)
300+static int st_austartwrite(ft_t ft)
301301 {
302302 au_t p = (au_t ) ft->priv;
303303 int rc;
@@ -344,7 +344,7 @@ static int unpack_input(ft_t ft, unsigned char *code) · 40 unmodified lines
344344 return (p->in_bits > 0);
345345 }
346346
347−st_ssize_t st_auread(ft_t ft, st_sample_t *buf, st_size_t samp)
347+static st_size_t st_auread(ft_t ft, st_sample_t *buf, st_size_t samp)
348348 {
349349 au_t p = (au_t ) ft->priv;
350350 unsigned char code;
@@ -362,14 +362,14 @@ st_ssize_t st_auread(ft_t ft, st_sample_t *buf, st_size_t samp) · 11 unmodified lines
362362 return done;
363363 }
364364
365−st_ssize_t st_auwrite(ft_t ft, const st_sample_t *buf, st_size_t samp)
365+static st_size_t st_auwrite(ft_t ft, const st_sample_t *buf, st_size_t samp)
366366 {
367367 au_t p = (au_t ) ft->priv;
368368 p->data_size += samp * ft->info.size;
369369 return(st_rawwrite(ft, buf, samp));
370370 }
371371
372−int st_austopwrite(ft_t ft)
372+static int st_austopwrite(ft_t ft)
373373 {
374374 au_t p = (au_t ) ft->priv;
375375 int rc;
@@ -411,7 +411,7 @@ static int st_ausunencoding(int size, int encoding) · 35 unmodified lines
411411 else if (encoding == ST_ENCODING_FLOAT && size == ST_SIZE_32BIT)
412412 sun_encoding = SUN_FLOAT;
413413 else
414− sun_encoding = -1;
414+ sun_encoding = ST_ENCODING_UNKNOWN;
415415 return sun_encoding;
416416 }
417417
src/auto.c+2−2
@@ -23,7 +23,7 @@ · 22 unmodified lines
2323 #define LASTCHAR '/'
2424 #endif
2525
26−int st_autostartread(ft_t ft)
26+static int st_autostartread(ft_t ft)
2727 {
2828 char *type = NULL;
2929 char header[20];
@@ -179,7 +179,7 @@ int st_autostartread(ft_t ft) · 149 unmodified lines
179179 return ((* ft->h->startread)(ft));
180180 }
181181
182−int st_autostartwrite(ft_t ft)
182+static int st_autostartwrite(ft_t ft)
183183 {
184184 st_fail_errno(ft,ST_EFMT,"Type AUTO can only be used for input!");
185185 return(ST_EOF);
src/avg.c+4−4
@@ -50,7 +50,7 @@ typedef struct avgstuff { · 49 unmodified lines
5050 /*
5151 * Process options
5252 */
53−int st_avg_getopts(eff_t effp, int n, char **argv)
53+static int st_avg_getopts(eff_t effp, int n, char **argv)
5454 {
5555 avg_t avg = (avg_t) effp->priv;
5656 double* pans = &avg->sources[0][0];
@@ -118,7 +118,7 @@ int st_avg_getopts(eff_t effp, int n, char **argv) · 61 unmodified lines
118118 /*
119119 * Start processing
120120 */
121−int st_avg_start(eff_t effp)
121+static int st_avg_start(eff_t effp)
122122 {
123123 /*
124124 Hmmm, this is tricky. Lemme think:
@@ -508,7 +508,7 @@ int st_avg_start(eff_t effp) · 383 unmodified lines
508508 * Process either isamp or osamp samples, whichever is smaller.
509509 */
510510
511−int st_avg_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
511+static int st_avg_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
512512 st_size_t *isamp, st_size_t *osamp)
513513 {
514514 avg_t avg = (avg_t) effp->priv;
@@ -542,7 +542,7 @@ int st_avg_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 27 unmodified lines
542542 *
543543 * Should have statistics on right, left, and output amplitudes.
544544 */
545−int st_avg_stop(eff_t effp)
545+static int st_avg_stop(eff_t effp UNUSED)
546546 {
547547 return (ST_SUCCESS); /* nothing to do */
548548 }
src/avr.c+4−4
@@ -63,7 +63,7 @@ typedef struct avrstuff { · 62 unmodified lines
6363 */
6464
6565
66−int st_avrstartread(ft_t ft)
66+static int st_avrstartread(ft_t ft)
6767 {
6868 avr_t avr = (avr_t)ft->priv;
6969 int rc;
@@ -148,7 +148,7 @@ int st_avrstartread(ft_t ft) · 78 unmodified lines
148148 return(ST_SUCCESS);
149149 }
150150
151−int st_avrstartwrite(ft_t ft)
151+static int st_avrstartwrite(ft_t ft)
152152 {
153153 avr_t avr = (avr_t)ft->priv;
154154 int rc;
@@ -260,7 +260,7 @@ int st_avrstartwrite(ft_t ft) · 105 unmodified lines
260260 return(ST_SUCCESS);
261261 }
262262
263−st_ssize_t st_avrwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
263+static st_size_t st_avrwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
264264 {
265265 avr_t avr = (avr_t)ft->priv;
266266
@@ -269,7 +269,7 @@ st_ssize_t st_avrwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) · 2 unmodified lines
269269 return (st_rawwrite (ft, buf, nsamp));
270270 }
271271
272−int st_avrstopwrite(ft_t ft)
272+static int st_avrstopwrite(ft_t ft)
273273 {
274274 avr_t avr = (avr_t)ft->priv;
275275 int rc;
src/band.c+4−4
@@ -61,7 +61,7 @@ typedef struct bandstuff { · 60 unmodified lines
6161 /*
6262 * Process options
6363 */
64−int st_band_getopts(eff_t effp, int n, char **argv)
64+static int st_band_getopts(eff_t effp, int n, char **argv)
6565 {
6666 band_t band = (band_t) effp->priv;
6767
@@ -88,7 +88,7 @@ int st_band_getopts(eff_t effp, int n, char **argv) · 20 unmodified lines
8888 /*
8989 * Prepare processing.
9090 */
91−int st_band_start(eff_t effp)
91+static int st_band_start(eff_t effp)
9292 {
9393 band_t band = (band_t) effp->priv;
9494 if (band->center > effp->ininfo.rate/2)
@@ -135,7 +135,7 @@ int st_band_start(eff_t effp) · 40 unmodified lines
135135 * Return number of samples processed.
136136 */
137137
138−int st_band_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
138+static int st_band_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
139139 st_size_t *isamp, st_size_t *osamp)
140140 {
141141 band_t band = (band_t) effp->priv;
@@ -162,7 +162,7 @@ int st_band_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 20 unmodified lines
162162 * Do anything required when you stop reading samples.
163163 * Don't close input file!
164164 */
165−int st_band_stop(eff_t effp)
165+static int st_band_stop(eff_t effp UNUSED)
166166 {
167167 return (ST_SUCCESS); /* nothing to do */
168168 }
src/bandpass.c+2−2
@@ -38,7 +38,7 @@ · 37 unmodified lines
3838
3939 static st_effect_t st_bandpass_effect;
4040
41−int st_bandpass_getopts (eff_t effp, int n, char **argv)
41+static int st_bandpass_getopts (eff_t effp, int n, char **argv)
4242 {
4343 butterworth_t butterworth = (butterworth_t)effp->priv;
4444
@@ -61,7 +61,7 @@ int st_bandpass_getopts (eff_t effp, int n, char **argv) · 16 unmodified lines
6161 return (ST_SUCCESS);
6262 }
6363
64−int st_bandpass_start (eff_t effp)
64+static int st_bandpass_start(eff_t effp)
6565 {
6666 butterworth_t butterworth = (butterworth_t) effp->priv;
6767 double c;
src/breject.c+2−2
@@ -38,7 +38,7 @@ · 37 unmodified lines
3838
3939 static st_effect_t st_bandreject_effect;
4040
41−int st_bandreject_getopts(eff_t effp, int n, char **argv)
41+static int st_bandreject_getopts(eff_t effp, int n, char **argv)
4242 {
4343 butterworth_t butterworth = (butterworth_t)effp->priv;
4444
@@ -61,7 +61,7 @@ int st_bandreject_getopts(eff_t effp, int n, char **argv) · 16 unmodified lines
6161 return (ST_SUCCESS);
6262 }
6363
64−int st_bandreject_start(eff_t effp)
64+static int st_bandreject_start(eff_t effp)
6565 {
6666 butterworth_t butterworth = (butterworth_t) effp->priv;
6767 double c;
src/cdr.c+6−6
@@ -39,7 +39,7 @@ typedef struct cdrstuff { · 38 unmodified lines
3939 * mono/stereo/quad.
4040 */
4141
42−int st_cdrstartread(ft_t ft)
42+static int st_cdrstartread(ft_t ft)
4343 {
4444 int rc;
4545
@@ -78,7 +78,7 @@ int st_cdrstartread(ft_t ft) · 32 unmodified lines
7878 * Return number of samples read.
7979 */
8080
81−st_ssize_t st_cdrread(ft_t ft, st_sample_t *buf, st_size_t len)
81+static st_size_t st_cdrread(ft_t ft, st_sample_t *buf, st_size_t len)
8282 {
8383
8484 return st_rawread(ft, buf, len);
@@ -88,13 +88,13 @@ st_ssize_t st_cdrread(ft_t ft, st_sample_t *buf, st_size_t len) · 3 unmodified lines
8888 * Do anything required when you stop reading samples.
8989 * Don't close input file!
9090 */
91−int st_cdrstopread(ft_t ft)
91+static int st_cdrstopread(ft_t ft)
9292 {
9393 /* Needed because of rawread() */
9494 return st_rawstopread(ft);
9595 }
9696
97−int st_cdrstartwrite(ft_t ft)
97+static int st_cdrstartwrite(ft_t ft)
9898 {
9999 cdr_t cdr = (cdr_t) ft->priv;
100100 int rc;
@@ -121,7 +121,7 @@ int st_cdrstartwrite(ft_t ft) · 20 unmodified lines
121121 return(ST_SUCCESS);
122122 }
123123
124−st_ssize_t st_cdrwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
124+static st_size_t st_cdrwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
125125 {
126126 cdr_t cdr = (cdr_t) ft->priv;
127127
@@ -135,7 +135,7 @@ st_ssize_t st_cdrwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 7 unmodified lines
135135 * samples. We write -32768 for each sample to pad it out.
136136 */
137137
138−int st_cdrstopwrite(ft_t ft)
138+static int st_cdrstopwrite(ft_t ft)
139139 {
140140 cdr_t cdr = (cdr_t) ft->priv;
141141 int padsamps = SECTORSIZE - (cdr->samples % SECTORSIZE);
src/chorus.c+5−5
@@ -92,7 +92,7 @@ typedef struct chorusstuff { · 91 unmodified lines
9292 /*
9393 * Process options
9494 */
95−int st_chorus_getopts(eff_t effp, int n, char **argv)
95+static int st_chorus_getopts(eff_t effp, int n, char **argv)
9696 {
9797 chorus_t chorus = (chorus_t) effp->priv;
9898 int i;
@@ -136,7 +136,7 @@ int st_chorus_getopts(eff_t effp, int n, char **argv) · 37 unmodified lines
136136 /*
137137 * Prepare for processing.
138138 */
139−int st_chorus_start(eff_t effp)
139+static int st_chorus_start(eff_t effp)
140140 {
141141 chorus_t chorus = (chorus_t) effp->priv;
142142 int i;
@@ -254,7 +254,7 @@ int st_chorus_start(eff_t effp) · 111 unmodified lines
254254 * Processed signed long samples from ibuf to obuf.
255255 * Return number of samples processed.
256256 */
257−int st_chorus_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
257+static int st_chorus_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
258258 st_size_t *isamp, st_size_t *osamp)
259259 {
260260 chorus_t chorus = (chorus_t) effp->priv;
@@ -293,7 +293,7 @@ int st_chorus_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 32 unmodified lines
293293 /*
294294 * Drain out reverb lines.
295295 */
296−int st_chorus_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
296+static int st_chorus_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
297297 {
298298 chorus_t chorus = (chorus_t) effp->priv;
299299 st_size_t done;
@@ -336,7 +336,7 @@ int st_chorus_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 36 unmodified lines
336336 /*
337337 * Clean up chorus effect.
338338 */
339−int st_chorus_stop(eff_t effp)
339+static int st_chorus_stop(eff_t effp)
340340 {
341341 chorus_t chorus = (chorus_t) effp->priv;
342342 int i;
src/compand.c+8−8
@@ -70,7 +70,7 @@ typedef struct { · 69 unmodified lines
7070 * Don't do initialization now.
7171 * The 'info' fields are not yet filled in.
7272 */
73−int st_compand_getopts(eff_t effp, int n, char **argv)
73+static int st_compand_getopts(eff_t effp, int n, char **argv)
7474 {
7575 compand_t l = (compand_t) effp->priv;
7676
@@ -191,7 +191,7 @@ int st_compand_getopts(eff_t effp, int n, char **argv) · 114 unmodified lines
191191 * Prepare processing.
192192 * Do all initializations.
193193 */
194−int st_compand_start(eff_t effp)
194+static int st_compand_start(eff_t effp)
195195 {
196196 compand_t l = (compand_t) effp->priv;
197197 int i;
@@ -264,14 +264,14 @@ static void doVolume(double *v, double samp, compand_t l, int chan) · 66 unmodified lines
264264 * Processed signed long samples from ibuf to obuf.
265265 * Return number of samples processed.
266266 */
267−int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
267+static int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
268268 st_size_t *isamp, st_size_t *osamp)
269269 {
270270 compand_t l = (compand_t) effp->priv;
271271 int len = (*isamp > *osamp) ? *osamp : *isamp;
272272 int filechans = effp->outinfo.channels;
273273 int idone,odone;
274− int64_t checkbuf; //if st_sample_t of type int32_t
274+ int64_t checkbuf; /* if st_sample_t of type int32_t */
275275
276276 for (idone = 0,odone = 0; idone < len; ibuf += filechans) {
277277 int chan;
@@ -326,7 +326,7 @@ int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 48 unmodified lines
326326 {
327327 if (l->delay_buf_cnt >= l->delay_buf_size)
328328 {
329− l->delay_buf_full=1; //delay buffer is now definetly full
329+ l->delay_buf_full=1; /* delay buffer is now definetly full */
330330 checkbuf = l->delay_buf[l->delay_buf_ptr]*(outv/v)*l->outgain;
331331 ST_SAMPLE_CLIP_COUNT(checkbuf, effp->clippedCount);
332332 obuf[odone] = checkbuf;
@@ -337,7 +337,7 @@ int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 4 unmodified lines
337337 else
338338 {
339339 l->delay_buf_cnt++;
340− idone++; //no "odone++" because we did not fill obuf[...]
340+ idone++; /* no "odone++" because we did not fill obuf[...] */
341341 }
342342 l->delay_buf[l->delay_buf_ptr++] = ibuf[chan];
343343 l->delay_buf_ptr %= l->delay_buf_size;
@@ -352,7 +352,7 @@ int st_compand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 8 unmodified lines
352352 /*
353353 * Drain out compander delay lines.
354354 */
355−int st_compand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
355+static int st_compand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
356356 {
357357 compand_t l = (compand_t) effp->priv;
358358 st_size_t done;
@@ -380,7 +380,7 @@ int st_compand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 21 unmodified lines
380380 /*
381381 * Clean up compander effect.
382382 */
383−int st_compand_stop(eff_t effp)
383+static int st_compand_stop(eff_t effp)
384384 {
385385 compand_t l = (compand_t) effp->priv;
386386
src/copy.c+4−14
@@ -19,7 +19,7 @@ static st_effect_t st_copy_effect; · 18 unmodified lines
1919 /*
2020 * Process options
2121 */
22−int st_copy_getopts(eff_t effp, int n, char **argv)
22+static int st_copy_getopts(eff_t effp UNUSED, int n, char **argv UNUSED)
2323 {
2424 if (n)
2525 {
@@ -32,11 +32,11 @@ int st_copy_getopts(eff_t effp, int n, char **argv) · 6 unmodified lines
3232 /*
3333 * Start processing
3434 */
35−int st_copy_start(eff_t effp)
35+static int st_copy_start(eff_t effp UNUSED)
3636 {
3737 /* nothing to do */
3838 /* stuff data into delaying effects here */
39− return (ST_SUCCESS);
39+ return (ST_SUCCESS);
4040 }
4141
4242 /*
@@ -45,7 +45,7 @@ int st_copy_start(eff_t effp) · 2 unmodified lines
4545 * Place in buf[].
4646 * Return number of samples read.
4747 */
48−int st_copy_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
48+static int st_copy_flow(eff_t effp UNUSED, const st_sample_t *ibuf, st_sample_t *obuf,
4949 st_size_t *isamp, st_size_t *osamp)
5050 {
5151 int done;
@@ -56,16 +56,6 @@ int st_copy_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 4 unmodified lines
5656 return (ST_SUCCESS);
5757 }
5858
59−/*
60− * Do anything required when you stop reading samples.
61− * Don't close input file!
62− */
63−int st_copy_stop(eff_t effp)
64−{
65− /* nothing to do */
66− return (ST_SUCCESS);
67−}
68−
6959 static st_effect_t st_copy_effect = {
7060 "copy",
7161 "Usage: Copy effect takes no options",
src/cvsd.c+11−11
@@ -153,7 +153,7 @@ static void cvsdstartcommon(ft_t ft) · 152 unmodified lines
153153
154154 /* ---------------------------------------------------------------------- */
155155
156−int st_cvsdstartread(ft_t ft)
156+static int st_cvsdstartread(ft_t ft)
157157 {
158158 struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
159159 float *fp1;
@@ -179,7 +179,7 @@ int st_cvsdstartread(ft_t ft) · 19 unmodified lines
179179
180180 /* ---------------------------------------------------------------------- */
181181
182−int st_cvsdstartwrite(ft_t ft)
182+static int st_cvsdstartwrite(ft_t ft)
183183 {
184184 struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
185185 float *fp1;
@@ -201,7 +201,7 @@ int st_cvsdstartwrite(ft_t ft) · 15 unmodified lines
201201
202202 /* ---------------------------------------------------------------------- */
203203
204−int st_cvsdstopwrite(ft_t ft)
204+static int st_cvsdstopwrite(ft_t ft)
205205 {
206206 struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
207207
@@ -217,7 +217,7 @@ int st_cvsdstopwrite(ft_t ft) · 9 unmodified lines
217217
218218 /* ---------------------------------------------------------------------- */
219219
220−int st_cvsdstopread(ft_t ft)
220+static int st_cvsdstopread(ft_t ft)
221221 {
222222 struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
223223
@@ -229,10 +229,10 @@ int st_cvsdstopread(ft_t ft) · 5 unmodified lines
229229
230230 /* ---------------------------------------------------------------------- */
231231
232−st_ssize_t st_cvsdread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
232+static st_size_t st_cvsdread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
233233 {
234234 struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
235− int done = 0;
235+ st_size_t done = 0;
236236 float oval;
237237
238238 while (done < nsamp) {
@@ -288,10 +288,10 @@ st_ssize_t st_cvsdread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 49 unmodified lines
288288
289289 /* ---------------------------------------------------------------------- */
290290
291−st_ssize_t st_cvsdwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
291+static st_size_t st_cvsdwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
292292 {
293293 struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
294− int done = 0;
294+ st_size_t done = 0;
295295 float inval;
296296
297297 for(;;) {
@@ -519,7 +519,7 @@ static void make_dvms_hdr(ft_t ft, struct dvms_header *hdr) · 221 unmodified lines
519519
520520 /* ---------------------------------------------------------------------- */
521521
522−int st_dvmsstartread(ft_t ft)
522+static int st_dvmsstartread(ft_t ft)
523523 {
524524 struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
525525 struct dvms_header hdr;
@@ -558,7 +558,7 @@ int st_dvmsstartread(ft_t ft) · 32 unmodified lines
558558
559559 /* ---------------------------------------------------------------------- */
560560
561−int st_dvmsstartwrite(ft_t ft)
561+static int st_dvmsstartwrite(ft_t ft)
562562 {
563563 struct cvsdpriv *p = (struct cvsdpriv *) ft->priv;
564564 struct dvms_header hdr;
@@ -584,7 +584,7 @@ int st_dvmsstartwrite(ft_t ft) · 19 unmodified lines
584584
585585 /* ---------------------------------------------------------------------- */
586586
587−int st_dvmsstopwrite(ft_t ft)
587+static int st_dvmsstopwrite(ft_t ft)
588588 {
589589 struct dvms_header hdr;
590590 int rc;
src/dat.c+14−26
@@ -1,27 +1,15 @@
1−
21 /*
3− * July 5, 1991
4− * Copyright 1991 Lance Norskog And Sundry Contributors
2+ * Sound Tools text format file. Tom Littlejohn, March 93.
3+ *
4+ * Reads/writes sound files as text for use with FFT and graph.
5+ *
6+ * Copyright 1998-2006 Chris Bagwell and SoX Contributors
57 * This source code is freely redistributable and may be used for
68 * any purpose. This copyright notice must be maintained.
79 * Lance Norskog And Sundry Contributors are not responsible for
810 * the consequences of using this software.
911 */
1012
11−/*
12− * Sound Tools text format file. Tom Littlejohn, March 93.
13− *
14− * Reads/writes sound files as text for use with fft and graph.
15− *
16− * June 28, 93: force output to mono.
17− *
18− * September 24, 1998: cbagwell - Set up extra output format info so that
19− * reports are accurate. Also warn user when forcing to mono.
20− *
21− * November 25, 2005: tomchristie - Work with multiple channels
22− *
23− */
24−
2513 #include "st_i.h"
2614 #include <string.h>
2715
@@ -34,7 +22,7 @@ typedef struct dat { · 6 unmodified lines
3422 char prevline[LINEWIDTH];
3523 } *dat_t;
3624
37−int st_datstartread(ft_t ft)
25+static int st_datstartread(ft_t ft)
3826 {
3927 char inpstr[LINEWIDTH];
4028 long rate;
@@ -61,7 +49,7 @@ int st_datstartread(ft_t ft) · 20 unmodified lines
6149 }
6250
6351 /* Default channels to 1 if not found */
64− if (ft->info.channels == -1)
52+ if (ft->info.channels == 0)
6553 ft->info.channels = 1;
6654
6755 ft->info.size = ST_SIZE_64BIT;
@@ -70,7 +58,7 @@ int st_datstartread(ft_t ft) · 2 unmodified lines
7058 return (ST_SUCCESS);
7159 }
7260
73−int st_datstartwrite(ft_t ft)
61+static int st_datstartwrite(ft_t ft)
7462 {
7563 dat_t dat = (dat_t) ft->priv;
7664 char s[LINEWIDTH];
@@ -88,7 +76,7 @@ int st_datstartwrite(ft_t ft) · 11 unmodified lines
8876 return (ST_SUCCESS);
8977 }
9078
91−st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
79+static st_size_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
9280 {
9381 char inpstr[LINEWIDTH];
9482 int inpPtr = 0;
@@ -96,8 +84,8 @@ st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 1 unmodified line
9684 double sampval = 0.0;
9785 int retc = 0;
9886 char sc = 0;
99− int done = 0;
100− int i=0;
87+ st_size_t done = 0;
88+ st_size_t i=0;
10189
10290 /* Always read a complete set of channels */
10391 nsamp -= (nsamp % ft->info.channels);
@@ -135,13 +123,13 @@ st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 31 unmodified lines
135123 return (done);
136124 }
137125
138−st_ssize_t st_datwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
126+static st_size_t st_datwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
139127 {
140128 dat_t dat = (dat_t) ft->priv;
141− int done = 0;
129+ st_size_t done = 0;
142130 double sampval=0.0;
143131 char s[LINEWIDTH];
144− int i=0;
132+ st_size_t i=0;
145133
146134 /* Always write a complete set of channels */
147135 nsamp -= (nsamp % ft->info.channels);
src/dcshift.c+4−4
@@ -30,7 +30,7 @@ typedef struct { · 29 unmodified lines
3030 /*
3131 * Process options: dcshift (double) type (amplitude, power, dB)
3232 */
33−int st_dcshift_getopts(eff_t effp, int n, char **argv)
33+static int st_dcshift_getopts(eff_t effp, int n, char **argv)
3434 {
3535 dcs_t dcs = (dcs_t) effp->priv;
3636 dcs->dcshift = 1.0; /* default is no change */
@@ -72,7 +72,7 @@ int st_dcshift_getopts(eff_t effp, int n, char **argv) · 35 unmodified lines
7272 /*
7373 * Start processing
7474 */
75−int st_dcshift_start(eff_t effp)
75+static int st_dcshift_start(eff_t effp)
7676 {
7777 dcs_t dcs = (dcs_t) effp->priv;
7878
@@ -99,7 +99,7 @@ int st_dcshift_start(eff_t effp) · 20 unmodified lines
9999 /*
100100 * Process data.
101101 */
102−int st_dcshift_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
102+static int st_dcshift_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
103103 st_size_t *isamp, st_size_t *osamp)
104104 {
105105 dcs_t dcs = (dcs_t) effp->priv;
@@ -166,7 +166,7 @@ int st_dcshift_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 60 unmodified lines
166166 * Do anything required when you stop reading samples.
167167 * Don't close input file!
168168 */
169−int st_dcshift_stop(eff_t effp)
169+static int st_dcshift_stop(eff_t effp)
170170 {
171171 dcs_t dcs = (dcs_t) effp->priv;
172172
src/deemphas.c+4−40
@@ -112,22 +112,6 @@ typedef struct deemphstuff { · 111 unmodified lines
112112 assert_static(sizeof(struct deemphstuff) <= ST_MAX_EFFECT_PRIVSIZE,
113113 /* else */ deemph_PRIVSIZE_too_big);
114114
115−/*
116− * Process options
117− *
118− * Don't do initialization now.
119− * The 'info' fields are not yet filled in.
120− */
121−int st_deemph_getopts(eff_t effp, int n, char **argv)
122−{
123− if (n)
124− {
125− st_fail(st_deemph_effect.usage);
126− return (ST_EOF);
127− }
128− return (ST_SUCCESS);
129−}
130−
131115 /* filter coefficients */
132116 #define a1 -0.62786881719628784282
133117 #define b0 0.45995451989513153057
@@ -137,7 +121,7 @@ int st_deemph_getopts(eff_t effp, int n, char **argv) · 3 unmodified lines
137121 * Prepare processing.
138122 * Do all initializations.
139123 */
140−int st_deemph_start(eff_t effp)
124+static int st_deemph_start(eff_t effp)
141125 {
142126 /* check the input format */
143127
@@ -188,7 +172,7 @@ int st_deemph_start(eff_t effp) · 44 unmodified lines
188172 * Return number of samples processed.
189173 */
190174
191−int st_deemph_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
175+static int st_deemph_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
192176 st_size_t *isamp, st_size_t *osamp)
193177 {
194178 deemph_t deemph = (deemph_t) effp->priv;
@@ -208,35 +192,15 @@ int st_deemph_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 13 unmodified lines
208192 return (ST_SUCCESS);
209193 }
210194
211−/*
212− * Drain out remaining samples if the effect generates any.
213− */
214−
215−int st_deemph_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
216−{
217− /* nothing to do */
218− return (ST_EOF);
219−}
220−
221−/*
222− * Do anything required when you stop reading samples.
223− * (free allocated memory, etc.)
224− */
225−int st_deemph_stop(eff_t effp)
226−{
227− /* nothing to do */
228− return (ST_SUCCESS);
229−}
230−
231195 static st_effect_t st_deemph_effect = {
232196 "deemph",
233197 "Usage: Deemphasis filtering effect takes no options",
234198 0,
235− st_deemph_getopts,
199+ st_effect_nothing_getopts,
236200 st_deemph_start,
237201 st_deemph_flow,
238202 st_effect_nothing_drain,
239− st_deemph_stop
203+ st_effect_nothing
240204 };
241205
242206 const st_effect_t *st_deemph_effect_fn(void)
src/earwax.c+12−28
@@ -1,12 +1,3 @@
1−/*
2− * November 9, 2000
3− * Copyright (C) 2000 Edward Beingessner And Sundry Contributors
4− * This source code is freely redistributable and may be used for
5− * any purpose. This copyright notice must be maintained.
6− * Edward Beingessner And Sundry Contributors are not responsible for
7− * the consequences of using this software.
8− */
9−
101 /*
112 * earwax - makes listening to headphones easier
123 *
@@ -23,7 +14,13 @@ · 10 unmodified lines
2314 * Note:
2415 * This filter only works for 44.1 kHz stereo signals (cd format)
2516 *
26−*/
17+ * November 9, 2000
18+ * Copyright (C) 2000 Edward Beingessner And Sundry Contributors
19+ * This source code is freely redistributable and may be used for
20+ * any purpose. This copyright notice must be maintained.
21+ * Edward Beingessner And Sundry Contributors are not responsible for
22+ * the consequences of using this software.
23+ */
2724
2825 #include "st_i.h"
2926
@@ -75,23 +72,10 @@ typedef struct earwaxstuff { · 45 unmodified lines
7572 st_sample_t *tap; /* taps are z^-1 delays for the FIR filter */
7673 } *earwax_t;
7774
78−/*
79− * Process options
80− */
81−int st_earwax_getopts(eff_t effp, int n, char **argv)
82−{
83− /* no options */
84− if (n){
85− st_fail(st_earwax_effect.usage);
86− return (ST_EOF);
87− }
88− return (ST_SUCCESS);
89−}
90−
9175 /*
9276 * Prepare for processing.
9377 */
94−int st_earwax_start(eff_t effp)
78+static int st_earwax_start(eff_t effp)
9579 {
9680 earwax_t earwax = (earwax_t) effp->priv;
9781 int i;
@@ -125,7 +109,7 @@ int st_earwax_start(eff_t effp) · 27 unmodified lines
125109 * Return number of samples processed.
126110 */
127111
128−int st_earwax_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
112+static int st_earwax_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
129113 st_size_t *isamp, st_size_t *osamp)
130114 {
131115 earwax_t earwax = (earwax_t) effp->priv;
@@ -157,7 +141,7 @@ int st_earwax_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 25 unmodified lines
157141 /*
158142 * Drain out taps.
159143 */
160−int st_earwax_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
144+static int st_earwax_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
161145 {
162146 earwax_t earwax = (earwax_t) effp->priv;
163147 int i,j;
@@ -178,7 +162,7 @@ int st_earwax_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 14 unmodified lines
178162 /*
179163 * Clean up taps.
180164 */
181−int st_earwax_stop(eff_t effp)
165+static int st_earwax_stop(eff_t effp)
182166 {
183167 earwax_t earwax = (earwax_t) effp->priv;
184168
@@ -191,7 +175,7 @@ static st_effect_t st_earwax_effect = { · 6 unmodified lines
191175 "earwax",
192176 "Usage: The earwax filtering effect takes no options",
193177 ST_EFF_MCHAN,
194− st_earwax_getopts,
178+ st_effect_nothing_getopts,
195179 st_earwax_start,
196180 st_earwax_flow,
197181 st_earwax_drain,
src/echo.c+6−6
@@ -82,7 +82,7 @@ typedef struct echostuff { · 81 unmodified lines
8282 /*
8383 * Process options
8484 */
85−int st_echo_getopts(eff_t effp, int n, char **argv)
85+static int st_echo_getopts(eff_t effp, int n, char **argv)
8686 {
8787 echo_t echo = (echo_t) effp->priv;
8888 int i;
@@ -113,7 +113,7 @@ int st_echo_getopts(eff_t effp, int n, char **argv) · 24 unmodified lines
113113 /*
114114 * Prepare for processing.
115115 */
116−int st_echo_start(eff_t effp)
116+static int st_echo_start(eff_t effp)
117117 {
118118 echo_t echo = (echo_t) effp->priv;
119119 int i;
@@ -143,7 +143,7 @@ int st_echo_start(eff_t effp) · 23 unmodified lines
143143 st_fail("echo: delay must be positive!");
144144 return (ST_EOF);
145145 }
146− if ( echo->samples[i] > DELAY_BUFSIZ )
146+ if ( echo->samples[i] > (st_ssize_t)DELAY_BUFSIZ )
147147 {
148148 st_fail("echo: delay must be less than %g seconds!",
149149 DELAY_BUFSIZ / (float) effp->ininfo.rate );
@@ -185,7 +185,7 @@ int st_echo_start(eff_t effp) · 35 unmodified lines
185185 * Processed signed long samples from ibuf to obuf.
186186 * Return number of samples processed.
187187 */
188−int st_echo_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
188+static int st_echo_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
189189 st_size_t *isamp, st_size_t *osamp)
190190 {
191191 echo_t echo = (echo_t) effp->priv;
@@ -222,7 +222,7 @@ int st_echo_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 30 unmodified lines
222222 /*
223223 * Drain out reverb lines.
224224 */
225−int st_echo_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
225+static int st_echo_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
226226 {
227227 echo_t echo = (echo_t) effp->priv;
228228 double d_in, d_out;
@@ -262,7 +262,7 @@ int st_echo_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 33 unmodified lines
262262 /*
263263 * Clean up reverb effect.
264264 */
265−int st_echo_stop(eff_t effp)
265+static int st_echo_stop(eff_t effp)
266266 {
267267 echo_t echo = (echo_t) effp->priv;
268268
src/echos.c+7−7
@@ -52,7 +52,7 @@ · 51 unmodified lines
5252
5353 static st_effect_t st_echos_effect;
5454
55−#define DELAY_BUFSIZ ( 50L * ST_MAXRATE )
55+#define DELAY_BUFSIZ ( 50 * ST_MAXRATE )
5656 #define MAX_ECHOS 7 /* 24 bit x ( 1 + MAX_ECHOS ) = */
5757 /* 24 bit x 8 = 32 bit !!! */
5858
@@ -72,7 +72,7 @@ typedef struct echosstuff { · 13 unmodified lines
7272 /*
7373 * Process options
7474 */
75−int st_echos_getopts(eff_t effp, int n, char **argv)
75+static int st_echos_getopts(eff_t effp, int n, char **argv)
7676 {
7777 echos_t echos = (echos_t) effp->priv;
7878 int i;
@@ -107,7 +107,7 @@ int st_echos_getopts(eff_t effp, int n, char **argv) · 28 unmodified lines
107107 /*
108108 * Prepare for processing.
109109 */
110−int st_echos_start(eff_t effp)
110+static int st_echos_start(eff_t effp)
111111 {
112112 echos_t echos = (echos_t) effp->priv;
113113 int i;
@@ -136,7 +136,7 @@ int st_echos_start(eff_t effp) · 22 unmodified lines
136136 st_fail("echos: delay must be positive!");
137137 return (ST_EOF);
138138 }
139− if ( echos->samples[i] > DELAY_BUFSIZ )
139+ if ( echos->samples[i] > (st_ssize_t)DELAY_BUFSIZ )
140140 {
141141 st_fail("echos: delay must be less than %g seconds!",
142142 DELAY_BUFSIZ / (float) effp->ininfo.rate );
@@ -177,7 +177,7 @@ int st_echos_start(eff_t effp) · 34 unmodified lines
177177 * Processed signed long samples from ibuf to obuf.
178178 * Return number of samples processed.
179179 */
180−int st_echos_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
180+static int st_echos_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
181181 st_size_t *isamp, st_size_t *osamp)
182182 {
183183 echos_t echos = (echos_t) effp->priv;
@@ -220,7 +220,7 @@ int st_echos_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 36 unmodified lines
220220 /*
221221 * Drain out reverb lines.
222222 */
223−int st_echos_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
223+static int st_echos_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
224224 {
225225 echos_t echos = (echos_t) effp->priv;
226226 double d_in, d_out;
@@ -266,7 +266,7 @@ int st_echos_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 39 unmodified lines
266266 /*
267267 * Clean up echos effect.
268268 */
269−int st_echos_stop(eff_t effp)
269+static int st_echos_stop(eff_t effp)
270270 {
271271 echos_t echos = (echos_t) effp->priv;
272272
src/equalizer.c+20−20
@@ -55,17 +55,17 @@ static st_effect_t st_equalizer_effect; · 54 unmodified lines
5555
5656 /* Filter parameters */
5757 typedef struct filterparams {
58− float rate; // Sample rate
59− float Q; // Q-factor
60− float cfreq; // Central frequency (Hz)
61− float gain; // Gain (dB)
62− double x[3]; // In where x[2] <=> x[ n - 2 ]
63− double y[3]; // Out
64− double b[3]; // From this point, equation constants...
58+ float rate; /* Sample rate */
59+ float Q; /* Q-factor */
60+ float cfreq; /* Central frequency (Hz) */
61+ float gain; /* Gain (dB) */
62+ double x[3]; /* In where x[2] <=> x[ n - 2 ] */
63+ double y[3]; /* Out */
64+ double b[3]; /* From this point, equation constants... */
6565 double a[3];
6666 } *equalizer_t;
6767
68−int st_equalizer_getopts(eff_t effp, int n, char **argv)
68+static int st_equalizer_getopts(eff_t effp, int n, char **argv)
6969 {
7070 equalizer_t eq = (equalizer_t) effp->priv;
7171 int i;
@@ -81,20 +81,20 @@ int st_equalizer_getopts(eff_t effp, int n, char **argv) · 9 unmodified lines
8181 sscanf(argv[i++], "%f", &eq->Q);
8282 sscanf(argv[i++], "%f", &eq->gain);
8383
84− // TODO: Would be nice to validate the params..
84+ /* FIXME: Would be nice to validate the params.. */
8585
8686 return (ST_SUCCESS);
8787 }
8888
89−// Set the filter constants
90−int st_equalizer_start(eff_t effp)
89+/* Set the filter constants */
90+static int st_equalizer_start(eff_t effp)
9191 {
9292 equalizer_t eq = (equalizer_t) effp->priv;
9393 double w0;
9494 double amp;
9595 double alpha;
9696
97− // Sample rate
97+ /* Sample rate */
9898 eq->rate = effp->ininfo.rate;
9999
100100 w0 = 2*M_PI*eq->cfreq/eq->rate;
@@ -109,7 +109,7 @@ int st_equalizer_start(eff_t effp) · 8 unmodified lines
109109 st_debug("amp: %f", amp);
110110 st_debug("alpha: %f", alpha);
111111
112− // Initialisation
112+ /* Initialisation */
113113 eq->b[0] = 1 + alpha*amp;
114114 eq->b[1] = -2*cos(w0);
115115 eq->b[2] = 1 - alpha*amp;
@@ -117,12 +117,12 @@ int st_equalizer_start(eff_t effp) · 1 unmodified line
117117 eq->a[1] = -2*cos(w0);
118118 eq->a[2] = 1 - alpha/amp;
119119
120− eq->x[0] = 0; // x[n]
121− eq->x[1] = 0; // x[n-1]
122− eq->x[2] = 0; // x[n-2]
123− eq->y[0] = 0; // y[n]
124− eq->y[1] = 0; // y[n-1]
125− eq->y[2] = 0; // y[n-2]
120+ eq->x[0] = 0; /* x[n] */
121+ eq->x[1] = 0; /* x[n-1] */
122+ eq->x[2] = 0; /* x[n-2] */
123+ eq->y[0] = 0; /* y[n] */
124+ eq->y[1] = 0; /* y[n-1] */
125+ eq->y[2] = 0; /* y[n-2] */
126126
127127 if (effp->globalinfo.octave_plot_effect)
128128 {
@@ -147,7 +147,7 @@ int st_equalizer_start(eff_t effp) · 18 unmodified lines
147147 return (ST_SUCCESS);
148148 }
149149
150−int st_equalizer_flow(eff_t effp, const st_sample_t *ibuf,
150+static int st_equalizer_flow(eff_t effp, const st_sample_t *ibuf,
151151 st_sample_t *obuf, st_size_t *isamp,
152152 st_size_t *osamp)
153153 {
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
src/filter.c+9−9
@@ -54,7 +54,7 @@ static void FiltWin(filter_t f, long Nx); · 53 unmodified lines
5454 /*
5555 * Process options
5656 */
57−int st_filter_getopts(eff_t effp, int n, char **argv)
57+static int st_filter_getopts(eff_t effp, int n, char **argv)
5858 {
5959 filter_t f = (filter_t) effp->priv;
6060
@@ -104,7 +104,7 @@ int st_filter_getopts(eff_t effp, int n, char **argv) · 43 unmodified lines
104104 /*
105105 * Prepare processing.
106106 */
107−int st_filter_start(eff_t effp)
107+static int st_filter_start(eff_t effp)
108108 {
109109 filter_t f = (filter_t) effp->priv;
110110 double *Fp0, *Fp1;
@@ -114,7 +114,7 @@ int st_filter_start(eff_t effp) · 3 unmodified lines
114114 f->rate = effp->ininfo.rate;
115115
116116 /* 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)
118118 f->freq1 = f->rate/2;
119119
120120 if ((f->freq0 < 0) || (f->freq0 > f->freq1))
@@ -126,7 +126,7 @@ int st_filter_start(eff_t effp) · 5 unmodified lines
126126
127127 Xh = f->Nwin/2;
128128 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) {
130130 Xh0 = makeFilter(Fp0, Xh, 2.0*(double)f->freq0/f->rate, f->beta, 1, 0);
131131 if (Xh0 <= 1)
132132 {
@@ -138,7 +138,7 @@ int st_filter_start(eff_t effp) · 5 unmodified lines
138138 }
139139 Fp1 = (double *) malloc(sizeof(double) * (Xh + 2)) + 1;
140140 /* 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) {
142142 Xh1 = makeFilter(Fp1, Xh, 2.0*(double)f->freq1/f->rate, f->beta, 1, 0);
143143 if (Xh1 <= 1)
144144 {
@@ -182,11 +182,11 @@ int st_filter_start(eff_t effp) · 37 unmodified lines
182182 * Processed signed long samples from ibuf to obuf.
183183 * Return number of samples processed.
184184 */
185−int st_filter_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
185+static int st_filter_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
186186 st_size_t *isamp, st_size_t *osamp)
187187 {
188188 filter_t f = (filter_t) effp->priv;
189− long i, Nx, Nproc;
189+ st_size_t i, Nx, Nproc;
190190
191191 /* constrain amount we actually process */
192192 /* 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
234234 /*
235235 * Process tail of input samples.
236236 */
237−int st_filter_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
237+static int st_filter_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
238238 {
239239 filter_t f = (filter_t) effp->priv;
240240 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
271271 * Do anything required when you stop reading samples.
272272 * Don't close input file!
273273 */
274−int st_filter_stop(eff_t effp)
274+static int st_filter_stop(eff_t effp)
275275 {
276276 filter_t f = (filter_t) effp->priv;
277277
src/flac.c+9−10
@@ -58,8 +58,7 @@ static void FLAC__decoder_metadata_callback(FLAC__FileDecoder const * const flac · 57 unmodified lines
5858 }
5959 else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT)
6060 {
61− int i;
62− int comment_size = 0;
61+ size_t i, comment_size = 0;
6362
6463 if (metadata->data.vorbis_comment.num_comments == 0)
6564 {
@@ -176,10 +175,10 @@ static int st_format_start_read(ft_t const format) · 110 unmodified lines
176175 }
177176
178177
179−static st_ssize_t st_format_read(ft_t const format, st_sample_t * sampleBuffer, st_size_t const requested)
178+static st_size_t st_format_read(ft_t const format, st_sample_t * sampleBuffer, st_size_t const requested)
180179 {
181180 Decoder * decoder = (Decoder *) format->priv;
182− int actual = 0;
181+ size_t actual = 0;
183182
184183 while (!decoder->eof && actual < requested)
185184 {
@@ -247,7 +246,7 @@ assert_static(sizeof(Encoder) <= ST_MAX_FILE_PRIVSIZE, /* else */ Encoder__PRIVS · 61 unmodified lines
247246
248247
249248
250−FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEncoder const * const flac, const FLAC__byte buffer[], unsigned const bytes, unsigned const samples, unsigned const current_frame, void * const client_data)
249+static FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEncoder const * const flac, const FLAC__byte buffer[], unsigned const bytes, unsigned const samples, unsigned const current_frame, void * const client_data)
251250 {
252251 ft_t const format = (ft_t) client_data;
253252 (void) flac, (void) samples, (void) current_frame;
@@ -257,7 +256,7 @@ FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEn · 3 unmodified lines
257256
258257
259258
260−void flac_stream_encoder_metadata_callback(FLAC__StreamEncoder const * encoder, FLAC__StreamMetadata const * metadata, void * client_data)
259+static void flac_stream_encoder_metadata_callback(FLAC__StreamEncoder const * encoder, FLAC__StreamMetadata const * metadata, void * client_data)
261260 {
262261 (void) encoder, (void) metadata, (void) client_data;
263262 }
@@ -341,7 +340,7 @@ static int st_format_start_write(ft_t const format) · 77 unmodified lines
341340 { /* Check if rate is streamable: */
342341 static const unsigned streamable_rates[] =
343342 {8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000};
344− int i;
343+ size_t i;
345344 bool streamable = false;
346345 for (i = 0; !streamable && i < array_length(streamable_rates); ++i)
347346 {
@@ -356,7 +355,7 @@ static int st_format_start_write(ft_t const format) · 8 unmodified lines
356355
357356 if (format->length != 0)
358357 {
359− FLAC__stream_encoder_set_total_samples_estimate(encoder->flac, format->length);
358+ FLAC__stream_encoder_set_total_samples_estimate(encoder->flac, (FLAC__uint64)format->length);
360359 }
361360
362361 if (format->comment != NULL && * format->comment != '\0')
@@ -423,7 +422,7 @@ static int st_format_start_write(ft_t const format) · 60 unmodified lines
423422
424423
425424
426−static st_ssize_t st_format_write(ft_t const format, st_sample_t const * const sampleBuffer, st_size_t const len)
425+static st_size_t st_format_write(ft_t const format, st_sample_t const * const sampleBuffer, st_size_t const len)
427426 {
428427 Encoder * encoder = (Encoder *) format->priv;
429428 unsigned i;
@@ -439,7 +438,7 @@ static st_ssize_t st_format_write(ft_t const format, st_sample_t const * const s · 9 unmodified lines
439438 }
440439 }
441440 FLAC__stream_encoder_process_interleaved(encoder->flac, encoder->decoded_samples, len / format->info.channels);
442− return FLAC__stream_encoder_get_state(encoder->flac) == FLAC__STREAM_ENCODER_OK ? len : -1;
441+ return FLAC__stream_encoder_get_state(encoder->flac) == FLAC__STREAM_ENCODER_OK ? len : 0;
443442 }
444443
445444
src/flanger.c+34−34
@@ -5,38 +5,38 @@ · 4 unmodified lines
55 * See LICENSE file for further copyright information.
66 */
77
8−static char const st_flanger_usage[] =
9− "Usage: \n"
10− " .\n"
11− " /|regen\n"
12− " / |\n"
13− " +--( |------------+\n"
14− " | \\ | | .\n"
15− " _V_ \\| _______ | |\\ width ___\n"
16− " | | ' | | | | \\ | |\n"
17− " +-->| + |---->| DELAY |--+-->| )----->| |\n"
18− " | |___| |_______| | / | |\n"
19− " | delay : depth |/ | |\n"
20− " In | : interp ' | | Out\n"
21− " --->+ __:__ | + |--->\n"
22− " | | |speed | |\n"
23− " | | ~ |shape | |\n"
24− " | |_____|phase | |\n"
25− " +------------------------------------->| |\n"
26− " |___|\n"
27− "\n"
28− "Usage: flanger [delay depth regen width speed shape phase interp]\n"
29− "\n"
30− " RANGE DEFAULT DESCRIPTION\n"
31− "delay 0 10 0 base delay in milliseconds\n"
32− "depth 0 10 2 added swept delay in milliseconds\n"
33− "regen -95 +95 0 percentage regeneration (delayed signal feedback)\n"
34− "width 0 100 71 percentage of delayed signal mixed with original\n"
35− "speed 0.1 10 0.5 sweeps per second (Hz) \n"
36− "shape -- sin swept wave shape: sine|triangle\n"
37− "phase 0 100 25 swept wave percentage phase-shift for multi-channel\n"
38− " (e.g. stereo) flange; 0 = 100 = same phase on each channel\n"
39− "interp -- lin delay-line interpolation: linear|quadratic";
8+#define st_flanger_usage \
9+ "Usage: \n" \
10+ " .\n" \
11+ " /|regen\n" \
12+ " / |\n" \
13+ " +--( |------------+\n" \
14+ " | \\ | | .\n" \
15+ " _V_ \\| _______ | |\\ width ___\n" \
16+ " | | ' | | | | \\ | |\n" \
17+ " +-->| + |---->| DELAY |--+-->| )----->| |\n" \
18+ " | |___| |_______| | / | |\n" \
19+ " | delay : depth |/ | |\n" \
20+ " In | : interp ' | | Out\n" \
21+ " --->+ __:__ | + |--->\n" \
22+ " | | |speed | |\n" \
23+ " | | ~ |shape | |\n" \
24+ " | |_____|phase | |\n" \
25+ " +------------------------------------->| |\n" \
26+ " |___|\n" \
27+ "\n" \
28+ "Usage: flanger [delay depth regen width speed shape phase interp]\n" \
29+ "\n" \
30+ " RANGE DEFAULT DESCRIPTION\n" \
31+ "delay 0 10 0 base delay in milliseconds\n" \
32+ "depth 0 10 2 added swept delay in milliseconds\n" \
33+ "regen -95 +95 0 percentage regeneration (delayed signal feedback)\n" \
34+ "width 0 100 71 percentage of delayed signal mixed with original\n" \
35+ "speed 0.1 10 0.5 sweeps per second (Hz) \n" \
36+ "shape -- sin swept wave shape: sine|triangle\n" \
37+ "phase 0 100 25 swept wave percentage phase-shift for multi-channel\n" \
38+ " (e.g. stereo) flange; 0 = 100 = same phase on each channel\n" \
39+ "interp -- lin delay-line interpolation: linear|quadratic"
4040
4141 /* TODO: Slide in the delay at the start? */
4242
@@ -88,7 +88,7 @@ assert_static(sizeof(struct flanger) <= ST_MAX_EFFECT_PRIVSIZE, · 45 unmodified lines
8888 static enum_item const interp_enum[] = {
8989 ENUM_ITEM(INTERP_,LINEAR)
9090 ENUM_ITEM(INTERP_,QUADRATIC)
91− {0}};
91+ {0, 0}};
9292
9393
9494
@@ -121,7 +121,7 @@ static enum_item const interp_enum[] = { · 26 unmodified lines
121121
122122
123123
124−static int st_flanger_getopts(eff_t effp, int argc, char const * const * argv)
124+static int st_flanger_getopts(eff_t effp, int argc, char *argv[])
125125 {
126126 flanger_t f = (flanger_t) effp->priv;
127127
src/g72x.c+2−2
@@ -373,7 +373,7 @@ void update(int code_size, int y, int wi, int fi, int dq, int sr, · 372 unmodified lines
373373 state_ptr->dq[cnt] = state_ptr->dq[cnt-1];
374374 /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */
375375 if (mag == 0) {
376− state_ptr->dq[0] = (dq >= 0) ? 0x20 : 0xFC20;
376+ state_ptr->dq[0] = (dq >= 0) ? 0x20 : (short)0xFC20;
377377 } else {
378378 exp = quan(mag, power2, 15);
379379 state_ptr->dq[0] = (dq >= 0) ?
@@ -393,7 +393,7 @@ void update(int code_size, int y, int wi, int fi, int dq, int sr, · 13 unmodified lines
393393 exp = quan(mag, power2, 15);
394394 state_ptr->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400;
395395 } else
396− state_ptr->sr[0] = 0xFC20;
396+ state_ptr->sr[0] = (short)(0xFC20);
397397
398398 /* DELAY A */
399399 state_ptr->pk[1] = state_ptr->pk[0];
src/gsm.c+9−9
@@ -63,7 +63,7 @@ static int gsmstart_rw(ft_t ft, int w) · 62 unmodified lines
6363 if (!ft->info.rate)
6464 ft->info.rate = 8000;
6565
66− if (ft->info.channels == -1)
66+ if (ft->info.channels == 0)
6767 ft->info.channels = 1;
6868
6969 p->channels = ft->info.channels;
@@ -88,12 +88,12 @@ static int gsmstart_rw(ft_t ft, int w) · 18 unmodified lines
8888 return (ST_SUCCESS);
8989 }
9090
91−int st_gsmstartread(ft_t ft)
91+static int st_gsmstartread(ft_t ft)
9292 {
9393 return gsmstart_rw(ft,0);
9494 }
9595
96−int st_gsmstartwrite(ft_t ft)
96+static int st_gsmstartwrite(ft_t ft)
9797 {
9898 return gsmstart_rw(ft,1);
9999 }
@@ -105,9 +105,9 @@ int st_gsmstartwrite(ft_t ft) · 5 unmodified lines
105105 * Return number of samples read.
106106 */
107107
108−st_ssize_t st_gsmread(ft_t ft, st_sample_t *buf, st_size_t samp)
108+static st_size_t st_gsmread(ft_t ft, st_sample_t *buf, st_size_t samp)
109109 {
110− int done = 0;
110+ size_t done = 0;
111111 int r, ch, chans;
112112 gsm_signal *gbuff;
113113 struct gsmpriv *p = (struct gsmpriv *) ft->priv;
@@ -183,9 +183,9 @@ static int gsmflush(ft_t ft) · 69 unmodified lines
183183 return (ST_SUCCESS);
184184 }
185185
186−st_ssize_t st_gsmwrite(ft_t ft, const st_sample_t *buf, st_size_t samp)
186+static st_size_t st_gsmwrite(ft_t ft, const st_sample_t *buf, st_size_t samp)
187187 {
188− int done = 0;
188+ size_t done = 0;
189189 struct gsmpriv *p = (struct gsmpriv *) ft->priv;
190190
191191 while (done < samp)
@@ -206,7 +206,7 @@ st_ssize_t st_gsmwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) · 14 unmodified lines
206206 return done;
207207 }
208208
209−int st_gsmstopread(ft_t ft)
209+static int st_gsmstopread(ft_t ft)
210210 {
211211 struct gsmpriv *p = (struct gsmpriv *) ft->priv;
212212 int ch;
@@ -219,7 +219,7 @@ int st_gsmstopread(ft_t ft) · 6 unmodified lines
219219 return (ST_SUCCESS);
220220 }
221221
222−int st_gsmstopwrite(ft_t ft)
222+static int st_gsmstopwrite(ft_t ft)
223223 {
224224 int rc;
225225 struct gsmpriv *p = (struct gsmpriv *) ft->priv;
src/handlers.c+1−1
@@ -37,7 +37,7 @@ st_format_fn_t st_format_fns[] = { · 36 unmodified lines
3737 st_la_format_fn,
3838 st_lu_format_fn,
3939 st_maud_format_fn,
40−#if defined(HAVE_LIBMAD) || defined(HAVE_LAME)
40+#if defined(HAVE_LIBMAD) || defined(HAVE_LIBMP3LAME)
4141 st_mp3_format_fn,
4242 #endif
4343 st_nul_format_fn,
src/hcom.c+6−6
@@ -50,7 +50,7 @@ struct readpriv { · 49 unmodified lines
5050
5151 static int skipbytes(ft_t, int);
5252
53−int st_hcomstartread(ft_t ft)
53+static int st_hcomstartread(ft_t ft)
5454 {
5555 struct readpriv *p = (struct readpriv *) ft->priv;
5656 int i;
@@ -174,7 +174,7 @@ static int skipbytes(ft_t ft, int n) · 117 unmodified lines
174174 return(ST_SUCCESS);
175175 }
176176
177−st_ssize_t st_hcomread(ft_t ft, st_sample_t *buf, st_size_t len)
177+static st_size_t st_hcomread(ft_t ft, st_sample_t *buf, st_size_t len)
178178 {
179179 register struct readpriv *p = (struct readpriv *) ft->priv;
180180 int done = 0;
@@ -238,7 +238,7 @@ st_ssize_t st_hcomread(ft_t ft, st_sample_t *buf, st_size_t len) · 57 unmodified lines
238238 return done;
239239 }
240240
241−int st_hcomstopread(ft_t ft)
241+static int st_hcomstopread(ft_t ft)
242242 {
243243 register struct readpriv *p = (struct readpriv *) ft->priv;
244244
@@ -265,7 +265,7 @@ struct writepriv { · 20 unmodified lines
265265
266266 #define BUFINCR (10*BUFSIZ)
267267
268−int st_hcomstartwrite(ft_t ft)
268+static int st_hcomstartwrite(ft_t ft)
269269 {
270270 register struct writepriv *p = (struct writepriv *) ft->priv;
271271
@@ -302,7 +302,7 @@ int st_hcomstartwrite(ft_t ft) · 30 unmodified lines
302302 return (ST_SUCCESS);
303303 }
304304
305−st_ssize_t st_hcomwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
305+static st_size_t st_hcomwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
306306 {
307307 register struct writepriv *p = (struct writepriv *) ft->priv;
308308 st_sample_t datum;
@@ -514,7 +514,7 @@ static void padbytes(ft_t ft, int n) · 205 unmodified lines
514514
515515 /* End of hcom utility routines */
516516
517−int st_hcomstopwrite(ft_t ft)
517+static int st_hcomstopwrite(ft_t ft)
518518 {
519519 register struct writepriv *p = (struct writepriv *) ft->priv;
520520 unsigned char *compressed_data = p->data;
src/highp.c+4−14
@@ -44,7 +44,7 @@ typedef struct highpstuff { · 43 unmodified lines
4444 /*
4545 * Process options
4646 */
47−int st_highp_getopts(eff_t effp, int n, char **argv)
47+static int st_highp_getopts(eff_t effp, int n, char **argv)
4848 {
4949 highp_t highp = (highp_t) effp->priv;
5050
@@ -59,7 +59,7 @@ int st_highp_getopts(eff_t effp, int n, char **argv) · 8 unmodified lines
5959 /*
6060 * Prepare processing.
6161 */
62−int st_highp_start(eff_t effp)
62+static int st_highp_start(eff_t effp)
6363 {
6464 highp_t highp = (highp_t) effp->priv;
6565 if (highp->cutoff > effp->ininfo.rate/2)
@@ -100,7 +100,7 @@ int st_highp_start(eff_t effp) · 34 unmodified lines
100100 * Processed signed long samples from ibuf to obuf.
101101 * Return number of samples processed.
102102 */
103−int st_highp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
103+static int st_highp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
104104 st_size_t *isamp, st_size_t *osamp)
105105 {
106106 highp_t highp = (highp_t) effp->priv;
@@ -125,16 +125,6 @@ int st_highp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 18 unmodified lines
125125 return (ST_SUCCESS);
126126 }
127127
128−/*
129− * Do anything required when you stop reading samples.
130− * Don't close input file!
131− */
132−int st_highp_stop(eff_t effp)
133−{
134− /* nothing to do */
135− return (ST_SUCCESS);
136−}
137−
138128 static st_effect_t st_highp_effect = {
139129 "highp",
140130 "Usage: highp cutoff",
@@ -143,7 +133,7 @@ static st_effect_t st_highp_effect = { · 2 unmodified lines
143133 st_highp_start,
144134 st_highp_flow,
145135 st_effect_nothing_drain,
146− st_highp_stop
136+ st_effect_nothing
147137 };
148138
149139 const st_effect_t *st_highp_effect_fn(void)
src/highpass.c+2−5
@@ -1,5 +1,4 @@
11 /*
2−
32 High-pass effect file for SoX
43 Copyright (C) 1999 Jan Paul Schmidt <jps@fundament.org>
54
@@ -38,7 +37,7 @@ · 32 unmodified lines
3837
3938 static st_effect_t st_highpass_effect;
4039
41−int st_highpass_getopts(eff_t effp, int n, char **argv)
40+static int st_highpass_getopts(eff_t effp, int n, char **argv)
4241 {
4342 butterworth_t butterworth = (butterworth_t)effp->priv;
4443
@@ -56,9 +55,7 @@ int st_highpass_getopts(eff_t effp, int n, char **argv) · 11 unmodified lines
5655 return (ST_SUCCESS);
5756 }
5857
59−
60−
61−int st_highpass_start(eff_t effp)
58+static int st_highpass_start(eff_t effp)
6259 {
6360 butterworth_t butterworth = (butterworth_t) effp->priv;
6461 double c;
src/ima_rw.c+5−7
@@ -164,8 +164,7 @@ static int ImaMashS( · 163 unmodified lines
164164 const SAMPL *ibuff, /* ibuff[] is interleaved input samples */
165165 int n, /* samples to encode PER channel, REQUIRE n % 8 == 1 */
166166 int *st, /* input/output state, REQUIRE 0 <= *st <= ISSTMAX */
167− unsigned char *obuff, /* output buffer[blockAlign], or NULL for no output */
168− int sho /* nonzero for debug printout */
167+ unsigned char *obuff /* output buffer[blockAlign], or NULL for no output */
169168 )
170169 {
171170 const SAMPL *ip, *itop;
@@ -258,14 +257,13 @@ inline static void ImaMashChannel( · 86 unmodified lines
258257 int snext,d;
259258 int s0,d0;
260259 int s32,d32;
261− int sho = 0;
262260
263261 s32 = s0 = *st;
264262 if (opt>0) {
265263 int low,hi,w;
266264 int low0,hi0;
267265 snext = s0;
268− d32 = d0 = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL, sho);
266+ d32 = d0 = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL);
269267
270268 w = 0;
271269 low=hi=s0;
@@ -275,7 +273,7 @@ inline static void ImaMashChannel( · 3 unmodified lines
275273 if (!w && low>low0) {
276274 int d;
277275 snext = --low;
278− d = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL, sho);
276+ d = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL);
279277 if (d<d0) {
280278 d0=d; s0=low;
281279 low0 = low-opt; if (low0<0) low0=0;
@@ -285,7 +283,7 @@ inline static void ImaMashChannel( · 3 unmodified lines
285283 if (w && hi<hi0) {
286284 int d;
287285 snext = ++hi;
288− d = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL, sho);
286+ d = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL);
289287 if (d<d0) {
290288 d0=d; s0=hi;
291289 low0 = hi-opt; if (low0<0) low0=0;
@@ -296,7 +294,7 @@ inline static void ImaMashChannel( · 4 unmodified lines
296294 }
297295 *st = s0;
298296 }
299− d = ImaMashS(ch, chans, ip[0], ip,n,st, obuff, 0);
297+ d = ImaMashS(ch, chans, ip[0], ip,n,st, obuff);
300298 }
301299
302300 /* mash one block. if you want to use opt>0, 9 is a reasonable value */
src/libgsm/Makefile.in+10−5
@@ -101,6 +101,7 @@ EGREP = @EGREP@ · 100 unmodified lines
101101 EXEEXT = @EXEEXT@
102102 GETOPT_LONG_FALSE = @GETOPT_LONG_FALSE@
103103 GETOPT_LONG_TRUE = @GETOPT_LONG_TRUE@
104+GREP = @GREP@
104105 INSTALL_DATA = @INSTALL_DATA@
105106 INSTALL_PROGRAM = @INSTALL_PROGRAM@
106107 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -128,9 +129,6 @@ SHELL = @SHELL@ · 21 unmodified lines
128129 STRIP = @STRIP@
129130 VERSION = @VERSION@
130131 ac_ct_CC = @ac_ct_CC@
131−ac_ct_RANLIB = @ac_ct_RANLIB@
132−ac_ct_STRIP = @ac_ct_STRIP@
133−ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
134132 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
135133 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
136134 am__include = @am__include@
@@ -141,19 +139,26 @@ am__untar = @am__untar@ · 4 unmodified lines
141139 bindir = @bindir@
142140 build_alias = @build_alias@
143141 datadir = @datadir@
142+datarootdir = @datarootdir@
143+docdir = @docdir@
144+dvidir = @dvidir@
144145 exec_prefix = @exec_prefix@
145146 host_alias = @host_alias@
147+htmldir = @htmldir@
146148 includedir = @includedir@
147149 infodir = @infodir@
148150 install_sh = @install_sh@
149151 libdir = @libdir@
150152 libexecdir = @libexecdir@
153+localedir = @localedir@
151154 localstatedir = @localstatedir@
152155 mandir = @mandir@
153156 mkdir_p = @mkdir_p@
154157 oldincludedir = @oldincludedir@
158+pdfdir = @pdfdir@
155159 prefix = @prefix@
156160 program_transform_name = @program_transform_name@
161+psdir = @psdir@
157162 sbindir = @sbindir@
158163 sharedstatedir = @sharedstatedir@
159164 sysconfdir = @sysconfdir@
@@ -178,9 +183,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) · 18 unmodified lines
178183 exit 1;; \
179184 esac; \
180185 done; \
181− echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libgsm/Makefile'; \
186+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libgsm/Makefile'; \
182187 cd $(top_srcdir) && \
183− $(AUTOMAKE) --foreign src/libgsm/Makefile
188+ $(AUTOMAKE) --gnu src/libgsm/Makefile
184189 .PRECIOUS: Makefile
185190 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
186191 @case '$?' in \
src/libgsm/code.c+5−7
@@ -54,21 +54,19 @@ void Gsm_Coder ( · 53 unmodified lines
5454 word so[160];
5555
5656 Gsm_Preprocess (S, s, so);
57− Gsm_LPC_Analysis (S, so, LARc);
57+ Gsm_LPC_Analysis (so, LARc);
5858 Gsm_Short_Term_Analysis_Filter (S, LARc, so);
5959
6060 for (k = 0; k <= 3; k++, xMc += 13) {
6161
62− Gsm_Long_Term_Predictor ( S,
63− so+k*40, /* d [0..39] IN */
62+ Gsm_Long_Term_Predictor (so+k*40, /* d [0..39] IN */
6463 dp, /* dp [-120..-1] IN */
65− e + 5, /* e [0..39] OUT */
66− dpp, /* dpp [0..39] OUT */
64+ e + 5, /* e [0..39] OUT */
65+ dpp, /* dpp [0..39] OUT */
6766 Nc++,
6867 bc++);
6968
70− Gsm_RPE_Encoding ( S,
71− e + 5, /* e ][0..39][ IN/OUT */
69+ Gsm_RPE_Encoding ( e + 5, /* e ][0..39][ IN/OUT */
7270 xmaxc++, Mc++, xMc );
7371 /*
7472 * Gsm_Update_of_reconstructed_short_time_residual_signal
src/libgsm/decode.c+1−1
@@ -49,7 +49,7 @@ void Gsm_Decoder ( · 48 unmodified lines
4949
5050 for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) {
5151
52− Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp );
52+ Gsm_RPE_Decoding( *xmaxcr, *Mcr, xMcr, erp );
5353 Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp );
5454
5555 for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ];
src/libgsm/long_term.c+0−3
@@ -198,9 +198,6 @@ static void Long_term_analysis_filtering ( · 197 unmodified lines
198198 }
199199
200200 void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */
201−
202− struct gsm_state * S,
203−
204201 word * d, /* [0..39] residual signal IN */
205202 word * dp, /* [-120..-1] d' IN */
206203
src/libgsm/lpc.c+0−1
@@ -269,7 +269,6 @@ static void Quantization_and_coding ( · 268 unmodified lines
269269 }
270270
271271 void Gsm_LPC_Analysis (
272− struct gsm_state *S,
273272 word * s, /* 0..159 signals IN/OUT */
274273 word * LARc) /* 0..7 LARc's OUT */
275274 {
src/libgsm/preprocess.c+1−1
@@ -90,7 +90,7 @@ void Gsm_Preprocess ( · 89 unmodified lines
9090
9191 L_s2 += GSM_MULT_R( lsp, 32735 );
9292 L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/
93− L_z2 = GSM_L_ADD( L_temp, L_s2 );
93+ L_z2 = GSM_L_ADD( L_temp, L_s2 );
9494
9595 /* Compute sof[k] with rounding
9696 */
src/libgsm/private.h+1−5
@@ -86,7 +86,7 @@ extern word gsm_asr (word a, int n); · 85 unmodified lines
8686 >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \
8787 : ((b) <= 0 ? (a) + (b) \
8888 : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \
89− ? MAX_LONGWORD : utmp))
89+ ? MAX_LONGWORD : (longword)utmp))
9090
9191 #define GSM_ADD(a, b) \
9292 ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \
@@ -112,7 +112,6 @@ extern void Gsm_Coder ( · 19 unmodified lines
112112 word * xMc /* [13*4] normalized RPE samples OUT */);
113113
114114 extern void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */
115− struct gsm_state * S,
116115 word * d, /* [0..39] residual signal IN */
117116 word * dp, /* [-120..-1] d' IN */
118117 word * e, /* [0..40] OUT */
@@ -121,7 +120,6 @@ extern void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */ · 2 unmodified lines
121120 word * bc /* gain factor OUT */);
122121
123122 extern void Gsm_LPC_Analysis (
124− struct gsm_state * S,
125123 word * s, /* 0..159 signals IN/OUT */
126124 word * LARc); /* 0..7 LARc's OUT */
127125
@@ -167,14 +165,12 @@ extern void Gsm_Long_Term_Synthesis_Filtering ( · 39 unmodified lines
167165 word * drp); /* [-120..-1] IN, [0..40] OUT */
168166
169167 void Gsm_RPE_Decoding (
170− struct gsm_state *S,
171168 word xmaxcr,
172169 word Mcr,
173170 word * xMcr, /* [0..12], 3 bits IN */
174171 word * erp); /* [0..39] OUT */
175172
176173 void Gsm_RPE_Encoding (
177− struct gsm_state * S,
178174 word * e, /* -5..-1][0..39][40..44 IN/OUT */
179175 word * xmaxc, /* OUT */
180176 word * Mc, /* OUT */
src/libgsm/rpe.c+0−5
@@ -430,9 +430,6 @@ void Gsm_Update_of_reconstructed_short_time_residual_signal P3((dpp, ep, dp), · 429 unmodified lines
430430 #endif /* Has been inlined in code.c */
431431
432432 void Gsm_RPE_Encoding (
433−
434− struct gsm_state * S,
435−
436433 word * e, /* -5..-1][0..39][40..44 IN/OUT */
437434 word * xmaxc, /* OUT */
438435 word * Mc, /* OUT */
@@ -453,8 +450,6 @@ void Gsm_RPE_Encoding ( · 14 unmodified lines
453450 }
454451
455452 void Gsm_RPE_Decoding (
456− struct gsm_state * S,
457−
458453 word xmaxcr,
459454 word Mcr,
460455 word * xMcr, /* [0..12], 3 bits IN */
src/lowp.c+4−14
@@ -42,7 +42,7 @@ typedef struct lowpstuff { · 41 unmodified lines
4242 /*
4343 * Process options
4444 */
45−int st_lowp_getopts(eff_t effp, int n, char **argv)
45+static int st_lowp_getopts(eff_t effp, int n, char **argv)
4646 {
4747 lowp_t lowp = (lowp_t) effp->priv;
4848
@@ -57,7 +57,7 @@ int st_lowp_getopts(eff_t effp, int n, char **argv) · 8 unmodified lines
5757 /*
5858 * Prepare processing.
5959 */
60−int st_lowp_start(eff_t effp)
60+static int st_lowp_start(eff_t effp)
6161 {
6262 lowp_t lowp = (lowp_t) effp->priv;
6363 if (lowp->cutoff > effp->ininfo.rate / 2)
@@ -96,7 +96,7 @@ int st_lowp_start(eff_t effp) · 32 unmodified lines
9696 * Processed signed long samples from ibuf to obuf.
9797 * Return number of samples processed.
9898 */
99−int st_lowp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
99+static int st_lowp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
100100 st_size_t *isamp, st_size_t *osamp)
101101 {
102102 lowp_t lowp = (lowp_t) effp->priv;
@@ -118,16 +118,6 @@ int st_lowp_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 15 unmodified lines
118118 return (ST_SUCCESS);
119119 }
120120
121−/*
122− * Do anything required when you stop reading samples.
123− * Don't close input file!
124− */
125−int st_lowp_stop(eff_t effp)
126−{
127− /* nothing to do */
128− return (ST_SUCCESS);
129−}
130−
131121 static st_effect_t st_lowp_effect = {
132122 "lowp",
133123 "Usage: lowp cutoff",
@@ -136,7 +126,7 @@ static st_effect_t st_lowp_effect = { · 2 unmodified lines
136126 st_lowp_start,
137127 st_lowp_flow,
138128 st_effect_nothing_drain,
139− st_lowp_stop
129+ st_effect_nothing
140130 };
141131
142132 const st_effect_t *st_lowp_effect_fn(void)
src/lowpass.c+2−2
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626
2727 static st_effect_t st_lowpass_effect;
2828
29−int st_lowpass_getopts(eff_t effp, int n, char **argv)
29+static int st_lowpass_getopts(eff_t effp, int n, char **argv)
3030 {
3131 butterworth_t butterworth = (butterworth_t)effp->priv;
3232
@@ -44,7 +44,7 @@ int st_lowpass_getopts(eff_t effp, int n, char **argv) · 11 unmodified lines
4444 return (ST_SUCCESS);
4545 }
4646
47−int st_lowpass_start(eff_t effp)
47+static int st_lowpass_start(eff_t effp)
4848 {
4949 butterworth_t butterworth = (butterworth_t) effp->priv;
5050 double c;
src/mask.c+2−2
@@ -29,7 +29,7 @@ static st_effect_t st_mask_effect; · 28 unmodified lines
2929 /*
3030 * Process options
3131 */
32−int st_mask_getopts(eff_t effp, int n, char **argv)
32+static int st_mask_getopts(eff_t effp UNUSED, int n, char **argv UNUSED)
3333 {
3434 if (n)
3535 {
@@ -46,7 +46,7 @@ int st_mask_getopts(eff_t effp, int n, char **argv) · 10 unmodified lines
4646 * Processed signed long samples from ibuf to obuf.
4747 * Return number of samples processed.
4848 */
49−int st_mask_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
49+static int st_mask_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
5050 st_size_t *isamp, st_size_t *osamp)
5151 {
5252 int len, done;
src/maud.c+11−40
@@ -1,20 +1,13 @@
1−/*
2− * July 5, 1991
3− * Copyright 1991 Lance Norskog And Sundry Contributors
4− * This source code is freely redistributable and may be used for
5− * any purpose. This copyright notice must be maintained.
6− * Lance Norskog And Sundry Contributors are not responsible for
7− * the consequences of using this software.
8− */
9−
101 /*
112 * Sound Tools MAUD file format driver, by Lutz Vieweg 1993
123 *
134 * supports: mono and stereo, linear, a-law and u-law reading and writing
145 *
15− * March 3, 1999 - cbagwell
16− * Changed to use rawread for reading.
17− *
6+ * Copyright 1998-2006 Chris Bagwell and SoX Contributors
7+ * This source code is freely redistributable and may be used for
8+ * any purpose. This copyright notice must be maintained.
9+ * Lance Norskog And Sundry Contributors are not responsible for
10+ * the consequences of using this software.
1811 */
1912
2013 #include "st_i.h"
@@ -40,7 +33,7 @@ static void maudwriteheader(ft_t); · 19 unmodified lines
4033 * size and encoding of samples,
4134 * mono/stereo/quad.
4235 */
43−int st_maudstartread(ft_t ft)
36+static int st_maudstartread(ft_t ft)
4437 {
4538 struct maudstuff * p = (struct maudstuff *) ft->priv;
4639
@@ -218,29 +211,7 @@ int st_maudstartread(ft_t ft) · 171 unmodified lines
218211 return(ST_SUCCESS);
219212 }
220213
221−/*
222− * Read up to len samples from file.
223− * Convert to signed longs.
224− * Place in buf[].
225− * Return number of samples read.
226− */
227−
228−st_ssize_t st_maudread(ft_t ft, st_sample_t *buf, st_size_t len)
229−{
230− return (st_rawread(ft, buf, len));
231−}
232−
233−/*
234− * Do anything required when you stop reading samples.
235− * Don't close input file!
236− */
237−int st_maudstopread(ft_t ft)
238−{
239− /* Needed because of rawread() */
240− return st_rawstopread(ft);
241−}
242−
243−int st_maudstartwrite(ft_t ft)
214+static int st_maudstartwrite(ft_t ft)
244215 {
245216 struct maudstuff * p = (struct maudstuff *) ft->priv;
246217 int rc;
@@ -282,7 +253,7 @@ int st_maudstartwrite(ft_t ft) · 35 unmodified lines
282253 return (ST_SUCCESS);
283254 }
284255
285−st_ssize_t st_maudwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
256+static st_size_t st_maudwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
286257 {
287258 struct maudstuff * p = (struct maudstuff *) ft->priv;
288259
@@ -291,7 +262,7 @@ st_ssize_t st_maudwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 2 unmodified lines
291262 return st_rawwrite(ft, buf, len);
292263 }
293264
294−int st_maudstopwrite(ft_t ft)
265+static int st_maudstopwrite(ft_t ft)
295266 {
296267 int rc;
297268
@@ -401,8 +372,8 @@ static st_format_t st_maud_format = { · 103 unmodified lines
401372 NULL,
402373 ST_FILE_STEREO,
403374 st_maudstartread,
404− st_maudread,
405− st_maudstopread,
375+ st_rawread,
376+ st_rawstopread,
406377 st_maudstartwrite,
407378 st_maudwrite,
408379 st_maudstopwrite,
src/mcompand.c+13−12
@@ -199,7 +199,7 @@ static int lowpass_flow(eff_t effp, butterworth_crossover_t butterworth, int nCh · 198 unmodified lines
199199 }
200200
201201 typedef struct comp_band {
202− int expectedChannels; /* Also flags that channels aren't to be treated
202+ st_size_t expectedChannels; /* Also flags that channels aren't to be treated
203203 individually when = 1 and input not mono */
204204 int transferPoints; /* Number of points specified on the transfer
205205 function */
@@ -213,9 +213,9 @@ typedef struct comp_band { · 7 unmodified lines
213213 double topfreq; /* upper bound crossover frequency */
214214 struct butterworth_crossover filter;
215215 st_sample_t *delay_buf; /* Old samples, used for delay processing */
216− st_ssize_t delay_size; /* lookahead for this band (in samples) - function of delay, above */
216+ st_size_t delay_size; /* lookahead for this band (in samples) - function of delay, above */
217217 st_ssize_t delay_buf_ptr; /* Index into delay_buf */
218− st_ssize_t delay_buf_cnt; /* No. of active entries in delay_buf */
218+ st_size_t delay_buf_cnt; /* No. of active entries in delay_buf */
219219 } *comp_band_t;
220220
221221 typedef struct {
@@ -235,7 +235,7 @@ typedef struct { · 13 unmodified lines
235235 static int st_mcompand_getopts_1(comp_band_t l, int n, char **argv)
236236 {
237237 char *s;
238− int rates, tfers, i, commas;
238+ st_size_t rates, tfers, i, commas;
239239
240240 /* Start by checking the attack and decay rates */
241241
@@ -379,7 +379,7 @@ static int parse_subarg(char *s, char **subargv, int *subargc) { · 137 unmodified lines
379379 return ST_SUCCESS;
380380 }
381381
382−int st_mcompand_getopts(eff_t effp, int n, char **argv)
382+static int st_mcompand_getopts(eff_t effp, int n, char **argv)
383383 {
384384 char *subargv[6], *cp;
385385 int subargc, i, len;
@@ -431,11 +431,12 @@ int st_mcompand_getopts(eff_t effp, int n, char **argv) · 45 unmodified lines
431431 * Prepare processing.
432432 * Do all initializations.
433433 */
434−int st_mcompand_start(eff_t effp)
434+static int st_mcompand_start(eff_t effp)
435435 {
436436 compand_t c = (compand_t) effp->priv;
437437 comp_band_t l;
438− int band, i;
438+ st_size_t i;
439+ int band;
439440
440441 for (band=0;band<c->nBands;++band) {
441442 l = &c->bands[band];
@@ -573,7 +574,7 @@ static int st_mcompand_flow_1(compand_t c, comp_band_t l, const st_sample_t *ibu · 131 unmodified lines
573574 * Processed signed long samples from ibuf to obuf.
574575 * Return number of samples processed.
575576 */
576−int st_mcompand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
577+static int st_mcompand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
577578 st_size_t *isamp, st_size_t *osamp) {
578579 compand_t c = (compand_t) effp->priv;
579580 comp_band_t l;
@@ -628,7 +629,7 @@ int st_mcompand_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 48 unmodified lines
628629 return ST_SUCCESS;
629630 }
630631
631−static int st_mcompand_drain_1(eff_t effp, compand_t c, comp_band_t l, st_sample_t *obuf, int maxdrain, int band)
632+static int st_mcompand_drain_1(eff_t effp, compand_t c, comp_band_t l, st_sample_t *obuf, int maxdrain)
632633 {
633634 int done;
634635 double out;
@@ -652,7 +653,7 @@ static int st_mcompand_drain_1(eff_t effp, compand_t c, comp_band_t l, st_sample · 17 unmodified lines
652653 /*
653654 * Drain out compander delay lines.
654655 */
655−int st_mcompand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
656+static int st_mcompand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
656657 {
657658 int band, drained, mostdrained = 0;
658659 compand_t c = (compand_t)effp->priv;
@@ -661,7 +662,7 @@ int st_mcompand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 2 unmodified lines
661662 memset(obuf,0,*osamp * sizeof *obuf);
662663 for (band=0;band<c->nBands;++band) {
663664 l = &c->bands[band];
664− drained = st_mcompand_drain_1(effp, c,l,obuf,*osamp,0);
665+ drained = st_mcompand_drain_1(effp, c,l,obuf,*osamp);
665666 if (drained > mostdrained)
666667 mostdrained = drained;
667668 }
@@ -677,7 +678,7 @@ int st_mcompand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 9 unmodified lines
677678 /*
678679 * Clean up compander effect.
679680 */
680−int st_mcompand_stop(eff_t effp)
681+static int st_mcompand_stop(eff_t effp)
681682 {
682683 compand_t c = (compand_t) effp->priv;
683684 comp_band_t l;
src/misc.c+58−21
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <math.h>
1616 #include <stdio.h>
1717 #include <stdlib.h>
18+#include <stddef.h>
1819 #include <time.h>
1920 #include <string.h>
2021 #include <ctype.h>
@@ -83,16 +84,16 @@ static const char writerr[] = "Error writing sample file. You are probably out · 62 unmodified lines
8384 * Returns number of elements read, not bytes read.
8485 */
8586
86−st_ssize_t st_readbuf(ft_t ft, void *buf, size_t size, st_size_t len)
87+size_t st_readbuf(ft_t ft, void *buf, size_t size, st_size_t len)
8788 {
8889 return fread(buf, size, len, ft->fp);
8990 }
9091
9192 /* Write a buffer of data of length len and each element is size bytes.
92− * Returns number of elements writen, not bytes writen.
93+ * Returns number of elements writen, not bytes written.
9394 */
9495
95−st_ssize_t st_writebuf(ft_t ft, void const *buf, size_t size, st_size_t len)
96+size_t st_writebuf(ft_t ft, void const *buf, size_t size, st_size_t len)
9697 {
9798 return fwrite(buf, size, len, ft->fp);
9899 }
@@ -157,13 +158,11 @@ int st_reads(ft_t ft, char *c, st_size_t len) · 58 unmodified lines
157158 return (ST_EOF);
158159 }
159160 if (in == 0 || in == '\n')
160− {
161161 break;
162− }
163162
164163 *sc = in;
165164 sc++;
166− } while (sc - c < len);
165+ } while (sc - c < (ptrdiff_t)len);
167166 *sc = 0;
168167 return(ST_SUCCESS);
169168 }
@@ -306,7 +305,7 @@ int st_writedf(ft_t ft, double d) · 136 unmodified lines
306305 }
307306
308307 /* generic swap routine. Swap l and place in to f (datatype length = n) */
309−void st_swapb(char *l, char *f, int n)
308+static void st_swapb(char *l, char *f, int n)
310309 {
311310 register int i;
312311
@@ -358,18 +357,28 @@ double st_swapd(double df) · 45 unmodified lines
358357
359358
360359 /* dummy format routines for do-nothing functions */
361−int st_format_nothing(ft_t ft) { return(ST_SUCCESS); }
362−st_ssize_t st_format_nothing_read_io(ft_t ft, st_sample_t *buf, st_size_t len) { return(0); }
363−st_ssize_t st_format_nothing_write_io(ft_t ft, const st_sample_t *buf, st_size_t len) { return(0); }
364−int st_format_nothing_seek(ft_t ft, st_size_t offset) { st_fail_errno(ft, ST_ENOTSUP, "operation not supported"); return(ST_EOF); }
360+int st_format_nothing(ft_t ft UNUSED) { return(ST_SUCCESS); }
361+st_size_t st_format_nothing_read_io(ft_t ft UNUSED, st_sample_t *buf UNUSED, st_size_t len UNUSED) { return(0); }
362+st_size_t st_format_nothing_write_io(ft_t ft UNUSED, const st_sample_t *buf UNUSED, st_size_t len UNUSED) { return(0); }
363+int st_format_nothing_seek(ft_t ft UNUSED, st_size_t offset UNUSED) { st_fail_errno(ft, ST_ENOTSUP, "operation not supported"); return(ST_EOF); }
365364
366365 /* dummy effect routine for do-nothing functions */
367−int st_effect_nothing(eff_t effp) { return(ST_SUCCESS); }
368−int st_effect_nothing_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
366+int st_effect_nothing(eff_t effp UNUSED) { return(ST_SUCCESS); }
367+int st_effect_nothing_drain(eff_t effp UNUSED, st_sample_t *obuf UNUSED, st_size_t *osamp)
369368 { /* Inform no more samples to drain */ *osamp = 0; return(ST_EOF); }
370369
370+int st_effect_nothing_getopts(eff_t effp, int n, char **argv UNUSED)
371+{
372+ if (n) {
373+ st_fail(effp->h->usage);
374+ return (ST_EOF);
375+ }
376+ return (ST_SUCCESS);
377+}
378+
379+
371380 /* here for linear interp. might be useful for other things */
372−st_sample_t st_gcd(st_sample_t a, st_sample_t b)
381+REGPARM(2) st_sample_t st_gcd(st_sample_t a, st_sample_t b)
373382 {
374383 if (b == 0)
375384 return a;
@@ -377,7 +386,7 @@ st_sample_t st_gcd(st_sample_t a, st_sample_t b) · 1 unmodified line
377386 return st_gcd(b, a % b);
378387 }
379388
380−st_sample_t st_lcm(st_sample_t a, st_sample_t b)
389+REGPARM(2) st_sample_t st_lcm(st_sample_t a, st_sample_t b)
381390 {
382391 /* parenthesize this way to avoid st_sample_t overflow in product term */
383392 return a * (b / st_gcd(a, b));
@@ -429,7 +438,7 @@ void st_initrand(void) { · 45 unmodified lines
429438 void st_generate_wave_table(
430439 st_wave_t wave_type,
431440 st_data_t data_type,
432− void * table,
441+ void *table,
433442 uint32_t table_size,
434443 double min,
435444 double max,
@@ -457,19 +466,47 @@ void st_generate_wave_table( · 21 unmodified lines
457466 case 3: d = d - 1.5; break;
458467 }
459468 break;
469+
470+ default: /* Oops! FIXME */
471+ d = 0.0; /* Make sure we have a value */
472+ break;
460473 }
461474 d = d * (max - min) + min;
462475 switch (data_type)
463476 {
464− case ST_FLOAT : *(float *)table = d; table += sizeof(float ); continue;
465− case ST_DOUBLE: *(double *)table = d; table += sizeof(double); continue;
477+ case ST_FLOAT:
478+ {
479+ float *fp = (float *)table;
480+ *fp++ = (float)d;
481+ table = fp;
482+ continue;
483+ }
484+ case ST_DOUBLE:
485+ {
486+ double *dp = (double *)table;
487+ *dp++ = d;
488+ table = dp;
489+ continue;
490+ }
466491 default: break;
467492 }
468493 d += d < 0? -0.5 : +0.5;
469494 switch (data_type)
470495 {
471− case ST_SHORT : *(short *)table = d; table += sizeof(short ); continue;
472− case ST_INT : *(int *)table = d; table += sizeof(int ); continue;
496+ case ST_SHORT:
497+ {
498+ short *sp = table;
499+ *sp++ = (short)d;
500+ table = sp;
501+ continue;
502+ }
503+ case ST_INT:
504+ {
505+ int *ip = table;
506+ *ip++ = (int)d;
507+ table = ip;
508+ continue;
509+ }
473510 default: break;
474511 }
475512 }
@@ -542,5 +579,5 @@ enum_item const * find_enum_text(char const * text, enum_item const * enum_items · 66 unmodified lines
542579 enum_item const st_wave_enum[] = {
543580 ENUM_ITEM(ST_WAVE_,SINE)
544581 ENUM_ITEM(ST_WAVE_,TRIANGLE)
545− {0}};
582+ {0, 0}};
546583
src/mp3.c+32−31
@@ -14,13 +14,13 @@ · 13 unmodified lines
1414
1515 #include <string.h>
1616
17−#if defined(HAVE_LIBMAD) || defined(HAVE_LAME)
17+#if defined(HAVE_LIBMAD) || defined(HAVE_LIBMP3LAME)
1818
1919 #ifdef HAVE_LIBMAD
2020 #include <mad.h>
2121 #endif
2222
23−#ifdef HAVE_LAME
23+#ifdef HAVE_LIBMP3LAME
2424 #include <lame/lame.h>
2525 #include <math.h>
2626 #endif
@@ -38,9 +38,9 @@ struct mp3priv { · 11 unmodified lines
3838 st_ssize_t cursamp;
3939 st_size_t FrameCount;
4040 #endif /*HAVE_LIBMAD*/
41−#ifdef HAVE_LAME
41+#ifdef HAVE_LIBMP3LAME
4242 lame_global_flags *gfp;
43−#endif /*HAVE_LAME*/
43+#endif /*HAVE_LIBMP3LAME*/
4444 };
4545
4646 #ifdef HAVE_LIBMAD
@@ -159,7 +159,7 @@ static int st_mp3_inputtag(ft_t ft) · 112 unmodified lines
159159 return rc;
160160 }
161161
162−int st_mp3startread(ft_t ft)
162+static int st_mp3startread(ft_t ft)
163163 {
164164 struct mp3priv *p = (struct mp3priv *) ft->priv;
165165 size_t ReadSize;
@@ -279,12 +279,12 @@ error: · 113 unmodified lines
279279 * Place in buf[].
280280 * Return number of samples read.
281281 */
282−st_ssize_t st_mp3read(ft_t ft, st_sample_t *buf, st_size_t len)
282+static st_size_t st_mp3read(ft_t ft, st_sample_t *buf, st_size_t len)
283283 {
284284 struct mp3priv *p = (struct mp3priv *) ft->priv;
285− st_ssize_t donow,i,done=0;
285+ st_size_t donow,i,done=0;
286286 mad_fixed_t sample;
287− int chan;
287+ size_t chan;
288288
289289 do {
290290 donow=min(len,(p->Synth->pcm.length - p->cursamp)*ft->info.channels);
@@ -342,7 +342,7 @@ st_ssize_t st_mp3read(ft_t ft, st_sample_t *buf, st_size_t len) · 51 unmodified lines
342342 return done;
343343 }
344344
345−int st_mp3stopread(ft_t ft)
345+static int st_mp3stopread(ft_t ft)
346346 {
347347 struct mp3priv *p=(struct mp3priv*) ft->priv;
348348
@@ -359,7 +359,7 @@ int st_mp3stopread(ft_t ft) · 10 unmodified lines
359359 return ST_SUCCESS;
360360 }
361361 #else /*HAVE_LIBMAD*/
362−int st_mp3startread(ft_t ft)
362+static int st_mp3startread(ft_t ft)
363363 {
364364 st_fail_errno(ft,ST_EOF,"SoX was compiled without MP3 decoding support");
365365 return ST_EOF;
@@ -378,17 +378,18 @@ int st_mp3stopread(ft_t ft) · 12 unmodified lines
378378 }
379379 #endif /*HAVE_LIBMAD*/
380380
381−#ifdef HAVE_LAME
382−void null_error_func(const char* string, va_list va){
381+#ifdef HAVE_LIBMP3LAME
382+static void null_error_func(const char* string UNUSED, va_list va UNUSED)
383+{
383384 return;
384385 }
385386
386−int st_mp3startwrite(ft_t ft)
387+static int st_mp3startwrite(ft_t ft)
387388 {
388389 struct mp3priv *p = (struct mp3priv *) ft->priv;
389390
390− if (ft->info.encoding != ST_ENCODING_MP3){
391− if(ft->info.encoding != -1)
391+ if (ft->info.encoding != ST_ENCODING_MP3) {
392+ if(ft->info.encoding != ST_ENCODING_UNKNOWN)
392393 st_report("Encoding forced to MP3");
393394 ft->info.encoding = ST_ENCODING_MP3;
394395 }
@@ -399,7 +400,7 @@ int st_mp3startwrite(ft_t ft) · 4 unmodified lines
399400 return(ST_EOF);
400401 }
401402
402− if (ft->info.channels != -1){
403+ if (ft->info.channels != ST_ENCODING_UNKNOWN) {
403404 if ( (lame_set_num_channels(p->gfp,ft->info.channels)) < 0) {
404405 st_fail_errno(ft,ST_EOF,"Unsupported number of channels");
405406 return(ST_EOF);
@@ -431,16 +432,16 @@ int st_mp3startwrite(ft_t ft) · 25 unmodified lines
431432 return(ST_SUCCESS);
432433 }
433434
434−st_ssize_t st_mp3write(ft_t ft, const st_sample_t *buf, st_size_t samp)
435+static st_size_t st_mp3write(ft_t ft, const st_sample_t *buf, st_size_t samp)
435436 {
436437 struct mp3priv *p = (struct mp3priv *)ft->priv;
437438 char *mp3buffer;
438− int mp3buffer_size;
439+ st_size_t mp3buffer_size;
439440 short signed int *buffer_l, *buffer_r = NULL;
440441 int nsamples = samp/ft->info.channels;
441442 int i,j;
442443 st_ssize_t done = 0;
443− int written;
444+ st_size_t written;
444445
445446 /* NOTE: This logic assumes that "short int" is 16-bits
446447 * on all platforms. It happens to be for all that I know
@@ -504,7 +505,7 @@ st_ssize_t st_mp3write(ft_t ft, const st_sample_t *buf, st_size_t samp) · 57 unmodified lines
504505
505506 if ((written = lame_encode_buffer(p->gfp,buffer_l, buffer_r,
506507 nsamples, (unsigned char *)mp3buffer,
507− mp3buffer_size)) < 0){
508+ mp3buffer_size)) < mp3buffer_size){
508509 st_fail_errno(ft,ST_EOF,"Encoding failed");
509510 goto end;
510511 }
@@ -528,7 +529,7 @@ end4: · 17 unmodified lines
528529 return done;
529530 }
530531
531−int st_mp3stopwrite(ft_t ft)
532+static int st_mp3stopwrite(ft_t ft)
532533 {
533534 struct mp3priv *p = (struct mp3priv *) ft->priv;
534535 char mp3buffer[7200];
@@ -537,7 +538,7 @@ int st_mp3stopwrite(ft_t ft) · 2 unmodified lines
537538 if ( (written=lame_encode_flush(p->gfp, (unsigned char *)mp3buffer, 7200)) <0){
538539 st_fail_errno(ft,ST_EOF,"Encoding failed");
539540 }
540− else if (st_writebuf(ft, mp3buffer, 1, written) < written){
541+ else if ((int)st_writebuf(ft, mp3buffer, 1, written) < written){
541542 st_fail_errno(ft,ST_EOF,"File write failed");
542543 }
543544
@@ -545,25 +546,25 @@ int st_mp3stopwrite(ft_t ft) · 1 unmodified line
545546 return ST_SUCCESS;
546547 }
547548
548−#else /* HAVE_LAME */
549−int st_mp3startwrite(ft_t ft)
549+#else /* HAVE_LIBMP3LAME */
550+static int st_mp3startwrite(ft_t ft UNUSED)
550551 {
551− st_fail_errno(ft,ST_EOF,"Sorry, no MP3 encoding support");
552+ st_fail_errno(ft,ST_EOF,"SoX was compiled without MP3 encoding support");
552553 return ST_EOF;
553554 }
554555
555−st_ssize_t st_mp3write(ft_t ft, const st_sample_t *buf, st_size_t samp)
556+static st_size_t st_mp3write(ft_t ft UNUSED, const st_sample_t *buf UNUSED, st_size_t samp UNUSED)
556557 {
557− st_fail_errno(ft,ST_EOF,"Sorry, no MP3 encoding support");
558− return ST_EOF;
558+ st_fail_errno(ft,ST_EOF,"SoX was compiled without MP3 encoding support");
559+ return 0;
559560 }
560561
561−int st_mp3stopwrite(ft_t ft)
562+static int st_mp3stopwrite(ft_t ft)
562563 {
563− st_fail_errno(ft,ST_EOF,"Sorry, no MP3 encoding support");
564+ st_fail_errno(ft,ST_EOF,"SoX was compiled without MP3 encoding support");
564565 return ST_EOF;
565566 }
566−#endif /* HAVE_LAME */
567+#endif /* HAVE_LIBMP3LAME */
567568
568569 /* MP3 */
569570 static const char *mp3names[] = {
src/noiseprof.c+10−10
@@ -39,7 +39,7 @@ typedef struct profdata { · 38 unmodified lines
3939 /*
4040 * Get the filename, if any. We don't open it until st_noiseprof_start.
4141 */
42−int st_noiseprof_getopts(eff_t effp, int n, char **argv)
42+static int st_noiseprof_getopts(eff_t effp, int n, char **argv)
4343 {
4444 profdata_t data = (profdata_t) effp->priv;
4545
@@ -57,7 +57,7 @@ int st_noiseprof_getopts(eff_t effp, int n, char **argv) · 11 unmodified lines
5757 * Prepare processing.
5858 * Do all initializations.
5959 */
60−int st_noiseprof_start(eff_t effp)
60+static int st_noiseprof_start(eff_t effp)
6161 {
6262 profdata_t data = (profdata_t) effp->priv;
6363 int channels = effp->ininfo.channels;
@@ -88,7 +88,7 @@ int st_noiseprof_start(eff_t effp) · 24 unmodified lines
8888 }
8989
9090 /* Collect statistics from the complete window on channel chan. */
91−static void collect_data(profdata_t data, chandata_t* chan) {
91+static void collect_data(chandata_t* chan) {
9292 float *out = (float*)calloc(FREQCOUNT, sizeof(float));
9393
9494 int i;
@@ -109,13 +109,13 @@ static void collect_data(profdata_t data, chandata_t* chan) { · 14 unmodified lines
109109 /*
110110 * Grab what we can from ibuf, and process if we have a whole window.
111111 */
112−int st_noiseprof_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
112+static int st_noiseprof_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
113113 st_size_t *isamp, st_size_t *osamp)
114114 {
115115 profdata_t data = (profdata_t) effp->priv;
116116 int samp = min(*isamp, *osamp);
117117 int tracks = effp->ininfo.channels;
118− int track_samples = samp / tracks;
118+ st_size_t track_samples = samp / tracks;
119119 int ncopy = 0;
120120 int i;
121121
@@ -133,7 +133,7 @@ int st_noiseprof_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 11 unmodified lines
133133 ST_SAMPLE_TO_FLOAT_DWORD(ibuf[i+j*tracks], effp->clippedCount);
134134 }
135135 if (ncopy + data->bufdata == WINDOWSIZE) {
136− collect_data(data, chan);
136+ collect_data(chan);
137137 }
138138 }
139139
@@ -152,7 +152,7 @@ int st_noiseprof_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 12 unmodified lines
152152 * Finish off the last window.
153153 */
154154
155−int st_noiseprof_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
155+static int st_noiseprof_drain(eff_t effp, st_sample_t *obuf UNUSED, st_size_t *osamp)
156156 {
157157 profdata_t data = (profdata_t) effp->priv;
158158 int tracks = effp->ininfo.channels;
@@ -169,7 +169,7 @@ int st_noiseprof_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 10 unmodified lines
169169 for (j = data->bufdata+1; j < WINDOWSIZE; j ++) {
170170 data->chandata[i].window[j] = 0;
171171 }
172− collect_data(data, &(data->chandata[i]));
172+ collect_data(&(data->chandata[i]));
173173 }
174174
175175 if (data->bufdata == WINDOWSIZE || data->bufdata == 0)
@@ -181,10 +181,10 @@ int st_noiseprof_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 5 unmodified lines
181181 /*
182182 * Print profile and clean up.
183183 */
184−int st_noiseprof_stop(eff_t effp)
184+static int st_noiseprof_stop(eff_t effp)
185185 {
186186 profdata_t data = (profdata_t) effp->priv;
187− int i;
187+ st_size_t i;
188188
189189 for (i = 0; i < effp->ininfo.channels; i ++) {
190190 int j;
src/noisered.c+13−13
@@ -38,7 +38,7 @@ typedef struct reddata { · 37 unmodified lines
3838 * Get the options. Filename is mandatory, though a reasonable default would
3939 * be stdin (if the input file isn't coming from there, of course!)
4040 */
41−int st_noisered_getopts(eff_t effp, int n, char **argv)
41+static int st_noisered_getopts(eff_t effp, int n, char **argv)
4242 {
4343 reddata_t data = (reddata_t) effp->priv;
4444
@@ -67,7 +67,7 @@ int st_noisered_getopts(eff_t effp, int n, char **argv) · 22 unmodified lines
6767 * Prepare processing.
6868 * Do all initializations.
6969 */
70−int st_noisered_start(eff_t effp)
70+static int st_noisered_start(eff_t effp)
7171 {
7272 reddata_t data = (reddata_t) effp->priv;
7373 int fchannels = 0;
@@ -245,17 +245,17 @@ static int process_window(eff_t effp, reddata_t data, int chan_num, int num_chan · 171 unmodified lines
245245 /*
246246 * Read in windows, and call process_window once we get a whole one.
247247 */
248−int st_noisered_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
248+static int st_noisered_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
249249 st_size_t *isamp, st_size_t *osamp)
250250 {
251251 reddata_t data = (reddata_t) effp->priv;
252− int samp = min(*isamp, *osamp);
253− int tracks = effp->ininfo.channels;
254− int track_samples = samp / tracks;
255− int ncopy = min(track_samples, WINDOWSIZE-data->bufdata);
256− int whole_window = (ncopy + data->bufdata == WINDOWSIZE);
252+ st_size_t samp = min(*isamp, *osamp);
253+ st_size_t tracks = effp->ininfo.channels;
254+ st_size_t track_samples = samp / tracks;
255+ st_size_t ncopy = min(track_samples, WINDOWSIZE-data->bufdata);
256+ st_size_t whole_window = (ncopy + data->bufdata == WINDOWSIZE);
257257 int oldbuf = data->bufdata;
258− int i;
258+ st_size_t i;
259259 assert(effp->ininfo.channels == effp->outinfo.channels);
260260
261261 if (whole_window) {
@@ -267,7 +267,7 @@ int st_noisered_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 5 unmodified lines
267267 /* Reduce noise on every channel. */
268268 for (i = 0; i < tracks; i ++) {
269269 chandata_t* chan = &(data->chandata[i]);
270− int j;
270+ st_size_t j;
271271 if (chan->window == NULL) {
272272 chan->window = (float*)calloc(WINDOWSIZE, sizeof(float));
273273 }
@@ -298,7 +298,7 @@ int st_noisered_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 24 unmodified lines
298298 * We have up to half a window left to dump.
299299 */
300300
301−int st_noisered_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
301+static int st_noisered_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
302302 {
303303 reddata_t data = (reddata_t)effp->priv;
304304 int i;
@@ -315,10 +315,10 @@ int st_noisered_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 10 unmodified lines
315315 /*
316316 * Clean up.
317317 */
318−int st_noisered_stop(eff_t effp)
318+static int st_noisered_stop(eff_t effp)
319319 {
320320 reddata_t data = (reddata_t) effp->priv;
321− int i;
321+ st_size_t i;
322322
323323 for (i = 0; i < effp->ininfo.channels; i ++) {
324324 chandata_t* chan = &(data->chandata[i]);
src/nulfile.c+5−5
@@ -17,26 +17,26 @@ · 16 unmodified lines
1717 #include "st_i.h"
1818 #include <string.h>
1919
20−int st_nulstartread(ft_t ft)
20+static int st_nulstartread(ft_t ft)
2121 {
2222 /* If format parameters are not given, set somewhat arbitrary
2323 * (but commonly used) defaults: */
2424 if (ft->info.rate == 0) ft->info.rate = 44100;
25− if (ft->info.channels == -1) ft->info.channels = 2;
25+ if (ft->info.channels == 0) ft->info.channels = 2;
2626 if (ft->info.size == -1) ft->info.size = ST_SIZE_WORD;
27− if (ft->info.encoding == -1) ft->info.encoding = ST_ENCODING_SIGN2;
27+ if (ft->info.encoding == ST_ENCODING_UNKNOWN) ft->info.encoding = ST_ENCODING_SIGN2;
2828
2929 return ST_SUCCESS;
3030 }
3131
32−st_ssize_t st_nulread(ft_t ft, st_sample_t *buf, st_size_t len)
32+static st_size_t st_nulread(ft_t ft UNUSED, st_sample_t *buf, st_size_t len)
3333 {
3434 /* Reading from null generates silence i.e. (st_sample_t)0. */
3535 memset(buf, 0, sizeof(st_sample_t) * len);
3636 return len; /* Return number of samples "read". */
3737 }
3838
39−st_ssize_t st_nulwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
39+static st_size_t st_nulwrite(ft_t ft UNUSED, const st_sample_t *buf UNUSED, st_size_t len)
4040 {
4141 /* Writing to null just discards the samples */
4242 return len; /* Return number of samples "written". */
src/oss.c+5−5
@@ -51,7 +51,7 @@ static int ossdspinit(ft_t ft) · 50 unmodified lines
5151 if (ft->info.size == ST_SIZE_BYTE) {
5252 sampletype = AFMT_U8;
5353 samplesize = 8;
54− if (ft->info.encoding == -1)
54+ if (ft->info.encoding == ST_ENCODING_UNKNOWN)
5555 ft->info.encoding = ST_ENCODING_UNSIGNED;
5656 if (ft->info.encoding != ST_ENCODING_UNSIGNED) {
5757 st_report("OSS driver only supports unsigned with bytes");
@@ -62,7 +62,7 @@ static int ossdspinit(ft_t ft) · 4 unmodified lines
6262 else if (ft->info.size == ST_SIZE_WORD) {
6363 sampletype = (ST_IS_BIGENDIAN) ? AFMT_S16_BE : AFMT_S16_LE;
6464 samplesize = 16;
65− if (ft->info.encoding == -1)
65+ if (ft->info.encoding == ST_ENCODING_UNKNOWN)
6666 ft->info.encoding = ST_ENCODING_SIGN2;
6767 if (ft->info.encoding != ST_ENCODING_SIGN2) {
6868 st_report("OSS driver only supports signed with words");
@@ -79,7 +79,7 @@ static int ossdspinit(ft_t ft) · 10 unmodified lines
7979 st_report("Forcing to signed linear word");
8080 }
8181
82− if (ft->info.channels == -1) ft->info.channels = 1;
82+ if (ft->info.channels == 0) ft->info.channels = 1;
8383 else if (ft->info.channels > 2) ft->info.channels = 2;
8484
8585 if (ioctl(fileno(ft->fp), SNDCTL_DSP_RESET, 0) < 0)
@@ -204,14 +204,14 @@ static int ossdspinit(ft_t ft) · 118 unmodified lines
204204 * size and encoding of samples,
205205 * mono/stereo/quad.
206206 */
207−int st_ossdspstartread(ft_t ft)
207+static int st_ossdspstartread(ft_t ft)
208208 {
209209 int rc;
210210 rc = ossdspinit(ft);
211211 return rc;
212212 }
213213
214−int st_ossdspstartwrite(ft_t ft)
214+static int st_ossdspstartwrite(ft_t ft)
215215 {
216216 return ossdspinit(ft);
217217 }
src/pan.c+5−12
@@ -30,7 +30,7 @@ typedef struct { · 29 unmodified lines
3030 /*
3131 * Process options
3232 */
33−int st_pan_getopts(eff_t effp, int n, char **argv)
33+static int st_pan_getopts(eff_t effp, int n, char **argv)
3434 {
3535 pan_t pan = (pan_t) effp->priv;
3636
@@ -49,7 +49,7 @@ int st_pan_getopts(eff_t effp, int n, char **argv) · 12 unmodified lines
4949 /*
5050 * Start processing
5151 */
52−int st_pan_start(eff_t effp)
52+static int st_pan_start(eff_t effp)
5353 {
5454 if (effp->outinfo.channels==1)
5555 st_warn("PAN onto a mono channel...");
@@ -73,7 +73,7 @@ int st_pan_start(eff_t effp) · 17 unmodified lines
7373 /*
7474 * Process either isamp or osamp samples, whichever is smaller.
7575 */
76−int st_pan_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
76+static int st_pan_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
7777 st_size_t *isamp, st_size_t *osamp)
7878 {
7979 pan_t pan = (pan_t) effp->priv;
@@ -408,15 +408,8 @@ int st_pan_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 328 unmodified lines
408408 }
409409
410410 /*
411− * Do anything required when you stop reading samples.
412− * Don't close input file!
413− *
414− * Should have statistics on right, left, and output amplitudes.
411+ * FIXME: Add a stop function with statistics on right, left, and output amplitudes.
415412 */
416−int st_pan_stop(eff_t effp)
417−{
418− return ST_SUCCESS;
419−}
420413
421414 static st_effect_t st_pan_effect = {
422415 "pan",
@@ -426,7 +419,7 @@ static st_effect_t st_pan_effect = { · 3 unmodified lines
426419 st_pan_start,
427420 st_pan_flow,
428421 st_effect_nothing_drain,
429− st_pan_stop
422+ st_effect_nothing
430423 };
431424
432425 const st_effect_t *st_pan_effect_fn(void)
src/phaser.c+5−5
@@ -81,7 +81,7 @@ typedef struct phaserstuff { · 80 unmodified lines
8181 /*
8282 * Process options
8383 */
84−int st_phaser_getopts(eff_t effp, int n, char **argv)
84+static int st_phaser_getopts(eff_t effp, int n, char **argv)
8585 {
8686 phaser_t phaser = (phaser_t) effp->priv;
8787
@@ -114,7 +114,7 @@ int st_phaser_getopts(eff_t effp, int n, char **argv) · 26 unmodified lines
114114 /*
115115 * Prepare for processing.
116116 */
117−int st_phaser_start(eff_t effp)
117+static int st_phaser_start(eff_t effp)
118118 {
119119 phaser_t phaser = (phaser_t) effp->priv;
120120 unsigned int i;
@@ -192,7 +192,7 @@ int st_phaser_start(eff_t effp) · 71 unmodified lines
192192 * Processed signed long samples from ibuf to obuf.
193193 * Return number of samples processed.
194194 */
195−int st_phaser_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
195+static int st_phaser_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
196196 st_size_t *isamp, st_size_t *osamp)
197197 {
198198 phaser_t phaser = (phaser_t) effp->priv;
@@ -227,7 +227,7 @@ int st_phaser_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 28 unmodified lines
227227 /*
228228 * Drain out reverb lines.
229229 */
230−int st_phaser_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
230+static int st_phaser_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
231231 {
232232 phaser_t phaser = (phaser_t) effp->priv;
233233 st_size_t done;
@@ -266,7 +266,7 @@ int st_phaser_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 32 unmodified lines
266266 /*
267267 * Clean up phaser effect.
268268 */
269−int st_phaser_stop(eff_t effp)
269+static int st_phaser_stop(eff_t effp)
270270 {
271271 phaser_t phaser = (phaser_t) effp->priv;
272272
src/pitch.c+5−5
@@ -246,7 +246,7 @@ static void process_intput_buffer(pitch_t pitch) · 245 unmodified lines
246246 /*
247247 * Process options
248248 */
249−int st_pitch_getopts(eff_t effp, int n, char **argv)
249+static int st_pitch_getopts(eff_t effp, int n, char **argv)
250250 {
251251 pitch_t pitch = (pitch_t) effp->priv;
252252
@@ -329,7 +329,7 @@ int st_pitch_getopts(eff_t effp, int n, char **argv) · 76 unmodified lines
329329 /*
330330 * Start processing
331331 */
332−int st_pitch_start(eff_t effp)
332+static int st_pitch_start(eff_t effp)
333333 {
334334 pitch_t pitch = (pitch_t) effp->priv;
335335 register int sample_rate = effp->outinfo.rate;
@@ -445,7 +445,7 @@ int st_pitch_start(eff_t effp) · 109 unmodified lines
445445
446446 /* Processes input.
447447 */
448−int st_pitch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
448+static int st_pitch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
449449 st_size_t *isamp, st_size_t *osamp)
450450 {
451451 pitch_t pitch = (pitch_t) effp->priv;
@@ -522,7 +522,7 @@ int st_pitch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 70 unmodified lines
522522
523523 /* at the end...
524524 */
525−int st_pitch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
525+static int st_pitch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
526526 {
527527 pitch_t pitch = (pitch_t) effp->priv;
528528 st_size_t i;
@@ -566,7 +566,7 @@ int st_pitch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 37 unmodified lines
566566 * Do anything required when you stop reading samples.
567567 * Don't close input file!
568568 */
569−int st_pitch_stop(eff_t effp)
569+static int st_pitch_stop(eff_t effp)
570570 {
571571 pitch_t pitch = (pitch_t) effp->priv;
572572
src/polyphas.c+13−13
@@ -80,7 +80,7 @@ static int win_type = 0; · 79 unmodified lines
8080 static int win_width = 1024;
8181 static Float cutoff = 0.95;
8282
83−int st_poly_getopts(eff_t effp, int n, char **argv)
83+static int st_poly_getopts(eff_t effp UNUSED, int n, char **argv)
8484 {
8585 /* 0: nuttall
8686 1: hamming */
@@ -179,9 +179,9 @@ static int prime(int n, int *q0) · 92 unmodified lines
179179 return (q-q0);
180180 }
181181
182−static int permute(int *m, int *l, int ct, int ct1, int amalg)
182+static int permute(int *m, int *l, int ct, int ct1, size_t amalg)
183183 {
184− int k, n;
184+ size_t k, n;
185185 int *p;
186186 int *q;
187187
@@ -221,7 +221,7 @@ static int permute(int *m, int *l, int ct, int ct1, int amalg) · 33 unmodified lines
221221 static int optimize_factors(int numer, int denom, int *l1, int *l2)
222222 {
223223 int f_min,c_min,u_min,ct1,ct2;
224− int amalg;
224+ size_t amalg;
225225 int k;
226226 static int m1[MF],m2[MF];
227227 static int b1[MF],b2[MF];
@@ -239,7 +239,7 @@ static int optimize_factors(int numer, int denom, int *l1, int *l2) · 11 unmodified lines
239239 ct1 = prime(numer,l1);
240240 ct2 = prime(denom,l2);
241241
242− for (amalg = max(9,l2[0]); amalg<= 9+l2[ct2-1]; amalg++) {
242+ for (amalg = max(9,l2[0]); amalg <= (size_t)(9+l2[ct2-1]); amalg++) {
243243 for (k = 0; k<100000; k++) {
244244 int u,u1,u2,j,f,cost;
245245 cost = 0;
@@ -369,7 +369,7 @@ static void fir_design(Float *buffer, int length, Float cutoff) · 123 unmodified lines
369369
370370 #define RIBLEN 2048
371371
372−int st_poly_start(eff_t effp)
372+static int st_poly_start(eff_t effp)
373373 {
374374 poly_t rate = (poly_t) effp->priv;
375375 static int l1[MF], l2[MF];
@@ -523,7 +523,7 @@ static void update_hist(Float *hist, int hist_size, int in_size) · 147 unmodified lines
523523
524524 }
525525
526−int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
526+static int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
527527 st_size_t *isamp, st_size_t *osamp)
528528 {
529529 poly_t rate = (poly_t) effp->priv;
@@ -534,7 +534,7 @@ int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 4 unmodified lines
534534 s0 = rate->stage[0]; /* the first stage */
535535 s1 = rate->stage[rate->total]; /* the 'last' stage is output buffer */
536536 {
537− int in_size, gap, k;
537+ st_size_t in_size, gap, k;
538538
539539 in_size = *isamp;
540540 gap = s0->size - s0->held; /* space available in this 'input' buffer */
@@ -558,7 +558,7 @@ int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 17 unmodified lines
558558 }
559559
560560 if (s0->held == s0->size && s1->held == 0) {
561− int k;
561+ st_size_t k;
562562 /* input buffer full, output buffer empty, so do process */
563563
564564 for(k=0; k<rate->total; k++) {
@@ -587,7 +587,7 @@ int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 22 unmodified lines
587587 st_size_t out_size;
588588 st_size_t oskip;
589589 Float *out_buf;
590− int k;
590+ st_size_t k;
591591
592592 oskip = rate->oskip;
593593 out_size = s1->held;
@@ -626,7 +626,7 @@ int st_poly_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 32 unmodified lines
626626 /*
627627 * Process tail of input samples.
628628 */
629−int st_poly_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
629+static int st_poly_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
630630 {
631631 st_size_t in_size;
632632 /* Call "flow" with NULL input. */
@@ -638,11 +638,11 @@ int st_poly_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 5 unmodified lines
638638 * Do anything required when you stop reading samples.
639639 * Don't close input file!
640640 */
641−int st_poly_stop(eff_t effp)
641+static int st_poly_stop(eff_t effp)
642642 {
643643 poly_t rate = (poly_t) effp->priv;
644644 polystage *s;
645− int k;
645+ st_size_t k;
646646
647647 for(k = 0; k <= rate->total; k++) {
648648 s = rate->stage[k];
src/prc.c+10−15
@@ -40,8 +40,8 @@ typedef struct prcpriv · 39 unmodified lines
4040 /* 16 bytes header = 3 UIDs plus checksum, standard Symbian/EPOC file
4141 header */
4242 static const char prc_header[]={
43− 0x37,0x00,0x00,0x10,0x6d,0x00,0x00,0x10,
44− 0x7e,0x00,0x00,0x10,0xcf,0xac,0x08,0x55
43+ '\x37','\x00','\x00','\x10','\x6d','\x00','\x00','\x10',
44+ '\x7e','\x00','\x00','\x10','\xcf','\xac','\x08','\x55'
4545 };
4646
4747 int prc_checkheader(ft_t ft, char *head)
@@ -52,7 +52,7 @@ int prc_checkheader(ft_t ft, char *head) · 4 unmodified lines
5252
5353 static void prcwriteheader(ft_t ft);
5454
55−int st_prcseek(ft_t ft, st_size_t offset)
55+static int st_prcseek(ft_t ft, st_size_t offset)
5656 {
5757 prc_t prc = (prc_t ) ft->priv;
5858 st_size_t new_offset, channel_block, alignment;
@@ -72,7 +72,7 @@ int st_prcseek(ft_t ft, st_size_t offset) · 13 unmodified lines
7272 return st_seeki(ft, new_offset, SEEK_SET);
7373 }
7474
75−int st_prcstartread(ft_t ft)
75+static int st_prcstartread(ft_t ft)
7676 {
7777 prc_t p = (prc_t ) ft->priv;
7878 char head[sizeof(prc_header)];
@@ -116,7 +116,7 @@ int st_prcstartread(ft_t ft) · 37 unmodified lines
116116 st_report("PRC must use 8000 sample rate. Overriding");
117117 ft->info.rate = 8000;
118118
119− if (ft->info.channels != -1 && ft->info.channels != 1)
119+ if (ft->info.channels != ST_ENCODING_UNKNOWN && ft->info.channels != 0)
120120 st_report("PRC must only supports 1 channel. Overriding");
121121 ft->info.channels = 1;
122122
@@ -135,7 +135,7 @@ int st_prcstartread(ft_t ft) · 12 unmodified lines
135135 if it is not, the unspecified size remains in the header
136136 (this is illegal). */
137137
138−int st_prcstartwrite(ft_t ft)
138+static int st_prcstartwrite(ft_t ft)
139139 {
140140 prc_t p = (prc_t ) ft->priv;
141141 int rc;
@@ -160,7 +160,7 @@ int st_prcstartwrite(ft_t ft) · 18 unmodified lines
160160 if (ft->info.rate != 0)
161161 st_report("PRC must use 8000 sample rate. Overriding");
162162
163− if (ft->info.channels != -1 && ft->info.channels != 1)
163+ if (ft->info.channels != ST_ENCODING_UNKNOWN && ft->info.channels != 0)
164164 st_report("PRC must only supports 1 channel. Overriding");
165165
166166 ft->info.encoding = ST_ENCODING_ALAW;
@@ -171,12 +171,7 @@ int st_prcstartwrite(ft_t ft) · 4 unmodified lines
171171 return ST_SUCCESS;
172172 }
173173
174−st_ssize_t st_prcread(ft_t ft, st_sample_t *buf, st_size_t samp)
175−{
176− return st_rawread(ft, buf, samp);
177−}
178−
179−st_ssize_t st_prcwrite(ft_t ft, const st_sample_t *buf, st_size_t samp)
174+static st_size_t st_prcwrite(ft_t ft, const st_sample_t *buf, st_size_t samp)
180175 {
181176 prc_t p = (prc_t ) ft->priv;
182177 p->length += samp * ft->info.size;
@@ -184,7 +179,7 @@ st_ssize_t st_prcwrite(ft_t ft, const st_sample_t *buf, st_size_t samp) · 1 unmodified line
184179 return st_rawwrite(ft, buf, samp);
185180 }
186181
187−int st_prcstopwrite(ft_t ft)
182+static int st_prcstopwrite(ft_t ft)
188183 {
189184 /* Call before seeking to flush buffer */
190185 st_rawstopwrite(ft);
@@ -229,7 +224,7 @@ static st_format_t st_prc_format = { · 38 unmodified lines
229224 NULL,
230225 ST_FILE_SEEK,
231226 st_prcstartread,
232− st_prcread,
227+ st_rawread,
233228 st_rawstopread,
234229 st_prcstartwrite,
235230 st_prcwrite,
src/raw.c+36−42
@@ -134,7 +134,7 @@ int st_rawstartwrite(ft_t ft) · 133 unmodified lines
134134 return ST_SUCCESS;
135135 }
136136
137−void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
137+void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED)
138138 {
139139 while (len)
140140 {
@@ -148,7 +148,7 @@ void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 7 unmodified lines
148148 }
149149 }
150150
151−void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
151+void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED)
152152 {
153153 while (len)
154154 {
@@ -162,7 +162,7 @@ void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 7 unmodified lines
162162 }
163163 }
164164
165−void st_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
165+static void st_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED)
166166 {
167167 while (len)
168168 {
@@ -176,7 +176,7 @@ void st_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char · 7 unmodified lines
176176 }
177177 }
178178
179−void st_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
179+static void st_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED)
180180 {
181181 while (len)
182182 {
@@ -190,7 +190,7 @@ void st_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char · 7 unmodified lines
190190 }
191191 }
192192
193−void st_inv_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
193+static void st_inv_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED)
194194 {
195195 while (len)
196196 {
@@ -204,7 +204,7 @@ void st_inv_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, c · 7 unmodified lines
204204 }
205205 }
206206
207−void st_inv_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
207+static void st_inv_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED)
208208 {
209209 while (len)
210210 {
@@ -219,7 +219,7 @@ void st_inv_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, c · 8 unmodified lines
219219 }
220220
221221
222−void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
222+void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED)
223223 {
224224 while (len)
225225 {
@@ -235,7 +235,7 @@ void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 9 unmodified lines
235235 }
236236 }
237237
238−void st_sw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
238+void st_sw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED)
239239 {
240240 while (len)
241241 {
@@ -266,12 +266,12 @@ static int24_t st_24_read_one(char const * * buffer, char swap) · 24 unmodified lines
266266 datum >>= 8;
267267 }
268268
269− return swap? st_swap24(datum) : datum;
269+ return swap ? (int24_t)(st_swap24(datum)) : datum;
270270 }
271271
272272
273273
274−void st_u24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount)
274+static void st_u24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount UNUSED)
275275 {
276276 while (len--)
277277 {
@@ -282,7 +282,7 @@ void st_u24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char · 4 unmodified lines
282282
283283
284284
285−void st_s24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount)
285+static void st_s24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount UNUSED)
286286 {
287287 while (len--)
288288 {
@@ -293,7 +293,7 @@ void st_s24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char · 4 unmodified lines
293293
294294
295295
296−void st_udw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
296+static void st_udw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED)
297297 {
298298 while (len)
299299 {
@@ -309,7 +309,7 @@ void st_udw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char s · 9 unmodified lines
309309 }
310310 }
311311
312−void st_dw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
312+static void st_dw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED)
313313 {
314314 while (len)
315315 {
@@ -325,7 +325,7 @@ void st_dw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 9 unmodified lines
325325 }
326326 }
327327
328−void st_f32_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
328+static void st_f32_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
329329 {
330330 while (len)
331331 {
@@ -341,7 +341,7 @@ void st_f32_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char s · 9 unmodified lines
341341 }
342342 }
343343
344−void st_f64_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
344+static void st_f64_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
345345 {
346346 while (len)
347347 {
@@ -366,18 +366,12 @@ void st_f64_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char s · 18 unmodified lines
366366 * functions will cause a loss of data! Need to have sox implement
367367 * a consistent buffering protocol.
368368 */
369−st_ssize_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
369+st_size_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
370370 {
371371 st_size_t len, done = 0;
372372 void (*read_buf)(st_sample_t *, char const *, st_size_t, char, st_size_t *) = 0;
373373 size_t i;
374374
375− if (nsamp < 0)
376− {
377− st_fail_errno(ft,ST_EINVAL,"st_rawread requires positive sizes");
378− return ST_EOF;
379− }
380−
381375 switch(ft->info.size) {
382376 case ST_SIZE_BYTE:
383377 switch(ft->info.encoding)
@@ -527,7 +521,7 @@ int st_rawstopread(ft_t ft) · 143 unmodified lines
527521 return ST_SUCCESS;
528522 }
529523
530−void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
524+void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount)
531525 {
532526 while (len)
533527 {
@@ -536,7 +530,7 @@ void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char s · 2 unmodified lines
536530 }
537531 }
538532
539−void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
533+void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount)
540534 {
541535 while (len)
542536 {
@@ -545,8 +539,8 @@ void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char s · 2 unmodified lines
545539 }
546540 }
547541
548−void st_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len,
549− char swap, st_size_t * clippedCount)
542+static void st_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len,
543+ char swap UNUSED, st_size_t * clippedCount)
550544 {
551545 while (len)
552546 {
@@ -555,8 +549,8 @@ void st_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, · 2 unmodified lines
555549 }
556550 }
557551
558−void st_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len,
559− char swap, st_size_t * clippedCount)
552+static void st_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len,
553+ char swap UNUSED, st_size_t * clippedCount)
560554 {
561555 while (len)
562556 {
@@ -565,8 +559,8 @@ void st_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, · 2 unmodified lines
565559 }
566560 }
567561
568−void st_inv_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len,
569− char swap, st_size_t * clippedCount)
562+static void st_inv_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len,
563+ char swap UNUSED, st_size_t * clippedCount)
570564 {
571565 while (len)
572566 {
@@ -575,8 +569,8 @@ void st_inv_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, · 2 unmodified lines
575569 }
576570 }
577571
578−void st_inv_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len,
579− char swap, st_size_t * clippedCount)
572+static void st_inv_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len,
573+ char swap UNUSED, st_size_t * clippedCount)
580574 {
581575 while (len)
582576 {
@@ -639,7 +633,7 @@ static void st_24_write_one(char * * const buf1, int24_t datum, char const swap) · 56 unmodified lines
639633
640634
641635
642−void st_u24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount)
636+static void st_u24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount)
643637 {
644638 while (len--)
645639 {
@@ -650,7 +644,7 @@ void st_u24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char · 4 unmodified lines
650644
651645
652646
653−void st_s24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount)
647+static void st_s24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount)
654648 {
655649 while (len--)
656650 {
@@ -661,7 +655,7 @@ void st_s24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char · 4 unmodified lines
661655
662656
663657
664−void st_udw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
658+static void st_udw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED)
665659 {
666660 while (len)
667661 {
@@ -677,7 +671,7 @@ void st_udw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char · 9 unmodified lines
677671 }
678672 }
679673
680−void st_dw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
674+static void st_dw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED)
681675 {
682676 while (len)
683677 {
@@ -693,7 +687,7 @@ void st_dw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char s · 9 unmodified lines
693687 }
694688 }
695689
696−void st_f32_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
690+static void st_f32_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
697691 {
698692 while (len)
699693 {
@@ -709,7 +703,7 @@ void st_f32_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char · 9 unmodified lines
709703 }
710704 }
711705
712−void st_f64_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
706+static void st_f64_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
713707 {
714708 while (len)
715709 {
@@ -744,7 +738,7 @@ static void writeflush(ft_t ft) · 28 unmodified lines
744738 * functions will cause a loss of data! Need to have sox implement
745739 * a consistent buffering protocol.
746740 */
747−st_ssize_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
741+st_size_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
748742 {
749743 st_size_t len, done = 0;
750744 void (*write_buf)(char *, st_sample_t const *, st_size_t, char, st_size_t *) = 0;
@@ -873,7 +867,7 @@ int st_rawstopwrite(ft_t ft) · 122 unmodified lines
873867 */
874868
875869 #define STARTREAD(NAME,SIZE,STYLE) \
876−int NAME(ft_t ft) \
870+static int NAME(ft_t ft) \
877871 { \
878872 ft->info.size = SIZE; \
879873 ft->info.encoding = STYLE; \
@@ -882,7 +876,7 @@ int NAME(ft_t ft) \ · 2 unmodified lines
882876 }
883877
884878 #define STARTWRITE(NAME,SIZE,STYLE)\
885−int NAME(ft_t ft) \
879+static int NAME(ft_t ft) \
886880 { \
887881 ft->info.size = SIZE; \
888882 ft->info.encoding = STYLE; \
@@ -930,7 +924,7 @@ void rawdefaults(ft_t ft) · 41 unmodified lines
930924 {
931925 if (ft->info.rate == 0)
932926 ft->info.rate = 8000;
933− if (ft->info.channels == -1)
927+ if (ft->info.channels == 0)
934928 ft->info.channels = 1;
935929 }
936930
src/repeat.c+5−5
@@ -33,7 +33,7 @@ typedef struct repeatstuff { · 32 unmodified lines
3333 int repeats;
3434 } *repeat_t;
3535
36−int st_repeat_getopts(eff_t effp, int n, char **argv)
36+static int st_repeat_getopts(eff_t effp, int n, char **argv)
3737 {
3838 repeat_t repeat = (repeat_t)effp->priv;
3939
@@ -55,7 +55,7 @@ int st_repeat_getopts(eff_t effp, int n, char **argv) · 15 unmodified lines
5555 return (ST_SUCCESS);
5656 }
5757
58−int st_repeat_start(eff_t effp)
58+static int st_repeat_start(eff_t effp)
5959 {
6060 repeat_t repeat = (repeat_t)effp->priv;
6161
@@ -69,7 +69,7 @@ int st_repeat_start(eff_t effp) · 7 unmodified lines
6969 return (ST_SUCCESS);
7070 }
7171
72−int st_repeat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
72+static int st_repeat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf UNUSED,
7373 st_size_t *isamp, st_size_t *osamp)
7474 {
7575 repeat_t repeat = (repeat_t)effp->priv;
@@ -85,7 +85,7 @@ int st_repeat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 9 unmodified lines
8585 return (ST_SUCCESS);
8686 }
8787
88−int st_repeat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
88+static int st_repeat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
8989 {
9090 size_t read = 0;
9191 st_sample_t *buf;
@@ -187,7 +187,7 @@ int st_repeat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 95 unmodified lines
187187 return ST_SUCCESS;
188188 }
189189
190−int st_repeat_stop(eff_t effp)
190+static int st_repeat_stop(eff_t effp)
191191 {
192192 repeat_t repeat = (repeat_t)effp->priv;
193193
src/resample.c+1−2
@@ -158,7 +158,7 @@ static long SrcEX(resample_t r, long Nx); · 157 unmodified lines
158158 /*
159159 * Process options
160160 */
161−int st_resample_getopts(eff_t effp, int n, char **argv)
161+int st_resample_getopts(eff_t effp, int n, char **argv)
162162 {
163163 resample_t r = (resample_t) effp->priv;
164164
@@ -392,7 +392,6 @@ int st_resample_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 227 unmodified lines
392392 r->Xp = r->Xoff;
393393
394394 for(i=0; i < Nout; i++) {
395− // orig: *obuf++ = r->Y[i] * ISCALE;
396395 double ftemp = r->Y[i] * ISCALE;
397396
398397 ST_SAMPLE_CLIP_COUNT(ftemp, effp->clippedCount);
src/reverb.c+11−11
@@ -104,18 +104,18 @@ static st_effect_t st_reverb_effect; · 103 unmodified lines
104104 /* Private data for SKEL file */
105105 typedef struct reverbstuff {
106106 int counter;
107− int numdelays;
107+ size_t numdelays;
108108 float *reverbbuf;
109109 float in_gain, out_gain, time;
110110 float delay[MAXREVERBS], decay[MAXREVERBS];
111− long samples[MAXREVERBS], maxsamples;
111+ size_t samples[MAXREVERBS], maxsamples;
112112 st_sample_t pl, ppl, pppl;
113113 } *reverb_t;
114114
115115 /*
116116 * Process options
117117 */
118−int st_reverb_getopts(eff_t effp, int n, char **argv)
118+static int st_reverb_getopts(eff_t effp, int n, char **argv)
119119 {
120120 reverb_t reverb = (reverb_t) effp->priv;
121121 int i;
@@ -150,10 +150,10 @@ int st_reverb_getopts(eff_t effp, int n, char **argv) · 28 unmodified lines
150150 /*
151151 * Prepare for processing.
152152 */
153−int st_reverb_start(eff_t effp)
153+static int st_reverb_start(eff_t effp)
154154 {
155155 reverb_t reverb = (reverb_t) effp->priv;
156− int i;
156+ size_t i;
157157
158158 reverb->in_gain = 1.0;
159159
@@ -208,12 +208,12 @@ int st_reverb_start(eff_t effp) · 48 unmodified lines
208208 * Processed signed long samples from ibuf to obuf.
209209 * Return number of samples processed.
210210 */
211−int st_reverb_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
211+static int st_reverb_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
212212 st_size_t *isamp, st_size_t *osamp)
213213 {
214214 reverb_t reverb = (reverb_t) effp->priv;
215− int len, done;
216− int i, j;
215+ size_t len, done;
216+ size_t i, j;
217217
218218 float d_in, d_out;
219219 st_sample_t out;
@@ -243,12 +243,12 @@ reverb->reverbbuf[(i + reverb->maxsamples - reverb->samples[j]) % reverb->maxsam · 23 unmodified lines
243243 /*
244244 * Drain out reverb lines.
245245 */
246−int st_reverb_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
246+static int st_reverb_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
247247 {
248248 reverb_t reverb = (reverb_t) effp->priv;
249249 float d_in, d_out;
250250 st_sample_t out, l;
251− int i, j;
251+ size_t i, j;
252252 st_size_t done;
253253
254254 i = reverb->counter;
@@ -280,7 +280,7 @@ reverb->reverbbuf[(i + reverb->maxsamples - reverb->samples[j]) % reverb->maxsam · 25 unmodified lines
280280 /*
281281 * Clean up reverb effect.
282282 */
283−int st_reverb_stop(eff_t effp)
283+static int st_reverb_stop(eff_t effp)
284284 {
285285 reverb_t reverb = (reverb_t) effp->priv;
286286
src/reverse.c+5−19
@@ -32,25 +32,11 @@ typedef struct reversestuff { · 31 unmodified lines
3232 #define WRITING 0
3333 #define READING 1
3434
35−/*
36− * Process options: none in our case.
37− */
38−
39−int st_reverse_getopts(eff_t effp, int n, char **argv)
40−{
41− if (n)
42− {
43− st_fail(st_reverse_effect.usage);
44− return (ST_EOF);
45− }
46− return(ST_SUCCESS);
47−}
48−
4935 /*
5036 * Prepare processing: open temporary file.
5137 */
5238
53−int st_reverse_start(eff_t effp)
39+static int st_reverse_start(eff_t effp)
5440 {
5541 reverse_t reverse = (reverse_t) effp->priv;
5642 reverse->fp = tmpfile();
@@ -67,7 +53,7 @@ int st_reverse_start(eff_t effp) · 10 unmodified lines
6753 * Effect flow: a degenerate case: write input samples on temporary file,
6854 * don't generate any output samples.
6955 */
70−int st_reverse_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
56+static int st_reverse_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf UNUSED,
7157 st_size_t *isamp, st_size_t *osamp)
7258 {
7359 reverse_t reverse = (reverse_t) effp->priv;
@@ -91,7 +77,7 @@ int st_reverse_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 17 unmodified lines
9177 * Effect drain: generate the actual samples in reverse order.
9278 */
9379
94−int st_reverse_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
80+static int st_reverse_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
9581 {
9682 reverse_t reverse = (reverse_t) effp->priv;
9783 st_size_t len, nbytes;
@@ -137,7 +123,7 @@ int st_reverse_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 39 unmodified lines
137123 /*
138124 * Close and unlink the temporary file.
139125 */
140−int st_reverse_stop(eff_t effp)
126+static int st_reverse_stop(eff_t effp)
141127 {
142128 reverse_t reverse = (reverse_t) effp->priv;
143129
@@ -149,7 +135,7 @@ static st_effect_t st_reverse_effect = { · 5 unmodified lines
149135 "reverse",
150136 "Usage: Reverse effect takes no options",
151137 0,
152− st_reverse_getopts,
138+ st_effect_nothing_getopts,
153139 st_reverse_start,
154140 st_reverse_flow,
155141 st_reverse_drain,
src/sf.c+4−4
@@ -64,7 +64,7 @@ static void readcodes(ft_t ft, SFHEADER *sfhead) · 63 unmodified lines
6464 ft->comment = commentbuf;
6565 }
6666
67−int st_sfseek(ft_t ft, st_size_t offset)
67+static int st_sfseek(ft_t ft, st_size_t offset)
6868 {
6969 st_size_t new_offset, channel_block, alignment;
7070
@@ -91,7 +91,7 @@ int st_sfseek(ft_t ft, st_size_t offset) · 20 unmodified lines
9191 * size and encoding of samples,
9292 * mono/stereo/quad.
9393 */
94−int st_sfstartread(ft_t ft)
94+static int st_sfstartread(ft_t ft)
9595 {
9696 sf_t sf = (sf_t) ft->priv;
9797 SFHEADER sfhead;
@@ -139,7 +139,7 @@ int st_sfstartread(ft_t ft) · 41 unmodified lines
139139 }
140140 ft->info.channels = (int) sf->info.sf_chans;
141141
142− if (ft->info.channels == -1)
142+ if (ft->info.channels == 0)
143143 ft->info.channels = 1;
144144
145145 /* Read codes and print as comments. */
@@ -159,7 +159,7 @@ int st_sfstartread(ft_t ft) · 13 unmodified lines
159159 return(rc);
160160 }
161161
162−int st_sfstartwrite(ft_t ft)
162+static int st_sfstartwrite(ft_t ft)
163163 {
164164 sf_t sf = (sf_t) ft->priv;
165165 SFHEADER sfhead;
src/silence.c+8−8
@@ -78,7 +78,7 @@ static void clear_rms(eff_t effp) · 77 unmodified lines
7878 silence->rms_sum = 0;
7979 }
8080
81−int st_silence_getopts(eff_t effp, int n, char **argv)
81+static int st_silence_getopts(eff_t effp, int n, char **argv)
8282 {
8383 silence_t silence = (silence_t) effp->priv;
8484 int parse_count;
@@ -250,7 +250,7 @@ int st_silence_getopts(eff_t effp, int n, char **argv) · 165 unmodified lines
250250 return(ST_SUCCESS);
251251 }
252252
253−int st_silence_start(eff_t effp)
253+static int st_silence_start(eff_t effp)
254254 {
255255 silence_t silence = (silence_t) effp->priv;
256256
@@ -321,7 +321,7 @@ int st_silence_start(eff_t effp) · 64 unmodified lines
321321 return(ST_SUCCESS);
322322 }
323323
324−int aboveThreshold(eff_t effp, st_sample_t value, double threshold, char unit)
324+static int aboveThreshold(eff_t effp, st_sample_t value, double threshold, char unit)
325325 {
326326 double ratio;
327327 int rc;
@@ -390,12 +390,12 @@ static void update_rms(eff_t effp, st_sample_t sample) · 62 unmodified lines
390390
391391 /* Process signed long samples from ibuf to obuf. */
392392 /* Return number of samples processed in isamp and osamp. */
393−int st_silence_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
393+static int st_silence_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
394394 st_size_t *isamp, st_size_t *osamp)
395395 {
396396 silence_t silence = (silence_t) effp->priv;
397− int threshold, j;
398− st_size_t i;
397+ int threshold;
398+ st_size_t i, j;
399399 st_size_t nrOfTicks, nrOfInSamplesRead, nrOfOutSamplesWritten;
400400
401401 nrOfInSamplesRead = 0;
@@ -640,7 +640,7 @@ silence_copy_flush: · 238 unmodified lines
640640 return (ST_SUCCESS);
641641 }
642642
643−int st_silence_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
643+static int st_silence_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
644644 {
645645 silence_t silence = (silence_t) effp->priv;
646646 st_size_t i;
@@ -676,7 +676,7 @@ int st_silence_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 29 unmodified lines
676676 return ST_SUCCESS;
677677 }
678678
679−int st_silence_stop(eff_t effp)
679+static int st_silence_stop(eff_t effp)
680680 {
681681 silence_t silence = (silence_t) effp->priv;
682682
src/smp.c+10−19
@@ -169,7 +169,7 @@ static int writetrailer(ft_t ft, struct smptrailer *trailer) · 168 unmodified lines
169169 return(ST_SUCCESS);
170170 }
171171
172−int st_smpseek(ft_t ft, st_size_t offset)
172+static int st_smpseek(ft_t ft, st_size_t offset)
173173 {
174174 int new_offset, channel_block, alignment;
175175 smp_t smp = (smp_t) ft->priv;
@@ -200,7 +200,7 @@ int st_smpseek(ft_t ft, st_size_t offset) · 24 unmodified lines
200200 * size and encoding of samples,
201201 * mono/stereo/quad.
202202 */
203−int st_smpstartread(ft_t ft)
203+static int st_smpstartread(ft_t ft)
204204 {
205205 smp_t smp = (smp_t) ft->priv;
206206 int i;
@@ -326,11 +326,11 @@ int st_smpstartread(ft_t ft) · 119 unmodified lines
326326 * Place in buf[].
327327 * Return number of samples read.
328328 */
329−st_ssize_t st_smpread(ft_t ft, st_sample_t *buf, st_size_t len)
329+static st_size_t st_smpread(ft_t ft, st_sample_t *buf, st_size_t len)
330330 {
331331 smp_t smp = (smp_t) ft->priv;
332332 unsigned short datum;
333− int done = 0;
333+ st_size_t done = 0;
334334
335335 for(; done < len && smp->NoOfSamps; done++, smp->NoOfSamps--) {
336336 st_readw(ft, &datum);
@@ -340,16 +340,7 @@ st_ssize_t st_smpread(ft_t ft, st_sample_t *buf, st_size_t len) · 3 unmodified lines
340340 return done;
341341 }
342342
343−/*
344− * Do anything required when you stop reading samples.
345− * Don't close input file!
346− */
347−int st_smpstopread(ft_t ft)
348−{
349− return(ST_SUCCESS);
350−}
351−
352−int st_smpstartwrite(ft_t ft)
343+static int st_smpstartwrite(ft_t ft)
353344 {
354345 smp_t smp = (smp_t) ft->priv;
355346 struct smpheader header;
@@ -390,11 +381,11 @@ int st_smpstartwrite(ft_t ft) · 34 unmodified lines
390381 return(ST_SUCCESS);
391382 }
392383
393−st_ssize_t st_smpwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
384+static st_size_t st_smpwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
394385 {
395386 smp_t smp = (smp_t) ft->priv;
396− register int datum;
397− st_ssize_t done = 0;
387+ int datum;
388+ st_size_t done = 0;
398389
399390 while(done < len) {
400391 datum = (int) ST_SAMPLE_TO_SIGNED_WORD(*buf++, ft->clippedCount);
@@ -406,7 +397,7 @@ st_ssize_t st_smpwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 5 unmodified lines
406397 return(done);
407398 }
408399
409−int st_smpstopwrite(ft_t ft)
400+static int st_smpstopwrite(ft_t ft)
410401 {
411402 smp_t smp = (smp_t) ft->priv;
412403 struct smptrailer trailer;
@@ -436,7 +427,7 @@ static st_format_t st_smp_format = { · 23 unmodified lines
436427 ST_FILE_STEREO | ST_FILE_LOOPS | ST_FILE_SEEK,
437428 st_smpstartread,
438429 st_smpread,
439− st_smpstopread,
430+ st_format_nothing,
440431 st_smpstartwrite,
441432 st_smpwrite,
442433 st_smpstopwrite,
src/sndrtool.c+31−84
@@ -20,9 +20,27 @@ typedef struct sndpriv { · 19 unmodified lines
2020 st_size_t dataStart;
2121 } *snd_t;
2222
23−static void sndtwriteheader(ft_t ft, st_size_t nsamples);
23+static void sndtwriteheader(ft_t ft, st_size_t nsamples)
24+{
25+ char name_buf[97];
2426
25−int st_sndseek(ft_t ft, st_size_t offset)
27+ /* sndtool header */
28+ st_writes(ft, "SOUND"); /* magic */
29+ st_writeb(ft, 0x1a);
30+ st_writew (ft,0); /* hGSound */
31+ st_writedw (ft,nsamples);
32+ st_writedw (ft,0);
33+ st_writedw (ft,nsamples);
34+ st_writew (ft,(int) ft->info.rate);
35+ st_writew (ft,0);
36+ st_writew (ft,10);
37+ st_writew (ft,4);
38+ memset (name_buf, 0, 96);
39+ sprintf (name_buf,"%.62s - File created by SoX",ft->filename);
40+ st_writebuf(ft, name_buf, 1, 96);
41+}
42+
43+static int st_sndseek(ft_t ft, st_size_t offset)
2644 {
2745 st_size_t new_offset, channel_block, alignment;
2846 snd_t snd = (snd_t ) ft->priv;
@@ -41,11 +59,8 @@ int st_sndseek(ft_t ft, st_size_t offset) · 12 unmodified lines
4159
4260 return st_seeki(ft, new_offset, SEEK_SET);
4361 }
44−/*======================================================================*/
45−/* SNDSTARTREAD */
46−/*======================================================================*/
4762
48−int st_sndtstartread(ft_t ft)
63+static int st_sndtstartread(ft_t ft)
4964 {
5065 snd_t snd = (snd_t ) ft->priv;
5166
@@ -122,10 +137,7 @@ int st_sndtstartread(ft_t ft) · 70 unmodified lines
122137 return (ST_SUCCESS);
123138 }
124139
125−/*======================================================================*/
126−/* SNDTSTARTWRITE */
127−/*======================================================================*/
128−int st_sndtstartwrite(ft_t ft)
140+static int st_sndtstartwrite(ft_t ft)
129141 {
130142 snd_t p = (snd_t ) ft->priv;
131143 int rc;
@@ -143,66 +155,24 @@ int st_sndtstartwrite(ft_t ft) · 11 unmodified lines
143155 ft->swap = ft->swap ? 0 : 1;
144156 }
145157
146−/* write header */
147−ft->info.channels = 1;
148−ft->info.encoding = ST_ENCODING_UNSIGNED;
149−ft->info.size = ST_SIZE_BYTE;
150−p->nsamples = 0;
151−sndtwriteheader(ft, 0);
152−
153−return(ST_SUCCESS);
154−}
155−
156−/*======================================================================*/
157−/* SNDRSTARTWRITE */
158−/*======================================================================*/
159−int st_sndrstartwrite(ft_t ft)
160−{
161− int rc;
162−
163− /* Needed for rawread() */
164− rc = st_rawstartread(ft);
165− if (rc)
166− return rc;
167−
168− /* sndr is in little endian format so
169− * swap bytes on big endian machines
170− */
171− if (ST_IS_BIGENDIAN)
172− {
173− ft->swap = ft->swap ? 0 : 1;
174− }
175−
176−/* write header */
177−ft->info.channels = 1;
178−ft->info.encoding = ST_ENCODING_UNSIGNED;
179−ft->info.size = ST_SIZE_BYTE;
180−
181−/* sounder header */
182−st_writew (ft,0); /* sample size code */
183−st_writew (ft,(int) ft->info.rate); /* sample rate */
184−st_writew (ft,10); /* volume */
185−st_writew (ft,4); /* shift */
158+ /* write header */
159+ ft->info.channels = 1;
160+ ft->info.encoding = ST_ENCODING_UNSIGNED;
161+ ft->info.size = ST_SIZE_BYTE;
162+ p->nsamples = 0;
163+ sndtwriteheader(ft, 0);
186164
187−return(ST_SUCCESS);
165+ return(ST_SUCCESS);
188166 }
189167
190−/*======================================================================*/
191−/* SNDTWRITE */
192−/*======================================================================*/
193−
194−st_ssize_t st_sndtwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
168+static st_size_t st_sndtwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
195169 {
196170 snd_t p = (snd_t ) ft->priv;
197171 p->nsamples += len;
198172 return st_rawwrite(ft, buf, len);
199173 }
200174
201−/*======================================================================*/
202−/* SNDTSTOPWRITE */
203−/*======================================================================*/
204−
205−int st_sndtstopwrite(ft_t ft)
175+static int st_sndtstopwrite(ft_t ft)
206176 {
207177 snd_t p = (snd_t ) ft->priv;
208178 int rc;
@@ -224,29 +194,6 @@ int st_sndtstopwrite(ft_t ft) · 15 unmodified lines
224194 return(ST_SUCCESS);
225195 }
226196
227−/*======================================================================*/
228−/* SNDTWRITEHEADER */
229−/*======================================================================*/
230−static void sndtwriteheader(ft_t ft, st_size_t nsamples)
231−{
232− char name_buf[97];
233−
234− /* sndtool header */
235− st_writes(ft, "SOUND"); /* magic */
236− st_writeb(ft, 0x1a);
237− st_writew (ft,0); /* hGSound */
238− st_writedw (ft,nsamples);
239− st_writedw (ft,0);
240− st_writedw (ft,nsamples);
241− st_writew (ft,(int) ft->info.rate);
242− st_writew (ft,0);
243− st_writew (ft,10);
244− st_writew (ft,4);
245− memset (name_buf, 0, 96);
246− sprintf (name_buf,"%.62s - File created by Sound Exchange",ft->filename);
247− st_writebuf(ft, name_buf, 1, 96);
248−}
249−
250197 /* Sndtool Sound File */
251198 static const char *sndtnames[] = {
252199 "sndt",
src/sox.c+15−15
@@ -128,8 +128,8 @@ static void sigint(int s); · 127 unmodified lines
128128 /* Array's tracking input and output files */
129129 static file_options_t *file_opts[MAX_FILES];
130130 static ft_t file_desc[MAX_FILES];
131−static int file_count = 0;
132−static int input_count = 0;
131+static size_t file_count = 0;
132+static size_t input_count = 0;
133133
134134 /* We parse effects into a temporary effects table and then place into
135135 * the real effects table. This makes it easier to reorder some effects
@@ -179,7 +179,7 @@ static void sox_output_message(int level, st_output_message_t m) · 43 unmodified lines
179179 int main(int argc, char **argv)
180180 {
181181 file_options_t *fo;
182− int i;
182+ size_t i;
183183
184184 myname = argv[0];
185185
@@ -202,8 +202,8 @@ int main(int argc, char **argv) · 16 unmodified lines
202202
203203 fo = (file_options_t *)calloc(sizeof(file_options_t), 1);
204204 fo->info.size = -1;
205− fo->info.encoding = -1;
206− fo->info.channels = -1;
205+ fo->info.encoding = ST_ENCODING_UNKNOWN;
206+ fo->info.channels = 0;
207207 fo->info.compression = HUGE_VAL;
208208 fo->volume = 1.0;
209209 file_opts[file_count++] = fo;
@@ -551,7 +551,7 @@ static int compare_input(ft_t ft1, ft_t ft2) · 341 unmodified lines
551551 return ST_SUCCESS;
552552 }
553553
554−void optimize_trim(void)
554+static void optimize_trim(void)
555555 {
556556 /* Speed hack. If the "trim" effect is the first effect then
557557 * peak inside its "effect descriptor" and see what the
@@ -585,9 +585,9 @@ void optimize_trim(void) · 27 unmodified lines
585585 */
586586
587587 static void process(void) {
588− int e, f, flowstatus = ST_SUCCESS;
589− int current_input;
590− st_size_t s;
588+ int e, flowstatus = ST_SUCCESS;
589+ size_t current_input;
590+ st_size_t s, f;
591591 st_ssize_t ilen[MAX_INPUT_FILES];
592592 st_sample_t *ibuf[MAX_INPUT_FILES];
593593
@@ -626,9 +626,9 @@ static void process(void) { · 32 unmodified lines
626626 options->info.rate = file_desc[0]->info.rate;
627627 if (options->info.size == -1)
628628 options->info.size = file_desc[0]->info.size;
629− if (options->info.encoding == -1)
629+ if (options->info.encoding == ST_ENCODING_UNKNOWN)
630630 options->info.encoding = file_desc[0]->info.encoding;
631− if (options->info.channels == -1)
631+ if (options->info.channels == 0)
632632 options->info.channels = file_desc[0]->info.channels;
633633
634634 if (options->comment != NULL)
@@ -1263,7 +1263,7 @@ static void reserve_effect_buf(void) · 628 unmodified lines
12631263 static int flow_effect_out(void)
12641264 {
12651265 int e, havedata, flowstatus = 0;
1266− int len, total;
1266+ size_t len, total;
12671267
12681268 do {
12691269 /* run entire chain BACKWARDS: pull, don't push.*/
@@ -1330,9 +1330,9 @@ static int flow_effect_out(void) · 60 unmodified lines
13301330
13311331 len = st_write(file_desc[file_count-1],
13321332 &efftab[neffects-1].obuf[total],
1333− (st_ssize_t)efftab[neffects-1].olen-total);
1333+ efftab[neffects-1].olen-total);
13341334
1335− if (len < 0 || file_desc[file_count-1]->file.eof)
1335+ if (len != efftab[neffects-1].olen-total || file_desc[file_count-1]->file.eof)
13361336 {
13371337 st_warn("Error writing: %s",
13381338 file_desc[file_count-1]->st_errstr);
@@ -1877,7 +1877,7 @@ static void usage_effect(char *effect) · 538 unmodified lines
18771877
18781878 void cleanup(void)
18791879 {
1880− int i;
1880+ size_t i;
18811881 struct stat st;
18821882 char *fn;
18831883
src/speed.c+5−5
@@ -76,7 +76,7 @@ static double cub( · 75 unmodified lines
7676 }
7777
7878 /* get options. */
79−int st_speed_getopts(eff_t effp, int n, char **argv)
79+static int st_speed_getopts(eff_t effp, int n, char **argv)
8080 {
8181 speed_t speed = (speed_t) effp->priv;
8282 int cent = 0;
@@ -106,7 +106,7 @@ int st_speed_getopts(eff_t effp, int n, char **argv) · 23 unmodified lines
106106 }
107107
108108 /* start processing. */
109−int st_speed_start(eff_t effp)
109+static int st_speed_start(eff_t effp)
110110 {
111111 speed_t speed = (speed_t) effp->priv;
112112
@@ -192,7 +192,7 @@ static st_size_t compute(eff_t effp, speed_t speed, st_sample_t *obuf, st_size_t · 79 unmodified lines
192192
193193 /* handle a flow.
194194 */
195−int st_speed_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
195+static int st_speed_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
196196 st_size_t *isamp, st_size_t *osamp)
197197 {
198198 speed_t speed;
@@ -237,7 +237,7 @@ int st_speed_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 38 unmodified lines
237237
238238 /* end of stuff.
239239 */
240−int st_speed_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
240+static int st_speed_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
241241 {
242242 speed_t speed = (speed_t) effp->priv;
243243 st_size_t i, oindex;
@@ -274,7 +274,7 @@ int st_speed_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines
274274
275275 /* stop processing. report overflows.
276276 */
277−int st_speed_stop(eff_t effp)
277+static int st_speed_stop(eff_t effp)
278278 {
279279 speed_t speed = (speed_t) effp->priv;
280280
src/sphere.c+9−11
@@ -1,8 +1,6 @@
11 /*
22 * NIST Sphere file format handler.
3− */
4−
5−/*
3+ *
64 * August 7, 2000
75 *
86 * Copyright (C) 2000 Chris Bagwell (cbagwell@sprynet.com)
@@ -28,7 +26,7 @@ typedef struct spherestuff { · 19 unmodified lines
2826 * size and encoding of samples,
2927 * mono/stereo/quad.
3028 */
31−int st_spherestartread(ft_t ft)
29+static int st_spherestartread(ft_t ft)
3230 {
3331 sphere_t sphere = (sphere_t) ft->priv;
3432 int rc;
@@ -85,7 +83,7 @@ int st_spherestartread(ft_t ft) · 50 unmodified lines
8583 ft->info.size = i;
8684 }
8785 if (strncmp(buf, "channel_count", 13) == 0 &&
88− ft->info.channels == -1)
86+ ft->info.channels == 0)
8987 {
9088 sscanf(buf, "%63s %15s %d", fldname, fldtype, &i);
9189 ft->info.channels = i;
@@ -96,7 +94,7 @@ int st_spherestartread(ft_t ft) · 4 unmodified lines
9694 /* Only bother looking for ulaw flag. All others
9795 * should be caught below by default PCM check
9896 */
99− if (ft->info.encoding == -1 &&
97+ if (ft->info.encoding == ST_ENCODING_UNKNOWN &&
10098 strncmp(fldsval,"ulaw",4) == 0)
10199 {
102100 ft->info.encoding = ST_ENCODING_ULAW;
@@ -146,7 +144,7 @@ int st_spherestartread(ft_t ft) · 43 unmodified lines
146144 * This means encoding is signed if size = word or
147145 * unsigned if size = byte.
148146 */
149− if (ft->info.encoding == -1)
147+ if (ft->info.encoding == ST_ENCODING_UNKNOWN)
150148 {
151149 if (ft->info.size == 1)
152150 ft->info.encoding = ST_ENCODING_UNSIGNED;
@@ -190,7 +188,7 @@ int st_spherestartread(ft_t ft) · 37 unmodified lines
190188 * Return number of samples read.
191189 */
192190
193−st_ssize_t st_sphereread(ft_t ft, st_sample_t *buf, st_size_t len)
191+static st_size_t st_sphereread(ft_t ft, st_sample_t *buf, st_size_t len)
194192 {
195193 sphere_t sphere = (sphere_t) ft->priv;
196194
@@ -204,7 +202,7 @@ st_ssize_t st_sphereread(ft_t ft, st_sample_t *buf, st_size_t len) · 7 unmodified lines
204202 return st_rawread(ft, buf, len);
205203 }
206204
207−int st_spherestartwrite(ft_t ft)
205+static int st_spherestartwrite(ft_t ft)
208206 {
209207 int rc;
210208 int x;
@@ -243,7 +241,7 @@ int st_spherestartwrite(ft_t ft) · 32 unmodified lines
243241
244242 }
245243
246−st_ssize_t st_spherewrite(ft_t ft, const st_sample_t *buf, st_size_t len)
244+static st_size_t st_spherewrite(ft_t ft, const st_sample_t *buf, st_size_t len)
247245 {
248246 sphere_t sphere = (sphere_t) ft->priv;
249247
@@ -251,7 +249,7 @@ st_ssize_t st_spherewrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 1 unmodified line
251249 return st_rawwrite(ft, buf, len);
252250 }
253251
254−int st_spherestopwrite(ft_t ft)
252+static int st_spherestopwrite(ft_t ft)
255253 {
256254 int rc;
257255 char buf[128];
src/st.h+13−10
@@ -19,6 +19,9 @@ · 18 unmodified lines
1919 # define __attribute__(x) /*NOTHING*/
2020 #endif
2121
22+/* Avoid warnings about unused parameters. */
23+#define UNUSED __attribute__ ((unused))
24+
2225 /* C language enhancements: */
2326
2427 /* Boolean type, compatible with C++ */
@@ -85,8 +88,8 @@ typedef int32_t st_sample_t; · 60 unmodified lines
8588 */
8689
8790 /* Temporary variables to prevent multiple evaluation of macro arguments: */
88−static st_sample_t st_macro_temp_sample __attribute__((unused));
89−static double st_macro_temp_double __attribute__((unused));
91+static st_sample_t st_macro_temp_sample UNUSED;
92+static double st_macro_temp_double UNUSED;
9093
9194 #define ST_SAMPLE_NEG ST_INT_MIN(32)
9295 #define ST_SAMPLE_TO_UNSIGNED(bits,d,clips) \
@@ -199,7 +202,7 @@ typedef struct st_signalinfo · 106 unmodified lines
199202 st_rate_t rate; /* sampling rate */
200203 signed char size; /* word length of data */
201204 st_encoding_t encoding; /* format of sample numbers */
202− signed char channels; /* number of sound channels */
205+ unsigned channels; /* number of sound channels */
203206 char swap; /* do byte- or word-swap */
204207 double compression; /* compression factor (where applicable) */
205208 } st_signalinfo_t;
@@ -263,13 +266,13 @@ typedef struct st_soundstream *ft_t; · 57 unmodified lines
263266
264267 typedef struct st_format {
265268 const char * const *names;
266− char *usage;
269+ const char *usage;
267270 unsigned int flags;
268271 int (*startread)(ft_t ft);
269− st_ssize_t (*read)(ft_t ft, st_sample_t *buf, st_size_t len);
272+ st_size_t (*read)(ft_t ft, st_sample_t *buf, st_size_t len);
270273 int (*stopread)(ft_t ft);
271274 int (*startwrite)(ft_t ft);
272− st_ssize_t (*write)(ft_t ft, const st_sample_t *buf, st_size_t len);
275+ st_size_t (*write)(ft_t ft, const st_sample_t *buf, st_size_t len);
273276 int (*stopwrite)(ft_t ft);
274277 int (*seek)(ft_t ft, st_size_t offset);
275278 } st_format_t;
@@ -344,7 +347,7 @@ typedef struct · 68 unmodified lines
344347 char *usage;
345348 unsigned int flags;
346349
347− int (*getopts)(eff_t effp, int argc, char **argv);
350+ int (*getopts)(eff_t effp, int argc, char *argv[]);
348351 int (*start)(eff_t effp);
349352 int (*flow)(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
350353 st_size_t *isamp, st_size_t *osamp);
@@ -363,7 +366,7 @@ struct st_effect · 12 unmodified lines
363366 st_size_t odone, olen; /* consumed, total length */
364367 st_size_t clippedCount; /* increment if clipping occurs */
365368 /* The following is a portable trick to align this variable on
366− * an 8-byte bounder. Once this is done, the buffer alloced
369+ * an 8-byte boundary. Once this is done, the buffer alloced
367370 * after it should be align on an 8-byte boundery as well.
368371 * This lets you cast any structure over the private area
369372 * without concerns of alignment.
@@ -380,8 +383,8 @@ extern ft_t st_open_write_instr(const char *path, const st_signalinfo_t *info, · 10 unmodified lines
380383 const char *filetype, const char *comment,
381384 const st_instrinfo_t *instr,
382385 const st_loopinfo_t *loops);
383−extern st_ssize_t st_read(ft_t ft, st_sample_t *buf, st_size_t len);
384−extern st_ssize_t st_write(ft_t ft, const st_sample_t *buf, st_size_t len);
386+extern st_size_t st_read(ft_t ft, st_sample_t *buf, st_size_t len);
387+extern st_size_t st_write(ft_t ft, const st_sample_t *buf, st_size_t len);
385388 extern int st_close(ft_t ft);
386389
387390 #define ST_SEEK_SET 0
src/st_i.h+18−20
@@ -21,17 +21,8 @@ · 20 unmodified lines
2121 #endif
2222
2323 /* various gcc optimizations and portablity defines */
24−#ifdef __GNUC__
2524 #define NORET __attribute__((noreturn))
26−#else
27−#define NORET
28−#endif
29−
30−#ifdef USE_REGPARM
3125 #define REGPARM(n) __attribute__((regparm(n)))
32−#else
33−#define REGPARM(n)
34−#endif
3526
3627 /* declared in misc.c */
3728 typedef struct {char const *text; int value;} enum_item;
@@ -45,14 +36,14 @@ extern enum_item const st_wave_enum[]; · 7 unmodified lines
4536 void st_generate_wave_table(
4637 st_wave_t wave_type,
4738 st_data_t data_type,
48− void * table,
39+ void *table,
4940 uint32_t table_size,
5041 double min,
5142 double max,
5243 double phase);
5344
54−st_sample_t st_gcd(st_sample_t a, st_sample_t b) REGPARM(2);
55−st_sample_t st_lcm(st_sample_t a, st_sample_t b) REGPARM(2);
45+REGPARM(2) st_sample_t st_gcd(st_sample_t a, st_sample_t b);
46+REGPARM(2) st_sample_t st_lcm(st_sample_t a, st_sample_t b);
5647
5748 #ifndef HAVE_STRCASECMP
5849 int strcasecmp(const char *s1, const char *s2);
@@ -69,8 +60,8 @@ void st_initrand(void); · 10 unmodified lines
6960 * possible byte swapping.
7061 */
7162 /* declared in misc.c */
72−st_ssize_t st_readbuf(ft_t ft, void *buf, size_t size, st_size_t len);
73−st_ssize_t st_writebuf(ft_t ft, void const *buf, size_t size, st_size_t len);
63+size_t st_readbuf(ft_t ft, void *buf, size_t size, st_size_t len);
64+size_t st_writebuf(ft_t ft, void const *buf, size_t size, st_size_t len);
7465 int st_reads(ft_t ft, char *c, st_size_t len);
7566 int st_writes(ft_t ft, char *c);
7667 int st_readb(ft_t ft, uint8_t *ub);
@@ -232,10 +223,10 @@ extern const st_format_t *st_xa_format_fn(void); · 155 unmodified lines
232223 /* Raw I/O
233224 */
234225 int st_rawstartread(ft_t ft);
235−st_ssize_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp);
226+st_size_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp);
236227 int st_rawstopread(ft_t ft);
237228 int st_rawstartwrite(ft_t ft);
238−st_ssize_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp);
229+st_size_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp);
239230 int st_rawstopwrite(ft_t ft);
240231 int st_rawseek(ft_t ft, st_size_t offset);
241232
@@ -243,11 +234,12 @@ int st_rawseek(ft_t ft, st_size_t offset); · 1 unmodified line
243234 * a file handler or effect doesn't need to do anything special
244235 */
245236 int st_format_nothing(ft_t ft);
246−st_ssize_t st_format_nothing_read_io(ft_t ft, st_sample_t *buf, st_size_t len);
247−st_ssize_t st_format_nothing_write_io(ft_t ft, const st_sample_t *buf, st_size_t len);
237+st_size_t st_format_nothing_read_io(ft_t ft, st_sample_t *buf, st_size_t len);
238+st_size_t st_format_nothing_write_io(ft_t ft, const st_sample_t *buf, st_size_t len);
248239 int st_format_nothing_seek(ft_t ft, st_size_t offset);
249240 int st_effect_nothing(eff_t effp);
250241 int st_effect_nothing_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp);
242+int st_effect_nothing_getopts(eff_t effp, int n, char **argv UNUSED);
251243
252244 /*=============================================================================
253245 * Effects
@@ -307,9 +299,15 @@ extern const st_effect_t *st_trim_effect_fn(void); · 53 unmodified lines
307299 extern const st_effect_t *st_vibro_effect_fn(void);
308300 extern const st_effect_t *st_vol_effect_fn(void);
309301
310−/* Needed in sox.c
311− */
302+/* Needed in sox.c */
312303 st_size_t st_trim_get_start(eff_t effp);
313304 void st_trim_clear_start(eff_t effp);
314305
306+/* Needed in rate.c */
307+int st_resample_start(eff_t effp);
308+int st_resample_getopts(eff_t effp, int n, char **argv);
309+int st_resample_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, st_size_t *isamp, st_size_t *osamp);
310+int st_resample_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp);
311+int st_resample_stop(eff_t effp);
312+
315313 #endif
src/stat.c+5−5
@@ -45,7 +45,7 @@ typedef struct statstuff { · 44 unmodified lines
4545 /*
4646 * Process options
4747 */
48−int st_stat_getopts(eff_t effp, int n, char **argv)
48+static int st_stat_getopts(eff_t effp, int n, char **argv)
4949 {
5050 stat_t stat = (stat_t) effp->priv;
5151
@@ -96,7 +96,7 @@ int st_stat_getopts(eff_t effp, int n, char **argv) · 44 unmodified lines
9696 /*
9797 * Prepare processing.
9898 */
99−int st_stat_start(eff_t effp)
99+static int st_stat_start(eff_t effp)
100100 {
101101 stat_t stat = (stat_t) effp->priv;
102102 int i;
@@ -152,7 +152,7 @@ static void print_power_spectrum(unsigned samples, float rate, float *re_in, flo · 49 unmodified lines
152152 * Return number of samples processed.
153153 */
154154
155−int st_stat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
155+static int st_stat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
156156 st_size_t *isamp, st_size_t *osamp)
157157 {
158158 stat_t stat = (stat_t) effp->priv;
@@ -231,7 +231,7 @@ int st_stat_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 72 unmodified lines
231231 /*
232232 * Process tail of input samples.
233233 */
234−int st_stat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
234+static int st_stat_drain(eff_t effp, st_sample_t *obuf UNUSED, st_size_t *osamp)
235235 {
236236 stat_t stat = (stat_t) effp->priv;
237237
@@ -256,7 +256,7 @@ int st_stat_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 18 unmodified lines
256256 * Do anything required when you stop reading samples.
257257 * Don't close input file!
258258 */
259−int st_stat_stop(eff_t effp)
259+static int st_stat_stop(eff_t effp)
260260 {
261261 stat_t stat = (stat_t) effp->priv;
262262 double amp, scale, rms = 0, freq;
src/stconfig.h.in+5−5
@@ -111,19 +111,19 @@ · 110 unmodified lines
111111 /* Define to the version of this package. */
112112 #undef PACKAGE_VERSION
113113
114−/* The size of a `char', as computed by sizeof. */
114+/* The size of `char', as computed by sizeof. */
115115 #undef SIZEOF_CHAR
116116
117−/* The size of a `int', as computed by sizeof. */
117+/* The size of `int', as computed by sizeof. */
118118 #undef SIZEOF_INT
119119
120−/* The size of a `long', as computed by sizeof. */
120+/* The size of `long', as computed by sizeof. */
121121 #undef SIZEOF_LONG
122122
123−/* The size of a `short', as computed by sizeof. */
123+/* The size of `short', as computed by sizeof. */
124124 #undef SIZEOF_SHORT
125125
126−/* The size of a `void*', as computed by sizeof. */
126+/* The size of `void*', as computed by sizeof. */
127127 #undef SIZEOF_VOIDP
128128
129129 /* Define to 1 if you have the ANSI C header files. */
src/stio.c+8−8
@@ -54,7 +54,7 @@ static int st_checkformat(ft_t ft) · 53 unmodified lines
5454 return ST_EOF;
5555 }
5656
57− if (ft->info.encoding == -1)
57+ if (ft->info.encoding == ST_ENCODING_UNKNOWN)
5858 {
5959 st_fail_errno(ft,ST_EFMT,"data encoding was not specified");
6060 return ST_EOF;
@@ -105,8 +105,8 @@ ft_t st_open_read(const char *path, const st_signalinfo_t *info, · 44 unmodified lines
105105 }
106106
107107 ft->info.size = -1;
108− ft->info.encoding = -1;
109− ft->info.channels = -1;
108+ ft->info.encoding = ST_ENCODING_UNKNOWN;
109+ ft->info.channels = 0;
110110 if (info)
111111 ft->info = *info;
112112 /* FIXME: Remove ft->swap from code */
@@ -145,7 +145,7 @@ ft_t st_open_read(const char *path, const st_signalinfo_t *info, · 32 unmodified lines
145145 * This is because libst usually doesn't set this for mono file
146146 * formats (for historical reasons).
147147 */
148− if (ft->info.channels == -1)
148+ if (ft->info.channels == 0)
149149 ft->info.channels = 1;
150150
151151 if (st_checkformat(ft) )
@@ -229,8 +229,8 @@ ft_t st_open_write_instr(const char *path, const st_signalinfo_t *info, · 77 unmodified lines
229229 }
230230
231231 ft->info.size = -1;
232− ft->info.encoding = -1;
233− ft->info.channels = -1;
232+ ft->info.encoding = ST_ENCODING_UNKNOWN;
233+ ft->info.channels = 0;
234234 if (info)
235235 ft->info = *info;
236236 ft->mode = 'w';
@@ -314,12 +314,12 @@ ft_t st_open_write(const char *path, const st_signalinfo_t *info, · 77 unmodified lines
314314 return st_open_write_instr(path, info, filetype, comment, NULL, NULL);
315315 }
316316
317−st_ssize_t st_read(ft_t ft, st_sample_t *buf, st_size_t len)
317+st_size_t st_read(ft_t ft, st_sample_t *buf, st_size_t len)
318318 {
319319 return (*ft->h->read)(ft, buf, len);
320320 }
321321
322−st_ssize_t st_write(ft_t ft, const st_sample_t *buf, st_size_t len)
322+st_size_t st_write(ft_t ft, const st_sample_t *buf, st_size_t len)
323323 {
324324 return (*ft->h->write)(ft, buf, len);
325325 }
src/stretch.c+19−27
@@ -55,36 +55,24 @@ typedef struct · 54 unmodified lines
5555 */
5656 stretch_status_t state; /* automaton status */
5757
58− int size; /* buffer size */
59− int index; /* next available element */
58+ st_size_t size; /* buffer size */
59+ st_size_t index; /* next available element */
6060 st_sample_t *ibuf; /* input buffer */
6161 int ishift; /* input shift */
6262
63− int oindex; /* next evailable element */
63+ st_size_t oindex; /* next evailable element */
6464 double * obuf; /* output buffer */
65− int oshift; /* output shift */
65+ st_size_t oshift; /* output shift */
6666
67− int fsize; /* fading size */
67+ st_size_t fsize; /* fading size */
6868 double * fbuf; /* fading, 1.0 -> 0.0 */
6969
7070 } * stretch_t;
7171
72−/*
73−static void debug(stretch_t s, char * where)
74−{
75− st_debug(
76− "%s: (f=%.2f w=%.2f r=%.2f f=%.2f)"
77− " st=%d s=%d ii=%d is=%d oi=%d os=%d fs=%d\n",
78− where, s->factor, s->window, s->shift, s->fading,
79− s->state, s->size, s->index, s->ishift,
80− s->oindex, s->oshift, s->fsize);
81−}
82−*/
83−
8472 /*
8573 * Process options
8674 */
87−int st_stretch_getopts(eff_t effp, int n, char **argv)
75+static int st_stretch_getopts(eff_t effp, int n, char **argv)
8876 {
8977 char usage[1024];
9078 stretch_t stretch = (stretch_t) effp->priv;
@@ -170,10 +158,10 @@ int st_stretch_getopts(eff_t effp, int n, char **argv) · 79 unmodified lines
170158 /*
171159 * Start processing
172160 */
173−int st_stretch_start(eff_t effp)
161+static int st_stretch_start(eff_t effp)
174162 {
175163 stretch_t stretch = (stretch_t) effp->priv;
176− register int i;
164+ st_size_t i;
177165
178166 /* not necessary. taken care by effect processing? */
179167 if (effp->outinfo.channels != effp->ininfo.channels)
@@ -199,7 +187,7 @@ int st_stretch_start(eff_t effp) · 19 unmodified lines
199187 sizeof(st_sample_t));
200188
201189 /* the shift ratio deal with the longest of ishift/oshift
202− hence ishift<=size and oshift<=size. should be asserted.
190+ hence ishift<=size and oshift<=size. FIXME: should be asserted.
203191 */
204192 if (stretch->factor < 1.0)
205193 {
@@ -246,7 +234,11 @@ int st_stretch_start(eff_t effp) · 40 unmodified lines
246234 } else if (stretch->fsize==1)
247235 stretch->fbuf[0] = 1.0;
248236
249− /* debug(stretch, "start"); */
237+ st_debug("start: (f=%.2f w=%.2f r=%.2f f=%.2f)"
238+ " st=%d s=%d ii=%d is=%d oi=%d os=%d fs=%d\n",
239+ stretch->factor, stretch->window, stretch->shift, stretch->fading,
240+ stretch->state, stretch->size, stretch->index, stretch->ishift,
241+ stretch->oindex, stretch->oshift, stretch->fsize);
250242
251243 return ST_SUCCESS;
252244 }
@@ -276,12 +268,12 @@ static void combine(stretch_t stretch) · 23 unmodified lines
276268 /*
277269 * Processes flow.
278270 */
279−int st_stretch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
271+static int st_stretch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
280272 st_size_t *isamp, st_size_t *osamp)
281273 {
282274 stretch_t stretch = (stretch_t) effp->priv;
283275 st_size_t iindex, oindex;
284− int i;
276+ st_size_t i;
285277
286278 iindex = 0;
287279 oindex = 0;
@@ -353,10 +345,10 @@ int st_stretch_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 65 unmodified lines
353345 * Drain buffer at the end
354346 * maybe not correct ? end might be artificially faded?
355347 */
356−int st_stretch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
348+static int st_stretch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
357349 {
358350 stretch_t stretch = (stretch_t) effp->priv;
359− register int i;
351+ st_size_t i;
360352 st_size_t oindex;
361353
362354 oindex = 0;
@@ -393,7 +385,7 @@ int st_stretch_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp) · 30 unmodified lines
393385 * Do anything required when you stop reading samples.
394386 * Don't close input file!
395387 */
396−int st_stretch_stop(eff_t effp)
388+static int st_stretch_stop(eff_t effp)
397389 {
398390 stretch_t stretch = (stretch_t) effp->priv;
399391
src/sunaudio.c+5−5
@@ -63,7 +63,7 @@ int st_sunstartread(ft_t ft) · 62 unmodified lines
6363
6464 if (ft->info.rate == 0.0) ft->info.rate = 8000;
6565 if (ft->info.size == -1) ft->info.size = ST_SIZE_BYTE;
66− if (ft->info.encoding == -1) ft->info.encoding = ST_ENCODING_ULAW;
66+ if (ft->info.encoding == ST_ENCODING_UNKNOWN) ft->info.encoding = ST_ENCODING_ULAW;
6767
6868 #ifdef __SVR4
6969 /* Read in old values, change to what we need and then send back */
@@ -78,7 +78,7 @@ int st_sunstartread(ft_t ft) · 8 unmodified lines
7878 }
7979 #endif
8080
81− // If simple hardware detected in force data to ulaw.
81+ /* If simple hardware detected in force data to ulaw. */
8282 if (simple_hw)
8383 {
8484 if (ft->info.size == ST_SIZE_BYTE)
@@ -125,7 +125,7 @@ int st_sunstartread(ft_t ft) · 40 unmodified lines
125125 return(ST_EOF);
126126 }
127127
128− if (ft->info.channels == -1) ft->info.channels = 1;
128+ if (ft->info.channels == 0) ft->info.channels = 1;
129129 else if (ft->info.channels > 1) {
130130 st_report("Warning: some Sun audio devices can not play stereo");
131131 st_report("at all or sometimes only with signed words. If the");
@@ -233,7 +233,7 @@ int st_sunstartwrite(ft_t ft) · 101 unmodified lines
233233
234234 if (ft->info.rate == 0.0) ft->info.rate = 8000;
235235 if (ft->info.size == -1) ft->info.size = ST_SIZE_BYTE;
236− if (ft->info.encoding == -1) ft->info.encoding = ST_ENCODING_ULAW;
236+ if (ft->info.encoding == ST_ENCODING_UNKNOWN) ft->info.encoding = ST_ENCODING_ULAW;
237237
238238 if (ft->info.size == ST_SIZE_BYTE) {
239239 samplesize = 8;
@@ -266,7 +266,7 @@ int st_sunstartwrite(ft_t ft) · 26 unmodified lines
266266 samplesize = 16;
267267 }
268268
269− if (ft->info.channels == -1) ft->info.channels = 1;
269+ if (ft->info.channels == 0) ft->info.channels = 1;
270270 else if (ft->info.channels > 1) ft->info.channels = 2;
271271
272272 /* Read in old values, change to what we need and then send back */
src/swap.c+5−25
@@ -26,7 +26,7 @@ typedef struct swapstuff { · 25 unmodified lines
2626 * Don't do initialization now.
2727 * The 'info' fields are not yet filled in.
2828 */
29−int st_swap_getopts(eff_t effp, int n, char **argv)
29+static int st_swap_getopts(eff_t effp, int n, char **argv)
3030 {
3131 swap_t swap = (swap_t) effp->priv;
3232
@@ -62,7 +62,7 @@ int st_swap_getopts(eff_t effp, int n, char **argv) · 29 unmodified lines
6262 * Prepare processing.
6363 * Do all initializations.
6464 */
65−int st_swap_start(eff_t effp)
65+static int st_swap_start(eff_t effp)
6666 {
6767 swap_t swap = (swap_t) effp->priv;
6868
@@ -128,7 +128,7 @@ int st_swap_start(eff_t effp) · 59 unmodified lines
128128 * Processed signed long samples from ibuf to obuf.
129129 * Return number of samples processed.
130130 */
131−int st_swap_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
131+static int st_swap_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
132132 st_size_t *isamp, st_size_t *osamp)
133133 {
134134 swap_t swap = (swap_t) effp->priv;
@@ -178,26 +178,6 @@ int st_swap_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 43 unmodified lines
178178 return (ST_SUCCESS);
179179 }
180180
181−/*
182− * Drain out remaining samples if the effect generates any.
183− */
184−
185−int st_swap_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
186−{
187− *osamp = 0;
188− return ST_EOF;
189−}
190−
191−/*
192− * Do anything required when you stop reading samples.
193− * (free allocated memory, etc.)
194− */
195−int st_swap_stop(eff_t effp)
196−{
197− /* nothing to do */
198− return (ST_SUCCESS);
199−}
200−
201181 static st_effect_t st_swap_effect = {
202182 "swap",
203183 "Usage: swap [1 2 | 1 2 3 4]",
@@ -205,8 +185,8 @@ static st_effect_t st_swap_effect = { · 1 unmodified line
205185 st_swap_getopts,
206186 st_swap_start,
207187 st_swap_flow,
208− st_swap_drain,
209− st_swap_stop
188+ st_effect_nothing_drain,
189+ st_effect_nothing
210190 };
211191
212192 const st_effect_t *st_swap_effect_fn(void)
src/synth.c+9−29
@@ -49,14 +49,14 @@ enum_item const synth_type[] = { · 48 unmodified lines
4949 ENUM_ITEM(SYNTH_,PINKNOISE )
5050 ENUM_ITEM(SYNTH_,BROWNNOISE)
5151 ENUM_ITEM(SYNTH_,EXP )
52− {0}};
52+ {0, 0}};
5353
5454 enum_item const combine_type[] = {
5555 ENUM_ITEM(SYNTH_,CREATE)
5656 ENUM_ITEM(SYNTH_,MIX )
5757 ENUM_ITEM(SYNTH_,AMOD )
5858 ENUM_ITEM(SYNTH_,FMOD )
59− {0}};
59+ {0, 0}};
6060
6161 /* do not ask me for the colored noise, i copied the
6262 * algorithm somewhere...
@@ -97,7 +97,7 @@ typedef struct{ · 34 unmodified lines
9797 } PinkNoise;
9898
9999 /* Setup PinkNoise structure for N rows of generators. */
100−void InitializePinkNoise( PinkNoise *pink, int numRows )
100+static void InitializePinkNoise( PinkNoise *pink, int numRows )
101101 {
102102 int i;
103103 long pmax;
@@ -112,7 +112,7 @@ void InitializePinkNoise( PinkNoise *pink, int numRows ) · 8 unmodified lines
112112 }
113113
114114 /* Generate Pink noise values between -1.0 and +1.0 */
115−float GeneratePinkNoise( PinkNoise *pink )
115+static float GeneratePinkNoise( PinkNoise *pink )
116116 {
117117 long newRandom;
118118 long sum;
@@ -238,7 +238,7 @@ static void parmcopy(synth_t sy, int s, int d){ · 119 unmodified lines
238238 * Don't do initialization now.
239239 * The 'info' fields are not yet filled in.
240240 */
241−int st_synth_getopts(eff_t effp, int n, char **argv)
241+static int st_synth_getopts(eff_t effp, int n, char **argv)
242242 {
243243 int argn;
244244 char *hlp;
@@ -372,7 +372,7 @@ int st_synth_getopts(eff_t effp, int n, char **argv) · 127 unmodified lines
372372 * Prepare processing.
373373 * Do all initializations.
374374 */
375−int st_synth_start(eff_t effp)
375+static int st_synth_start(eff_t effp)
376376 {
377377 int i;
378378 int c;
@@ -664,7 +664,7 @@ static st_sample_t do_synth(st_sample_t iv, synth_t synth, int c){ · 285 unmodified lines
664664 /*
665665 * Processed signed long samples from ibuf to obuf.
666666 */
667−int st_synth_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
667+static int st_synth_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
668668 st_size_t *isamp, st_size_t *osamp)
669669 {
670670 synth_t synth = (synth_t) effp->priv;
@@ -701,26 +701,6 @@ int st_synth_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 30 unmodified lines
701701 return result;
702702 }
703703
704−/*
705− * Drain out remaining samples if the effect generates any.
706− */
707−
708−int st_synth_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
709−{
710− *osamp = 0;
711− return ST_EOF;
712−}
713−
714−/*
715− * Do anything required when you stop reading samples.
716− * (free allocated memory, etc.)
717− */
718−int st_synth_stop(eff_t effp)
719−{
720− /* nothing to do */
721− return (ST_SUCCESS);
722−}
723−
724704 static st_effect_t st_synth_effect = {
725705 "synth",
726706 "Usage: synth [len] {[type] [combine] [freq[-freq2]] [off] [ph] [p1] [p2] [p3]}\n"
@@ -741,8 +721,8 @@ static st_effect_t st_synth_effect = { · 14 unmodified lines
741721 st_synth_getopts,
742722 st_synth_start,
743723 st_synth_flow,
744− st_synth_drain,
745− st_synth_stop
724+ st_effect_nothing_drain,
725+ st_effect_nothing
746726 };
747727
748728 const st_effect_t *st_synth_effect_fn(void)
src/trim.c+5−5
@@ -37,7 +37,7 @@ typedef struct · 36 unmodified lines
3737 /*
3838 * Process options
3939 */
40−int st_trim_getopts(eff_t effp, int n, char **argv)
40+static int st_trim_getopts(eff_t effp, int n, char **argv)
4141 {
4242 trim_t trim = (trim_t) effp->priv;
4343
@@ -88,7 +88,7 @@ int st_trim_getopts(eff_t effp, int n, char **argv) · 44 unmodified lines
8888 /*
8989 * Start processing
9090 */
91−int st_trim_start(eff_t effp)
91+static int st_trim_start(eff_t effp)
9292 {
9393 trim_t trim = (trim_t) effp->priv;
9494
@@ -128,7 +128,7 @@ int st_trim_start(eff_t effp) · 33 unmodified lines
128128 * Place in buf[].
129129 * Return number of samples read.
130130 */
131−int st_trim_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
131+static int st_trim_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
132132 st_size_t *isamp, st_size_t *osamp)
133133 {
134134 int finished = 0;
@@ -195,7 +195,7 @@ int st_trim_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 60 unmodified lines
195195 * Do anything required when you stop reading samples.
196196 * Don't close input file!
197197 */
198−int st_trim_stop(eff_t effp)
198+static int st_trim_stop(eff_t effp)
199199 {
200200 trim_t trim = (trim_t) effp->priv;
201201
@@ -227,7 +227,7 @@ static st_effect_t st_trim_effect = { · 25 unmodified lines
227227 st_trim_start,
228228 st_trim_flow,
229229 st_effect_nothing_drain,
230− st_effect_nothing
230+ st_trim_stop
231231 };
232232
233233 const st_effect_t *st_trim_effect_fn(void)
src/tx16w.c+8−17
@@ -74,7 +74,7 @@ static st_size_t writedone=0; · 73 unmodified lines
7474 * size and encoding of samples,
7575 * mono/stereo/quad.
7676 */
77−int st_txwstartread(ft_t ft)
77+static int st_txwstartread(ft_t ft)
7878 {
7979 int c;
8080 char filetype[7];
@@ -186,10 +186,10 @@ int st_txwstartread(ft_t ft) · 105 unmodified lines
186186 * Return number of samples read.
187187 */
188188
189−st_ssize_t st_txwread(ft_t ft, st_sample_t *buf, st_size_t len)
189+static st_size_t st_txwread(ft_t ft, st_sample_t *buf, st_size_t len)
190190 {
191191 txw_t sk = (txw_t) ft->priv;
192− int done = 0;
192+ st_size_t done = 0;
193193 unsigned char uc1,uc2,uc3;
194194 unsigned short s1,s2;
195195
@@ -236,16 +236,7 @@ st_ssize_t st_txwread(ft_t ft, st_sample_t *buf, st_size_t len) · 40 unmodified lines
236236 return done;
237237 }
238238
239−/*
240− * Do anything required when you stop reading samples.
241− * Don't close input file!
242− */
243−int st_txwstopread(ft_t ft)
244−{
245− return(ST_SUCCESS);
246−}
247−
248−int st_txwstartwrite(ft_t ft)
239+static int st_txwstartwrite(ft_t ft)
249240 {
250241 struct WaveHeader_ WH;
251242
@@ -276,9 +267,9 @@ int st_txwstartwrite(ft_t ft) · 24 unmodified lines
276267 return(ST_SUCCESS);
277268 }
278269
279−st_ssize_t st_txwwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
270+static st_size_t st_txwwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
280271 {
281− int i;
272+ st_size_t i;
282273 unsigned int w1,w2;
283274
284275 tx16w_len += len;
@@ -299,7 +290,7 @@ st_ssize_t st_txwwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 14 unmodified lines
299290 return(len);
300291 }
301292
302−int st_txwstopwrite(ft_t ft)
293+static int st_txwstopwrite(ft_t ft)
303294 {
304295 struct WaveHeader_ WH;
305296 int AttackLength, LoopLength, i;
@@ -388,7 +379,7 @@ static st_format_t st_txw_format = { · 82 unmodified lines
388379 0,
389380 st_txwstartread,
390381 st_txwread,
391− st_txwstopread,
382+ st_format_nothing,
392383 st_txwstartwrite,
393384 st_txwwrite,
394385 st_txwstopwrite,
src/util.c+3−3
@@ -16,9 +16,9 @@ · 15 unmodified lines
1616 */
1717
1818 #include "st_i.h"
19+#include <stddef.h>
1920 #include <string.h>
2021 #include <ctype.h>
21−
2222 #include <stdarg.h>
2323
2424 struct st_output_message_s
@@ -49,8 +49,8 @@ void st_output_message(FILE * file, st_output_message_t message) · 24 unmodified lines
4949 }
5050
5151 dot_pos = strrchr(drivername, '.');
52− if (dot_pos != NULL && dot_pos - drivername <= sizeof(buffer) - 1) {
53− strncpy(buffer, drivername, dot_pos - drivername);
52+ if (dot_pos != NULL && dot_pos - drivername <= (ptrdiff_t)(sizeof(buffer) - 1)) {
53+ strncpy(buffer, drivername, (size_t)(dot_pos - drivername));
5454 buffer[dot_pos - drivername] = '\0';
5555 drivername = buffer;
5656 }
src/vibro.c+3−13
@@ -43,7 +43,7 @@ typedef struct vibrostuff { · 42 unmodified lines
4343 /*
4444 * Process options
4545 */
46−int st_vibro_getopts(eff_t effp, int n, char **argv)
46+static int st_vibro_getopts(eff_t effp, int n, char **argv)
4747 {
4848 vibro_t vibro = (vibro_t) effp->priv;
4949
@@ -66,7 +66,7 @@ int st_vibro_getopts(eff_t effp, int n, char **argv) · 16 unmodified lines
6666 /*
6767 * Prepare processing.
6868 */
69−int st_vibro_start(eff_t effp)
69+static int st_vibro_start(eff_t effp)
7070 {
7171 vibro_t vibro = (vibro_t) effp->priv;
7272
@@ -89,7 +89,7 @@ int st_vibro_start(eff_t effp) · 16 unmodified lines
8989 * Return number of samples processed.
9090 */
9191
92−int st_vibro_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
92+static int st_vibro_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
9393 st_size_t *isamp, st_size_t *osamp)
9494 {
9595 vibro_t vibro = (vibro_t) effp->priv;
@@ -114,16 +114,6 @@ int st_vibro_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 18 unmodified lines
114114 return (ST_SUCCESS);
115115 }
116116
117−/*
118− * Do anything required when you stop reading samples.
119− * Don't close input file!
120− */
121−int st_vibro_stop(eff_t effp)
122−{
123− /* nothing to do */
124− return (ST_SUCCESS);
125−}
126−
127117 static st_effect_t st_vibro_effect = {
128118 "vibro",
129119 "Usage: vibro speed [ depth ]",
src/voc.c+41−51
@@ -200,7 +200,6 @@ typedef struct vocstuff { · 199 unmodified lines
200200 /* Prototypes for internal functions */
201201 static int getblock(ft_t);
202202 static void blockstart(ft_t);
203−static void blockstop(ft_t);
204203
205204 /* Conversion macros (from raw.c) */
206205 #define ST_ALAW_BYTE_TO_SAMPLE(d) ((st_sample_t)(st_alaw2linear16(d)) << 16)
@@ -210,7 +209,7 @@ static void blockstop(ft_t); · 3 unmodified lines
210209 /*-----------------------------------------------------------------
211210 * st_vocstartread() -- start reading a VOC file
212211 *-----------------------------------------------------------------*/
213−int st_vocstartread(ft_t ft)
212+static int st_vocstartread(ft_t ft)
214213 {
215214 int rtn = ST_SUCCESS;
216215 char header[20];
@@ -306,7 +305,7 @@ int st_vocstartread(ft_t ft) · 89 unmodified lines
306305 }
307306
308307 /* setup number of channels */
309− if (ft->info.channels == -1)
308+ if (ft->info.channels == 0)
310309 ft->info.channels = v->channels;
311310
312311 return(ST_SUCCESS);
@@ -317,10 +316,10 @@ int st_vocstartread(ft_t ft) · 4 unmodified lines
317316 * ANN: Major changes here to support multi-part files and files
318317 * that do not have audio in block 9's.
319318 *-----------------------------------------------------------------*/
320−st_ssize_t st_vocread(ft_t ft, st_sample_t *buf, st_size_t len)
319+static st_size_t st_vocread(ft_t ft, st_sample_t *buf, st_size_t len)
321320 {
322321 vs_t v = (vs_t) ft->priv;
323− int done = 0;
322+ st_size_t done = 0;
324323 int rc = 0;
325324 int16_t sw;
326325 unsigned char uc;
@@ -405,15 +404,6 @@ st_ssize_t st_vocread(ft_t ft, st_sample_t *buf, st_size_t len) · 78 unmodified lines
405404 return done;
406405 }
407406
408−/*-----------------------------------------------------------------
409− * st_vocstartread() -- start reading a VOC file
410− * nothing to do
411− *-----------------------------------------------------------------*/
412−int st_vocstopread(ft_t ft)
413−{
414− return(ST_SUCCESS);
415−}
416−
417407 /* When saving samples in VOC format the following outline is followed:
418408 * If an 8-bit mono sample then use a VOC_DATA header.
419409 * If an 8-bit stereo sample then use a VOC_EXTENDED header followed
@@ -427,7 +417,7 @@ int st_vocstopread(ft_t ft) · 7 unmodified lines
427417 * which will work with the oldest software (eg. an 8-bit mono sample
428418 * will be able to be played with a really old SB VOC player.)
429419 */
430−int st_vocstartwrite(ft_t ft)
420+static int st_vocstartwrite(ft_t ft)
431421 {
432422 vs_t v = (vs_t) ft->priv;
433423
@@ -457,21 +447,21 @@ int st_vocstartwrite(ft_t ft) · 23 unmodified lines
457447 ft->info.encoding = ST_ENCODING_UNSIGNED;
458448 else
459449 ft->info.encoding = ST_ENCODING_SIGN2;
460− if (ft->info.channels == -1)
450+ if (ft->info.channels == 0)
461451 ft->info.channels = 1;
462452
463453 return(ST_SUCCESS);
464454 }
465455
466456 /*-----------------------------------------------------------------
467− * st_vocstartread() -- start reading a VOC file
457+ * st_vocwrite() -- write a VOC file
468458 *-----------------------------------------------------------------*/
469−st_ssize_t st_vocwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
459+static st_size_t st_vocwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
470460 {
471461 vs_t v = (vs_t) ft->priv;
472462 unsigned char uc;
473463 int16_t sw;
474− st_ssize_t done = 0;
464+ st_size_t done = 0;
475465
476466 if (v->samples == 0) {
477467 /* No silence packing yet. */
@@ -492,10 +482,40 @@ st_ssize_t st_vocwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 14 unmodified lines
492482 return done;
493483 }
494484
485+/*-----------------------------------------------------------------
486+ * blockstop() -- stop an output block
487+ * End the current data or silence block.
488+ *-----------------------------------------------------------------*/
489+static void blockstop(ft_t ft)
490+{
491+ vs_t v = (vs_t) ft->priv;
492+ st_sample_t datum;
493+
494+ st_writeb(ft, 0); /* End of file block code */
495+ st_seeki(ft, v->blockseek, 0); /* seek back to block length */
496+ st_seeki(ft, 1, 1); /* seek forward one */
497+ if (v->silent) {
498+ st_writew(ft, v->samples);
499+ } else {
500+ if (ft->info.size == ST_SIZE_BYTE) {
501+ if (ft->info.channels > 1) {
502+ st_seeki(ft, 8, 1); /* forward 7 + 1 for new block header */
503+ }
504+ }
505+ v->samples += 2; /* adjustment: SBDK pp. 3-5 */
506+ datum = (v->samples * ft->info.size) & 0xff;
507+ st_writeb(ft, (int)datum); /* low byte of length */
508+ datum = ((v->samples * ft->info.size) >> 8) & 0xff;
509+ st_writeb(ft, (int)datum); /* middle byte of length */
510+ datum = ((v->samples * ft->info.size)>> 16) & 0xff;
511+ st_writeb(ft, (int)datum); /* high byte of length */
512+ }
513+}
514+
495515 /*-----------------------------------------------------------------
496516 * st_vocstopwrite() -- stop writing a VOC file
497517 *-----------------------------------------------------------------*/
498−int st_vocstopwrite(ft_t ft)
518+static int st_vocstopwrite(ft_t ft)
499519 {
500520 blockstop(ft);
501521 return(ST_SUCCESS);
@@ -795,36 +815,6 @@ static void blockstart(ft_t ft) · 293 unmodified lines
795815 }
796816 }
797817
798−/*-----------------------------------------------------------------
799− * blockstop() -- stop an output block
800− * End the current data or silence block.
801− *-----------------------------------------------------------------*/
802−static void blockstop(ft_t ft)
803−{
804− vs_t v = (vs_t) ft->priv;
805− st_sample_t datum;
806−
807− st_writeb(ft, 0); /* End of file block code */
808− st_seeki(ft, v->blockseek, 0); /* seek back to block length */
809− st_seeki(ft, 1, 1); /* seek forward one */
810− if (v->silent) {
811− st_writew(ft, v->samples);
812− } else {
813− if (ft->info.size == ST_SIZE_BYTE) {
814− if (ft->info.channels > 1) {
815− st_seeki(ft, 8, 1); /* forward 7 + 1 for new block header */
816− }
817− }
818− v->samples += 2; /* adjustment: SBDK pp. 3-5 */
819− datum = (v->samples * ft->info.size) & 0xff;
820− st_writeb(ft, (int)datum); /* low byte of length */
821− datum = ((v->samples * ft->info.size) >> 8) & 0xff;
822− st_writeb(ft, (int)datum); /* middle byte of length */
823− datum = ((v->samples * ft->info.size)>> 16) & 0xff;
824− st_writeb(ft, (int)datum); /* high byte of length */
825− }
826−}
827−
828818 /* Sound Blaster .VOC */
829819 static const char *vocnames[] = {
830820 "voc",
@@ -837,7 +827,7 @@ static st_format_t st_voc_format = { · 6 unmodified lines
837827 ST_FILE_STEREO,
838828 st_vocstartread,
839829 st_vocread,
840− st_vocstopread,
830+ st_format_nothing,
841831 st_vocstartwrite,
842832 st_vocwrite,
843833 st_vocstopwrite,
src/vol.c+4−4
@@ -29,7 +29,7 @@ typedef struct { · 28 unmodified lines
2929 /*
3030 * Process options: gain (float) type (amplitude, power, dB)
3131 */
32−int st_vol_getopts(eff_t effp, int n, char **argv)
32+static int st_vol_getopts(eff_t effp, int n, char **argv)
3333 {
3434 vol_t vol = (vol_t) effp->priv;
3535 vol->gain = 1.0; /* default is no change */
@@ -90,7 +90,7 @@ int st_vol_getopts(eff_t effp, int n, char **argv) · 54 unmodified lines
9090 /*
9191 * Start processing
9292 */
93−int st_vol_start(eff_t effp)
93+static int st_vol_start(eff_t effp)
9494 {
9595 vol_t vol = (vol_t) effp->priv;
9696
@@ -116,7 +116,7 @@ int st_vol_start(eff_t effp) · 19 unmodified lines
116116 /*
117117 * Process data.
118118 */
119−int st_vol_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
119+static int st_vol_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf,
120120 st_size_t *isamp, st_size_t *osamp)
121121 {
122122 vol_t vol = (vol_t) effp->priv;
@@ -180,7 +180,7 @@ int st_vol_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, · 57 unmodified lines
180180 * Do anything required when you stop reading samples.
181181 * Don't close input file!
182182 */
183−int st_vol_stop(eff_t effp)
183+static int st_vol_stop(eff_t effp)
184184 {
185185 vol_t vol = (vol_t) effp->priv;
186186 if (vol->limited)
src/vorbis.c+13−13
@@ -66,7 +66,7 @@ typedef struct vorbisstuff { · 65 unmodified lines
6666 } *vorbis_t;
6767
6868 /******** Callback functions used in ov_open_callbacks ************/
69−int myclose (void *datasource)
69+static int myclose (void *datasource UNUSED)
7070 {
7171 /* Do nothing so sox can close the file for us */
7272 return 0;
@@ -89,7 +89,7 @@ static int _fseeko64_wrap(FILE *f, ogg_int64_t off, int whence) { · 16 unmodified lines
8989 * size and encoding of samples,
9090 * mono/stereo/quad.
9191 */
92−int st_vorbisstartread(ft_t ft)
92+static int st_vorbisstartread(ft_t ft)
9393 {
9494 vorbis_t vb = (vorbis_t) ft->priv;
9595 vorbis_info *vi;
@@ -195,7 +195,7 @@ int st_vorbisstartread(ft_t ft) · 99 unmodified lines
195195 /* Refill the buffer with samples. Returns BUF_EOF if the end of the
196196 vorbis data was reached while the buffer was being filled,
197197 BUF_ERROR is something bad happens, and BUF_DATA otherwise */
198−int refill_buffer (vorbis_t vb)
198+static int refill_buffer (vorbis_t vb)
199199 {
200200 int num_read;
201201
@@ -230,10 +230,10 @@ int refill_buffer (vorbis_t vb) · 28 unmodified lines
230230 * Return number of samples read.
231231 */
232232
233−st_ssize_t st_vorbisread(ft_t ft, st_sample_t *buf, st_size_t len)
233+static st_size_t st_vorbisread(ft_t ft, st_sample_t *buf, st_size_t len)
234234 {
235235 vorbis_t vb = (vorbis_t) ft->priv;
236− int i;
236+ st_size_t i;
237237 int ret;
238238 st_sample_t l;
239239
@@ -265,7 +265,7 @@ st_ssize_t st_vorbisread(ft_t ft, st_sample_t *buf, st_size_t len) · 25 unmodified lines
265265 * Do anything required when you stop reading samples.
266266 * Don't close input file!
267267 */
268−int st_vorbisstopread(ft_t ft)
268+static int st_vorbisstopread(ft_t ft)
269269 {
270270 vorbis_t vb = (vorbis_t) ft->priv;
271271
@@ -277,7 +277,7 @@ int st_vorbisstopread(ft_t ft) · 5 unmodified lines
277277
278278 /* Write a page of ogg data to a file. Taken directly from encode.c in
279279 oggenc. Returns the number of bytes written. */
280−int oe_write_page(ogg_page *page, ft_t ft)
280+static int oe_write_page(ogg_page *page, ft_t ft)
281281 {
282282 int written;
283283 written = st_writebuf(ft, page->header,1,page->header_len);
@@ -289,7 +289,7 @@ int oe_write_page(ogg_page *page, ft_t ft) · 5 unmodified lines
289289 /* Write out the header packets. Derived mostly from encode.c in
290290 oggenc. Returns HEADER_ERROR if the header cannot be written and
291291 HEADER_OK otherwise. */
292−int write_vorbis_header(ft_t ft, vorbis_enc_t *ve)
292+static int write_vorbis_header(ft_t ft, vorbis_enc_t *ve)
293293 {
294294 ogg_packet header_main;
295295 ogg_packet header_comments;
@@ -345,7 +345,7 @@ int write_vorbis_header(ft_t ft, vorbis_enc_t *ve) · 49 unmodified lines
345345 return HEADER_OK;
346346 }
347347
348−int st_vorbisstartwrite(ft_t ft)
348+static int st_vorbisstartwrite(ft_t ft)
349349 {
350350 vorbis_t vb = (vorbis_t) ft->priv;
351351 vorbis_enc_t *ve;
@@ -399,13 +399,13 @@ int st_vorbisstartwrite(ft_t ft) · 47 unmodified lines
399399 return(ST_SUCCESS);
400400 }
401401
402−st_ssize_t st_vorbiswrite(ft_t ft, const st_sample_t *buf, st_size_t len)
402+static st_size_t st_vorbiswrite(ft_t ft, const st_sample_t *buf, st_size_t len)
403403 {
404404 vorbis_t vb = (vorbis_t) ft->priv;
405405 vorbis_enc_t *ve = vb->vorbis_enc_data;
406− st_ssize_t samples = len / ft->info.channels;
406+ st_size_t samples = len / ft->info.channels;
407407 float **buffer = vorbis_analysis_buffer(&ve->vd, samples);
408− st_ssize_t i, j;
408+ st_size_t i, j;
409409 int ret;
410410 int eos = 0;
411411
@@ -450,7 +450,7 @@ st_ssize_t st_vorbiswrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 38 unmodified lines
450450 return (len);
451451 }
452452
453−int st_vorbisstopwrite(ft_t ft)
453+static int st_vorbisstopwrite(ft_t ft)
454454 {
455455 vorbis_t vb = (vorbis_t) ft->priv;
456456 vorbis_enc_t *ve = vb->vorbis_enc_data;
src/vox.c+26−50
@@ -26,10 +26,6 @@ · 25 unmodified lines
2626 * *
2727 ************************************************************************/
2828
29− ///////////////////////////////////////////
30− // ORIGINAL SOX COPYRIGHT AND DISCLAIMER //
31−///////////////////////////////////////////
32−
3329 /************************************************************************
3430 * July 5, 1991 *
3531 * *
@@ -43,30 +39,19 @@ · 7 unmodified lines
4339 * *
4440 ************************************************************************/
4541
46− ///////////////////
47− // INCLUDE FILES //
48−///////////////////
49−
5042 #include "st_i.h"
5143
52− //////////////
53− // TYPEDEFS //
54−//////////////
5544
56−typedef struct voxstuff { struct { short last; // ADPCM codec state
45+typedef struct voxstuff { struct { short last; /* ADPCM codec state */
5746 short index;
5847 } state;
5948
60− struct { uint8_t byte; // write store
49+ struct { uint8_t byte; /* write store */
6150 uint8_t flag;
6251 } store;
6352 } *vox_t;
6453
6554
66− ///////////////
67− // CONSTANTS //
68−///////////////
69−
7055 static short STEPSIZE[49] = { 16, 17, 19, 21, 23, 25, 28,
7156 31, 34, 37, 41, 45, 50, 55,
7257 60, 66, 73, 80, 88, 97, 107,
@@ -79,18 +64,10 @@ static short STEPSIZE[49] = { 16, 17, 19, 21, 23, 25, 28, · 6 unmodified lines
7964 static short STEPADJUST[8] = { -1,-1,-1,-1,2,4,6,8 };
8065
8166
82− /////////////////////////
83− // FUNCTION PROTOTYPES //
84−/////////////////////////
85−
8667 static uint8_t envox (short, vox_t);
8768 static short devox (uint8_t,vox_t);
8869
8970
90− ////////////////////
91− // IMPLEMENTATION //
92−////////////////////
93−
9471 /******************************************************************************
9572 * Function : st_voxstartread
9673 * Description: Initialises the file parameters and ADPCM codec state.
@@ -104,11 +81,11 @@ static short devox (uint8_t,vox_t); · 7 unmodified lines
10481 * rates but the codecs allows any user specified rate.
10582 ******************************************************************************/
10683
107−int st_voxstartread (ft_t ft)
84+static int st_voxstartread (ft_t ft)
10885 { vox_t state = (vox_t) ft->priv;
10986
11087
111− // ... setup file info
88+ /* ... setup file info */
11289
11390 ft->file.buf = (char *)malloc(ST_BUFSIZ);
11491
@@ -123,11 +100,11 @@ int st_voxstartread (ft_t ft) · 8 unmodified lines
123100 ft->file.pos = 0;
124101 ft->file.eof = 0;
125102
126− ft->info.size = ST_SIZE_WORD;
103+ ft->info.size = ST_SIZE_WORD;
127104 ft->info.encoding = ST_ENCODING_OKI_ADPCM;
128105 ft->info.channels = 1;
129106
130− // ... initialise CODEC state
107+ /* ... initialise CODEC state */
131108
132109 state->state.last = 0;
133110 state->state.index = 0;
@@ -151,22 +128,22 @@ int st_voxstartread (ft_t ft) · 17 unmodified lines
151128 * Notes :
152129 ******************************************************************************/
153130
154−st_ssize_t st_voxread (ft_t ft,st_sample_t *buffer,st_size_t length)
131+static st_size_t st_voxread (ft_t ft,st_sample_t *buffer,st_size_t length)
155132 { vox_t state = (vox_t) ft->priv;
156− int count = 0;
133+ int count = 0;
157134 int N;
158135 uint8_t byte;
159136 short word;
160137
161− // ... round length down to nearest even number
138+ /* ... round length down to nearest even number */
162139
163140 N = length/2;
164141 N *=2;
165142
166− // ... loop until buffer full or EOF
143+ /* ... loop until buffer full or EOF */
167144
168145 while (count < N)
169− { // ... refill buffer
146+ { /* ... refill buffer */
170147
171148 if (ft->file.pos >= ft->file.count)
172149 { ft->file.count = st_readbuf (ft,ft->file.buf,1,ft->file.size);
@@ -176,7 +153,7 @@ st_ssize_t st_voxread (ft_t ft,st_sample_t *buffer,st_size_t length) · 3 unmodified lines
176153 break;
177154 }
178155
179− // ... decode two nibbles stored as a byte
156+ /* ... decode two nybbles stored as a byte */
180157
181158 byte = ft->file.buf[ft->file.pos++];
182159
@@ -201,7 +178,7 @@ st_ssize_t st_voxread (ft_t ft,st_sample_t *buffer,st_size_t length) · 18 unmodified lines
201178 * Notes :
202179 ******************************************************************************/
203180
204−int st_voxstopread (ft_t ft)
181+static int st_voxstopread (ft_t ft)
205182 { free (ft->file.buf);
206183
207184 return (ST_SUCCESS);
@@ -221,11 +198,11 @@ int st_voxstopread (ft_t ft) · 13 unmodified lines
221198 * rates but the codecs allows any user specified rate.
222199 ******************************************************************************/
223200
224−int st_voxstartwrite (ft_t ft)
201+static int st_voxstartwrite (ft_t ft)
225202 { vox_t state = (vox_t) ft->priv;
226203
227204
228− // ... setup file info
205+ /* ... setup file info */
229206
230207 ft->file.buf = (char *)malloc(ST_BUFSIZ);
231208
@@ -244,7 +221,7 @@ int st_voxstartwrite (ft_t ft) · 12 unmodified lines
244221 ft->info.encoding = ST_ENCODING_OKI_ADPCM;
245222 ft->info.channels = 1;
246223
247− // ... initialise CODEC state
224+ /* ... initialise CODEC state */
248225
249226 state->state.last = 0;
250227 state->state.index = 0;
@@ -267,9 +244,9 @@ int st_voxstartwrite (ft_t ft) · 16 unmodified lines
267244 * Notes :
268245 ******************************************************************************/
269246
270−st_ssize_t st_voxwrite (ft_t ft,const st_sample_t *buffer,st_size_t length)
247+static st_size_t st_voxwrite (ft_t ft,const st_sample_t *buffer,st_size_t length)
271248 { vox_t state = (vox_t) ft->priv;
272− int count = 0;
249+ st_size_t count = 0;
273250 uint8_t byte = state->store.byte;
274251 uint8_t flag = state->store.flag;
275252 short word;
@@ -297,7 +274,7 @@ st_ssize_t st_voxwrite (ft_t ft,const st_sample_t *buffer,st_size_t length) · 21 unmodified lines
297274 count++;
298275 }
299276
300− // ... keep last byte across calls
277+ /* ... keep last byte across calls */
301278
302279 state->store.byte = byte;
303280 state->store.flag = flag;
@@ -315,12 +292,12 @@ st_ssize_t st_voxwrite (ft_t ft,const st_sample_t *buffer,st_size_t length) · 11 unmodified lines
315292 * Notes :
316293 ******************************************************************************/
317294
318−int st_voxstopwrite (ft_t ft)
295+static int st_voxstopwrite (ft_t ft)
319296 { vox_t state = (vox_t) ft->priv;
320297 uint8_t byte = state->store.byte;
321298 uint8_t flag = state->store.flag;
322299
323− // ... flush remaining samples
300+ /* ... flush remaining samples */
324301
325302 if (flag != 0)
326303 { byte <<= 4;
@@ -332,8 +309,6 @@ int st_voxstopwrite (ft_t ft) · 5 unmodified lines
332309 if (ft->file.count > 0)
333310 st_writebuf (ft,ft->file.buf,1,ft->file.count);
334311
335− // ... free buffer
336−
337312 free (ft->file.buf);
338313
339314 return (ST_SUCCESS);
@@ -377,7 +352,8 @@ static uint8_t envox (short sample,vox_t state) · 37 unmodified lines
377352 { code = code | 0x01;
378353 }
379354
380− // ... use decoder to set the estimate of last sample and adjust the step index
355+ /* ... use decoder to set the estimate of last sample and
356+ adjust the step index */
381357
382358 state->state.last = devox (code,state);
383359
@@ -418,7 +394,7 @@ static short devox (uint8_t code,vox_t state) · 34 unmodified lines
418394
419395 sample = state->state.last + dn;
420396
421− // ... clip to 12 bits
397+ /* ... clip to 12 bits */
422398
423399 if (sample > 2047)
424400 sample = 2047;
@@ -426,7 +402,7 @@ static short devox (uint8_t code,vox_t state) · 1 unmodified line
426402 if (sample < -2048)
427403 sample = -2048;
428404
429− // ... adjust step size
405+ /* ... adjust step size */
430406
431407 state->state.last = sample;
432408 state->state.index += STEPADJUST[code & 0x07];
@@ -437,7 +413,7 @@ static short devox (uint8_t code,vox_t state) · 4 unmodified lines
437413 if (state->state.index > 48)
438414 state->state.index = 48;
439415
440− // ... done
416+ /* ... done */
441417
442418 return (sample);
443419 }
src/wav.c+39−87
@@ -1,58 +1,10 @@
11 /*
22 * Microsoft's WAVE sound format driver
33 *
4− * This source code is freely redistributable and may be used for
5− * any purpose. This copyright notice must be maintained.
6− * Lance Norskog And Sundry Contributors are not responsible for
7− * the consequences of using this software.
8− *
9− * Change History:
10− *
11− * November 23, 1999 - Stan Brooks (stabro@megsinet.com)
12− * Merged in gsm support patches from Stuart Daines...
13− * Since we had simultaneously made similar changes in
14− * wavwritehdr() and wavstartread(), this was some
15− * work. Hopefully the result is cleaner than either
16− * version, and nothing broke.
17− *
18− * November 20, 1999 - Stan Brooks (stabro@megsinet.com)
19− * Mods for faster adpcm decoding and addition of IMA_ADPCM
20− * and ADPCM writing... low-level codex functions moved to
21− * external modules ima_rw.c and adpcm.c. Some general cleanup,
22− * consistent with writing adpcm and other output formats.
23− * Headers written for adpcm include the 'fact' subchunk.
24− *
25− * September 11, 1998 - Chris Bagwell (cbagwell@sprynet.com)
26− * Fixed length bug for IMA and MS ADPCM files.
27− *
28− * June 1, 1998 - Chris Bagwell (cbagwell@sprynet.com)
29− * Fixed some compiler warnings as reported by Kjetil Torgrim Homme
30− * <kjetilho@ifi.uio.no>.
31− * Fixed bug that caused crashes when reading mono MS ADPCM files. Patch
32− * was sent from Michael Brown (mjb@pootle.demon.co.uk).
33− *
34− * March 15, 1998 - Chris Bagwell (cbagwell@sprynet.com)
35− * Added support for Microsoft's ADPCM and IMA (or better known as
36− * DVI) ADPCM format for wav files. Thanks goes to Mark Podlipec's
37− * XAnim code. It gave some real life understanding of how the ADPCM
38− * format is processed. Actual code was implemented based off of
39− * various sources from the net.
40− *
41− * NOTE: Previous maintainers weren't very good at providing contact
42− * information.
43− *
44− * Copyright 1992 Rick Richardson
4+ * Copyright 1998-2006 Chris Bagwell and SoX Contributors
455 * Copyright 1991 Lance Norskog And Sundry Contributors
46− *
47− * Fixed by various contributors previous to 1998:
48− * 1) Little-endian handling
49− * 2) Skip other kinds of file data
50− * 3) Handle 16-bit formats correctly
51− * 4) Not go into infinite loop
52− *
53− * User options should override file header - we assumed user knows what
54− * they are doing if they specify options.
55− * Enhancements and clean up by Graeme W. Gill, 93/5/17
6+ * Copyright 1992 Rick Richardson
7+ * Copyright 1997 Graeme W. Gill, 93/5/17
568 *
579 * Info for format tags can be found at:
5810 * http://www.microsoft.com/asf/resources/draft-ietf-fleischman-codec-subtree-01.txt
@@ -122,7 +74,7 @@ static int wavwritehdr(ft_t, int); · 63 unmodified lines
12274 * ImaAdpcmReadBlock - Grab and decode complete block of samples
12375 *
12476 */
125−unsigned short ImaAdpcmReadBlock(ft_t ft)
77+static unsigned short ImaAdpcmReadBlock(ft_t ft)
12678 {
12779 wav_t wav = (wav_t) ft->priv;
12880 int bytesRead;
@@ -162,7 +114,7 @@ unsigned short ImaAdpcmReadBlock(ft_t ft) · 33 unmodified lines
162114 * AdpcmReadBlock - Grab and decode complete block of samples
163115 *
164116 */
165−unsigned short AdpcmReadBlock(ft_t ft)
117+static unsigned short AdpcmReadBlock(ft_t ft)
166118 {
167119 wav_t wav = (wav_t) ft->priv;
168120 int bytesRead;
@@ -211,7 +163,7 @@ static int xxxAdpcmWriteBlock(ft_t ft) · 42 unmodified lines
211163 for (p = wav->samplePtr; p < wav->sampleTop; p++) *p=0;
212164 /* compress the samples to wav->packet */
213165 if (wav->formatTag == WAVE_FORMAT_ADPCM) {
214− AdpcmBlockMashI(chans, wav->samples, wav->samplesPerBlock, wav->state, wav->packet, wav->blockAlign,9);
166+ AdpcmBlockMashI(chans, wav->samples, wav->samplesPerBlock, wav->state, wav->packet, wav->blockAlign);
215167 }else{ /* WAVE_FORMAT_IMA_ADPCM */
216168 ImaBlockMashI(chans, wav->samples, wav->samplesPerBlock, wav->state, wav->packet, 9);
217169 }
@@ -236,7 +188,7 @@ static int xxxAdpcmWriteBlock(ft_t ft) · 18 unmodified lines
236188 /* WAV GSM6.10 support functions */
237189 /****************************************************************************/
238190 /* create the gsm object, malloc buffer for 160*2 samples */
239−int wavgsminit(ft_t ft)
191+static int wavgsminit(ft_t ft)
240192 {
241193 int valueP=1;
242194 wav_t wav = (wav_t) ft->priv;
@@ -263,21 +215,21 @@ int wavgsminit(ft_t ft) · 20 unmodified lines
263215 }
264216
265217 /*destroy the gsm object and free the buffer */
266−void wavgsmdestroy(ft_t ft)
218+static void wavgsmdestroy(ft_t ft)
267219 {
268220 wav_t wav = (wav_t) ft->priv;
269221 gsm_destroy(wav->gsmhandle);
270222 free(wav->gsmsample);
271223 }
272224
273−st_ssize_t wavgsmread(ft_t ft, st_sample_t *buf, st_size_t len)
225+static st_size_t wavgsmread(ft_t ft, st_sample_t *buf, st_size_t len)
274226 {
275227 wav_t wav = (wav_t) ft->priv;
276− int done=0;
228+ size_t done=0;
277229 int bytes;
278230 gsm_byte frame[65];
279231
280− ft->st_errno = ST_SUCCESS;
232+ ft->st_errno = ST_SUCCESS;
281233
282234 /* copy out any samples left from the last call */
283235 while(wav->gsmindex && (wav->gsmindex<160*2) && (done < len))
@@ -338,13 +290,13 @@ static int wavgsmflush(ft_t ft) · 54 unmodified lines
338290 return (ST_SUCCESS);
339291 }
340292
341−st_ssize_t wavgsmwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
293+static st_size_t wavgsmwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
342294 {
343− wav_t wav = (wav_t) ft->priv;
344− int done = 0;
295+ wav_t wav = (wav_t) ft->priv;
296+ size_t done = 0;
345297 int rc;
346298
347− ft->st_errno = ST_SUCCESS;
299+ ft->st_errno = ST_SUCCESS;
348300
349301 while (done < len) {
350302 while ((wav->gsmindex < 160*2) && (done < len))
@@ -362,7 +314,7 @@ st_ssize_t wavgsmwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 11 unmodified lines
362314
363315 }
364316
365−void wavgsmstopwrite(ft_t ft)
317+static void wavgsmstopwrite(ft_t ft)
366318 {
367319 wav_t wav = (wav_t) ft->priv;
368320
@@ -425,7 +377,7 @@ static int findChunk(ft_t ft, const char *Label, st_size_t *len) · 56 unmodified lines
425377 * size and encoding of samples,
426378 * mono/stereo/quad.
427379 */
428−int st_wavstartread(ft_t ft)
380+static int st_wavstartread(ft_t ft)
429381 {
430382 wav_t wav = (wav_t) ft->priv;
431383 char magic[5];
@@ -537,7 +489,7 @@ int st_wavstartread(ft_t ft) · 105 unmodified lines
537489
538490 case WAVE_FORMAT_PCM:
539491 /* Default (-1) depends on sample size. Set that later on. */
540− if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_UNSIGNED &&
492+ if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_UNSIGNED &&
541493 ft->info.encoding != ST_ENCODING_SIGN2)
542494 st_report("User options overriding encoding read in .wav header");
543495
@@ -549,21 +501,21 @@ int st_wavstartread(ft_t ft) · 5 unmodified lines
549501 break;
550502
551503 case WAVE_FORMAT_IMA_ADPCM:
552− if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_IMA_ADPCM)
504+ if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_IMA_ADPCM)
553505 ft->info.encoding = ST_ENCODING_IMA_ADPCM;
554506 else
555507 st_report("User options overriding encoding read in .wav header");
556508 break;
557509
558510 case WAVE_FORMAT_ADPCM:
559− if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_ADPCM)
511+ if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_ADPCM)
560512 ft->info.encoding = ST_ENCODING_ADPCM;
561513 else
562514 st_report("User options overriding encoding read in .wav header");
563515 break;
564516
565517 case WAVE_FORMAT_IEEE_FLOAT:
566− if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_FLOAT)
518+ if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_FLOAT)
567519 ft->info.encoding = ST_ENCODING_FLOAT;
568520 else
569521 st_report("User options overriding encoding read in .wav header");
@@ -576,7 +528,7 @@ int st_wavstartread(ft_t ft) · 6 unmodified lines
576528 break;
577529
578530 case WAVE_FORMAT_ALAW:
579− if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_ALAW)
531+ if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_ALAW)
580532 ft->info.encoding = ST_ENCODING_ALAW;
581533 else
582534 st_report("User options overriding encoding read in .wav header");
@@ -589,7 +541,7 @@ int st_wavstartread(ft_t ft) · 6 unmodified lines
589541 break;
590542
591543 case WAVE_FORMAT_MULAW:
592− if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_ULAW)
544+ if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_ULAW)
593545 ft->info.encoding = ST_ENCODING_ULAW;
594546 else
595547 st_report("User options overriding encoding read in .wav header");
@@ -614,7 +566,7 @@ int st_wavstartread(ft_t ft) · 18 unmodified lines
614566 st_fail_errno(ft,ST_EHDR,"Sorry, this WAV file is in Dolby AC2 format.");
615567 return ST_EOF;
616568 case WAVE_FORMAT_GSM610:
617− if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_GSM )
569+ if (ft->info.encoding == ST_ENCODING_UNKNOWN || ft->info.encoding == ST_ENCODING_GSM )
618570 ft->info.encoding = ST_ENCODING_GSM;
619571 else
620572 st_report("User options overriding encoding read in .wav header");
@@ -648,7 +600,7 @@ int st_wavstartread(ft_t ft) · 27 unmodified lines
648600 }
649601
650602 /* User options take precedence */
651− if (ft->info.channels == -1 || ft->info.channels == wChannels)
603+ if (ft->info.channels == 0 || ft->info.channels == wChannels)
652604 ft->info.channels = wChannels;
653605 else
654606 st_report("User options overriding channels read in .wav header");
@@ -839,7 +791,7 @@ int st_wavstartread(ft_t ft) · 184 unmodified lines
839791 st_warn("User options overriding size read in .wav header");
840792
841793 /* Now we have enough information to set default encodings. */
842− if (ft->info.encoding == -1)
794+ if (ft->info.encoding == ST_ENCODING_UNKNOWN)
843795 ft->info.encoding = ST_ENCODING_UNSIGNED;
844796 break;
845797
@@ -850,7 +802,7 @@ int st_wavstartread(ft_t ft) · 4 unmodified lines
850802 st_warn("User options overriding size read in .wav header");
851803
852804 /* Now we have enough information to set default encodings. */
853− if (ft->info.encoding == -1)
805+ if (ft->info.encoding == ST_ENCODING_UNKNOWN)
854806 ft->info.encoding = ST_ENCODING_SIGN2;
855807 break;
856808
@@ -861,7 +813,7 @@ int st_wavstartread(ft_t ft) · 4 unmodified lines
861813 st_warn("User options overriding size read in .wav header");
862814
863815 /* Now we have enough information to set default encodings. */
864− if (ft->info.encoding == -1)
816+ if (ft->info.encoding == ST_ENCODING_UNKNOWN)
865817 ft->info.encoding = ST_ENCODING_SIGN2;
866818 break;
867819
@@ -872,7 +824,7 @@ int st_wavstartread(ft_t ft) · 4 unmodified lines
872824 st_warn("User options overriding size read in .wav header");
873825
874826 /* Now we have enough information to set default encodings. */
875− if (ft->info.encoding == -1)
827+ if (ft->info.encoding == ST_ENCODING_UNKNOWN)
876828 ft->info.encoding = ST_ENCODING_SIGN2;
877829 break;
878830
@@ -1078,10 +1030,10 @@ int st_wavstartread(ft_t ft) · 199 unmodified lines
10781030 * Return number of samples read.
10791031 */
10801032
1081−st_ssize_t st_wavread(ft_t ft, st_sample_t *buf, st_size_t len)
1033+static st_size_t st_wavread(ft_t ft, st_sample_t *buf, st_size_t len)
10821034 {
10831035 wav_t wav = (wav_t) ft->priv;
1084− st_ssize_t done;
1036+ st_size_t done;
10851037
10861038 ft->st_errno = ST_SUCCESS;
10871039
@@ -1116,7 +1068,7 @@ st_ssize_t st_wavread(ft_t ft, st_sample_t *buf, st_size_t len) · 28 unmodified lines
11161068 /* Copy interleaved data into buf, converting to st_sample_t */
11171069 {
11181070 short *p, *top;
1119− int ct;
1071+ size_t ct;
11201072 ct = len-done;
11211073 if (ct > (wav->blockSamplesRemaining*ft->info.channels))
11221074 ct = (wav->blockSamplesRemaining*ft->info.channels);
@@ -1186,7 +1138,7 @@ st_ssize_t st_wavread(ft_t ft, st_sample_t *buf, st_size_t len) · 63 unmodified lines
11861138 * Do anything required when you stop reading samples.
11871139 * Don't close input file!
11881140 */
1189−int st_wavstopread(ft_t ft)
1141+static int st_wavstopread(ft_t ft)
11901142 {
11911143 wav_t wav = (wav_t) ft->priv;
11921144 int rc = ST_SUCCESS;
@@ -1218,7 +1170,7 @@ int st_wavstopread(ft_t ft) · 25 unmodified lines
12181170 return rc;
12191171 }
12201172
1221−int st_wavstartwrite(ft_t ft)
1173+static int st_wavstartwrite(ft_t ft)
12221174 {
12231175 wav_t wav = (wav_t) ft->priv;
12241176 int rc;
@@ -1252,7 +1204,7 @@ int st_wavstartwrite(ft_t ft) · 27 unmodified lines
12521204 wav->iCoefs = NULL;
12531205 switch (wav->formatTag)
12541206 {
1255− int ch, sbsize;
1207+ size_t ch, sbsize;
12561208
12571209 case WAVE_FORMAT_IMA_ADPCM:
12581210 initImaTable();
@@ -1572,7 +1524,7 @@ static int wavwritehdr(ft_t ft, int second_header) · 313 unmodified lines
15721524
15731525 if (isExtensible)
15741526 {
1575− int i;
1527+ size_t i;
15761528 static const char guid[14] = "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71";
15771529 st_writew(ft, 22);
15781530 st_writew(ft, wBitsPerSample); /* No padding in container */
@@ -1640,7 +1592,7 @@ static int wavwritehdr(ft_t ft, int second_header) · 61 unmodified lines
16401592 return ST_SUCCESS;
16411593 }
16421594
1643−st_ssize_t st_wavwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
1595+static st_size_t st_wavwrite(ft_t ft, const st_sample_t *buf, st_size_t len)
16441596 {
16451597 wav_t wav = (wav_t) ft->priv;
16461598 st_ssize_t total_len = len;
@@ -1681,7 +1633,7 @@ st_ssize_t st_wavwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 34 unmodified lines
16811633 }
16821634 }
16831635
1684−int st_wavstopwrite(ft_t ft)
1636+static int st_wavstopwrite(ft_t ft)
16851637 {
16861638 wav_t wav = (wav_t) ft->priv;
16871639
@@ -1778,7 +1730,7 @@ static char *wav_format_str(unsigned wFormatTag) · 90 unmodified lines
17781730 }
17791731 }
17801732
1781−int st_wavseek(ft_t ft, st_size_t offset)
1733+static int st_wavseek(ft_t ft, st_size_t offset)
17821734 {
17831735 wav_t wav = (wav_t) ft->priv;
17841736 int new_offset, channel_block, alignment;
src/wve.c+7−7
@@ -25,7 +25,7 @@ typedef struct wvepriv · 24 unmodified lines
2525
2626 static void wvewriteheader(ft_t ft);
2727
28−int st_wveseek(ft_t ft, st_size_t offset)
28+static int st_wveseek(ft_t ft, st_size_t offset)
2929 {
3030 int new_offset, channel_block, alignment;
3131 wve_t wve = (wve_t ) ft->priv;
@@ -45,7 +45,7 @@ int st_wveseek(ft_t ft, st_size_t offset) · 13 unmodified lines
4545 return st_seeki(ft, offset, SEEK_SET);
4646 }
4747
48−int st_wvestartread(ft_t ft)
48+static int st_wvestartread(ft_t ft)
4949 {
5050 wve_t p = (wve_t ) ft->priv;
5151 char magic[16];
@@ -117,7 +117,7 @@ int st_wvestartread(ft_t ft) · 65 unmodified lines
117117 st_report("WVE must use 8000 sample rate. Overriding");
118118 ft->info.rate = 8000;
119119
120− if (ft->info.channels != -1 && ft->info.channels != 1)
120+ if (ft->info.channels != ST_ENCODING_UNKNOWN && ft->info.channels != 1)
121121 st_report("WVE must only supports 1 channel. Overriding");
122122 ft->info.channels = 1;
123123
@@ -136,7 +136,7 @@ int st_wvestartread(ft_t ft) · 12 unmodified lines
136136 if it is not, the unspecified size remains in the header
137137 (this is illegal). */
138138
139−int st_wvestartwrite(ft_t ft)
139+static int st_wvestartwrite(ft_t ft)
140140 {
141141 wve_t p = (wve_t ) ft->priv;
142142 int rc;
@@ -161,7 +161,7 @@ int st_wvestartwrite(ft_t ft) · 18 unmodified lines
161161 if (ft->info.rate != 0)
162162 st_report("WVE must use 8000 sample rate. Overriding");
163163
164− if (ft->info.channels != -1 && ft->info.channels != 1)
164+ if (ft->info.channels != 0 && ft->info.channels != 1)
165165 st_report("WVE must only supports 1 channel. Overriding");
166166
167167 ft->info.encoding = ST_ENCODING_ALAW;
@@ -172,14 +172,14 @@ int st_wvestartwrite(ft_t ft) · 4 unmodified lines
172172 return ST_SUCCESS;
173173 }
174174
175−st_ssize_t st_wvewrite(ft_t ft, const st_sample_t *buf, st_size_t samp)
175+static st_size_t st_wvewrite(ft_t ft, const st_sample_t *buf, st_size_t samp)
176176 {
177177 wve_t p = (wve_t ) ft->priv;
178178 p->length += samp * ft->info.size;
179179 return st_rawwrite(ft, buf, samp);
180180 }
181181
182−int st_wvestopwrite(ft_t ft)
182+static int st_wvestopwrite(ft_t ft)
183183 {
184184
185185 /* Call before seeking to flush buffer */
src/xa.c+4−6
@@ -141,7 +141,7 @@ static int st_xastartread(ft_t ft) · 140 unmodified lines
141141 st_report("User options overriding size read in .xa header");
142142 }
143143
144− if (ft->info.channels == -1 || ft->info.channels == xa->header.channels) {
144+ if (ft->info.channels == 0 || ft->info.channels == xa->header.channels) {
145145 ft->info.channels = xa->header.channels;
146146 } else {
147147 st_report("User options overriding channels read in .xa header");
@@ -210,14 +210,12 @@ static int st_xastartread(ft_t ft) · 62 unmodified lines
210210 * Read up to len samples from a file, converted to signed longs.
211211 * Return the number of samples read.
212212 */
213−static st_ssize_t st_xaread(ft_t ft, st_sample_t *buf, st_size_t len)
213+static st_size_t st_xaread(ft_t ft, st_sample_t *buf, st_size_t len)
214214 {
215215 xa_t xa = (xa_t) ft->priv;
216− st_ssize_t done;
217− st_ssize_t bytes;
218216 int32_t sample;
219217 unsigned char inByte;
220− unsigned int i;
218+ size_t i, done, bytes;
221219
222220 ft->st_errno = ST_SUCCESS;
223221 done = 0;
@@ -312,7 +310,7 @@ static int st_xastartwrite(ft_t ft) · 88 unmodified lines
312310 return ST_EOF;
313311 }
314312
315−static st_ssize_t st_xawrite(ft_t ft, const st_sample_t *buf, st_size_t len)
313+static st_size_t st_xawrite(ft_t ft, const st_sample_t *buf UNUSED, st_size_t len UNUSED)
316314 {
317315 st_fail_errno(ft, ST_ENOTSUP, ".XA writing not supported");
318316 return ST_EOF;

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