diff options
author | Michael Giacomelli <giac2000@hotmail.com> | 2009-06-30 22:37:05 +0000 |
---|---|---|
committer | Michael Giacomelli <giac2000@hotmail.com> | 2009-06-30 22:37:05 +0000 |
commit | bd70193e98e7d572dd5f7d374d5034b3d9c220d7 (patch) | |
tree | f5fe12f94158c6db7fb47f1108702fb7f4a8ed6f /apps/codecs/libtremor | |
parent | a538b89060bee76d5c6a078883748cac0a720ea7 (diff) |
Commit rest of fix in FS#9866. Don't parse Vorbis comments again in libtremor. It wastes memory and we already have the comments in memory. Looking at the spec and code, I think this fix is proper, but if it breaks any files this may need to be revisited.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21581 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libtremor')
-rw-r--r-- | apps/codecs/libtremor/info.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/apps/codecs/libtremor/info.c b/apps/codecs/libtremor/info.c index e96dd88b70..cb3860bbff 100644 --- a/apps/codecs/libtremor/info.c +++ b/apps/codecs/libtremor/info.c @@ -138,34 +138,11 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){ } static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){ - int i; int vendorlen=oggpack_read(opb,32); if(vendorlen<0)goto err_out; vc->vendor=(char *)_ogg_calloc(vendorlen+1,1); _v_readstring(opb,vc->vendor,vendorlen); - vc->comments=oggpack_read(opb,32); - if(vc->comments<0)goto err_out; - vc->user_comments=(char **)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments)); - vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths)); - - for(i=0;i<vc->comments;i++){ - int len=oggpack_read(opb,32); - if(len<0)goto err_out; - vc->comment_lengths[i]=len; - if(len>10000){ /*truncate long comments rather then seg faulting*/ - vc->user_comments[i]=(char *)_ogg_calloc(10001,1); - _v_readstring(opb,vc->user_comments[i],10000); - /*just to be neat, consumed and discard the rest of the comment*/ - len-=10000; - while(len--) - oggpack_read(opb,8); - }else{ - vc->user_comments[i]=(char *)_ogg_calloc(len+1,1); - _v_readstring(opb,vc->user_comments[i],len); - } - } - if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ - + vc->comments=0; return(0); err_out: vorbis_comment_clear(vc); |