From f23b02805e975b0450af662ca89d4f50105ad325 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 14 May 2024 00:01:14 +0200 Subject: [PATCH] Fix a Clang 19 warning. Clang rightfully pointed out that VLAs are a non-standard extension. We can do just fine with three small heap allocations per software-decoded JPEG (the main path is VA-API anyway). --- futatabi/jpeg_frame_view.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/futatabi/jpeg_frame_view.cpp b/futatabi/jpeg_frame_view.cpp index 6ab1948..6dafb3e 100644 --- a/futatabi/jpeg_frame_view.cpp +++ b/futatabi/jpeg_frame_view.cpp @@ -182,8 +182,10 @@ shared_ptr decode_jpeg(const string &jpeg) } if (!error_mgr.run([&dinfo, &y_pix, &cb_pix, &cr_pix, pitch_y, pitch_chroma, v_mcu_size, mcu_height_blocks] { - JSAMPROW yptr[v_mcu_size], cbptr[v_mcu_size], crptr[v_mcu_size]; - JSAMPARRAY data[3] = { yptr, cbptr, crptr }; + unique_ptr yptr(new JSAMPROW[v_mcu_size]); + unique_ptr cbptr(new JSAMPROW[v_mcu_size]); + unique_ptr crptr(new JSAMPROW[v_mcu_size]); + JSAMPARRAY data[3] = { yptr.get(), cbptr.get(), crptr.get() }; for (unsigned y = 0; y < mcu_height_blocks; ++y) { // NOTE: The last elements of cbptr/crptr will be unused for vertically subsampled chroma. for (unsigned yy = 0; yy < v_mcu_size; ++yy) { -- 2.39.2