[FFmpeg-devel] [FFmpeg-cvslog] avcodec/pngdec: Fix () placement

Moritz Barsnick barsnick at gmx.net
Wed Sep 13 15:44:47 EEST 2017


On Wed, Aug 23, 2017 at 22:26:45 +0200, Alexander Strasser wrote:
> > -    if ((ret = decode_zbuf(&bp, s->gb.buffer, s->gb.buffer + length) < 0))
> > +    if ((ret = decode_zbuf(&bp, s->gb.buffer, s->gb.buffer + length)) < 0)
> 
> IMHO another reason not to do the assignment and the comparison on the same
> line inside the if-condition in C.
> 
> I mean you need the extra parens and if you are not careful enough you will 
> just get it silently wrong like it was above.
> 
> Probably we found enough of such errors to discourage that style in FFmpeg?

This also looks fishy:
./libavformat/mxfdec.c:2314:    if ((ret = avpriv_dict_set_timestamp(&s->metadata, name, mxf_timestamp_to_int64(var)) < 0)) \
(It's inside a macro.)

And this one went for overkill (i.e. it's correct, but uses one set too
many on its outside):
./libavdevice/avdevice.c:156:    if (((ret = av_opt_set_dict(s->priv_data, device_options)) < 0))

Moritz


More information about the ffmpeg-devel mailing list