[FFmpeg-devel] [PATCH] avcodec/dvenc: silence -Wdiscarded-qualifiers
gajjanag at mit.edu
Sun Sep 20 15:09:49 CEST 2015
On Sun, Sep 20, 2015 at 6:00 AM, Clément Bœsch <u at pkh.me> wrote:
> On Sat, Sep 19, 2015 at 07:08:01PM -0400, Ganesh Ajjanagadde wrote:
>> s->frame is non-const, so this casts them explicitly.
>> This suppresses -Wdiscarded-qualifiers seen in e.g
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> libavcodec/dvenc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
>> index 5de12cc..0f4daa1 100644
>> --- a/libavcodec/dvenc.c
>> +++ b/libavcodec/dvenc.c
>> @@ -721,7 +721,7 @@ static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt,
>> return ret;
>> c->pix_fmt = s->sys->pix_fmt;
>> - s->frame = frame;
>> + s->frame = (AVFrame *) frame;
> Just a note here: I see you tend to like "(type *) var" style. I honestly
> don't mind that much, but keep in mind the common way is to stick the var
> to the cast (for various reasons such as consistency with most of the
> current code base but also because it makes more sense semantically as
> well as avoiding confusion with more complex expressions).
> Feel free to commit as is, I won't raise it again, I'm just trying to
> prevent an introduction of a more "distributed" code style.
No, I have created patchv2 - this is a very valid objection. You know
that I take consistency seriously and consider it a valid grounds for
improvement. On the other hand, there are instances of both throughout
the codebase. I personally do not consider patches whose sole purpose
it to bring them all to this style worthwhile, but will definitely
keep this in mind while working on other parts of the codebase.
As for (type *)var vs (type*)var, I really can't say. I personally
always used the type* in my own code, but FFmpeg (at least outside of
casts) seems to prefer
type * at least for declarations, things outside of casts, etc. For
things in casts, it is far too mixed to draw any conclusions. I hence
adopt (type *)var for patchv2.
> Clément B.
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
More information about the ffmpeg-devel