From 20b970ec902bf574b287f8ad69df085746ff6ad1 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Tue, 24 Dec 2019 16:20:13 +0100 Subject: [PATCH] VP1Base: Fix clang warnings - useless comparison will nullptr - unused variables - typeid with side effects - string conversion --- graphics/VP1/VP1Base/src/IVP1System.cxx | 8 +++----- graphics/VP1/VP1Base/src/VP1Controller.cxx | 4 +--- graphics/VP1/VP1Base/src/VP1ExaminerViewer.cxx | 8 +++++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/graphics/VP1/VP1Base/src/IVP1System.cxx b/graphics/VP1/VP1Base/src/IVP1System.cxx index 2537ead3394..ad2b04bb1cc 100644 --- a/graphics/VP1/VP1Base/src/IVP1System.cxx +++ b/graphics/VP1/VP1Base/src/IVP1System.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -85,10 +85,8 @@ IVP1System::~IVP1System() assert(m_d->state==UNCREATED||m_d->state==CONSTRUCTED); assert(!m_d->controller); - if(!m_d==0) { - delete m_d; - m_d=0; - } + delete m_d; + m_d=nullptr; VP1Msg::messageDebug("IVP1System() Destructor. END."); } diff --git a/graphics/VP1/VP1Base/src/VP1Controller.cxx b/graphics/VP1/VP1Base/src/VP1Controller.cxx index 1001d2adc48..f1fa3d96a4f 100644 --- a/graphics/VP1/VP1Base/src/VP1Controller.cxx +++ b/graphics/VP1/VP1Base/src/VP1Controller.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -393,7 +393,6 @@ void VP1Controller::restoreSettings(QByteArray ba) if (m_d->collWidget) s.ignoreWidget(m_d->collWidget); s.warnUnrestored((QWidget*)(this)); - QPair<QPushButton*,QWidget*> b2d; foreach (Imp::DialogInfo* di,m_d->dialogs) s.warnUnrestored(di->dialogWidget); @@ -415,7 +414,6 @@ QByteArray VP1Controller::saveSettings() const s.ignoreWidget(m_d->collWidget); s.warnUnsaved((QWidget*)(this)); - QPair<QPushButton*,QWidget*> b2d; foreach (Imp::DialogInfo* di,m_d->dialogs) s.warnUnsaved(di->dialogWidget); diff --git a/graphics/VP1/VP1Base/src/VP1ExaminerViewer.cxx b/graphics/VP1/VP1Base/src/VP1ExaminerViewer.cxx index f26fba8ef6b..c5cba06d102 100644 --- a/graphics/VP1/VP1Base/src/VP1ExaminerViewer.cxx +++ b/graphics/VP1/VP1Base/src/VP1ExaminerViewer.cxx @@ -482,8 +482,10 @@ void debugCameraClipPlanes(void * data, const SbVec2f & nearfar) SoPathList &cameras = action.getPaths(); - for (int i = 0, e = cameras.getLength(); i != e; ++i) - std::cerr << "Camera #" << i << " = " << (void *) cameras[i]->getTail() << "(" << typeid(*cameras[i]->getTail()).name() << ")\n"; + for (int i = 0, e = cameras.getLength(); i != e; ++i) { + auto* tail = cameras[i]->getTail(); + std::cerr << "Camera #" << i << " = " << (void *) tail << "(" << typeid(*tail).name() << ")\n"; + } std::cerr << "Calculated clip-planes. Near: " << nearfar[0] << ". Far: " << nearfar[1] << "\n" << "Current camera clip-planes. Near: " << camera->nearDistance.getValue() << ", Far: " << camera->farDistance.getValue() << "\n" @@ -1279,7 +1281,7 @@ void VP1ExaminerViewer::Imp::detectorZoomButtonClicked(std::pair<REGION,VIEW> p) { grabFocus(); - VP1Msg::messageVerbose("detectorZoomButtonClicked region = "+toString(p.first)+", from "+QString(p.second +" Z axis") ); + VP1Msg::messageVerbose("detectorZoomButtonClicked region = "+toString(p.first)+", from "+QString((std::to_string(p.second) +" Z axis").c_str())); SoNode * rootnode = theclass->getSceneGraph(); if (!rootnode) { -- GitLab