[FFmpeg-devel] [PATCH 26/26] avfilter/vf_geq: Simplify creating string

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Sep 21 09:27:46 EEST 2021


Also fixes a Wformat-truncation warning from GCC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavfilter/vf_geq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
index 4a78336540..1dc59dc1fa 100644
--- a/libavfilter/vf_geq.c
+++ b/libavfilter/vf_geq.c
@@ -250,9 +250,7 @@ static av_cold int geq_init(AVFilterContext *ctx)
     }
 
     if (!geq->expr_str[A]) {
-        char bps_string[8];
-        snprintf(bps_string, sizeof(bps_string), "%d", (1<<geq->bps) - 1);
-        geq->expr_str[A] = av_strdup(bps_string);
+        geq->expr_str[A] = av_asprintf("%d", (1<<geq->bps) - 1);
     }
     if (!geq->expr_str[G])
         geq->expr_str[G] = av_strdup("g(X,Y)");
-- 
2.30.2



More information about the ffmpeg-devel mailing list