[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec lzo.c, NONE, 1.1 lzo.h, NONE, 1.1 Makefile, 1.220, 1.221 cscd.c, 1.1, 1.2

Reimar at mplayerhq.hu Reimar
Fri Jan 13 08:43:31 CET 2006


Hi,
On Thu, Jan 12, 2006 at 06:55:30PM +0000, M?ns Rullg?rd wrote:
> >>     do {
> >>         *c->out++ = *c->in++;
> >>     } while (--cnt);
> >
> > somehow i feel that
> > while(--cnt >= 0){
> >     *c->out++ = *c->in++;
> > }
> >
> > would be safer ...

In principle yes, but this function is always called with cnt > 0. So if
anything at all, an assert(cnt > 0) at the beginning might make most sense.

> Or while(cnt-- > 0) ...
> or why not use memcpy?

Because there is another copy function where memcpy can't be used, and
like this these are more similar. Also it's often only a few bytes that
are copied.

Greetings,
Reimar D?ffinger





More information about the ffmpeg-cvslog mailing list