[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

Måns Rullgård mru
Thu Jan 12 19:55:30 CET 2006


Michael Niedermayer <michaelni at gmx.at> writes:

> Hi
>
> On Thu, Jan 12, 2006 at 06:52:44PM +0100, Reimar D?ffinger CVS wrote:
> [...]
>> /**
>>  * \brief copy bytes from input to output buffer with checking
>>  * \param cnt number of bytes to copy, must be > 0
>>  */
>> static inline void copy(LZOContext *c, int cnt) {
>>     if (c->in + cnt > c->in_end) {
>>         cnt = c->in_end - c->in;
>>         c->error |= LZO_INPUT_DEPLETED;
>>     }
>>     if (c->out + cnt > c->out_end) {
>>         cnt = c->out_end - c->out;
>>         c->error |= LZO_OUTPUT_FULL;
>>     }
>>     do {
>>         *c->out++ = *c->in++;
>>     } while (--cnt);
>
> somehow i feel that
> while(--cnt >= 0){
>     *c->out++ = *c->in++;
> }
>
> would be safer ...

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

-- 
M?ns Rullg?rd
mru at inprovide.com





More information about the ffmpeg-cvslog mailing list