From 4337bc3a61f39bf658453452f390d30f344755f3 Mon Sep 17 00:00:00 2001 From: Paul Wicking <paul.wicking@qt.io> Date: Thu, 26 Sep 2019 14:15:21 +0200 Subject: [PATCH] QDoc: Minor cleanup in generator.cpp Fix 0 as nullptr constant. Stop using C-style casts: - Do not cast to int that which returns an int (QString::length()) - Use static_cast<>() where it's sensible to do so. Change-Id: I48c7a3e6f1465759dd3973eff66656a4f2a1c19a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> --- src/qdoc/generator.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index 4c353fdd2..9f7e65205 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -508,7 +508,7 @@ QString Generator::cleanRef(const QString &ref) clean += QLatin1Char('A'); } - for (int i = 1; i < (int) ref.length(); i++) { + for (int i = 1; i < ref.length(); i++) { const QChar c = ref[i]; const uint u = c.unicode(); if ((u >= 'a' && u <= 'z') || @@ -532,7 +532,7 @@ QString Generator::cleanRef(const QString &ref) clean += QLatin1Char('#'); } else { clean += QLatin1Char('-'); - clean += QString::number((int)u, 16); + clean += QString::number(static_cast<int>(u), 16); } } return clean; @@ -868,7 +868,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) } if (node->isEnumType()) { - const EnumNode *enume = (const EnumNode *) node; + const EnumNode *enume = static_cast<const EnumNode *>(node); QSet<QString> definedItems; QList<EnumItem>::ConstIterator it = enume->items().constBegin(); @@ -1014,7 +1014,7 @@ void Generator::generateLinkToExample(const ExampleNode *en, << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom::ParaRight; - generateText(text, 0, marker); + generateText(text, nullptr, marker); } /*! @@ -1785,7 +1785,7 @@ QString Generator::indent(int level, const QString &markedCode) int column = 0; int i = 0; - while (i < (int) markedCode.length()) { + while (i < markedCode.length()) { if (markedCode.at(i) == QLatin1Char('\n')) { column = 0; } -- GitLab