[FFmpeg-devel] [PATCH 2/2] movtextenc.c: Support for Bold, Italic and Underlined styles

wm4 nfxjfg at googlemail.com
Tue Jun 23 16:54:08 CEST 2015


On Tue, 23 Jun 2015 11:14:36 +0530
Niklesh Lalwani <niklesh.lalwani at iitb.ac.in> wrote:

> On 6/23/15, Philip Langdale <philipl at overt.org> wrote:
> > I got a bunch of warnings when I compiled it. Please fix.
> >
> > Thanks.
> >
> > ----------------------------------------------------------
> >
> > CC libavcodec/movtextenc.o
> > libavcodec/movtextenc.c: In function ‘mov_text_style_cb’:
> > libavcodec/movtextenc.c:124:17: warning: ‘return’ with a value, in
> > function returning void return AVERROR(ENOMEM);
> > ^
> > libavcodec/movtextenc.c:138:21: warning: ‘return’ with a value, in
> > function returning void return AVERROR(ENOMEM);
> > ^
> > libavcodec/movtextenc.c:167:13: warning: ‘return’ with a value, in
> > function returning void return AVERROR(ENOMEM);
> 
> The function mov_text_style_cb() is a void function, I'll make it int
> funciton to return a value.
> 
> > ^
> > libavcodec/movtextenc.c: In function ‘mov_text_encode_frame’:
> > libavcodec/movtextenc.c:242:47: warning: passing argument 2 of
> > ‘av_bprint_append_data’ from incompatible pointer type
> > av_bprint_append_data(&s->buffer, &s->tsmb_size, 4); ^
> > In file included from libavcodec/ass.h:26:0,
> > from libavcodec/movtextenc.c:30:
> > ./libavutil/bprint.h:146:6: note: expected ‘const char *’ but argument
> > is of type ‘uint32_t *’ void av_bprint_append_data(AVBPrint *buf, const
> > char *data, unsigned size); ^
> > libavcodec/movtextenc.c:243:47: warning: passing argument 2 of
> > ‘av_bprint_append_data’ from incompatible pointer type
> > av_bprint_append_data(&s->buffer, &s->tsmb_type, 4); ^
> > In file included from libavcodec/ass.h:26:0,
> > from libavcodec/movtextenc.c:30:
> > ./libavutil/bprint.h:146:6: note: expected ‘const char *’ but argument
> > is of type ‘uint32_t *’ void av_bprint_append_data(AVBPrint *buf, const
> > char *data, unsigned size); ^
> > libavcodec/movtextenc.c:244:47: warning: passing argument 2 of
> > ‘av_bprint_append_data’ from incompatible pointer type
> > av_bprint_append_data(&s->buffer, &s->style_entries, 2); ^
> > In file included from libavcodec/ass.h:26:0,
> > from libavcodec/movtextenc.c:30:
> > ./libavutil/bprint.h:146:6: note: expected ‘const char *’ but argument
> > is of type ‘uint16_t *’ void av_bprint_append_data(AVBPrint *buf, const
> > char *data, unsigned size); ^
> > libavcodec/movtextenc.c:246:51: warning: passing argument 2 of
> > ‘av_bprint_append_data’ from incompatible pointer type
> > av_bprint_append_data(&s->buffer, &s->style_attributes[j]->style_start,
> > 2); ^ In file included from libavcodec/ass.h:26:0,
> > from libavcodec/movtextenc.c:30:
> > ./libavutil/bprint.h:146:6: note: expected ‘const char *’ but argument
> > is of type ‘uint16_t *’ void av_bprint_append_data(AVBPrint *buf, const
> > char *data, unsigned size); ^
> > libavcodec/movtextenc.c:247:51: warning: passing argument 2 of
> > ‘av_bprint_append_data’ from incompatible pointer type
> > av_bprint_append_data(&s->buffer, &s->style_attributes[j]->style_end,
> > 2); ^ In file included from libavcodec/ass.h:26:0,
> > from libavcodec/movtextenc.c:30:
> > ./libavutil/bprint.h:146:6: note: expected ‘const char *’ but argument
> > is of type ‘uint16_t *’ void av_bprint_append_data(AVBPrint *buf, const
> > char *data, unsigned size); ^
> > libavcodec/movtextenc.c:248:51: warning: passing argument 2 of
> > ‘av_bprint_append_data’ from incompatible pointer type
> > av_bprint_append_data(&s->buffer, &s->style_fontID, 2); ^
> > In file included from libavcodec/ass.h:26:0,
> > from libavcodec/movtextenc.c:30:
> > ./libavutil/bprint.h:146:6: note: expected ‘const char *’ but argument
> > is of type ‘uint16_t *’ void av_bprint_append_data(AVBPrint *buf, const
> > char *data, unsigned size); ^
> > libavcodec/movtextenc.c:251:51: warning: passing argument 2 of
> > ‘av_bprint_append_data’ from incompatible pointer type
> > av_bprint_append_data(&s->buffer, &s->style_color, 4); ^
> > In file included from libavcodec/ass.h:26:0,
> > from libavcodec/movtextenc.c:30:
> > ./libavutil/bprint.h:146:6: note: expected ‘const char *’ but argument
> > is of type ‘uint32_t *’ void av_bprint_append_data(AVBPrint *buf, const
> > char *data, unsigned size); ^
> 
> As for these warnings, we discussed that they were fine as long as I am
> keeping check of alignment and placement into the buffer properly. Defining
> all these variables as char* would make the code lengthier and less clean.
> What do you suggest?

In my opinion these warnings should either be silenced, or an av_bprint
function taking void* should be added and used. While the warning is
indeed a false positive here, they can obscure interesting warnings.


More information about the ffmpeg-devel mailing list