From eea930b4d7cabb6ada6155b66b5b143b73a10344 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 30 Jun 2021 11:25:46 +0200 Subject: QTest: fix -Wformat-overflow GCC warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Says GCC: In function ‘char* QTest::toString(QPair&) [with T1 = QWidget*; T2 = QEvent::Type]’, warning: ‘%s’ directive argument is null [-Wformat-overflow=] Fix by re-using formatString(), once introduced for std::tuple. As a side-effect, this gets rid of the funny double-quotes around the output. Change-Id: I2dd5f10fa2b3a392370bf487c1b7e98f3d190978 Reviewed-by: Thiago Macieira Reviewed-by: Qt CI Bot --- src/testlib/qtest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 4bf5e018a7..cee01e7217 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -380,7 +380,7 @@ inline char *toString(const std::pair &pair) { const QScopedArrayPointer first(toString(pair.first)); const QScopedArrayPointer second(toString(pair.second)); - return toString(QString::asprintf("std::pair(%s,%s)", first.data(), second.data())); + return formatString("std::pair(", ")", 2, first.data(), second.data()); } template -- cgit v1.2.3