[FFmpeg-devel] [PATCH 1/2] swresample/swresample: add av_warn_unused_result

Michael Niedermayer michael at niedermayer.cc
Fri Oct 30 11:13:59 CET 2015


On Thu, Oct 15, 2015 at 09:31:59PM -0400, Ganesh Ajjanagadde wrote:
> This will trigger a few warnings (e.g in avfilter) that need to be
> fixed.
> 
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libswresample/swresample.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/libswresample/swresample.h b/libswresample/swresample.h
> index 10eaebc..d21084f 100644
> --- a/libswresample/swresample.h
> +++ b/libswresample/swresample.h
> @@ -220,6 +220,7 @@ struct SwrContext *swr_alloc(void);
>   * @param[in,out]   s Swr context to initialize
>   * @return AVERROR error code in case of failure.
>   */
> +av_warn_unused_result
>  int swr_init(struct SwrContext *s);
>  
>  /**

> @@ -307,6 +308,7 @@ void swr_close(struct SwrContext *s);
>   *
>   * @return number of samples output per channel, negative value on error
>   */
> +av_warn_unused_result
>  int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
>                                  const uint8_t **in , int in_count);
>  

i dont think the user needs to check the return code for simple
sample format convertions for example


> @@ -354,6 +356,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
>   *            @li compensation unsupported by resampler, or
>   *            @li swr_init() fails when called.
>   */
> +av_warn_unused_result
>  int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance);
>  
>  /**
> @@ -364,6 +367,7 @@ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensatio
>   *                            indexes, -1 for a muted channel)
>   * @return >= 0 on success, or AVERROR error code in case of failure.
>   */
> +av_warn_unused_result
>  int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
>  
>  /**

> @@ -375,6 +379,7 @@ int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
>   * @param stride  offset between lines of the matrix
>   * @return  >= 0 on success, or AVERROR error code in case of failure.
>   */
> +av_warn_unused_result
>  int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride);

the only failure mode i see is EINVAL, so the user could know that
failure wont happen

its possible this applies to more functions

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- 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/20151030/235bbded/attachment.sig>


More information about the ffmpeg-devel mailing list