From 017e41bb8671ed273fffcd2899c3e963d4dd9445 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 24 Nov 2020 17:08:11 -0800 Subject: QCborValue & QCborStreamReader tests: fix warning about %llx on 32-bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cborlargedatavalidation.cpp:93:60: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘qsizetype’ {aka ‘int’} [-Wformat=] 93 | QTest::addRow("bytearray-too-big-for-qbytearray-%llx", v) | ~~~^ ~ | | | | | qsizetype {aka int} | long long unsigned int | %x The cast to size_t is required to make the 64-bit not complain due to the long vs long long difference. Pick-to: 5.15 6.0 Change-Id: I00b01c01a66748508ea1fffd164a9add2a2650cf Reviewed-by: Allan Sandfeld Jensen --- tests/auto/corelib/serialization/cborlargedatavalidation.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/auto/corelib/serialization/cborlargedatavalidation.cpp b/tests/auto/corelib/serialization/cborlargedatavalidation.cpp index a9a31ddf57..39e4f1fb17 100644 --- a/tests/auto/corelib/serialization/cborlargedatavalidation.cpp +++ b/tests/auto/corelib/serialization/cborlargedatavalidation.cpp @@ -90,23 +90,23 @@ void addValidationLargeData(qsizetype minInvalid, qsizetype maxInvalid) bool overflows = v > std::numeric_limits::max() - 1 - qsizetype(sizeof(v)); CborError err = overflows ? CborErrorDataTooLarge : CborErrorUnexpectedEOF; - QTest::addRow("bytearray-too-big-for-qbytearray-%llx", v) + QTest::addRow("bytearray-too-big-for-qbytearray-%zx", size_t(v)) << QByteArray(toolong, sizeof(toolong)) << 0 << err; - QTest::addRow("bytearray-chunked-too-big-for-qbytearray-%llx", v) + QTest::addRow("bytearray-chunked-too-big-for-qbytearray-%zx", size_t(v)) << ('\x5f' + QByteArray(toolong, sizeof(toolong)) + '\xff') << 0 << err; - QTest::addRow("bytearray-2chunked-too-big-for-qbytearray-%llx", v) + QTest::addRow("bytearray-2chunked-too-big-for-qbytearray-%zx", size_t(v)) << ("\x5f\x40" + QByteArray(toolong, sizeof(toolong)) + '\xff') << 0 << err; toolong[0] |= 0x20; // QCborStreamReader::readString copies to a QByteArray first - QTest::addRow("string-too-big-for-qbytearray-%llx", v) + QTest::addRow("string-too-big-for-qbytearray-%zx", size_t(v)) << QByteArray(toolong, sizeof(toolong)) << 0 << err; - QTest::addRow("string-chunked-too-big-for-qbytearray-%llx", v) + QTest::addRow("string-chunked-too-big-for-qbytearray-%zx", size_t(v)) << ('\x7f' + QByteArray(toolong, sizeof(toolong)) + '\xff') << 0 << err; - QTest::addRow("string-2chunked-too-big-for-qbytearray-%llx", v) + QTest::addRow("string-2chunked-too-big-for-qbytearray-%zx", size_t(v)) << ("\x7f\x60" + QByteArray(toolong, sizeof(toolong)) + '\xff') << 0 << err; } -- cgit v1.2.3