From f6b780b58339bbaccd5c981291de5ef462e7aa3a Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Wed, 15 Mar 2023 17:27:21 +0200 Subject: 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 --- src/testlib/qteamcitylogger.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/testlib/qteamcitylogger.cpp') 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 #include #include +#include -#include #include #include #include @@ -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'; } -- cgit v1.2.3