[FFmpeg-devel] [PATCH] avutil/pixdesc: add av_warn_unused_result to av_pix_fmt_get_chroma_sub_sample

Ganesh Ajjanagadde gajjanag at mit.edu
Thu Oct 29 04:03:33 CET 2015


On Fri, Oct 16, 2015 at 5:17 PM, Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
> On Fri, Oct 16, 2015 at 11:39 AM, Michael Niedermayer
> <michael at niedermayer.cc> wrote:
>> On Thu, Oct 15, 2015 at 07:20:30PM -0400, Ganesh Ajjanagadde wrote:
>>> This will trigger a bunch of warnings (rightfully so). This API has been
>>> abused, see the Doxygen comment above for what to do if the error code
>>> is not meant to be checked.
>>>
>>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>>> ---
>>>  libavutil/pixdesc.h | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
>>> index a6056fe..975fbf2 100644
>>> --- a/libavutil/pixdesc.h
>>> +++ b/libavutil/pixdesc.h
>>> @@ -297,6 +297,7 @@ enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc);
>>>   *
>>>   * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format
>>>   */
>>> +av_warn_unused_result
>>>  int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
>>>                                       int *h_shift, int *v_shift);
>>
>> if the caller knows the pixel format is valid (and non hw accel) then
>> there is no need to check the return code
>> in many cases this is true, like a decoder that set the pix_fmt itself
>> it can be sure all possible values are valid
>
> See the Doxygen right above (this is why I pointed to it in the commit
> message) - you are right, but for such "guaranteed safety" usage there
> is a different API in avcodec. It seems to have been created precisely
> for this purpose.

ping; you don't find the above reasoning satisfying?

>
>>
>> [...]
>> --
>> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> No human being will ever know the Truth, for even if they happen to say it
>> by chance, they would not even known they had done so. -- Xenophanes
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>


More information about the ffmpeg-devel mailing list