[FFmpeg-devel] [PATCHv2 2/2] avfilter/formats: add av_warn_unused_result to function prototypes

Ganesh Ajjanagadde gajjanagadde at gmail.com
Sat Oct 10 15:21:36 CEST 2015


This uses the av_warn_unused_result attribute liberally to catch some forms of improper
usage of functions defined in avfilter/formats.h.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavfilter/formats.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavfilter/formats.h b/libavfilter/formats.h
index 5a8ee5e..7259afb 100644
--- a/libavfilter/formats.h
+++ b/libavfilter/formats.h
@@ -142,8 +142,10 @@ AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts);
  * layouts/sample rates. If there are no links hooked to this filter, the list
  * is freed.
  */
+av_warn_unused_result
 int ff_set_common_channel_layouts(AVFilterContext *ctx,
                                   AVFilterChannelLayouts *layouts);
+av_warn_unused_result
 int ff_set_common_samplerates(AVFilterContext *ctx,
                               AVFilterFormats *samplerates);
 
@@ -152,13 +154,16 @@ int ff_set_common_samplerates(AVFilterContext *ctx,
  * formats. If there are no links hooked to this filter, the list of formats is
  * freed.
  */
+av_warn_unused_result
 int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
 
+av_warn_unused_result
 int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
 
 /**
  * Add *ref as a new reference to f.
  */
+av_warn_unused_result
 int ff_channel_layouts_ref(AVFilterChannelLayouts *f,
                            AVFilterChannelLayouts **ref);
 
@@ -170,6 +175,7 @@ void ff_channel_layouts_unref(AVFilterChannelLayouts **ref);
 void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
                                   AVFilterChannelLayouts **newref);
 
+av_warn_unused_result
 int ff_default_query_formats(AVFilterContext *ctx);
 
 /**
@@ -178,6 +184,7 @@ int ff_default_query_formats(AVFilterContext *ctx);
  * accepts channel layouts with unknown disposition. It should only be used
  * with audio filters.
  */
+av_warn_unused_result
 int ff_query_formats_all(AVFilterContext *ctx);
 
 
@@ -198,6 +205,7 @@ AVFilterFormats *ff_make_format_list(const int *fmts);
  * @return a non negative value in case of success, or a negative
  * value corresponding to an AVERROR code in case of error
  */
+av_warn_unused_result
 int ff_add_format(AVFilterFormats **avff, int64_t fmt);
 
 /**
@@ -233,6 +241,7 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b,
  *  | |____| |    | |____|
  *  |________|    |________________________
  */
+av_warn_unused_result
 int ff_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref);
 
 /**
-- 
2.6.1



More information about the ffmpeg-devel mailing list