diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-09-30 14:09:04 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-04 07:40:08 +0200 |
commit | df9d882d41b741fef7c5beeddb0abe9d904443d8 (patch) | |
tree | 6f3e90dacad4581b7f1cabe235cca298833a3da4 /src/opengl/qopengldebug.cpp | |
parent | 109e088c7c5d0c9325966e88d55fd9f7a58f67ea (diff) |
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/opengl/qopengldebug.cpp')
-rw-r--r-- | src/opengl/qopengldebug.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/opengl/qopengldebug.cpp b/src/opengl/qopengldebug.cpp index 522aa2dba7..b774d0a85e 100644 --- a/src/opengl/qopengldebug.cpp +++ b/src/opengl/qopengldebug.cpp @@ -1147,7 +1147,7 @@ void QOpenGLDebugLoggerPrivate::controlDebugMessages(QOpenGLDebugMessage::Source QVarLengthArray<GLenum, 8> glTypes; QVarLengthArray<GLenum, 8> glSeverities; - if (ids.count() > 0) { + if (ids.size() > 0) { Q_ASSERT(severities == QOpenGLDebugMessage::AnySeverity); // The GL_KHR_debug extension says: @@ -1188,7 +1188,7 @@ void QOpenGLDebugLoggerPrivate::controlDebugMessages(QOpenGLDebugMessage::Source CONVERT_TO_GL_DEBUG_MESSAGE_CONTROL_PARAMETERS(Severity, severities, glSeverities) #undef CONVERT_TO_GL_DEBUG_MESSAGE_CONTROL_PARAMETERS - const GLsizei idCount = ids.count(); + const GLsizei idCount = ids.size(); // The GL_KHR_debug extension says that if idCount is 0, idPtr must be ignored. // Unfortunately, some bugged drivers do NOT ignore it, so pass NULL in case. const GLuint * const idPtr = idCount ? ids.constData() : nullptr; @@ -1504,9 +1504,9 @@ void QOpenGLDebugLogger::logMessage(const QOpenGLDebugMessage &debugMessage) QByteArray rawMessage = debugMessage.message().toUtf8(); rawMessage.append('\0'); - if (rawMessage.length() > d->maxMessageLength) { + if (rawMessage.size() > d->maxMessageLength) { qWarning("QOpenGLDebugLogger::logMessage(): message too long, truncating it\n" - " (%d bytes long, but the GL accepts up to %d bytes)", int(rawMessage.length()), d->maxMessageLength); + " (%d bytes long, but the GL accepts up to %d bytes)", int(rawMessage.size()), d->maxMessageLength); rawMessage.resize(d->maxMessageLength - 1); rawMessage.append('\0'); } @@ -1556,9 +1556,9 @@ void QOpenGLDebugLogger::pushGroup(const QString &name, GLuint id, QOpenGLDebugM QByteArray rawName = name.toUtf8(); rawName.append('\0'); - if (rawName.length() > d->maxMessageLength) { + if (rawName.size() > d->maxMessageLength) { qWarning("QOpenGLDebugLogger::pushGroup(): group name too long, truncating it\n" - " (%d bytes long, but the GL accepts up to %d bytes)", int(rawName.length()), d->maxMessageLength); + " (%d bytes long, but the GL accepts up to %d bytes)", int(rawName.size()), d->maxMessageLength); rawName.resize(d->maxMessageLength - 1); rawName.append('\0'); } |