changeset 16307:03cd6abe5664

avoid reading more than maxlen bytes. Has the sideeffect that the amount read will be close to maxlen instead of minlen as before.
author reimar
date Thu, 25 Aug 2005 19:46:20 +0000
parents 7f88103a9710
children 41278ab73e9b
files libmpcodecs/ad_pcm.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_pcm.c	Thu Aug 25 18:22:12 2005 +0000
+++ b/libmpcodecs/ad_pcm.c	Thu Aug 25 19:46:20 2005 +0000
@@ -98,8 +98,8 @@
 
 static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
 {
-  int len=sh_audio->channels*sh_audio->samplesize-1;
-  len=(minlen+len)&(~len); // sample align
+  unsigned len = sh_audio->channels*sh_audio->samplesize;
+  len = maxlen - maxlen % len; // sample align
   len=demux_read_data(sh_audio->ds,buf,len);
   return len;
 }