tst_QBuffer: fix warning about overflow

The constexpr in the if is ignored here, use #if instead

Change-Id: I9a81955e53e9da72e2302e128bf86b03eaf846e7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Mårten Nordheim 2024-09-16 13:35:25 +02:00
parent ca4334bc96
commit 1318232c05

View File

@ -301,7 +301,7 @@ void tst_QBuffer::invalidSeeks()
buffer.open(QIODevice::WriteOnly);
QCOMPARE(buffer.buffer().size(), qsizetype(0));
QCOMPARE(buffer.pos(), qint64(0));
constexpr qint64 MaxQByteArrayCapacity = (std::numeric_limits<qsizetype>::max)();
constexpr qint64 MaxQByteArrayCapacity = (std::numeric_limits<int>::max)();
// this should fail fast, not after trying to allocate nearly 2 GiB of data,
// potentially crashing in the process:
QVERIFY(!buffer.seek(2 * MaxQByteArrayCapacity - 1));