shithub: sox

Download patch

ref: e32b9fd834d00654bf973fa435aa8dce624edf90
parent: d9e0910fc05fbb6382a2d5e2361b7271e98e8e84
author: rrt <rrt>
date: Mon Dec 11 22:14:15 EST 2006

Implement FIXME: make assertions about some parameters.

--- a/src/stretch.c
+++ b/src/stretch.c
@@ -23,6 +23,7 @@
 
 #include <stdlib.h> /* malloc and free */
 #include <string.h> /* memcpy() */
+#include <assert.h>
 
 static st_effect_t st_stretch_effect;
 
@@ -187,7 +188,7 @@
                                             sizeof(st_sample_t));
 
     /* the shift ratio deal with the longest of ishift/oshift
-       hence ishift<=size and oshift<=size. FIXME: should be asserted.
+       hence ishift<=size and oshift<=size.
      */
     if (stretch->factor < 1.0)
     {
@@ -199,6 +200,8 @@
         stretch->oshift = (int) (stretch->shift * stretch->size);
         stretch->ishift = (int) (stretch->oshift / stretch->factor);
     }
+    assert(stretch->ishift <= stretch->size);
+    assert(stretch->oshift <= stretch->size);
 
     stretch->oindex = stretch->index; /* start as synchronized */
     stretch->obuf = (double *)