[FFmpeg-devel] [PATCH 2/2] avfilter/formats: add av_warn_unused_result to function prototypes
Ganesh Ajjanagadde
gajjanagadde at gmail.com
Mon Oct 5 21:44:15 CEST 2015
On Mon, Oct 5, 2015 at 3:23 PM, Ganesh Ajjanagadde
<gajjanagadde at gmail.com> wrote:
> On Mon, Oct 5, 2015 at 3:20 PM, Ganesh Ajjanagadde
> <gajjanagadde at gmail.com> wrote:
>> 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 | 38 +++++++++++++++++++-------------------
>> 1 file changed, 19 insertions(+), 19 deletions(-)
>>
>> diff --git a/libavfilter/formats.h b/libavfilter/formats.h
>> index 5a8ee5e..e01be4a 100644
>> --- a/libavfilter/formats.h
>> +++ b/libavfilter/formats.h
>> @@ -116,25 +116,25 @@ typedef struct AVFilterChannelLayouts {
>> * If a and b do not share any common elements, neither is modified, and NULL
>> * is returned.
>> */
>> -AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
>> +av_warn_unused_result AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
>> AVFilterChannelLayouts *b);
>> -AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
>> +av_warn_unused_result AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
>> AVFilterFormats *b);
>>
>> /**
>> * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct --
>> * representing any channel layout (with known disposition)/sample rate.
>> */
>> -AVFilterChannelLayouts *ff_all_channel_layouts(void);
>> -AVFilterFormats *ff_all_samplerates(void);
>> +av_warn_unused_result AVFilterChannelLayouts *ff_all_channel_layouts(void);
>> +av_warn_unused_result AVFilterFormats *ff_all_samplerates(void);
>>
>> /**
>> * Construct an AVFilterChannelLayouts coding for any channel layout, with
>> * known or unknown disposition.
>> */
>> -AVFilterChannelLayouts *ff_all_channel_counts(void);
>> +av_warn_unused_result AVFilterChannelLayouts *ff_all_channel_counts(void);
>>
>> -AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts);
>> +av_warn_unused_result AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts);
>>
>>
>> /**
>> @@ -142,9 +142,9 @@ 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.
>> */
>> -int ff_set_common_channel_layouts(AVFilterContext *ctx,
>> +av_warn_unused_result int ff_set_common_channel_layouts(AVFilterContext *ctx,
>> AVFilterChannelLayouts *layouts);
>> -int ff_set_common_samplerates(AVFilterContext *ctx,
>> +av_warn_unused_result int ff_set_common_samplerates(AVFilterContext *ctx,
>> AVFilterFormats *samplerates);
>>
>> /**
>> @@ -152,14 +152,14 @@ int ff_set_common_samplerates(AVFilterContext *ctx,
>> * formats. If there are no links hooked to this filter, the list of formats is
>> * freed.
>> */
>> -int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
>> +av_warn_unused_result int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
>>
>> -int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
>> +av_warn_unused_result int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
>>
>> /**
>> * Add *ref as a new reference to f.
>> */
>> -int ff_channel_layouts_ref(AVFilterChannelLayouts *f,
>> +av_warn_unused_result int ff_channel_layouts_ref(AVFilterChannelLayouts *f,
>> AVFilterChannelLayouts **ref);
>>
>> /**
>> @@ -170,7 +170,7 @@ void ff_channel_layouts_unref(AVFilterChannelLayouts **ref);
>> void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
>> AVFilterChannelLayouts **newref);
>>
>> -int ff_default_query_formats(AVFilterContext *ctx);
>> +av_warn_unused_result int ff_default_query_formats(AVFilterContext *ctx);
>>
>> /**
>> * Set the formats list to all existing formats.
>> @@ -178,7 +178,7 @@ int ff_default_query_formats(AVFilterContext *ctx);
>> * accepts channel layouts with unknown disposition. It should only be used
>> * with audio filters.
>> */
>> -int ff_query_formats_all(AVFilterContext *ctx);
>> +av_warn_unused_result int ff_query_formats_all(AVFilterContext *ctx);
>>
>>
>> /**
>> @@ -188,7 +188,7 @@ int ff_query_formats_all(AVFilterContext *ctx);
>> * @param fmts list of media formats, terminated by -1
>> * @return the format list, with no existing references
>> */
>> -AVFilterFormats *ff_make_format_list(const int *fmts);
>> +av_warn_unused_result AVFilterFormats *ff_make_format_list(const int *fmts);
>>
>> /**
>> * Add fmt to the list of media formats contained in *avff.
>> @@ -198,17 +198,17 @@ 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
>> */
>> -int ff_add_format(AVFilterFormats **avff, int64_t fmt);
>> +av_warn_unused_result int ff_add_format(AVFilterFormats **avff, int64_t fmt);
>>
>> /**
>> * Return a list of all formats supported by FFmpeg for the given media type.
>> */
>> -AVFilterFormats *ff_all_formats(enum AVMediaType type);
>> +av_warn_unused_result AVFilterFormats *ff_all_formats(enum AVMediaType type);
>>
>> /**
>> * Construct a formats list containing all planar sample formats.
>> */
>> -AVFilterFormats *ff_planar_sample_fmts(void);
>> +av_warn_unused_result AVFilterFormats *ff_planar_sample_fmts(void);
>>
>> /**
>> * Return a format list which contains the intersection of the formats of
>> @@ -218,7 +218,7 @@ AVFilterFormats *ff_planar_sample_fmts(void);
>> * If a and b do not share any common formats, neither is modified, and NULL
>> * is returned.
>> */
>> -AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b,
>> +av_warn_unused_result AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b,
>> enum AVMediaType type);
>>
>> /**
>> @@ -233,7 +233,7 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b,
>> * | |____| | | |____|
>> * |________| |________________________
>> */
>> -int ff_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref);
>> +av_warn_unused_result int ff_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref);
>>
>> /**
>> * If *ref is non-NULL, remove *ref as a reference to the format list
>> --
>> 2.6.0
>>
>
> patch 1/2 is relatively large (~1000 line diff). Gmail can't seem to
> handle the send-email correctly, and so I will attach it to a separate
> thread.
Off topic, but I would greatly appreciate any help/suggestions for how
to get gmail to work correctly, or alternative mailbox providers for
patch sending purposes.
More information about the ffmpeg-devel
mailing list