ffmpeg | branch: master | Marton Balint <c...@passwd.hu> | Wed May 7 12:45:16 2025 +0200| [0d6ef6f545042981583669aa88f2f1f6459b0325] | committer: Marton Balint
fftools/textformat: correctly propagate uninit error codes This allows catching IO errors occuring at file close. Signed-off-by: Marton Balint <c...@passwd.hu> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d6ef6f545042981583669aa88f2f1f6459b0325 --- fftools/textformat/avtextformat.c | 4 ++-- fftools/textformat/avtextformat.h | 2 +- fftools/textformat/avtextwriters.h | 2 +- fftools/textformat/tw_avio.c | 6 ++++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c index ad8e5bcb35..bb90e66918 100644 --- a/fftools/textformat/avtextformat.c +++ b/fftools/textformat/avtextformat.c @@ -113,7 +113,7 @@ int avtext_context_close(AVTextFormatContext **ptctx) if (tctx->formatter) { if (tctx->formatter->uninit) - tctx->formatter->uninit(tctx); + ret = tctx->formatter->uninit(tctx); if (tctx->formatter->priv_class) av_opt_free(tctx->priv); } @@ -627,7 +627,7 @@ int avtextwriter_context_close(AVTextWriterContext **pwctx) if (wctx->writer) { if (wctx->writer->uninit) - wctx->writer->uninit(wctx); + ret = wctx->writer->uninit(wctx); if (wctx->writer->priv_class) av_opt_free(wctx->priv); } diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h index 22f351c12e..cf23d93871 100644 --- a/fftools/textformat/avtextformat.h +++ b/fftools/textformat/avtextformat.h @@ -97,7 +97,7 @@ typedef struct AVTextFormatter { const char *name; int (*init) (AVTextFormatContext *tctx); - void (*uninit)(AVTextFormatContext *tctx); + int (*uninit)(AVTextFormatContext *tctx); void (*print_section_header)(AVTextFormatContext *tctx, const void *data); void (*print_section_footer)(AVTextFormatContext *tctx); diff --git a/fftools/textformat/avtextwriters.h b/fftools/textformat/avtextwriters.h index c4aa88b072..8457d7a6ea 100644 --- a/fftools/textformat/avtextwriters.h +++ b/fftools/textformat/avtextwriters.h @@ -33,7 +33,7 @@ typedef struct AVTextWriter { const char *name; int (*init)(AVTextWriterContext *wctx); - void (*uninit)(AVTextWriterContext *wctx); + int (*uninit)(AVTextWriterContext *wctx); void (*writer_w8)(AVTextWriterContext *wctx, int b); void (*writer_put_str)(AVTextWriterContext *wctx, const char *str); void (*writer_vprintf)(AVTextWriterContext *wctx, const char *fmt, va_list vl); diff --git a/fftools/textformat/tw_avio.c b/fftools/textformat/tw_avio.c index 39c63d8c9a..21d3af27df 100644 --- a/fftools/textformat/tw_avio.c +++ b/fftools/textformat/tw_avio.c @@ -37,12 +37,14 @@ typedef struct IOWriterContext { int close_on_uninit; } IOWriterContext; -static av_cold void iowriter_uninit(AVTextWriterContext *wctx) +static av_cold int iowriter_uninit(AVTextWriterContext *wctx) { IOWriterContext *ctx = wctx->priv; + int ret = 0; if (ctx->close_on_uninit) - avio_closep(&ctx->avio_context); + ret = avio_closep(&ctx->avio_context); + return ret; } static void io_w8(AVTextWriterContext *wctx, int b) _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".