diff options
author | Marc Mutz <[email protected]> | 2024-07-22 14:37:59 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2024-08-03 12:30:05 +0200 |
commit | b5115d1c2fc73feb149a8ee97de011b3c75694fb (patch) | |
tree | 128068e5f13e4bfc2fad71a0bfec2cfa8456f690 /src/testlib/qtestlog.cpp | |
parent | a15ff49be73228bbbc72989736d32059322c414f (diff) |
QtTest: port from qsnprintf to std::snprintf and mark the module as qsnprintf-free
Drive-by remove an explicit NUL-termination (std::snprintf() does
that) and port a repeated use of printf argument checking to the
protect() idiom.
Pick-to: 6.8
Change-Id: Ida15940fe9aef0622e9836a229a398c909503a9a
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r-- | src/testlib/qtestlog.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 89149f3d47a..39178feb2b7 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -30,6 +30,8 @@ #include <QtCore/QRegularExpression> #endif +#include <cstdio> + #include <stdlib.h> #include <string.h> #include <limits.h> @@ -194,8 +196,8 @@ namespace QTest { const size_t maxMsgLen = 1024; char msg[maxMsgLen] = {'\0'}; - qsnprintf(msg, maxMsgLen, "Received a warning that resulted in a failure:\n%s", - qPrintable(message)); + std::snprintf(msg, maxMsgLen, "Received a warning that resulted in a failure:\n%s", + qPrintable(message)); QTestResult::addFailure(msg, context.file, context.line); return true; } |