summaryrefslogtreecommitdiffstats
path: root/src/testlib/qteamcitylogger.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-03-15 17:27:21 +0200
committerAhmad Samir <a.samirh78@gmail.com>2023-03-18 12:00:56 +0200
commitf6b780b58339bbaccd5c981291de5ef462e7aa3a (patch)
tree7ae1bbaa96a644e2f9550e06dd3f245809c4f970 /src/testlib/qteamcitylogger.cpp
parentd184c66ad5ca90ef93ce1df6012f6cfb4318cf6d (diff)
QtMiscUtils: add isAsciiPrintable() helper
- isAsciiPrintable: borrowed the logic from isPrintable(uchar) in qdebug.cpp, now isPrintable(uchar) calls isAsciiPrintable - Replace ::isspace() with ascii_isspace() from qlocale_p.h Functions from ctype.h have a couple of issues: - they're locale-dependent, which isn't what's required here, the code is only interested in ASCII - their args should be representable as uchar or EOF otherwise it's undefined behavior An Early-Warning could use something like: grep -rP "\b(isalnum|isalpha|isblank|iscntrl|isdigit|islower|isgraph|\ "isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper)\b" Pick-to: 6.5 Task-number: QTBUG-111262 Change-Id: I1f47f41bd56735297078ff0d0ddc2ebf999abf8b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/testlib/qteamcitylogger.cpp')
-rw-r--r--src/testlib/qteamcitylogger.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/testlib/qteamcitylogger.cpp b/src/testlib/qteamcitylogger.cpp
index fbb2b2f051..840a0334f6 100644
--- a/src/testlib/qteamcitylogger.cpp
+++ b/src/testlib/qteamcitylogger.cpp
@@ -7,8 +7,8 @@
#include <QtTest/private/qtestlog_p.h>
#include <QtTest/private/qteamcitylogger_p.h>
#include <QtCore/qbytearray.h>
+#include <private/qlocale_p.h>
-#include <cctype>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
@@ -235,7 +235,7 @@ void QTeamCityLogger::tcEscapedString(QTestCharBuffer *buf, const char *str) con
swallowSpace = false;
break;
default:
- if (std::isspace(ch)) {
+ if (ascii_isspace(ch)) {
if (swallowSpace)
continue;
swallowSpace = true;
@@ -252,7 +252,7 @@ void QTeamCityLogger::tcEscapedString(QTestCharBuffer *buf, const char *str) con
Q_ASSERT(p[-1] == ' ');
--p;
}
- Q_ASSERT(p == buf->data() || !std::isspace(p[-1]));
+ Q_ASSERT(p == buf->data() || !ascii_isspace(p[-1]));
*p = '\0';
}