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

Michael Niedermayer michael at niedermayer.cc
Fri Oct 16 17:39:48 CEST 2015

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

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151016/036f722b/attachment.sig>

More information about the ffmpeg-devel mailing list