Replace variable length array in qt_mac_draw_pattern with QVarLengthArray

Pick-to: 6.9 6.8
Change-Id: I1869ba14cdddb23cd903013fb6d160e24ac72967
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2025-03-28 15:39:40 +01:00
parent a42fbfba26
commit 1085143208

View File

@ -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<uchar> 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);