shithub: sox

Download patch

ref: 91be46d3df5fd10ad8cb1cd815258e9bb762c2c0
parent: e353ebb0dfd92b61cd0bbd35fde44f0576bde9c4
author: robs <robs>
date: Sat Jan 13 11:32:08 EST 2007

Fix crash when specifying an empty comment;
plus a few clean-ups

--- a/sox.1
+++ b/sox.1
@@ -279,10 +279,10 @@
 SoX can be used in pipeline operations by using the special
 file-name `\-' which,
 if used in place of an input file-name, will cause
-SoX will read audio data from stdin,
+SoX will read audio data from `standard input' (stdin),
 and which,
 if used in place of the output file-name, will cause
-SoX will send audio data to stdout.
+SoX will send audio data to `standard output' (stdout).
 Note that when using this option, the file-type (see
 .B \-t
 below) must also be given.
@@ -565,6 +565,12 @@
 \fB\-\-comment \fItext\fR
 Specify the comment text to store in the output file header (where
 applicable).
+.SP
+SoX will provide a default comment if this option (or
+.BR \-\-comment\-file )
+is not given; to specify that no comment should be stored in the output file,
+use 
+.BR "\-\-comment \(dq\(dq" .
 .TP
 \fB\-\-comment\-file \fIfile-name\fR
 Specify a file containing the comment text to store in the output
--- a/src/8svx.c
+++ b/src/8svx.c
@@ -272,7 +272,7 @@
 
         while(done < len) {
                 for (i = 0; i < ft->signal.channels; i++) {
-                        datum = ST_SAMPLE_TO_SIGNED_BYTE(*buf++, ft->clippedCount);
+                        datum = ST_SAMPLE_TO_SIGNED_BYTE(*buf++, ft->clips);
                         /* FIXME: Needs to pass ft struct and not FILE */
                         putc(datum, p->ch[i]);
                 }
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -282,19 +282,19 @@
     return st_alsasetup(ft, SND_PCM_STREAM_CAPTURE);
 }
 
-static void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED)
+static void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clips UNUSED)
 {
     while (len--)
         *buf1++ = ST_UNSIGNED_BYTE_TO_SAMPLE(*((unsigned char *)buf2++),);
 }
 
-static void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED)
+static void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clips UNUSED)
 {
     while (len--)
         *buf1++ = ST_SIGNED_BYTE_TO_SAMPLE(*((int8_t *)buf2++),);
 }
 
-static void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED)
+static void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clips UNUSED)
 {
     while (len--)
     {
@@ -307,7 +307,7 @@
     }
 }
 
-static void st_sw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED)
+static void st_sw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clips UNUSED)
 {
     while (len--)
     {
@@ -381,7 +381,7 @@
         }
         else
         {
-            read_buf(buf+(len*sizeof(st_sample_t)), alsa->buf, err, ft->signal.reverse_bytes, &ft->clippedCount);
+            read_buf(buf+(len*sizeof(st_sample_t)), alsa->buf, err, ft->signal.reverse_bytes, &ft->clips);
             len += err * ft->signal.channels;
         }
     }
@@ -405,23 +405,23 @@
     return st_alsasetup(ft, SND_PCM_STREAM_PLAYBACK);
 }
 
-static void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount)
+static void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clips)
 {
     while (len--)
-        *(uint8_t *)buf1++ = ST_SAMPLE_TO_UNSIGNED_BYTE(*buf2++, *clippedCount);
+        *(uint8_t *)buf1++ = ST_SAMPLE_TO_UNSIGNED_BYTE(*buf2++, *clips);
 }
 
-static void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount)
+static void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clips)
 {
     while (len--)
-        *(int8_t *)buf1++ = ST_SAMPLE_TO_SIGNED_BYTE(*buf2++, *clippedCount);
+        *(int8_t *)buf1++ = ST_SAMPLE_TO_SIGNED_BYTE(*buf2++, *clips);
 }
 
-static void st_uw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
+static void st_uw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clips)
 {
     while (len--)
     {
-        uint16_t datum = ST_SAMPLE_TO_UNSIGNED_WORD(*buf2++, *clippedCount);
+        uint16_t datum = ST_SAMPLE_TO_UNSIGNED_WORD(*buf2++, *clips);
         if (swap)
             datum = st_swapw(datum);
         *(uint16_t *)buf1 = datum;
@@ -429,11 +429,11 @@
     }
 }
 
-static void st_sw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount)
+static void st_sw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clips)
 {
     while (len--)
     {
-        int16_t datum = ST_SAMPLE_TO_SIGNED_WORD(*buf2++, *clippedCount);
+        int16_t datum = ST_SAMPLE_TO_SIGNED_WORD(*buf2++, *clips);
         if (swap)
             datum = st_swapw(datum);
         *(int16_t *)buf1 = datum;
@@ -486,7 +486,7 @@
       st_size_t len;
       
       osamp = min(nsamp - done, alsa->buf_size / ft->signal.size);
-      write_buf(alsa->buf, buf, osamp, ft->signal.reverse_bytes, &ft->clippedCount);
+      write_buf(alsa->buf, buf, osamp, ft->signal.reverse_bytes, &ft->clips);
       buf += osamp;
 
       for (len = 0; len < osamp;) {
--- a/src/avg.c
+++ b/src/avg.c
@@ -527,7 +527,7 @@
             samp = 0.0;
             for (i = 0; i < ichan; i++)
                 samp += ibuf[i] * avg->sources[i][j];
-            ST_SAMPLE_CLIP_COUNT(samp, effp->clippedCount);
+            ST_SAMPLE_CLIP_COUNT(samp, effp->clips);
             obuf[j] = samp;
         }
     }
--- a/src/biquad.c
+++ b/src/biquad.c
@@ -77,7 +77,7 @@
     double o0 = *ibuf*p->b0 +p->i1*p->b1 +p->i2*p->b2 -p->o1*p->a1 -p->o2*p->a2;
     p->i2 = p->i1, p->i1 = *ibuf++;
     p->o2 = p->o1, p->o1 = o0;
-    *obuf++ = ST_ROUND_CLIP_COUNT(o0, effp->clippedCount);
+    *obuf++ = ST_ROUND_CLIP_COUNT(o0, effp->clips);
   }
   return ST_SUCCESS;
 }
--- a/src/btrworth.c
+++ b/src/btrworth.c
@@ -102,7 +102,7 @@
     butterworth->y [1] = butterworth->y [0];
     butterworth->y [0] = out;
 
-    ST_SAMPLE_CLIP_COUNT(out, effp->clippedCount);
+    ST_SAMPLE_CLIP_COUNT(out, effp->clips);
 
     *obuf++ = out;
   }
--- a/src/chorus.c
+++ b/src/chorus.c
@@ -265,7 +265,7 @@
                         chorus->maxsamples] * chorus->decay[i];
                 /* Adjust the output volume and size to 24 bit */
                 d_out = d_out * chorus->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 *obuf++ = out * 256;
                 /* Mix decay of delay and input */
                 chorus->chorusbuf[chorus->counter] = d_in;
@@ -302,7 +302,7 @@
                 chorus->maxsamples] * chorus->decay[i];
                 /* Adjust the output volume and size to 24 bit */
                 d_out = d_out * chorus->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 *obuf++ = out * 256;
                 /* Mix decay of delay and input */
                 chorus->chorusbuf[chorus->counter] = d_in;
--- a/src/compand.c
+++ b/src/compand.c
@@ -305,7 +305,7 @@
       if (l->delay_buf_size <= 0)
       {
         checkbuf = ibuf[chan]*(outv/v)*l->outgain;
-        ST_SAMPLE_CLIP_COUNT(checkbuf, effp->clippedCount);
+        ST_SAMPLE_CLIP_COUNT(checkbuf, effp->clips);
         obuf[odone] = checkbuf;
 
         idone++;
@@ -317,7 +317,7 @@
         {
             l->delay_buf_full=1; /* delay buffer is now definetly full */
             checkbuf = l->delay_buf[l->delay_buf_ptr]*(outv/v)*l->outgain;
-            ST_SAMPLE_CLIP_COUNT(checkbuf, effp->clippedCount);
+            ST_SAMPLE_CLIP_COUNT(checkbuf, effp->clips);
             obuf[odone] = checkbuf;
 
             odone++;
--- a/src/dat.c
+++ b/src/dat.c
@@ -115,7 +115,7 @@
           return (ST_EOF);
         }
         sampval *= ST_SAMPLE_MAX;
-        *buf++ = ST_ROUND_CLIP_COUNT(sampval, ft->clippedCount);
+        *buf++ = ST_ROUND_CLIP_COUNT(sampval, ft->clips);
         done++;
       }
     }
@@ -139,7 +139,7 @@
       sprintf(s," %15.8g ",dat->timevalue);
       st_writes(ft, s);
       for (i=0; i<ft->signal.channels; i++) {
-        sampval = ST_SAMPLE_TO_FLOAT_DDWORD(*buf++, ft->clippedCount);
+        sampval = ST_SAMPLE_TO_FLOAT_DDWORD(*buf++, ft->clips);
         sprintf(s," %15.8g", sampval);
         st_writes(ft, s);
         done++;
--- a/src/echo.c
+++ b/src/echo.c
@@ -203,7 +203,7 @@
                 }
                 /* Adjust the output volume and size to 24 bit */
                 d_out = d_out * echo->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 *obuf++ = out * 256;
                 /* Store input in delay buffer */
                 echo->delay_buf[echo->counter] = d_in;
@@ -237,7 +237,7 @@
                 }
                 /* Adjust the output volume and size to 24 bit */
                 d_out = d_out * echo->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 *obuf++ = out * 256;
                 /* Store input in delay buffer */
                 echo->delay_buf[echo->counter] = d_in;
--- a/src/echos.c
+++ b/src/echos.c
@@ -193,7 +193,7 @@
                 }
                 /* Adjust the output volume and size to 24 bit */
                 d_out = d_out * echos->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 *obuf++ = out * 256;
                 /* Mix decay of delays and input */
                 for ( j = 0; j < echos->num_delays; j++ ) {
@@ -233,7 +233,7 @@
                 }
                 /* Adjust the output volume and size to 24 bit */
                 d_out = d_out * echos->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 *obuf++ = out * 256;
                 /* Mix decay of delays and input */
                 for ( j = 0; j < echos->num_delays; j++ ) {
--- a/src/flac.c
+++ b/src/flac.c
@@ -425,9 +425,9 @@
   {
     switch (encoder->bits_per_sample)
     {
-      case  8: encoder->decoded_samples[i] = ST_SAMPLE_TO_SIGNED_BYTE(sampleBuffer[i], format->clippedCount); break;
-      case 16: encoder->decoded_samples[i] = ST_SAMPLE_TO_SIGNED_WORD(sampleBuffer[i], format->clippedCount); break;
-      case 24: encoder->decoded_samples[i] = ST_SAMPLE_TO_SIGNED_24BIT(sampleBuffer[i],format->clippedCount); break;
+      case  8: encoder->decoded_samples[i] = ST_SAMPLE_TO_SIGNED_BYTE(sampleBuffer[i], format->clips); break;
+      case 16: encoder->decoded_samples[i] = ST_SAMPLE_TO_SIGNED_WORD(sampleBuffer[i], format->clips); break;
+      case 24: encoder->decoded_samples[i] = ST_SAMPLE_TO_SIGNED_24BIT(sampleBuffer[i],format->clips); break;
       case 32: encoder->decoded_samples[i] = ST_SAMPLE_TO_SIGNED_DWORD(sampleBuffer[i],); break;
     }
   }
--- a/src/flanger.c
+++ b/src/flanger.c
@@ -268,7 +268,7 @@
 
       f->delay_last[c] = delayed;
       out = in * f->in_gain + delayed * f->delay_gain;
-      *obuf++ = ST_ROUND_CLIP_COUNT(out, effp->clippedCount);
+      *obuf++ = ST_ROUND_CLIP_COUNT(out, effp->clips);
     }
     f->lfo_pos = (f->lfo_pos + 1) % f->lfo_length;
   }
--- a/src/gsm.c
+++ b/src/gsm.c
@@ -192,7 +192,7 @@
         {
                 while ((p->samplePtr < p->sampleTop) && (done < samp))
                         *(p->samplePtr)++ = 
-                            ST_SAMPLE_TO_SIGNED_WORD(buf[done++], ft->clippedCount);
+                            ST_SAMPLE_TO_SIGNED_WORD(buf[done++], ft->clips);
 
                 if (p->samplePtr == p->sampleTop)
                 {
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -280,7 +280,7 @@
 
   for (i = 0; i < len; i++) {
     datum = *buf++;
-    p->data[p->pos++] = ST_SAMPLE_TO_UNSIGNED_BYTE(datum, ft->clippedCount);
+    p->data[p->pos++] = ST_SAMPLE_TO_UNSIGNED_BYTE(datum, ft->clips);
   }
 
   return len;
--- a/src/highp.c
+++ b/src/highp.c
@@ -115,7 +115,7 @@
                 d = highp->A0 * l + 
                     highp->A1 * highp->inm1 + 
                     highp->B1 * highp->outm1;
-                ST_SAMPLE_CLIP_COUNT(d, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(d, effp->clips);
                 highp->inm1 = l;
                 highp->outm1 = d;
                 *obuf++ = d;
--- a/src/lowp.c
+++ b/src/lowp.c
@@ -109,7 +109,7 @@
         for(done = 0; done < len; done++) {
                 l = *ibuf++;
                 d = lowp->A * l + lowp->B * lowp->outm1;
-                ST_SAMPLE_CLIP_COUNT(d, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(d, effp->clips);
                 lowp->outm1 = d;
                 *obuf++ = d;
         }
--- a/src/mask.c
+++ b/src/mask.c
@@ -58,7 +58,7 @@
   while (len--) {             /* 16 signed bits of triangular noise */
     int tri16 = ((rand() % 32768L) + (rand() % 32768L)) - 32767;
     double l = *ibuf++ + tri16 * mask->amount;
-    *obuf++ = ST_ROUND_CLIP_COUNT(l, effp->clippedCount);
+    *obuf++ = ST_ROUND_CLIP_COUNT(l, effp->clips);
   }
   return ST_SUCCESS;
 }
--- a/src/mcompand.c
+++ b/src/mcompand.c
@@ -160,7 +160,7 @@
       butterworth->xy_low[chan].y [1] = butterworth->xy_low[chan].y [0];
       butterworth->xy_low[chan].y [0] = out;
 
-      ST_SAMPLE_CLIP_COUNT(out, effp->clippedCount);
+      ST_SAMPLE_CLIP_COUNT(out, effp->clips);
 
       *lowbufptr = out;
 
@@ -176,7 +176,7 @@
       butterworth->xy_high[chan].y [1] = butterworth->xy_high[chan].y [0];
       butterworth->xy_high[chan].y [0] = out;
 
-      ST_SAMPLE_CLIP_COUNT(out, effp->clippedCount);
+      ST_SAMPLE_CLIP_COUNT(out, effp->clips);
 
       /* don't forget polarity reversal of high pass! */
 
@@ -577,7 +577,7 @@
     for (i=0;i<len;++i)
     {
       out = obuf[i] + abuf[i];
-      ST_SAMPLE_CLIP_COUNT(out, effp->clippedCount);
+      ST_SAMPLE_CLIP_COUNT(out, effp->clips);
       obuf[i] = out;
     }
     oldabuf = abuf;
@@ -602,7 +602,7 @@
    */
   for (done = 0;  done < maxdrain  &&  l->delay_buf_cnt > 0;  done++) {
     out = obuf[done] + l->delay_buf[l->delay_buf_ptr++];
-    ST_SAMPLE_CLIP_COUNT(out, effp->clippedCount);
+    ST_SAMPLE_CLIP_COUNT(out, effp->clips);
     obuf[done] = out;
     l->delay_buf_ptr %= c->delay_buf_size;
     l->delay_buf_cnt--;
--- a/src/misc.c
+++ b/src/misc.c
@@ -57,7 +57,7 @@
         "NONSENSE!",
 
         "u-law",
-        "a-law",
+        "A-law",
         "G72x-ADPCM",
         "MS-ADPCM",
         "IMA-ADPCM",
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -461,8 +461,8 @@
         j=0;
         for (i=0; i<nsamples; i++)
         {
-            buffer_l[i]=ST_SAMPLE_TO_SIGNED_WORD(buf[j++], ft->clippedCount);
-            buffer_r[i]=ST_SAMPLE_TO_SIGNED_WORD(buf[j++], ft->clippedCount);
+            buffer_l[i]=ST_SAMPLE_TO_SIGNED_WORD(buf[j++], ft->clips);
+            buffer_r[i]=ST_SAMPLE_TO_SIGNED_WORD(buf[j++], ft->clips);
         }
     }
     else
@@ -470,7 +470,7 @@
         j=0;
         for (i=0; i<nsamples; i++)
         {
-            buffer_l[i]=ST_SAMPLE_TO_SIGNED_WORD(buf[j++], ft->clippedCount); 
+            buffer_l[i]=ST_SAMPLE_TO_SIGNED_WORD(buf[j++], ft->clips); 
         }
     }
 
--- a/src/noiseprof.c
+++ b/src/noiseprof.c
@@ -127,7 +127,7 @@
         int j;
         for (j = 0; j < ncopy; j ++) {
             chan->window[j+data->bufdata] =
-                ST_SAMPLE_TO_FLOAT_DWORD(ibuf[i+j*tracks], effp->clippedCount);
+                ST_SAMPLE_TO_FLOAT_DWORD(ibuf[i+j*tracks], effp->clips);
         }
         if (ncopy + data->bufdata == WINDOWSIZE)
             collect_data(chan);
--- a/src/noisered.c
+++ b/src/noisered.c
@@ -220,7 +220,7 @@
         for (j = 0; j < use; j ++) {
             float s = chan->window[j] + chan->lastwindow[WINDOWSIZE/2 + j];
             obuf[chan_num + num_chans * j] =
-                ST_FLOAT_DWORD_TO_SAMPLE(s, effp->clippedCount);
+                ST_FLOAT_DWORD_TO_SAMPLE(s, effp->clips);
         }
         free(chan->lastwindow);
     } else {
@@ -227,7 +227,7 @@
         for (j = 0; j < use; j ++) {
             assert(chan->window[j] >= -1 && chan->window[j] <= 1);
             obuf[chan_num + num_chans * j] =
-                ST_FLOAT_DWORD_TO_SAMPLE(chan->window[j], effp->clippedCount);
+                ST_FLOAT_DWORD_TO_SAMPLE(chan->window[j], effp->clips);
         }
     }
     chan->lastwindow = chan->window;
@@ -268,7 +268,7 @@
         
         for (j = 0; j < ncopy; j ++)
             chan->window[oldbuf + j] =
-                ST_SAMPLE_TO_FLOAT_DWORD(ibuf[i + tracks * j], effp->clippedCount);
+                ST_SAMPLE_TO_FLOAT_DWORD(ibuf[i + tracks * j], effp->clips);
 
         if (!whole_window)
             continue;
--- a/src/pan.c
+++ b/src/pan.c
@@ -112,7 +112,7 @@
             {
                 double f;
                 f = 0.5*ibuf_copy[0] + 0.5*ibuf_copy[1];
-                ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                 *obuf++ = f;
                 ibuf_copy += 2;
             }
@@ -123,7 +123,7 @@
                 double f;
                 f = 0.25*ibuf_copy[0] + 0.25*ibuf_copy[1] + 
                         0.25*ibuf_copy[2] + 0.25*ibuf_copy[3];
-                ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                 *obuf++ = f;
                 ibuf_copy += 4;
             }
@@ -141,10 +141,10 @@
                 double f;
 
                 f = left * ibuf_copy[0];
-                ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                 obuf[0] = f;
                 f = right * ibuf_copy[0];
-                ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                 obuf[1] = f;
                 obuf += 2;
                 ibuf_copy++;
@@ -167,10 +167,10 @@
                     double f;
 
                     f = cll * ibuf_copy[0] + clr * ibuf_copy[1];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[0] = f;
                     f = cr * ibuf_copy[1];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[1] = f;
                     obuf += 2;
                     ibuf_copy += 2;
@@ -190,10 +190,10 @@
                     double f;
 
                     f = cl * ibuf_copy[0];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[0] = f;
                     f = crl * ibuf_copy[0] + crr * ibuf_copy[1];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[1] = f;
                     obuf += 2;
                     ibuf_copy += 2;
@@ -220,10 +220,10 @@
 
                     /* pan it */
                     f = cll * ibuf0 + clr * ibuf1;
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[0] = f;
                     f = cr * ibuf1;
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[1] = f;
                     obuf += 2;
                     ibuf_copy += 4;
@@ -246,10 +246,10 @@
                     ibuf1 = 0.5*ibuf_copy[1] + 0.5*ibuf_copy[3];
 
                     f = cl * ibuf0;
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[0] = f;
                     f = crl * ibuf0 + crr * ibuf1;
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[1] = f;
                     obuf += 2;
                     ibuf_copy += 4;
@@ -275,10 +275,10 @@
                     double f;
 
                     f = cl * ibuf_copy[0];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[2] = obuf[0] = f;
                     f = cr * ibuf_copy[0];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     ibuf_copy[3] = obuf[1] = f;
                     obuf += 4;
                     ibuf_copy++;
@@ -300,10 +300,10 @@
                     double f;
 
                     f = cll * ibuf_copy[0] + clr * ibuf_copy[1];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[2] = obuf[0] = f;
                     f = cr * ibuf_copy[1];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     ibuf_copy[3] = obuf[1] = f;
                     obuf += 4;
                     ibuf_copy += 2;
@@ -323,10 +323,10 @@
                     double f;
 
                     f = cl * ibuf_copy[0];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[2] = obuf[0] =f ;
                     f = crl * ibuf_copy[0] + crr * ibuf_copy[1];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     ibuf_copy[3] = obuf[1] = f;
                     obuf += 4;
                     ibuf_copy += 2;
@@ -349,16 +349,16 @@
                     double f;
 
                     f = cown*ibuf_copy[0] + cright*ibuf_copy[1];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[0] = f;
                     f = cown*ibuf_copy[1] + cright*ibuf_copy[3];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[1] = f;
                     f = cown*ibuf_copy[2] + cright*ibuf_copy[0];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[2] = f;
                     f = cown*ibuf_copy[3] + cright*ibuf_copy[2];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[3] = f;
                     obuf += 4;
                     ibuf_copy += 4;              
@@ -376,16 +376,16 @@
                     double f;
 
                     f = cleft*ibuf_copy[2] + cown*ibuf_copy[0];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[0] = f;
                     f = cleft*ibuf_copy[0] + cown*ibuf_copy[1];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[1] = f;
                     f = cleft*ibuf_copy[3] + cown*ibuf_copy[2];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[2] = f;
                     f = cleft*ibuf_copy[1] + cown*ibuf_copy[3];
-                    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                     obuf[3] = f;
                     obuf += 4;
                     ibuf_copy += 4;
--- a/src/phaser.c
+++ b/src/phaser.c
@@ -199,7 +199,7 @@
         phaser->maxsamples] * phaser->decay * -1.0;
                 /* Adjust the output volume and size to 24 bit */
                 d_out = d_in * phaser->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 *obuf++ = out * 256;
                 /* Mix decay of delay and input */
                 phaser->phaserbuf[phaser->counter] = d_in;
@@ -232,7 +232,7 @@
         phaser->maxsamples] * phaser->decay * -1.0;
                 /* Adjust the output volume and size to 24 bit */
                 d_out = d_in * phaser->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 *obuf++ = out * 256;
                 /* Mix decay of delay and input */
                 phaser->phaserbuf[phaser->counter] = d_in;
--- a/src/pitch.c
+++ b/src/pitch.c
@@ -489,7 +489,7 @@
                 float f;
 
                 f = pitch->acc[pitch->iacc++];
-                ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(f, effp->clips);
                 obuf[oindex++] = f;
             }
 
@@ -542,7 +542,7 @@
         float f;
 
         f = pitch->acc[pitch->iacc++];
-        ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+        ST_SAMPLE_CLIP_COUNT(f, effp->clips);
         obuf[i++] = f;
     }
 
--- a/src/polyphas.c
+++ b/src/polyphas.c
@@ -590,7 +590,7 @@
     {
         float f;
         f = out_buf[k] * ISCALE; /* should clip-limit */
-        ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+        ST_SAMPLE_CLIP_COUNT(f, effp->clips);
         *q++ = f;
     }
 
--- a/src/rabbit.c
+++ b/src/rabbit.c
@@ -85,8 +85,12 @@
 static int st_rabbit_start(eff_t effp)
 {
   rabbit_t r = (rabbit_t) effp->priv;
+
+  /* The next line makes the "speed" effect accurate; it's needed because
+   * ininfo.rate (st_rate_t) isn't floating point (but it's probably not worth
+   * changing st_rate_t just because of this): */
   double in_rate = floor(effp->ininfo.rate / effp->globalinfo->speed + .5)
-    * effp->globalinfo->speed; /* FIXME: Make "speed" more accurate (st_rate_t is int) */
+    * effp->globalinfo->speed;
 
   if (effp->ininfo.channels != effp->outinfo.channels) {
     st_fail("number of Input and Output channels must be equal to use rabbit effect");
@@ -120,7 +124,7 @@
   r->data->data_in = (float *)xrealloc(r->data->data_in, newsamples * sizeof(float));
 
   for (i = 0 ; i < *isamp; i++)
-    r->data->data_in[r->samples + i] = ST_SAMPLE_TO_FLOAT_DWORD(ibuf[i], effp->clippedCount);
+    r->data->data_in[r->samples + i] = ST_SAMPLE_TO_FLOAT_DWORD(ibuf[i], effp->clips);
 
   r->samples = newsamples;
   r->data->input_frames = r->samples / channels;
@@ -168,7 +172,7 @@
 
   outsamps = min(r->data->output_frames_gen * channels - r->outsamp, *osamp);
   for (i = 0; i < outsamps; i++)
-    obuf[i] = ST_FLOAT_DWORD_TO_SAMPLE(r->data->data_out[r->outsamp + i], effp->clippedCount);
+    obuf[i] = ST_FLOAT_DWORD_TO_SAMPLE(r->data->data_out[r->outsamp + i], effp->clips);
   *osamp = (st_size_t)outsamps;
   r->outsamp += outsamps;
 
--- a/src/raw.c
+++ b/src/raw.c
@@ -104,7 +104,7 @@
       int ret = st_read ## size(ft, (uctype *)&datum); \
       if (ret != ST_SUCCESS) \
         break; \
-      *buf++ = ST_ ## cast ## _TO_SAMPLE(datum, ft->clippedCount); \
+      *buf++ = ST_ ## cast ## _TO_SAMPLE(datum, ft->clips); \
     } \
     return n; \
   }
@@ -128,7 +128,7 @@
   { \
     st_size_t n; \
     for (n = 0; n < len; n++) { \
-      int ret = st_write ## size(ft, ST_SAMPLE_TO_ ## cast(*buf++, ft->clippedCount)); \
+      int ret = st_write ## size(ft, ST_SAMPLE_TO_ ## cast(*buf++, ft->clips)); \
       if (ret != ST_SUCCESS) \
         break; \
     } \
--- a/src/resample.c
+++ b/src/resample.c
@@ -194,80 +194,83 @@
  */
 int st_resample_start(eff_t effp)
 {
-        resample_t r = (resample_t) effp->priv;
-        long Xoff, gcdrate;
-        int i;
-        double in_rate = floor(effp->ininfo.rate / effp->globalinfo->speed + .5)
-          * effp->globalinfo->speed;/* Make "speed" more accurate (st_rate_t is int)*/
+  resample_t r = (resample_t) effp->priv;
+  long Xoff, gcdrate;
+  int i;
 
-        r->Factor = (double)effp->outinfo.rate / in_rate;
+  /* The next line makes the "speed" effect accurate; it's needed because
+   * ininfo.rate (st_rate_t) isn't floating point (but it's probably not worth
+   * changing st_rate_t just because of this): */
+  double in_rate = floor(effp->ininfo.rate / effp->globalinfo->speed + .5)
+    * effp->globalinfo->speed;
 
-        gcdrate = st_gcd((long)effp->ininfo.rate, (long)effp->outinfo.rate);
-        r->a = effp->ininfo.rate / gcdrate;
-        r->b = effp->outinfo.rate / gcdrate;
+  r->Factor = (double) effp->outinfo.rate / in_rate;
 
-        if (r->a <= r->b && r->b <= NQMAX) {
-                r->quadr = -1; /* exact coeffs */
-                r->Nq = r->b;  /* max(r->a,r->b) */
-        } else
-                r->Nq = Nc; /* for now */
+  gcdrate = st_gcd((long) effp->ininfo.rate, (long) effp->outinfo.rate);
+  r->a = effp->ininfo.rate / gcdrate;
+  r->b = effp->outinfo.rate / gcdrate;
 
-        /* Nwing: # of filter coeffs in right wing */
-        r->Nwing = r->Nq * (r->Nmult/2+1) + 1;
+  if (r->a <= r->b && r->b <= NQMAX) {
+    r->quadr = -1;      /* exact coeffs */
+    r->Nq = r->b;       /* max(r->a,r->b) */
+  } else
+    r->Nq = Nc; /* for now */
 
-        r->Imp = (double *)xmalloc(sizeof(double) * (r->Nwing+2)) + 1;
-        /* need Imp[-1] and Imp[Nwing] for quadratic interpolation */
-        /* returns error # <=0, or adjusted wing-len > 0 */
-        i = makeFilter(r->Imp, r->Nwing, r->rolloff, r->beta, r->Nq, 1);
-        if (i <= 0)
-        {
-                st_fail("resample: Unable to make filter");
-                return (ST_EOF);
-        }
+  /* Nwing: # of filter coeffs in right wing */
+  r->Nwing = r->Nq * (r->Nmult / 2 + 1) + 1;
 
-        st_debug("Nmult: %ld, Nwing: %ld, Nq: %ld",r->Nmult,r->Nwing,r->Nq);
+  r->Imp = (double *) xmalloc(sizeof(double) * (r->Nwing + 2)) + 1;
+  /* need Imp[-1] and Imp[Nwing] for quadratic interpolation */
+  /* returns error # <=0, or adjusted wing-len > 0 */
+  i = makeFilter(r->Imp, r->Nwing, r->rolloff, r->beta, r->Nq, 1);
+  if (i <= 0) {
+    st_fail("resample: Unable to make filter");
+    return (ST_EOF);
+  }
 
-        if (r->quadr < 0) { /* exact coeff's method */
-                r->Xh = r->Nwing/r->b;
-          st_debug("resample: rate ratio %ld:%ld, coeff interpolation not needed", r->a, r->b);
-        } else {
-          r->dhb = Np;  /* Fixed-point Filter sampling-time-increment */
-          if (r->Factor<1.0) r->dhb = r->Factor*Np + 0.5;
-          r->Xh = (r->Nwing<<La)/r->dhb;
-          /* (Xh * dhb)>>La is max index into Imp[] */
-        }
+  st_debug("Nmult: %ld, Nwing: %ld, Nq: %ld", r->Nmult, r->Nwing, r->Nq);
 
-        /* reach of LP filter wings + some creeping room */
-        Xoff = r->Xh + 10;
-        r->Xoff = Xoff;
+  if (r->quadr < 0) {     /* exact coeff's method */
+    r->Xh = r->Nwing / r->b;
+    st_debug("resample: rate ratio %ld:%ld, coeff interpolation not needed", r->a, r->b);
+  } else {
+    r->dhb = Np;        /* Fixed-point Filter sampling-time-increment */
+    if (r->Factor < 1.0)
+      r->dhb = r->Factor * Np + 0.5;
+    r->Xh = (r->Nwing << La) / r->dhb;
+    /* (Xh * dhb)>>La is max index into Imp[] */
+  }
 
-        /* Current "now"-sample pointer for input to filter */
-        r->Xp = Xoff;
-        /* Position in input array to read into */
-        r->Xread = Xoff;
-        /* Current-time pointer for converter */
-        r->Time = Xoff;
-        if (r->quadr < 0) { /* exact coeff's method */
-                r->t = Xoff*r->Nq;
-        }
-        i = BUFFSIZE - 2*Xoff;
-        if (i < r->Factor + 1.0/r->Factor)      /* Check input buffer size */
-        {
-                st_fail("Factor is too small or large for BUFFSIZE");
-                return (ST_EOF);
-        }
-        
-        r->Xsize = 2*Xoff + i/(1.0+r->Factor);
-        r->Ysize = BUFFSIZE - r->Xsize;
-        st_debug("Xsize %d, Ysize %d, Xoff %d",r->Xsize,r->Ysize,r->Xoff);
+  /* reach of LP filter wings + some creeping room */
+  Xoff = r->Xh + 10;
+  r->Xoff = Xoff;
 
-        r->X = (double *) xmalloc(sizeof(double) * (BUFFSIZE));
-        r->Y = r->X + r->Xsize;
+  /* Current "now"-sample pointer for input to filter */
+  r->Xp = Xoff;
+  /* Position in input array to read into */
+  r->Xread = Xoff;
+  /* Current-time pointer for converter */
+  r->Time = Xoff;
+  if (r->quadr < 0) {     /* exact coeff's method */
+    r->t = Xoff * r->Nq;
+  }
+  i = BUFFSIZE - 2 * Xoff;
+  if (i < r->Factor + 1.0 / r->Factor) {  /* Check input buffer size */
+    st_fail("Factor is too small or large for BUFFSIZE");
+    return (ST_EOF);
+  }
 
-        /* Need Xoff zeros at beginning of sample */
-        for (i=0; i<Xoff; i++)
-                r->X[i] = 0;
-        return (ST_SUCCESS);
+  r->Xsize = 2 * Xoff + i / (1.0 + r->Factor);
+  r->Ysize = BUFFSIZE - r->Xsize;
+  st_debug("Xsize %d, Ysize %d, Xoff %d", r->Xsize, r->Ysize, r->Xoff);
+
+  r->X = (double *) xmalloc(sizeof(double) * (BUFFSIZE));
+  r->Y = r->X + r->Xsize;
+
+  /* Need Xoff zeros at beginning of sample */
+  for (i = 0; i < Xoff; i++)
+    r->X[i] = 0;
+  return (ST_SUCCESS);
 }
 
 /*
@@ -365,7 +368,7 @@
         for(i=0; i < Nout; i++) { 
                 double ftemp = r->Y[i] * ISCALE;
 
-                ST_SAMPLE_CLIP_COUNT(ftemp, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(ftemp, effp->clips);
                 *obuf++ = ftemp;
         }
 
--- a/src/reverb.c
+++ b/src/reverb.c
@@ -224,7 +224,7 @@
                         d_in +=
 reverb->reverbbuf[(i + reverb->maxsamples - reverb->samples[j]) % reverb->maxsamples] * reverb->decay[j];
                 d_out = d_in * reverb->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 *obuf++ = out * 256;
                 reverb->reverbbuf[i] = d_in;
                 i++;            /* XXX need a % maxsamples here ? */
@@ -256,10 +256,10 @@
                         d_in += 
 reverb->reverbbuf[(i + reverb->maxsamples - reverb->samples[j]) % reverb->maxsamples] * reverb->decay[j];
                 d_out = d_in * reverb->out_gain;
-                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clippedCount);
+                out = ST_24BIT_CLIP_COUNT((st_sample_t) d_out, effp->clips);
                 obuf[done++] = out * 256;
                 reverb->reverbbuf[i] = d_in;
-                l = ST_24BIT_CLIP_COUNT((st_sample_t) d_in, effp->clippedCount);
+                l = ST_24BIT_CLIP_COUNT((st_sample_t) d_in, effp->clips);
                 reverb->pppl = reverb->ppl;
                 reverb->ppl = reverb->pl;
                 reverb->pl = l;
--- a/src/skelform.c
+++ b/src/skelform.c
@@ -172,7 +172,7 @@
     switch (ft->signal.encoding) {
     case ST_ENCODING_UNSIGNED:
       while (len--) {
-        len = st_writeb(ft, ST_SAMPLE_TO_UNSIGNED_BYTE(*buf++, ft->clippedCount));
+        len = st_writeb(ft, ST_SAMPLE_TO_UNSIGNED_BYTE(*buf++, ft->clips));
         if (len == 0)
           break;
       }
--- a/src/smp.c
+++ b/src/smp.c
@@ -374,7 +374,7 @@
         st_size_t done = 0;
 
         while(done < len) {
-                datum = (int) ST_SAMPLE_TO_SIGNED_WORD(*buf++, ft->clippedCount);
+                datum = (int) ST_SAMPLE_TO_SIGNED_WORD(*buf++, ft->clips);
                 st_writew(ft, datum);
                 smp->NoOfSamps++;
                 done++;
--- a/src/sox.c
+++ b/src/sox.c
@@ -271,7 +271,7 @@
       if (fi->filetype != NULL && strcmp(fi->filetype, "null") != 0)
         st_warn("Ignoring \"-t %s\".", fi->filetype);
       fi->filetype = "null";
-      fi->filename = xstrdup(fi->filetype);
+      fi->filename = xstrdup("--");
     } else {
       if (optind >= argc || is_effect_name(argv[optind])) {
         if (memcmp(fi, &fi_none, sizeof(fi_none)) != 0) /* fopts but no file */
@@ -641,8 +641,13 @@
 static void report_file(ft_t f)
 {
   static char const * const no_yes[] = {"no", "yes"};
+  char const * type =
+    (strcmp(f->filename, "-") == 0 ||
+     strcmp(f->filename, "--") == 0 ||
+          f->h->flags & ST_FILE_NOFEXT)? 
+          f->h->names[0] : "\b ";
 
-  st_report("\n\n%s: %s\n"
+  st_report("\n\n%s: \"%s\" (%s%c\n"
     "Sample Size    : %s\n"
     "Sample Encoding: %s\n"
     "Channels       : %u\n"
@@ -651,8 +656,8 @@
     "Reverse Nibbles: %s\n"
     "Reverse Bits   : %s\n"
     "Comment        : \"%s%c\n", /* Deliberate \n to get blank line */
-    f->mode == 'r'? "Input Filename " : "Output Filename",
-    f->filename, 
+    f->mode == 'r'? "Input File     " : "Output File    ",
+    f->filename, type, *type == '\b'? ' ' : ')',
     st_sizes_str[(unsigned char)f->signal.size],
     st_encodings_str[(unsigned char)f->signal.encoding],
     f->signal.channels,
@@ -707,13 +712,10 @@
     if (info->signal.channels == 0)
       info->signal.channels = file_desc[0]->signal.channels;
     
-    if (info->comment != NULL) {
-      if (*info->comment == '\0')
-        free(info->comment);
-      else
-        comment = info->comment;
-    } else
+    if (info->comment == NULL)
       comment = file_desc[0]->comment ? file_desc[0]->comment : "Processed by SoX";
+    else if (*info->comment != '\0')
+        comment = info->comment;
     
     /*
      * copy loop info, resizing appropriately
@@ -965,15 +967,15 @@
   stop_effects();
 
   for (f = 0; f < input_count; f++)
-    if (file_desc[f]->clippedCount != 0)
+    if (file_desc[f]->clips != 0)
       st_warn("%s: input clipped %u samples", file_desc[f]->filename,
-              file_desc[f]->clippedCount);
+              file_desc[f]->clips);
 
-  if (file_desc[f]->clippedCount != 0)
+  if (file_desc[f]->clips != 0)
     st_warn("%s: output clipped %u samples; decrease volume?",
             (file_desc[f]->h->flags & ST_FILE_NOFEXT)?
             file_desc[f]->h->names[0] : file_desc[f]->filename,
-            file_desc[f]->clippedCount);
+            file_desc[f]->clips);
 }
   
 static void parse_effects(int argc, char **argv)
@@ -1180,11 +1182,11 @@
   int e, ret = ST_SUCCESS;
 
   for (e = 1; e < neffects; e++) {
-    efftab[e].clippedCount = 0;
+    efftab[e].clips = 0;
     if ((ret = (*efftab[e].h->start)(&efftab[e])) == ST_EOF)
       break;
     if (efftabR[e].name) {
-      efftabR[e].clippedCount = 0;
+      efftabR[e].clips = 0;
       if ((ret = (*efftabR[e].h->start)(&efftabR[e])) != ST_SUCCESS)
         break;
     }
@@ -1514,18 +1516,18 @@
   int e;
 
   for (e = 1; e < neffects; e++) {
-    st_size_t clippedCount;
+    st_size_t clips;
     (*efftab[e].h->stop)(&efftab[e]);
-    clippedCount = efftab[e].clippedCount;
+    clips = efftab[e].clips;
     (*efftab[e].h->delete)(&efftab[e]);
     if (efftabR[e].name) {
       (*efftabR[e].h->stop)(&efftabR[e]);
-      clippedCount += efftab[e].clippedCount;
+      clips += efftab[e].clips;
       (*efftabR[e].h->delete)(&efftabR[e]);
     }
-    if (clippedCount != 0)
+    if (clips != 0)
       st_warn("%s clipped %u samples; decrease volume?", efftab[e].name,
-              clippedCount);
+              clips);
   }
 }
 
--- a/src/st.h
+++ b/src/st.h
@@ -288,7 +288,7 @@
 } st_format_t;
 
 struct st_soundstream {
-    st_signalinfo_t signal;                 /* signal specifications */
+    st_signalinfo_t signal;               /* signal specifications */
     st_instrinfo_t  instr;                /* instrument specification */
     st_loopinfo_t   loops[ST_MAX_NLOOPS]; /* Looping specification */
     char            seekable;             /* can seek on this file */
@@ -295,7 +295,7 @@
     char            mode;                 /* read or write mode */
     /* Total samples per channel of file.  Zero if unknown. */
     st_size_t       length;    
-    st_size_t       clippedCount;         /* increment if clipping occurs */
+    st_size_t       clips;                /* increment if clipping occurs */
     char            *filename;            /* file name */
     char            *filetype;            /* type of file */
     char            *comment;             /* comment string */
@@ -305,7 +305,7 @@
     char            st_errstr[256];       /* Extend Failure text */
     const st_format_t *h;                 /* format struct for this file */
     /* The following is a portable trick to align this variable on
-     * an 8-byte bounder.  Once this is done, the buffer alloced
+     * an 8-byte boundery.  Once this is done, the buffer alloced
      * after it should be align on an 8-byte boundery as well.
      * This lets you cast any structure over the private area
      * without concerns of alignment.
@@ -321,7 +321,7 @@
 #define ST_FILE_SEEK    8  /* does file format support seeking? */
 #define ST_FILE_NOSTDIO 16 /* does not use stdio routines */
 #define ST_FILE_NOFEXT  32 /* does not use file extensions */
-/* These two for use by SoX: */
+/* These two for use by stlib clients: */
 #define ST_FILE_ENDIAN  64 /* is file format endian? */
 #define ST_FILE_ENDBIG  128/* if so, is it big endian? */
 /* These two for use within stlib: */
@@ -380,7 +380,7 @@
     const st_effect_t *h;           /* effects driver */
     st_sample_t     *obuf;          /* output buffer */
     st_size_t       odone, olen;    /* consumed, total length */
-    st_size_t       clippedCount;   /* increment if clipping occurs */
+    st_size_t       clips;   /* increment if clipping occurs */
     /* The following is a portable trick to align this variable on
      * an 8-byte boundary.  Once this is done, the buffer alloced
      * after it should be align on an 8-byte boundery as well.
--- a/src/stat.c
+++ b/src/stat.c
@@ -144,7 +144,7 @@
 
   if (stat->fft) {
     for (x = 0; x < len; x++) {
-      stat->re_in[stat->fft_offset++] = ST_SAMPLE_TO_FLOAT_DWORD(ibuf[x], effp->clippedCount);
+      stat->re_in[stat->fft_offset++] = ST_SAMPLE_TO_FLOAT_DWORD(ibuf[x], effp->clips);
 
       if (stat->fft_offset >= stat->fft_size) {
         stat->fft_offset = 0;
--- a/src/stretch.c
+++ b/src/stretch.c
@@ -277,7 +277,7 @@
       while (stretch->oindex < stretch->oshift && oindex < *osamp) {
         float f;
         f = stretch->obuf[stretch->oindex++];
-        ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+        ST_SAMPLE_CLIP_COUNT(f, effp->clips);
         obuf[oindex++] = f;
       }
 
@@ -325,7 +325,7 @@
   
   while (oindex<*osamp && stretch->oindex<stretch->index) {
     float f = stretch->obuf[stretch->oindex++];
-    ST_SAMPLE_CLIP_COUNT(f, effp->clippedCount);
+    ST_SAMPLE_CLIP_COUNT(f, effp->clips);
     obuf[oindex++] = f;
   }
     
--- a/src/tests.sh
+++ b/src/tests.sh
@@ -1,12 +1,12 @@
 #!/bin/sh
 #
-# SoX Regression Test script.
+# SoX Regression Test script: Lossless file conversion
 #
-# This script is just a quick sanity check of SoX on lossless format conversions.
 # TODO sndt sph
 
-# verbose options
+# Options:
 #verbose=-V
+#all=all
 
 getFormat () {
   formatText=$1; formatFlags=""
@@ -105,14 +105,18 @@
 do_multichannel_formats
 
 channels=2 
-do_multichannel_formats
+if [ "$all" = "all" ]; then
+  do_multichannel_formats
+fi
 do_twochannel_formats
 format1=cdda         # 2-channel only
 convertToAndFrom sw u3 aiff
 
 channels=1 
-do_multichannel_formats
-do_twochannel_formats
+if [ "$all" = "all" ]; then
+  do_multichannel_formats
+  do_twochannel_formats
+fi
 do_singlechannel_formats
 
 ./sox -c 1 -- output.ub synth .01 vol .5
--- a/src/voc.c
+++ b/src/voc.c
@@ -456,10 +456,10 @@
         v->samples += len;
         while(done < len) {
           if (ft->signal.size == ST_SIZE_BYTE) {
-            uc = ST_SAMPLE_TO_UNSIGNED_BYTE(*buf++, ft->clippedCount);
+            uc = ST_SAMPLE_TO_UNSIGNED_BYTE(*buf++, ft->clips);
             st_writeb(ft, uc);
           } else {
-            sw = (int) ST_SAMPLE_TO_SIGNED_WORD(*buf++, ft->clippedCount);
+            sw = (int) ST_SAMPLE_TO_SIGNED_WORD(*buf++, ft->clips);
             st_writew(ft,sw);
           }
           done++;
--- a/src/vol.c
+++ b/src/vol.c
@@ -155,7 +155,7 @@
                 } else
                         sample = gain * sample;
 
-                ST_SAMPLE_CLIP_COUNT(sample, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(sample, effp->clips);
                *obuf++ = sample;
             }
     }
@@ -165,7 +165,7 @@
         for (;len>0; len--)
         {
                 sample = gain * *ibuf++;
-                ST_SAMPLE_CLIP_COUNT(sample, effp->clippedCount);
+                ST_SAMPLE_CLIP_COUNT(sample, effp->clips);
                 *obuf++ = sample;
         }
     }
--- a/src/vox.c
+++ b/src/vox.c
@@ -117,10 +117,10 @@
 
   for (n = 0; n < (len&~1) && st_readb(ft, &byte) == ST_SUCCESS; n += 2) {
     short word = adpcm_decode(byte >> 4, &state->encoder);
-    *buffer++ = ST_SIGNED_WORD_TO_SAMPLE(word, ft->clippedCount);
+    *buffer++ = ST_SIGNED_WORD_TO_SAMPLE(word, ft->clips);
 
     word = adpcm_decode(byte, &state->encoder);
-    *buffer++ = ST_SIGNED_WORD_TO_SAMPLE(word, ft->clippedCount);
+    *buffer++ = ST_SIGNED_WORD_TO_SAMPLE(word, ft->clips);
   }
   return n;
 }
@@ -166,7 +166,7 @@
   short word;
 
   while (count < length) {
-    word = ST_SAMPLE_TO_SIGNED_WORD(*buffer++, ft->clippedCount);
+    word = ST_SAMPLE_TO_SIGNED_WORD(*buffer++, ft->clips);
 
     byte <<= 4;
     byte |= adpcm_encode(word, &state->encoder) & 0x0F;
--- a/src/wav.c
+++ b/src/wav.c
@@ -297,7 +297,7 @@
     while (done < len) {
         while ((wav->gsmindex < 160*2) && (done < len))
             wav->gsmsample[(wav->gsmindex)++] = 
-                ST_SAMPLE_TO_SIGNED_WORD(buf[done++], ft->clippedCount);
+                ST_SAMPLE_TO_SIGNED_WORD(buf[done++], ft->clips);
 
         if (wav->gsmindex < 160*2)
             break;
--- a/src/xmalloc.c
+++ b/src/xmalloc.c
@@ -64,8 +64,12 @@
  */
 char *xstrdup(const char *s)
 {
-  char *t = strdup(s);
+  char * t;
 
+  if (s == NULL)
+    return NULL;
+
+  t = strdup(s);
   if (t == NULL) {
     st_fail("out of memory");
     exit(2);