summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Kauffmann <johanneskauffmann@hotmail.com>2022-10-24 23:21:52 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-10-25 14:57:19 +0000
commit3fc5c9b6b6ce08298e98bde84e75661a155398c9 (patch)
treed2c3b8985f569ab3f32c236cba58d4c2ef4ca818
parent0bd5fc32811a26d772e5dd6e30f0b226bc33d925 (diff)
downloadqtbase-3fc5c9b6b6ce08298e98bde84e75661a155398c9.tar.gz
qlogging: use qsizetype to fix Wconversion warnings
While the strlen() calls don't raise warnings themselves, it seems like they were artifacts of indexOf() returning int instead of qsizetype. Task-number: QTBUG-103527 Change-Id: I32fbf69feca38a5977dde084bef9993f24843ccf Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit e38a48200b7e0d20c0ab564bb59bd978d72677b7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/corelib/global/qlogging.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index dc169ce5fc..d1fa4b8077 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -862,7 +862,7 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
if (info.isEmpty())
return info;
- int pos;
+ qsizetype pos;
// Skip trailing [with XXX] for templates (gcc), but make
// sure to not affect Objective-C message names.
@@ -909,7 +909,7 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
info.truncate(++pos);
if (info.at(pos - 1) == ')') {
- if (info.indexOf(operator_call) == pos - (int)strlen(operator_call))
+ if (info.indexOf(operator_call) == pos - (qsizetype)strlen(operator_call))
break;
// this function returns a pointer to a function
@@ -932,19 +932,19 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
if (pos > -1) {
switch (info.at(pos)) {
case ')':
- if (info.indexOf(operator_call) == pos - (int)strlen(operator_call) + 1)
+ if (info.indexOf(operator_call) == pos - (qsizetype)strlen(operator_call) + 1)
pos -= 2;
break;
case '<':
- if (info.indexOf(operator_lessThan) == pos - (int)strlen(operator_lessThan) + 1)
+ if (info.indexOf(operator_lessThan) == pos - (qsizetype)strlen(operator_lessThan) + 1)
--pos;
break;
case '>':
- if (info.indexOf(operator_greaterThan) == pos - (int)strlen(operator_greaterThan) + 1)
+ if (info.indexOf(operator_greaterThan) == pos - (qsizetype)strlen(operator_greaterThan) + 1)
--pos;
break;
case '=': {
- int operatorLength = (int)strlen(operator_lessThanEqual);
+ qsizetype operatorLength = (qsizetype)strlen(operator_lessThanEqual);
if (info.indexOf(operator_lessThanEqual) == pos - operatorLength + 1)
pos -= 2;
else if (info.indexOf(operator_greaterThanEqual) == pos - operatorLength + 1)
@@ -988,7 +988,7 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
break;
// find the matching close
- int end = pos;
+ qsizetype end = pos;
templatecount = 1;
--pos;
while (pos && templatecount) {
@@ -1151,7 +1151,7 @@ void QMessagePattern::setPattern(const QString &pattern)
tokens[i] = qthreadptrTokenC;
else if (lexeme.startsWith(QLatin1StringView(timeTokenC))) {
tokens[i] = timeTokenC;
- int spaceIdx = lexeme.indexOf(QChar::fromLatin1(' '));
+ qsizetype spaceIdx = lexeme.indexOf(QChar::fromLatin1(' '));
if (spaceIdx > 0)
timeArgs.append(lexeme.mid(spaceIdx + 1, lexeme.length() - spaceIdx - 2));
else