[FFmpeg-devel] [PATCH 01/10] zlib decoder

Reimar Doeffinger Reimar.Doeffinger
Mon Jul 16 11:02:33 CEST 2007


Hello,
On Mon, Jul 16, 2007 at 10:53:44AM +0200, Aurelien Jacobs wrote:
> On Mon, 16 Jul 2007 08:24:45 +0100
> M?ns Rullg?rd <mans at mansr.com> wrote:
> 
> > Vadim Lebedev <vadim at mbdsys.com> writes:
> > 
> > >>>>+static void
> > >>>>+copy_bytes(uint8_t *dst, uint8_t *src, unsigned int len)
> > >>>>+{
> > >>>>+    while (len--)
> > >>>>+        *dst++ = *src++;
> > >>>>+}
> > >>>>      
> > >>>i think we have such a copy routine somewhere already, but i dont remember
> > >>>where
> > >>
> > >>Reimar said it looked familiar too.  Wherever it is, it's not in a
> > >>central location.  Where would be the appropriate place for a function
> > >>like this?
> > >>
> > > Why don't you simply use memcpy in this case?
> > 
> > Because memcpy() has undefined behaviour if the source and destination
> > overlap.
> 
> Sure, but is there any reason why you can't use memmove() ?

See Mans, I told you to add a comment, nobody who hasn't written a
decompressor gets it...
This copy code can be used to generate a repeating pattern, memmove does
somebody else entirely.

Greetings,
Reimar Doeffinger




More information about the ffmpeg-devel mailing list