Re: [libav-devel] [PATCH] avplay: Rework variable initialization to avoid gcc warning
On 10/04/2012 07:14 PM, Måns Rullgård wrote: > Diego Biurrun writes: > >> On Thu, Oct 04, 2012 at 06:03:57PM +0100, Måns Rullgård wrote: >>> Diego Biurrun writes: On Thu, Oct 04, 2012 at 05:36:58PM +0100, Måns Rullgård wrote: > Diego Biurrun writes: > >> avplay.c:3015:20: warning: assignment discards ‘const’ qualifier from >> pointer target type >> --- a/avplay.c >> +++ b/avplay.c >> @@ -2959,6 +2959,7 @@ static void opt_input_file(void *optctx, const >> char *filename) >> int main(int argc, char **argv) >> { >> int flags; >> +char str_flush[] = "FLUSH"; >> >> @@ -3012,7 +3013,7 @@ int main(int argc, char **argv) >> >> av_init_packet(&flush_pkt); >> -flush_pkt.data = "FLUSH"; >> +flush_pkt.data = str_flush; > > Can't we kill whatever hack needs this abomination instead? I don't really care enough to dig deeper - >>> >>> You should. >> Explanations on how that works: you have a canary packet that is used to tell the thing there isn't anything more to decode, you could either: - use any constant pointer (e.g. the pointer to the struct) instead of a string - use a separate variable and refactor the whole thing so the queue_get returns a value when the queue is flushing. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avplay: Rework variable initialization to avoid gcc warning
Diego Biurrun writes: > On Thu, Oct 04, 2012 at 06:03:57PM +0100, Måns Rullgård wrote: >> Diego Biurrun writes: >> > On Thu, Oct 04, 2012 at 05:36:58PM +0100, Måns Rullgård wrote: >> >> Diego Biurrun writes: >> >> >> >> > avplay.c:3015:20: warning: assignment discards ‘const’ qualifier from >> >> > pointer target type >> >> > --- a/avplay.c >> >> > +++ b/avplay.c >> >> > @@ -2959,6 +2959,7 @@ static void opt_input_file(void *optctx, const >> >> > char *filename) >> >> > int main(int argc, char **argv) >> >> > { >> >> > int flags; >> >> > +char str_flush[] = "FLUSH"; >> >> > >> >> > @@ -3012,7 +3013,7 @@ int main(int argc, char **argv) >> >> > >> >> > av_init_packet(&flush_pkt); >> >> > -flush_pkt.data = "FLUSH"; >> >> > +flush_pkt.data = str_flush; >> >> >> >> Can't we kill whatever hack needs this abomination instead? >> > >> > I don't really care enough to dig deeper - >> >> You should. > > I dig deeper, refactor and beautify more code than anybody around here, > but I have to pick my battles. This shall not be one of them... This is one of the ones I'd support you in fighting. >> > the warning was very annoying; I shut it up... >> >> The code is still very annoying. > > Yes, but now we can at least get rid of the warning. So - can I shut > it up or not? You mean, can you sweep the horrors under the carpet. -- Måns Rullgård m...@mansr.com ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avplay: Rework variable initialization to avoid gcc warning
On Thu, Oct 04, 2012 at 06:03:57PM +0100, Måns Rullgård wrote: > Diego Biurrun writes: > > On Thu, Oct 04, 2012 at 05:36:58PM +0100, Måns Rullgård wrote: > >> Diego Biurrun writes: > >> > >> > avplay.c:3015:20: warning: assignment discards ‘const’ qualifier from > >> > pointer target type > >> > --- a/avplay.c > >> > +++ b/avplay.c > >> > @@ -2959,6 +2959,7 @@ static void opt_input_file(void *optctx, const > >> > char *filename) > >> > int main(int argc, char **argv) > >> > { > >> > int flags; > >> > +char str_flush[] = "FLUSH"; > >> > > >> > @@ -3012,7 +3013,7 @@ int main(int argc, char **argv) > >> > > >> > av_init_packet(&flush_pkt); > >> > -flush_pkt.data = "FLUSH"; > >> > +flush_pkt.data = str_flush; > >> > >> Can't we kill whatever hack needs this abomination instead? > > > > I don't really care enough to dig deeper - > > You should. I dig deeper, refactor and beautify more code than anybody around here, but I have to pick my battles. This shall not be one of them... > > the warning was very annoying; I shut it up... > > The code is still very annoying. Yes, but now we can at least get rid of the warning. So - can I shut it up or not? Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avplay: Rework variable initialization to avoid gcc warning
Diego Biurrun writes: > On Thu, Oct 04, 2012 at 05:36:58PM +0100, Måns Rullgård wrote: >> Diego Biurrun writes: >> >> > avplay.c:3015:20: warning: assignment discards ‘const’ qualifier from >> > pointer target type >> > --- a/avplay.c >> > +++ b/avplay.c >> > @@ -2959,6 +2959,7 @@ static void opt_input_file(void *optctx, const char >> > *filename) >> > int main(int argc, char **argv) >> > { >> > int flags; >> > +char str_flush[] = "FLUSH"; >> > >> > @@ -3012,7 +3013,7 @@ int main(int argc, char **argv) >> > >> > av_init_packet(&flush_pkt); >> > -flush_pkt.data = "FLUSH"; >> > +flush_pkt.data = str_flush; >> >> Can't we kill whatever hack needs this abomination instead? > > I don't really care enough to dig deeper - You should. > the warning was very annoying; I shut it up... The code is still very annoying. -- Måns Rullgård m...@mansr.com ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avplay: Rework variable initialization to avoid gcc warning
On Thu, Oct 04, 2012 at 05:36:58PM +0100, Måns Rullgård wrote: > Diego Biurrun writes: > > > avplay.c:3015:20: warning: assignment discards ‘const’ qualifier from > > pointer target type > > --- a/avplay.c > > +++ b/avplay.c > > @@ -2959,6 +2959,7 @@ static void opt_input_file(void *optctx, const char > > *filename) > > int main(int argc, char **argv) > > { > > int flags; > > +char str_flush[] = "FLUSH"; > > > > @@ -3012,7 +3013,7 @@ int main(int argc, char **argv) > > > > av_init_packet(&flush_pkt); > > -flush_pkt.data = "FLUSH"; > > +flush_pkt.data = str_flush; > > Can't we kill whatever hack needs this abomination instead? I don't really care enough to dig deeper - the warning was very annoying; I shut it up... Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avplay: Rework variable initialization to avoid gcc warning
Diego Biurrun writes: > avplay.c:3015:20: warning: assignment discards ‘const’ qualifier from pointer > target type > --- > avplay.c |3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/avplay.c b/avplay.c > index 5ba8155..cd8c386 100644 > --- a/avplay.c > +++ b/avplay.c > @@ -2959,6 +2959,7 @@ static void opt_input_file(void *optctx, const char > *filename) > int main(int argc, char **argv) > { > int flags; > +char str_flush[] = "FLUSH"; > > av_log_set_flags(AV_LOG_SKIP_REPEATED); > parse_loglevel(argc, argv, options); > @@ -3012,7 +3013,7 @@ int main(int argc, char **argv) > SDL_EventState(SDL_USEREVENT, SDL_IGNORE); > > av_init_packet(&flush_pkt); > -flush_pkt.data = "FLUSH"; > +flush_pkt.data = str_flush; Can't we kill whatever hack needs this abomination instead? -- Måns Rullgård m...@mansr.com ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] avplay: Rework variable initialization to avoid gcc warning
avplay.c:3015:20: warning: assignment discards ‘const’ qualifier from pointer target type --- avplay.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/avplay.c b/avplay.c index 5ba8155..cd8c386 100644 --- a/avplay.c +++ b/avplay.c @@ -2959,6 +2959,7 @@ static void opt_input_file(void *optctx, const char *filename) int main(int argc, char **argv) { int flags; +char str_flush[] = "FLUSH"; av_log_set_flags(AV_LOG_SKIP_REPEATED); parse_loglevel(argc, argv, options); @@ -3012,7 +3013,7 @@ int main(int argc, char **argv) SDL_EventState(SDL_USEREVENT, SDL_IGNORE); av_init_packet(&flush_pkt); -flush_pkt.data = "FLUSH"; +flush_pkt.data = str_flush; cur_stream = stream_open(input_filename, file_iformat); -- 1.7.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel