diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-25 16:56:33 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-26 09:32:29 +0000 |
commit | 285f5ffeac9db359ef7775d3f3a4d59c4e844d4a (patch) | |
tree | 012e3a9a40f4b60ec8eb377b4fb762feed8948af /sources | |
parent | 1b661a3f4f6871071a4e35b5b89404a72e3dbe3e (diff) |
Fix clazy warnings in the doc generators
- Unused variables
- Mixing const/non-const iterators
- Signedness
- Missing const ref in range-based for
- Uninitialized variable
Change-Id: I02e6d4c5b0416aa8462f7b9d567b562a702a5740
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/shiboken2/ApiExtractor/qtdocparser.cpp | 1 | ||||
-rw-r--r-- | sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp | 12 |
2 files changed, 5 insertions, 8 deletions
diff --git a/sources/shiboken2/ApiExtractor/qtdocparser.cpp b/sources/shiboken2/ApiExtractor/qtdocparser.cpp index f53cc1ead..99cf15e48 100644 --- a/sources/shiboken2/ApiExtractor/qtdocparser.cpp +++ b/sources/shiboken2/ApiExtractor/qtdocparser.cpp @@ -46,7 +46,6 @@ void QtDocParser::fillDocumentation(AbstractMetaClass* metaClass) if (!metaClass) return; - QString scope = metaClass->name(); const AbstractMetaClass* context = metaClass->enclosingClass(); while(context) { if (context->enclosingClass() == 0) diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp index 5b58e7e8a..1310f5ac0 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp @@ -303,7 +303,7 @@ QString QtXmlToSphinx::transform(const QString& doc) QString QtXmlToSphinx::readFromLocations(const QStringList& locations, const QString& path, const QString& identifier) { QString result; - bool ok; + bool ok = false; for (QString location : locations) { location.append(QLatin1Char('/')); location.append(path); @@ -372,7 +372,7 @@ void QtXmlToSphinx::handleHeadingTag(QXmlStreamReader& reader) static char types[] = { '-', '^' }; QXmlStreamReader::TokenType token = reader.tokenType(); if (token == QXmlStreamReader::StartElement) { - uint typeIdx = reader.attributes().value(QLatin1String("level")).toString().toInt(); + uint typeIdx = reader.attributes().value(QLatin1String("level")).toString().toUInt(); if (typeIdx >= sizeof(types)) type = types[sizeof(types)-1]; else @@ -731,12 +731,11 @@ void QtXmlToSphinx::handleCodeTag(QXmlStreamReader& reader) { QXmlStreamReader::TokenType token = reader.tokenType(); if (token == QXmlStreamReader::StartElement) { - QString format = reader.attributes().value(QLatin1String("format")).toString(); m_output << INDENT << "::" << endl << endl; INDENT.indent++; } else if (token == QXmlStreamReader::Characters) { const QStringList lst(reader.text().toString().split(QLatin1Char('\n'))); - for (const QString row : lst) + for (const QString &row : lst) m_output << INDENT << INDENT << row << endl; } else if (token == QXmlStreamReader::EndElement) { m_output << endl << endl; @@ -981,8 +980,8 @@ static QString getFuncName(const AbstractMetaFunction* cppFunc) { hashInitialized = true; } - QHash<QString, QString>::const_iterator it = operatorsHash.find(cppFunc->name()); - QString result = it != operatorsHash.end() ? it.value() : cppFunc->name(); + QHash<QString, QString>::const_iterator it = operatorsHash.constFind(cppFunc->name()); + QString result = it != operatorsHash.cend() ? it.value() : cppFunc->name(); result.replace(QLatin1String("::"), QLatin1String(".")); return result; } @@ -1164,7 +1163,6 @@ void QtDocGenerator::writeFunctionList(QTextStream& s, const AbstractMetaClass* if ((functionList.size() > 0) || (staticFunctionList.size() > 0)) { QtXmlToSphinx::Table functionTable; - QtXmlToSphinx::TableRow row; s << "Synopsis" << endl << "--------" << endl << endl; |