From ca20cb7bc9c6c5e733d23f3a8151784b229882a6 Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Fri, 23 Feb 2018 19:11:35 +0100 Subject: [PATCH] src: use nullptr instead of NULL --- src/lib/LicenseChecker.cpp | 2 +- src/lib/component/Component.cpp | 4 ++-- src/lib/component/view/View.h | 2 +- .../shared_types/SharedIndexerCommand.cpp | 6 +++--- src/lib/utility/ConfigManager.cpp | 2 +- src/lib/utility/utilityXml.cpp | 16 ++++++++-------- .../parser/cxx/CxxAstVisitorComponentContext.cpp | 10 +++++----- .../parser/cxx/CxxAstVisitorComponentIndexer.cpp | 6 +++--- .../cxx/name_resolver/CxxDeclNameResolver.cpp | 2 +- src/lib_cxx/data/parser/cxx/utilityClang.cpp | 2 +- src/lib_gui/qt/element/QtBookmark.cpp | 2 +- src/lib_gui/qt/element/QtBookmarkCategory.cpp | 4 ++-- src/lib_gui/qt/network/QtTcpWrapper.cpp | 6 +++--- src/lib_gui/qt/view/QtGraphView.cpp | 14 +++++++------- src/lib_gui/qt/window/QtBookmarkBrowser.cpp | 4 ++-- .../window/project_wizzard/QtProjectWizzard.cpp | 2 +- src/test/TextAccessTestSuite.h | 4 ++-- 17 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/lib/LicenseChecker.cpp b/src/lib/LicenseChecker.cpp index 22e6e1b0..0e68c83a 100644 --- a/src/lib/LicenseChecker.cpp +++ b/src/lib/LicenseChecker.cpp @@ -62,7 +62,7 @@ bool LicenseChecker::isCurrentLicenseValid() LicenseChecker::LicenseState LicenseChecker::checkCurrentLicense() const { ApplicationSettings* appSettings = ApplicationSettings::getInstance().get(); - if (appSettings == NULL) + if (appSettings == nullptr) { LOG_ERROR_STREAM(<< "Unable to retrieve app settings"); return LICENSE_EMPTY; diff --git a/src/lib/component/Component.cpp b/src/lib/component/Component.cpp index 38d1a415..30ebe7b8 100644 --- a/src/lib/component/Component.cpp +++ b/src/lib/component/Component.cpp @@ -22,12 +22,12 @@ Component::~Component() { if (m_controller) { - m_controller->setComponent(NULL); + m_controller->setComponent(nullptr); } if (m_view) { - m_view->setComponent(NULL); + m_view->setComponent(nullptr); } } diff --git a/src/lib/component/view/View.h b/src/lib/component/view/View.h index d076fc21..e5ab74c5 100644 --- a/src/lib/component/view/View.h +++ b/src/lib/component/view/View.h @@ -81,7 +81,7 @@ ControllerType* View::getController() { return m_component->getController(); } - return NULL; + return nullptr; } #endif // VIEW_H diff --git a/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp b/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp index bbb4fdad..75fda395 100644 --- a/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp +++ b/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp @@ -13,7 +13,7 @@ void SharedIndexerCommand::fromLocal(IndexerCommand* indexerCommand) setIndexedPaths(indexerCommand->getIndexedPaths()); setExcludedPaths(indexerCommand->getExcludedPath()); - if (dynamic_cast(indexerCommand) != NULL) + if (dynamic_cast(indexerCommand) != nullptr) { IndexerCommandCxxCdb* cmd = dynamic_cast(indexerCommand); @@ -23,7 +23,7 @@ void SharedIndexerCommand::fromLocal(IndexerCommand* indexerCommand) setSystemHeaderSearchPaths(cmd->getSystemHeaderSearchPaths()); setFrameworkSearchhPaths(cmd->getFrameworkSearchPaths()); } - else if (dynamic_cast(indexerCommand) != NULL) + else if (dynamic_cast(indexerCommand) != nullptr) { IndexerCommandCxxEmpty* cmd = dynamic_cast(indexerCommand); @@ -34,7 +34,7 @@ void SharedIndexerCommand::fromLocal(IndexerCommand* indexerCommand) setSystemHeaderSearchPaths(cmd->getSystemHeaderSearchPaths()); setFrameworkSearchhPaths(cmd->getFrameworkSearchPaths()); } - else if (dynamic_cast(indexerCommand) != NULL) + else if (dynamic_cast(indexerCommand) != nullptr) { IndexerCommandJava* cmd = dynamic_cast(indexerCommand); diff --git a/src/lib/utility/ConfigManager.cpp b/src/lib/utility/ConfigManager.cpp index 7e38c041..3c2295e3 100644 --- a/src/lib/utility/ConfigManager.cpp +++ b/src/lib/utility/ConfigManager.cpp @@ -308,7 +308,7 @@ bool ConfigManager::load(const std::shared_ptr textAccess) TiXmlDocument doc; const char* pTest = doc.Parse(text.c_str(), 0, TIXML_ENCODING_UTF8); - if (pTest != NULL) + if (pTest != nullptr) { TiXmlHandle docHandle(&doc); TiXmlNode *rootNode = docHandle.FirstChild("config").ToNode(); diff --git a/src/lib/utility/utilityXml.cpp b/src/lib/utility/utilityXml.cpp index c71e728f..72309f2b 100644 --- a/src/lib/utility/utilityXml.cpp +++ b/src/lib/utility/utilityXml.cpp @@ -15,7 +15,7 @@ namespace utility TiXmlDocument doc; const char* pTest = doc.Parse(text.c_str(), 0, TIXML_ENCODING_LEGACY); - if (pTest != NULL) + if (pTest != nullptr) { TiXmlHandle docHandle(&doc); std::vector> traversalStates; @@ -77,7 +77,7 @@ namespace utility TiXmlDocument doc; const char* pTest = doc.Parse(text.c_str(), 0, TIXML_ENCODING_UTF8); - if (pTest != NULL) + if (pTest != nullptr) { TiXmlHandle docHandle(&doc); TiXmlElement *rootElement = docHandle.ToNode()->FirstChildElement(); @@ -121,31 +121,31 @@ namespace utility nodes.push_back(element); } - if (element->FirstChildElement() != NULL) + if (element->FirstChildElement() != nullptr) { element = element->FirstChildElement(); } - else if (element->NextSiblingElement() != NULL) + else if (element->NextSiblingElement() != nullptr) { element = element->NextSiblingElement(); } else { - if (element == NULL) + if (element == nullptr) { } - while (element->Parent()->ToElement() != NULL && element->Parent()->NextSiblingElement() == NULL) + while (element->Parent()->ToElement() != nullptr && element->Parent()->NextSiblingElement() == nullptr) { TiXmlElement* newElement = element->Parent()->ToElement(); - if (newElement == NULL) + if (newElement == nullptr) { } element = newElement; } - if (element->Parent() != NULL && element->Parent()->NextSiblingElement() != NULL) + if (element->Parent() != nullptr && element->Parent()->NextSiblingElement() != nullptr) { element = element->Parent()->NextSiblingElement(); } diff --git a/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentContext.cpp b/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentContext.cpp index 0eec4d6c..528925e6 100644 --- a/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentContext.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentContext.cpp @@ -70,11 +70,11 @@ void CxxAstVisitorComponentContext::beginTraverseDecl(clang::Decl* d) if (d && clang::isa(d) && - !clang::isa(d) && // no parameter - !(clang::isa(d) && d->getParentFunctionOrMethod() != NULL) && // no local variable - !clang::isa(d) && // no using directive decl - !clang::isa(d) && // no using decl - !clang::isa(d) // no namespace + !clang::isa(d) && // no parameter + !(clang::isa(d) && d->getParentFunctionOrMethod() != nullptr) && // no local variable + !clang::isa(d) && // no using directive decl + !clang::isa(d) && // no using decl + !clang::isa(d) // no namespace ){ clang::NamedDecl* nd = clang::dyn_cast(d); context = std::make_shared(nd, getAstVisitor()->getDeclNameCache()); diff --git a/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp b/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp index ed96fa0d..2d699ddc 100644 --- a/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp @@ -440,7 +440,7 @@ void CxxAstVisitorComponentIndexer::visitTypedefDecl(clang::TypedefDecl* d) { m_client->recordSymbol( getAstVisitor()->getDeclNameCache()->getValue(d), - d->getAnonDeclWithTypedefName() == NULL ? SYMBOL_TYPEDEF : utility::convertTagKind(d->getAnonDeclWithTypedefName()->getTagKind()), + d->getAnonDeclWithTypedefName() == nullptr ? SYMBOL_TYPEDEF : utility::convertTagKind(d->getAnonDeclWithTypedefName()->getTagKind()), getParseLocation(d->getLocation()), utility::convertAccessSpecifier(d->getAccess()), utility::isImplicit(d) ? DEFINITION_IMPLICIT : DEFINITION_EXPLICIT @@ -454,7 +454,7 @@ void CxxAstVisitorComponentIndexer::visitTypeAliasDecl(clang::TypeAliasDecl* d) { m_client->recordSymbol( getAstVisitor()->getDeclNameCache()->getValue(d), - d->getAnonDeclWithTypedefName() == NULL ? SYMBOL_TYPEDEF : utility::convertTagKind(d->getAnonDeclWithTypedefName()->getTagKind()), + d->getAnonDeclWithTypedefName() == nullptr ? SYMBOL_TYPEDEF : utility::convertTagKind(d->getAnonDeclWithTypedefName()->getTagKind()), getParseLocation(d->getLocation()), utility::convertAccessSpecifier(d->getAccess()), utility::isImplicit(d) ? DEFINITION_IMPLICIT : DEFINITION_EXPLICIT @@ -572,7 +572,7 @@ void CxxAstVisitorComponentIndexer::visitDeclRefExpr(clang::DeclRefExpr* s) if (shouldVisitReference(s->getLocation(), getAstVisitor()->getComponent()->getTopmostContextDecl())) { if ((clang::isa(decl)) || - (clang::isa(decl) && decl->getParentFunctionOrMethod() != NULL) + (clang::isa(decl) && decl->getParentFunctionOrMethod() != nullptr) ) { ParseLocation declLocation = getParseLocation(decl->getLocation()); std::wstring name = declLocation.filePath.fileName() + L"<" + diff --git a/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp b/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp index ea43bb83..01e293d7 100644 --- a/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp +++ b/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp @@ -345,7 +345,7 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named else if (clang::isa(declaration)) { const clang::VarDecl* varDecl = clang::dyn_cast(declaration); - if (varDecl->getParentFunctionOrMethod() == NULL) + if (varDecl->getParentFunctionOrMethod() == nullptr) { bool isStatic = false; if (varDecl->getAccess() != clang::AS_none) diff --git a/src/lib_cxx/data/parser/cxx/utilityClang.cpp b/src/lib_cxx/data/parser/cxx/utilityClang.cpp index 591229b4..cb33290f 100644 --- a/src/lib_cxx/data/parser/cxx/utilityClang.cpp +++ b/src/lib_cxx/data/parser/cxx/utilityClang.cpp @@ -90,7 +90,7 @@ SymbolKind utility::getSymbolKind(const clang::VarDecl* d) { symbolKind = SYMBOL_PARAMETER; } - else if (d->getParentFunctionOrMethod() == NULL) + else if (d->getParentFunctionOrMethod() == nullptr) { if (d->getAccess() == clang::AS_none) { diff --git a/src/lib_gui/qt/element/QtBookmark.cpp b/src/lib_gui/qt/element/QtBookmark.cpp index 6ebd7e4d..0d699bae 100644 --- a/src/lib_gui/qt/element/QtBookmark.cpp +++ b/src/lib_gui/qt/element/QtBookmark.cpp @@ -11,7 +11,7 @@ QtBookmark::QtBookmark(ControllerProxy* controllerProxy) : m_controllerProxy(controllerProxy) - , m_treeWidgetItem(NULL) + , m_treeWidgetItem(nullptr) , m_arrowImageName(L"arrow_line_down.png") , m_hovered(false) , m_ignoreNextResize(false) diff --git a/src/lib_gui/qt/element/QtBookmarkCategory.cpp b/src/lib_gui/qt/element/QtBookmarkCategory.cpp index 361d0e70..d98d05a8 100644 --- a/src/lib_gui/qt/element/QtBookmarkCategory.cpp +++ b/src/lib_gui/qt/element/QtBookmarkCategory.cpp @@ -81,7 +81,7 @@ void QtBookmarkCategory::setTreeWidgetItem(QTreeWidgetItem* treeItem) void QtBookmarkCategory::updateArrow() { - if (m_treeItem != NULL) + if (m_treeItem != nullptr) { if (m_treeItem->isExpanded()) { @@ -98,7 +98,7 @@ void QtBookmarkCategory::updateArrow() void QtBookmarkCategory::expandClicked() { - if (m_treeItem != NULL) + if (m_treeItem != nullptr) { m_treeItem->setExpanded(!m_treeItem->isExpanded()); updateArrow(); diff --git a/src/lib_gui/qt/network/QtTcpWrapper.cpp b/src/lib_gui/qt/network/QtTcpWrapper.cpp index dab967a8..060b5ad0 100644 --- a/src/lib_gui/qt/network/QtTcpWrapper.cpp +++ b/src/lib_gui/qt/network/QtTcpWrapper.cpp @@ -32,7 +32,7 @@ void QtTcpWrapper::stopListening() QtTcpWrapper::~QtTcpWrapper() { - if (m_tcpServer != NULL) + if (m_tcpServer != nullptr) { if (m_tcpServer->isListening()) { @@ -111,7 +111,7 @@ void QtTcpWrapper::startRead() QString message = QString::fromUtf8(byteArray); - if (m_readCallback != NULL) + if (m_readCallback != nullptr) { m_readCallback(message.toStdWString()); } @@ -121,7 +121,7 @@ void QtTcpWrapper::startRead() m_tcpClient->close(); - if (m_readCallback != NULL) + if (m_readCallback != nullptr) { m_readCallback(buffer); }*/ diff --git a/src/lib_gui/qt/view/QtGraphView.cpp b/src/lib_gui/qt/view/QtGraphView.cpp index 99e7cfba..128c9b5c 100644 --- a/src/lib_gui/qt/view/QtGraphView.cpp +++ b/src/lib_gui/qt/view/QtGraphView.cpp @@ -297,7 +297,7 @@ void QtGraphView::rebuildGraph( for (unsigned int i = 0; i < nodes.size(); i++) { - QtGraphNode* node = createNodeRecursive(view, NULL, nodes[i].get(), activeNodeCount > 1); + QtGraphNode* node = createNodeRecursive(view, nullptr, nodes[i].get(), activeNodeCount > 1); if (node) { m_nodes.push_back(node); @@ -889,7 +889,7 @@ QtGraphNode* QtGraphView::createNodeRecursive( ){ if (!node->visible) { - return NULL; + return nullptr; } QtGraphNode* newNode = nullptr; @@ -970,13 +970,13 @@ QtGraphEdge* QtGraphView::createEdge( { if (!edge->visible) { - return NULL; + return nullptr; } QtGraphNode* owner = findNodeRecursive(m_nodes, edge->ownerId); QtGraphNode* target = findNodeRecursive(m_nodes, edge->targetId); - if (owner != NULL && target != NULL) + if (owner != nullptr && target != nullptr) { QtGraphEdge* qtEdge = new QtGraphEdge( owner, target, edge->data, edge->getWeight(), edge->active && !useBezier, edge->getDirection()); @@ -1022,7 +1022,7 @@ QtGraphEdge* QtGraphView::createEdge( return qtEdge; } - return NULL; + return nullptr; } QtGraphEdge* QtGraphView::createAggregationEdge( @@ -1030,7 +1030,7 @@ QtGraphEdge* QtGraphView::createAggregationEdge( { if (!edge->visible) { - return NULL; + return nullptr; } bool allVisible = true; @@ -1046,7 +1046,7 @@ QtGraphEdge* QtGraphView::createAggregationEdge( if (allVisible) { - return NULL; + return nullptr; } return createEdge(view, edge, visibleEdgeIds, Graph::TRAIL_NONE, QPointF(), false); diff --git a/src/lib_gui/qt/window/QtBookmarkBrowser.cpp b/src/lib_gui/qt/window/QtBookmarkBrowser.cpp index 971c9e47..944e0ae3 100644 --- a/src/lib_gui/qt/window/QtBookmarkBrowser.cpp +++ b/src/lib_gui/qt/window/QtBookmarkBrowser.cpp @@ -193,14 +193,14 @@ void QtBookmarkBrowser::filterOrOrderChanged(const QString& text) void QtBookmarkBrowser::treeItemClicked(QTreeWidgetItem* item, int column) { QtBookmarkCategory* category = dynamic_cast(m_bookmarkTree->itemWidget(item, 0)); - if (category != NULL) + if (category != nullptr) { category->expandClicked(); return; } QtBookmark* bookmark = dynamic_cast(m_bookmarkTree->itemWidget(item, 0)); - if (bookmark != NULL) + if (bookmark != nullptr) { bookmark->commentToggled(); return; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index 21b6d4a0..00d92585 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -937,7 +937,7 @@ void QtProjectWizzard::createProject() if (m_editing) { Application* application = Application::getInstance().get(); - if (application->getCurrentProject() != NULL) + if (application->getCurrentProject() != nullptr) { settingsChanged = !(application->getCurrentProject()->settingsEqualExceptNameAndLocation(*(m_projectSettings.get()))); } diff --git a/src/test/TextAccessTestSuite.h b/src/test/TextAccessTestSuite.h index 8e1533c0..59ccad2c 100644 --- a/src/test/TextAccessTestSuite.h +++ b/src/test/TextAccessTestSuite.h @@ -11,7 +11,7 @@ public: std::shared_ptr textAccess = TextAccess::createFromString(text); - TS_ASSERT(textAccess.get() != NULL); + TS_ASSERT(textAccess.get() != nullptr); } void test_textAccessString_lines_count() @@ -91,7 +91,7 @@ public: std::shared_ptr textAccess = TextAccess::createFromFile(filePath); - TS_ASSERT(textAccess.get() != NULL); + TS_ASSERT(textAccess.get() != nullptr); } void test_textAccessFile_lines_count()