From: Steinar H. Gunderson Date: Mon, 13 May 2024 22:01:14 +0000 (+0200) Subject: Fix a Clang 19 warning. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;p=nageru 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). --- 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) {