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-08 14:20:46 -0800 |
commit | afcb2bb2481d3623cf101ee81519ce73b8fd4c59 (patch) | |
tree | 7e621574f480e39f0a7ee5ddf7625246bdde2134 /tests/auto | |
parent | 53497d217feb49329d2627ec174f8f397ffde5aa (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.
Change-Id: I00b01c01a66748508ea1fffd164a9add2a2650cf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 017e41bb8671ed273fffcd2899c3e963d4dd9445)
Diffstat (limited to 'tests/auto')
-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; } |