From 10851432080df38668a07ff22f1da1c3cbfbfe51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 28 Mar 2025 15:39:40 +0100 Subject: [PATCH] Replace variable length array in qt_mac_draw_pattern with QVarLengthArray Pick-to: 6.9 6.8 Change-Id: I1869ba14cdddb23cd903013fb6d160e24ac72967 Reviewed-by: Ivan Solovev Reviewed-by: Timur Pocheptsov --- src/printsupport/platform/macos/qpaintengine_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/printsupport/platform/macos/qpaintengine_mac.mm b/src/printsupport/platform/macos/qpaintengine_mac.mm index 27274f116ed..a2c08b416bf 100644 --- a/src/printsupport/platform/macos/qpaintengine_mac.mm +++ b/src/printsupport/platform/macos/qpaintengine_mac.mm @@ -256,10 +256,10 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c) CGDataProviderRelease(provider); #else const int numBytes = (w*h)/sizeof(uchar); - uchar xor_bytes[numBytes]; + QVarLengthArray xor_bytes(numBytes); for (int i = 0; i < numBytes; ++i) xor_bytes[i] = pat->data.bytes[i] ^ 0xFF; - CGDataProviderRef provider = CGDataProviderCreateWithData(nullptr, xor_bytes, w*h, nullptr); + CGDataProviderRef provider = CGDataProviderCreateWithData(nullptr, xor_bytes.constData(), w*h, nullptr); CGImageRef swatch = CGImageMaskCreate(w, h, 1, 1, 1, provider, nullptr, false); CGDataProviderRelease(provider);