diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2020-11-24 17:08:11 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2020-12-07 22:54:43 +0000 |
commit | 017e41bb8671ed273fffcd2899c3e963d4dd9445 (patch) | |
tree | 1a6500251078cdf471110b8435b59f27094c3349 | |
parent | 3c88728b5367f9705a8ff6f62fa66d9f46880084 (diff) |
QCborValue & QCborStreamReader tests: fix warning about %llx on 32-bit
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 <allan.jensen@qt.io>
-rw-r--r-- | tests/auto/corelib/serialization/cborlargedatavalidation.cpp | 12 |
1 files 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<qsizetype>::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; } |