[MPlayer-dev-eng] [PATCH] Use memmove when source and destination can overlap
Tobias Diedrich
ranma at tdiedrich.de
Wed Mar 9 19:53:15 CET 2011
Use memmove when source and destination can overlap.
glibc behaviour recently changed:
http://lwn.net/Articles/414467/
Maybe we should an assert to fast_memcpy when compiled with debugging enabled?
Index: mplayer-patchset1/mencoder.c
===================================================================
--- mplayer-patchset1.orig/mencoder.c 2011-02-18 20:13:39.814308000 +0100
+++ mplayer-patchset1/mencoder.c 2011-02-18 20:20:09.247520000 +0100
@@ -308,7 +308,7 @@
fast_memcpy(buffer+size,sh_audio->a_out_buffer,len);
sh_audio->a_out_buffer_len-=len; size+=len;
if(sh_audio->a_out_buffer_len>0)
- fast_memcpy(sh_audio->a_out_buffer,&sh_audio->a_out_buffer[len],sh_audio->a_out_buffer_len);
+ memmove(sh_audio->a_out_buffer,&sh_audio->a_out_buffer[len],sh_audio->a_out_buffer_len);
}
return size;
}
@@ -1400,7 +1400,7 @@
mux_a->wf->nAvgBytesPerSec=0.5f+(double)mux_a->size/a_muxer_time; // avg bps (VBR)
if(mux_a->buffer_len>=len){
mux_a->buffer_len-=len;
- fast_memcpy(mux_a->buffer,mux_a->buffer+len,mux_a->buffer_len);
+ memmove(mux_a->buffer,mux_a->buffer+len,mux_a->buffer_len);
}
More information about the MPlayer-dev-eng
mailing list