Mercurial > audlegacy-plugins
changeset 2415:4fb714073ae4
fix for bug #150:
- avoid use of memcpy in these cases since memory area may overlap.
- do not perform memmove if it is not necessary.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Wed, 20 Feb 2008 02:57:59 +0900 |
parents | 7c0cee3d74d9 |
children | 372c4e0943ed |
files | src/madplug/decoder.c |
diffstat | 1 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/madplug/decoder.c Tue Feb 19 03:27:02 2008 -0600 +++ b/src/madplug/decoder.c Wed Feb 20 02:57:59 2008 +0900 @@ -115,15 +115,10 @@ while (1) { remainder = stream.bufend - stream.next_frame; - - /* - if (remainder >= BUFFER_SIZE) - { - printf("oh dear.. remainder = %d\n", remainder); - } - */ - memcpy(buffer, stream.this_frame, remainder); + if(buffer != stream.this_frame && remainder) + memmove(buffer, stream.this_frame, remainder); + len = input_get_data(info, buffer + remainder, BUFFER_SIZE - remainder); @@ -132,7 +127,7 @@ break; } - mad_stream_buffer(&stream, buffer, len + remainder); + mad_stream_buffer(&stream, buffer, remainder + len); while (!fast || (fast && info->frames < N_AVERAGE_FRAMES)) { if (mad_header_decode(&header, &stream) == -1) { @@ -393,12 +388,15 @@ AUDDBG("decode: stop signaled\n"); break; } + if (seek_skip) remainder = 0; else { remainder = stream.bufend - stream.next_frame; - memcpy(buffer, stream.this_frame, remainder); + if(buffer != stream.this_frame && remainder) + memmove(buffer, stream.this_frame, remainder); } + len = input_get_data(info, buffer + remainder, BUFFER_SIZE - remainder);