[FFmpeg-devel] [PATCH 5/5] Fix constness for the return value of av_stristr().
Mans Rullgard
mans
Sun Jun 13 15:43:26 CEST 2010
"Stefano Sabatini" <stefano.sabatini-lala at poste.it> wrote:
>On date Sunday 2010-06-13 11:29:35 +0100, M?ns Rullg?rd encoded:
>> Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:
>>
>> > Fix gcc warnings:
>> > avstring.c: In function `av_stristr':
>> > avstring.c:54: warning: return discards qualifiers from pointer target type
>> > avstring.c:58: warning: return discards qualifiers from pointer target type
>> > ---
>> > libavutil/avstring.c | 2 +-
>> > libavutil/avstring.h | 2 +-
>> > 2 files changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/libavutil/avstring.c b/libavutil/avstring.c
>> > index 4844e28..c9751da 100644
>> > --- a/libavutil/avstring.c
>> > +++ b/libavutil/avstring.c
>> > @@ -48,7 +48,7 @@ int av_stristart(const char *str, const char *pfx, const char **ptr)
>> > return !*pfx;
>> > }
>> >
>> > -char *av_stristr(const char *s1, const char *s2)
>> > +const char *av_stristr(const char *s1, const char *s2)
>>
>> This will introduce warnings in many places where the function is used
>> instead. There is no solution.
>
>Looks semantically more correct, the other warnings can be fixed using
>intermediate variables.
No, any const removal produces a warning. You have the choice of one warning in the function itself or (potentially) one each time it is used.
--
Mans Rullgard
mans at mansr.com
More information about the ffmpeg-devel
mailing list