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

Måns Rullgård mans
Mon Jul 16 11:51:02 CEST 2007


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() ?

Yes, memmove() does the opposite of what is needed.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list