From 9ae42d42e6d488e05ed19f50d3fa627723d3ce66 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Fri, 5 Sep 2025 12:55:14 +0200 Subject: [PATCH] avcodec/dvdsubdec: Don't return value != 0 on init success Currently, any nonnegative return value from an init function is just treated as success and otherwise ignored; while it is not explicitly forbidden to return something else than 0 (there is no documentation whatsoever), the assumption is that they return zero on success. So change dvdsubdec.c accordingly. Also change dvdsub_parse_extradata() to return zero on success. Signed-off-by: Andreas Rheinhardt --- libavcodec/dvdsubdec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index c4fbcffc41..9f9845bf8e 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -624,10 +624,10 @@ static int dvdsub_parse_extradata(AVCodecContext *avctx) { DVDSubContext *ctx = (DVDSubContext*) avctx->priv_data; char *dataorig, *data; - int ret = 1; + int ret; if (!avctx->extradata || !avctx->extradata_size) - return 1; + return 0; dataorig = data = av_malloc(avctx->extradata_size+1); if (!data) @@ -656,6 +656,7 @@ static int dvdsub_parse_extradata(AVCodecContext *avctx) data += strspn(data, "\n\r"); } + ret = 0; fail: av_free(dataorig); return ret; @@ -683,7 +684,7 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_DEBUG, "\n"); } - return 1; + return 0; } static av_cold void dvdsub_flush(AVCodecContext *avctx)