changeset 7590:0cba73469341

Fixing the fix buffer overrun should work now
author anders
date Thu, 03 Oct 2002 12:43:39 +0000
parents 443b440798a5
children 5ef4d009f950
files libaf/af.c libaf/af_channels.c
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af.c	Thu Oct 03 12:02:46 2002 +0000
+++ b/libaf/af.c	Thu Oct 03 12:43:39 2002 +0000
@@ -370,7 +370,7 @@
    needed */
 inline int af_lencalc(frac_t mul, af_data_t* d){
   register int t = d->bps*d->nch;
-  return t*(((d->len/t)*mul.n + 1)/mul.d);
+  return t*(((d->len/t)*mul.n)/mul.d + 1);
 }
 
 /* Calculate how long the output from the filters will be given the
--- a/libaf/af_channels.c	Thu Oct 03 12:02:46 2002 +0000
+++ b/libaf/af_channels.c	Thu Oct 03 12:43:39 2002 +0000
@@ -122,7 +122,7 @@
 
   // Reset unused channels if nch in < nch out
   if(af->mul.n > af->mul.d)
-    memset(l->audio,0,af_lencalc(af->mul, c));
+    memset(l->audio,0,(c->len*af->mul.n)/af->mul.d);
   
   // Special case always output L & R
   if(c->nch == 1){
@@ -143,7 +143,7 @@
   
   // Set output data
   c->audio = l->audio;
-  c->len   = af_lencalc(af->mul, c);
+  c->len   = (c->len*af->mul.n)/af->mul.d;
   c->nch   = l->nch;
 
   return c;