[FFmpeg-devel,1/9] lavc: Mark functions where ignoring returned error code is always wrong

Submitted by Mark Thompson on Oct. 17, 2017, 9:12 p.m.

Details

Message ID 20171017211225.3175-1-sw@jkqxz.net
State New
Headers show

Commit Message

Mark Thompson Oct. 17, 2017, 9:12 p.m.
---
 libavcodec/avcodec.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Michael Niedermayer Oct. 19, 2017, 1:11 a.m.
On Tue, Oct 17, 2017 at 10:12:17PM +0100, Mark Thompson wrote:
> ---
>  libavcodec/avcodec.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)

if you checked that failure for each cannot be detected by another
way then it should be ok

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 18c3e3ea1e..8fc2f6920e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4492,6 +4492,7 @@  int avcodec_parameters_to_context(AVCodecContext *codec,
  * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
  *      av_dict_set(), av_opt_find().
  */
+av_warn_unused_result
 int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
 
 /**
@@ -4577,6 +4578,7 @@  void av_init_packet(AVPacket *pkt);
  * @param size wanted payload size
  * @return 0 if OK, AVERROR_xxx otherwise
  */
+av_warn_unused_result
 int av_new_packet(AVPacket *pkt, int size);
 
 /**
@@ -4593,6 +4595,7 @@  void av_shrink_packet(AVPacket *pkt, int size);
  * @param pkt packet
  * @param grow_by number of bytes by which to increase the size of the packet
  */
+av_warn_unused_result
 int av_grow_packet(AVPacket *pkt, int grow_by);
 
 /**
@@ -4751,6 +4754,7 @@  void av_packet_free_side_data(AVPacket *pkt);
  *
  * @return 0 on success, a negative AVERROR on error.
  */
+av_warn_unused_result
 int av_packet_ref(AVPacket *dst, const AVPacket *src);
 
 /**
@@ -4829,6 +4833,7 @@  AVCodec *avcodec_find_decoder_by_name(const char *name);
  * it can be called by custom get_buffer2() implementations for decoders without
  * AV_CODEC_CAP_DR1 set.
  */
+av_warn_unused_result
 int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
 
 #if FF_API_EMU_EDGE
@@ -5095,6 +5100,7 @@  int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
  *      AVERROR(EINVAL):   codec not opened, or it is an encoder
  *      other negative values: legitimate decoding errors
  */
+av_warn_unused_result
 int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
 
 /**
@@ -5149,6 +5155,7 @@  int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
  *      AVERROR(EINVAL):   codec not opened, or it is an encoder
  *      other errors: legitimate decoding errors
  */
+av_warn_unused_result
 int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
 
 
@@ -6106,12 +6113,14 @@  const AVBitStreamFilter *av_bsf_next(void **opaque);
  *
  * @return 0 on success, a negative AVERROR code on failure
  */
+av_warn_unused_result
 int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx);
 
 /**
  * Prepare the filter for use, after all the parameters and options have been
  * set.
  */
+av_warn_unused_result
 int av_bsf_init(AVBSFContext *ctx);
 
 /**
@@ -6155,6 +6164,7 @@  int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
  * output fewer packets than were sent to it, so this function may return
  * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
  */
+av_warn_unused_result
 int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
 
 /**