changeset 2145:b35c1f8b2ddd fix-static-analysis

Merge from default branch
author Chris Cannam
date Tue, 04 Dec 2018 13:53:59 +0000
parents 292f6cc6b65e (diff) 3a4202cae7fe (current diff)
children 16315742840b
files repoint-lock.json repoint-project.json
diffstat 10 files changed, 179 insertions(+), 115 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Tue Dec 04 10:57:36 2018 +0000
+++ b/main/MainWindow.cpp	Tue Dec 04 13:53:59 2018 +0000
@@ -139,42 +139,42 @@
 
 MainWindow::MainWindow(SoundOptions options, bool withOSCSupport) :
     MainWindowBase(options),
-    m_overview(0),
+    m_overview(nullptr),
     m_mainMenusCreated(false),
-    m_paneMenu(0),
-    m_layerMenu(0),
-    m_transformsMenu(0),
-    m_playbackMenu(0),
-    m_existingLayersMenu(0),
-    m_sliceMenu(0),
-    m_recentFilesMenu(0),
-    m_recentTransformsMenu(0),
-    m_templatesMenu(0),
-    m_rightButtonMenu(0),
-    m_rightButtonLayerMenu(0),
-    m_rightButtonTransformsMenu(0),
-    m_rightButtonPlaybackMenu(0),
-    m_soloAction(0),
-    m_rwdStartAction(0),
-    m_rwdSimilarAction(0),
-    m_rwdAction(0),
-    m_ffwdAction(0),
-    m_ffwdSimilarAction(0),
-    m_ffwdEndAction(0),
-    m_playAction(0),
-    m_recordAction(0),
-    m_playSelectionAction(0),
-    m_playLoopAction(0),
+    m_paneMenu(nullptr),
+    m_layerMenu(nullptr),
+    m_transformsMenu(nullptr),
+    m_playbackMenu(nullptr),
+    m_existingLayersMenu(nullptr),
+    m_sliceMenu(nullptr),
+    m_recentFilesMenu(nullptr),
+    m_recentTransformsMenu(nullptr),
+    m_templatesMenu(nullptr),
+    m_rightButtonMenu(nullptr),
+    m_rightButtonLayerMenu(nullptr),
+    m_rightButtonTransformsMenu(nullptr),
+    m_rightButtonPlaybackMenu(nullptr),
+    m_soloAction(nullptr),
+    m_rwdStartAction(nullptr),
+    m_rwdSimilarAction(nullptr),
+    m_rwdAction(nullptr),
+    m_ffwdAction(nullptr),
+    m_ffwdSimilarAction(nullptr),
+    m_ffwdEndAction(nullptr),
+    m_playAction(nullptr),
+    m_recordAction(nullptr),
+    m_playSelectionAction(nullptr),
+    m_playLoopAction(nullptr),
     m_soloModified(false),
     m_prevSolo(false),
-    m_playControlsSpacer(0),
+    m_playControlsSpacer(nullptr),
     m_playControlsWidth(0),
-    m_preferencesDialog(0),
-    m_layerTreeDialog(0),
+    m_preferencesDialog(nullptr),
+    m_layerTreeDialog(nullptr),
     m_activityLog(new ActivityLog()),
     m_unitConverter(new UnitConverter()),
     m_keyReference(new KeyReference()),
-    m_templateWatcher(0)
+    m_templateWatcher(nullptr)
 {
     Profiler profiler("MainWindow::MainWindow");
 
@@ -350,8 +350,8 @@
         connect(m_versionTester, SIGNAL(newerVersionAvailable(QString)),
                 this, SLOT(newerVersionAvailable(QString)));
     } else {
-        m_surveyer = 0;
-        m_versionTester = 0;
+        m_surveyer = nullptr;
+        m_versionTester = nullptr;
     }
 
 /*
@@ -447,7 +447,7 @@
     }
 
     QWidget *ps = m_mainScroll->takeWidget();
-    ps->setParent(0);
+    ps->setParent(nullptr);
 
     QShortcut *sc;
 
@@ -924,7 +924,7 @@
 
     IconLoader il;
 
-    QAction *action = 0;
+    QAction *action = nullptr;
 
     m_keyReference->setCategory(tr("Panning and Navigation"));
 
@@ -1306,7 +1306,7 @@
             if (menuType == paneMenuType) menu = m_paneMenu;
             else menu = m_layerMenu;
 
-            QMenu *submenu = 0;
+            QMenu *submenu = nullptr;
 
             QIcon icon;
             QString mainText, tipText, channelText;
@@ -1503,7 +1503,7 @@
                         connect(this, SIGNAL(canAddLayer(bool)),
                                 action, SLOT(setEnabled(bool)));
                         m_layerActions.push_back
-                            ({ action, LayerConfiguration(type, 0, 0) });
+                            ({ action, LayerConfiguration(type, nullptr, 0) });
                         m_rightButtonLayerMenu->addAction(action);
                     }
                 }
@@ -1971,7 +1971,7 @@
 
     m_templatesMenu->addSeparator();
 
-    QAction *action = 0;
+    QAction *action = nullptr;
 
     QStringList templates = ResourceFinder().getResourceFiles("templates", "svt");
 
@@ -2235,7 +2235,7 @@
     connect(m_soloAction, SIGNAL(triggered()), this, SLOT(playSoloToggled()));
     connect(this, SIGNAL(canChangeSolo(bool)), m_soloAction, SLOT(setEnabled(bool)));
 
-    QAction *alAction = 0;
+    QAction *alAction = nullptr;
     if (Document::canAlign()) {
         alAction = toolbar->addAction(il.load("align"),
                                       tr("Align File Timelines"));
@@ -2484,19 +2484,19 @@
 {
     MainWindowBase::updateMenuStates();
 
-    Pane *currentPane = 0;
-    Layer *currentLayer = 0;
+    Pane *currentPane = nullptr;
+    Layer *currentLayer = nullptr;
 
     if (m_paneStack) currentPane = m_paneStack->getCurrentPane();
     if (currentPane) currentLayer = currentPane->getSelectedLayer();
 
     bool haveCurrentPane =
-        (currentPane != 0);
+        (currentPane != nullptr);
     bool haveCurrentLayer =
         (haveCurrentPane &&
-         (currentLayer != 0));
+         (currentLayer != nullptr));
     bool havePlayTarget =
-        (m_playTarget != 0 || m_audioIO != 0);
+        (m_playTarget != nullptr || m_audioIO != nullptr);
     bool haveSelection = 
         (m_viewManager &&
          !m_viewManager->getSelections().empty());
@@ -2764,7 +2764,7 @@
 
     bool multiple = false;
 
-    MultiSelection *selectionToWrite = 0;
+    MultiSelection *selectionToWrite = nullptr;
 
     if (selections.size() == 1) {
 
@@ -3147,7 +3147,7 @@
 
     settings.setValue("lastimageexportregion", deflt);
 
-    QImage *image = 0;
+    QImage *image = nullptr;
     
     if (item == items[0]) {
         image = pane->renderToNewImage();
@@ -3328,9 +3328,9 @@
     m_keyReference->hide();
 
     delete m_document;
-    m_document = 0;
+    m_document = nullptr;
     m_viewManager->clearSelections();
-    m_timeRulerLayer = 0; // document owned this
+    m_timeRulerLayer = nullptr; // document owned this
 
     m_sessionFile = "";
     setWindowTitle(QApplication::applicationName());
@@ -3901,7 +3901,7 @@
     Layer *newLayer = m_document->createLayer(configuration.layer);
 
     Model *suggestedModel = configuration.sourceModel;
-    Model *model = 0;
+    Model *model = nullptr;
 
     if (suggestedModel) {
 
@@ -4023,7 +4023,7 @@
         LayerFactory::LayerTypeSet emptyTypes =
             LayerFactory::getInstance()->getValidEmptyLayerTypes();
 
-        Layer *newLayer = 0;
+        Layer *newLayer = nullptr;
 
         if (emptyTypes.find(type) != emptyTypes.end()) {
 
@@ -4132,7 +4132,7 @@
     std::vector<Model *> candidateInputModels =
         m_document->getTransformInputModels();
 
-    Model *defaultInputModel = 0;
+    Model *defaultInputModel = nullptr;
 
     for (int j = 0; j < pane->getLayerCount(); ++j) {
 
@@ -4156,7 +4156,7 @@
         if (defaultInputModel) break;
     }
 
-    AggregateWaveModel *aggregate = 0;
+    AggregateWaveModel *aggregate = nullptr;
     
     if (candidateInputModels.size() > 1) {
         // Add an aggregate model as another option
@@ -4257,7 +4257,7 @@
     TransformId transform = finder->getTransform();
     delete finder;
     
-    if (getMainModel() != 0 && m_paneStack->getCurrentPane() != 0) {
+    if (getMainModel() != nullptr && m_paneStack->getCurrentPane() != nullptr) {
         addLayer(transform);
     }
 }
@@ -4484,7 +4484,7 @@
 {
     if (!statusBar()->isVisible()) return;
 
-    Pane *pane = 0;
+    Pane *pane = nullptr;
     sv_frame_t frame = m_viewManager->getPlaybackFrame();
 
     if (m_paneStack) pane = m_paneStack->getCurrentPane();
@@ -4584,9 +4584,9 @@
 void
 MainWindow::midiEventsAvailable()
 {
-    Pane *currentPane = 0;
-    NoteLayer *currentNoteLayer = 0;
-    TimeValueLayer *currentTimeValueLayer = 0;
+    Pane *currentPane = nullptr;
+    NoteLayer *currentNoteLayer = nullptr;
+    TimeValueLayer *currentTimeValueLayer = nullptr;
 
     if (m_paneStack) {
         currentPane = m_paneStack->getCurrentPane();
@@ -4677,8 +4677,8 @@
 void
 MainWindow::playStatusChanged(bool )
 {
-    Pane *currentPane = 0;
-    NoteLayer *currentNoteLayer = 0;
+    Pane *currentPane = nullptr;
+    NoteLayer *currentNoteLayer = nullptr;
 
     if (m_paneStack) currentPane = m_paneStack->getCurrentPane();
     if (currentPane) {
@@ -4754,7 +4754,7 @@
 {
     if (model == m_panLayer->getModel()) {
         if (model == getMainModel()) {
-            m_panLayer->setModel(0);
+            m_panLayer->setModel(nullptr);
         } else {
             m_panLayer->setModel(getMainModel());
         }
--- a/main/MainWindow.h	Tue Dec 04 10:57:36 2018 +0000
+++ b/main/MainWindow.h	Tue Dec 04 13:53:59 2018 +0000
@@ -40,7 +40,7 @@
     void canAlign(bool);
 
 public slots:
-    virtual void preferenceChanged(PropertyContainer::PropertyName);
+    void preferenceChanged(PropertyContainer::PropertyName) override;
     virtual void coloursChanged();
 
     virtual bool commitData(bool mayAskUser);
@@ -69,12 +69,12 @@
     virtual void saveSession();
     virtual void saveSessionAs();
     virtual void newSession();
-    virtual void closeSession();
+    void closeSession() override;
     virtual void preferences();
 
-    virtual void sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool);
-    virtual void audioOverloadPluginDisabled();
-    virtual void audioTimeStretchMultiChannelDisabled();
+    void sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool) override;
+    void audioOverloadPluginDisabled() override;
+    void audioTimeStretchMultiChannelDisabled() override;
 
     virtual void toolNavigateSelected();
     virtual void toolSelectSelected();
@@ -83,12 +83,12 @@
     virtual void toolEraseSelected();
     virtual void toolMeasureSelected();
 
-    virtual void documentModified();
-    virtual void documentRestored();
+    void documentModified() override;
+    void documentRestored() override;
     virtual void documentReplaced();
 
-    virtual void updateMenuStates();
-    virtual void updateDescriptionLabel();
+    void updateMenuStates() override;
+    void updateDescriptionLabel() override;
 
     virtual void setInstantsNumbering();
     virtual void setInstantsCounterCycle();
@@ -97,13 +97,13 @@
     virtual void subdivideInstants();
     virtual void winnowInstants();
 
-    virtual void modelGenerationFailed(QString, QString);
-    virtual void modelGenerationWarning(QString, QString);
-    virtual void modelRegenerationFailed(QString, QString, QString);
-    virtual void modelRegenerationWarning(QString, QString, QString);
-    virtual void alignmentFailed(QString);
+    void modelGenerationFailed(QString, QString) override;
+    void modelGenerationWarning(QString, QString) override;
+    void modelRegenerationFailed(QString, QString, QString) override;
+    void modelRegenerationWarning(QString, QString, QString) override;
+    void alignmentFailed(QString) override;
 
-    virtual void rightButtonMenuRequested(Pane *, QPoint point);
+    void rightButtonMenuRequested(Pane *, QPoint point) override;
 
     virtual void propertyStacksResized(int);
 
@@ -114,36 +114,36 @@
 
     virtual void findTransform();
 
-    virtual void paneAdded(Pane *);
-    virtual void paneHidden(Pane *);
-    virtual void paneAboutToBeDeleted(Pane *);
-    virtual void paneDropAccepted(Pane *, QStringList);
-    virtual void paneDropAccepted(Pane *, QString);
+    void paneAdded(Pane *) override;
+    void paneHidden(Pane *) override;
+    void paneAboutToBeDeleted(Pane *) override;
+    void paneDropAccepted(Pane *, QStringList) override;
+    void paneDropAccepted(Pane *, QString) override;
 
     virtual void setupRecentFilesMenu();
     virtual void setupRecentTransformsMenu();
     virtual void setupTemplatesMenu();
 
     virtual void playSpeedChanged(int);
-    virtual void playSoloToggled();
+    void playSoloToggled() override;
     virtual void alignToggled();
 
-    virtual void currentPaneChanged(Pane *);
+    void currentPaneChanged(Pane *) override;
 
     virtual void speedUpPlayback();
     virtual void slowDownPlayback();
     virtual void restoreNormalPlayback();
 
-    virtual void monitoringLevelsChanged(float, float);
+    void monitoringLevelsChanged(float, float) override;
 
-    virtual void layerRemoved(Layer *);
-    virtual void layerInAView(Layer *, bool);
+    void layerRemoved(Layer *) override;
+    void layerInAView(Layer *, bool) override;
 
-    virtual void mainModelChanged(WaveFileModel *);
+    void mainModelChanged(WaveFileModel *) override;
     virtual void mainModelGainChanged(float);
     virtual void mainModelPanChanged(float);
-    virtual void modelAdded(Model *);
-    virtual void modelAboutToBeDeleted(Model *);
+    void modelAdded(Model *) override;
+    void modelAboutToBeDeleted(Model *) override;
 
     virtual void showLayerTree();
     virtual void showActivityLog();
@@ -152,7 +152,7 @@
     virtual void mouseEnteredWidget();
     virtual void mouseLeftWidget();
 
-    virtual void handleOSCMessage(const OSCMessage &);
+    void handleOSCMessage(const OSCMessage &) override;
     virtual void midiEventsAvailable();
     virtual void playStatusChanged(bool);
 
@@ -169,7 +169,7 @@
     virtual void about();
     virtual void whatsNew();
     virtual void keyReference();
-    virtual void newerVersionAvailable(QString);
+    void newerVersionAvailable(QString) override;
 
 protected:
     Overview                *m_overview;
@@ -284,7 +284,7 @@
 
     QString getReleaseText() const;
     
-    virtual void setupMenus();
+    void setupMenus() override;
     virtual void setupFileMenu();
     virtual void setupEditMenu();
     virtual void setupViewMenu();
@@ -296,17 +296,17 @@
 
     virtual void addPane(const LayerConfiguration &configuration, QString text);
 
-    virtual void closeEvent(QCloseEvent *e);
-    virtual bool checkSaveModified();
+    void closeEvent(QCloseEvent *e) override;
+    bool checkSaveModified() override;
 
     virtual void exportAudio(bool asData);
 
-    virtual void updateVisibleRangeDisplay(Pane *p) const;
-    virtual void updatePositionStatusDisplays() const;
+    void updateVisibleRangeDisplay(Pane *p) const override;
+    void updatePositionStatusDisplays() const override;
 
-    virtual bool shouldCreateNewSessionForRDFAudio(bool *cancel);
+    bool shouldCreateNewSessionForRDFAudio(bool *cancel) override;
     
-    virtual void connectLayerEditDialog(ModelDataTableDialog *);
+    void connectLayerEditDialog(ModelDataTableDialog *) override;
 };
 
 
--- a/main/OSCHandler.cpp	Tue Dec 04 10:57:36 2018 +0000
+++ b/main/OSCHandler.cpp	Tue Dec 04 13:53:59 2018 +0000
@@ -271,7 +271,7 @@
                 f1 = lrint(t1 * getMainModel()->getSampleRate());
                 
                 Pane *pane = m_paneStack->getCurrentPane();
-                Layer *layer = 0;
+                Layer *layer = nullptr;
                 if (pane) layer = pane->getSelectedLayer();
                 if (layer) {
                     int resolution;
@@ -408,7 +408,7 @@
             }
                 
         } else {
-            PropertyContainer *container = 0;
+            PropertyContainer *container = nullptr;
             Pane *pane = m_paneStack->getCurrentPane();
             if (pane &&
                 message.getArgCount() == 3 &&
@@ -454,7 +454,7 @@
                 Layer *layer = pane->getLayer(layerIndex);
                 m_paneStack->setCurrentLayer(pane, layer);
             } else if (wantLayer && layerIndex == -1) {
-                m_paneStack->setCurrentLayer(pane, 0);
+                m_paneStack->setCurrentLayer(pane, nullptr);
             }
         }
 
@@ -514,7 +514,7 @@
     } else if (message.getMethod() == "zoomvertical") {
 
         Pane *pane = m_paneStack->getCurrentPane();
-        Layer *layer = 0;
+        Layer *layer = nullptr;
         if (pane && pane->getLayerCount() > 0) {
             layer = pane->getLayer(pane->getLayerCount() - 1);
         }
--- a/main/PreferencesDialog.cpp	Tue Dec 04 10:57:36 2018 +0000
+++ b/main/PreferencesDialog.cpp	Tue Dec 04 13:53:59 2018 +0000
@@ -386,8 +386,8 @@
     connect(hms, SIGNAL(stateChanged(int)),
             this, SLOT(showHMSChanged(int)));
 
-    QFrame *frame = 0;
-    QGridLayout *subgrid = 0;
+    QFrame *frame = nullptr;
+    QGridLayout *subgrid = nullptr;
     int row = 0;
 
     // Appearance tab
--- a/main/SVSplash.h	Tue Dec 04 10:57:36 2018 +0000
+++ b/main/SVSplash.h	Tue Dec 04 13:53:59 2018 +0000
@@ -31,7 +31,7 @@
     void finishSplash(QWidget *);
     
 protected:
-    void drawContents(QPainter *);
+    void drawContents(QPainter *) override;
     QPixmap *m_pixmap;
 };
 
--- a/main/Surveyer.cpp	Tue Dec 04 10:57:36 2018 +0000
+++ b/main/Surveyer.cpp	Tue Dec 04 13:53:59 2018 +0000
@@ -34,7 +34,7 @@
     m_hostname(hostname),
     m_testPath(testPath),
     m_surveyPath(surveyPath),
-    m_reply(0),
+    m_reply(nullptr),
     m_nm(new QNetworkAccessManager)
 {
     QSettings settings;
--- a/main/main.cpp	Tue Dec 04 10:57:36 2018 +0000
+++ b/main/main.cpp	Tue Dec 04 13:53:59 2018 +0000
@@ -201,13 +201,13 @@
         QApplication(argc, argv),
         m_readyForFiles(false),
         m_filepathQueue(QStringList()),
-        m_mainWindow(0)
+        m_mainWindow(nullptr)
     {
     }
-    virtual ~SVApplication() { }
+    ~SVApplication() override { }
 
     void setMainWindow(MainWindow *mw) { m_mainWindow = mw; }
-    void releaseMainWindow() { m_mainWindow = 0; }
+    void releaseMainWindow() { m_mainWindow = nullptr; }
 
     virtual void commitData(QSessionManager &manager) {
         if (!m_mainWindow) return;
@@ -224,7 +224,7 @@
 
 protected:
     MainWindow *m_mainWindow;
-    bool event(QEvent *);
+    bool event(QEvent *) override;
 };
 
 int
@@ -281,7 +281,7 @@
 
     QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
 
-    SVSplash *splash = 0;
+    SVSplash *splash = nullptr;
 
     QSettings settings;
 
@@ -492,7 +492,7 @@
     case QEvent::FileOpen:
         thePath = static_cast<QFileOpenEvent *>(event)->file();
         if(m_readyForFiles)
-            handleFilepathArgument(thePath, NULL);
+            handleFilepathArgument(thePath, nullptr);
         else
             m_filepathQueue.append(thePath);
         return true;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/run-clang-tidy.sh	Tue Dec 04 13:53:59 2018 +0000
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+usage() {
+    echo
+    echo "  $0: run clang-tidy on a build with supplied arguments" 1>&2
+    echo
+    echo "  Run this from the root of the source tree, on a Linux system." 1>&2
+    echo "  Assumes that \"./configure && make clean && make\" will produce a successful" 1>&2
+    echo "  build using g++." 1>&2
+    echo "  All arguments are passed to clang-tidy." 1>&2
+    echo
+    exit 2
+}
+
+if [ t"$1" = "t" ]; then
+    usage
+fi
+
+ctargs="$@"
+
+echo "clang-tidy args: $ctargs"
+
+set -eu
+
+tmpdir=$(mktemp -d)
+trap "rm -rf \$tmpdir\$" 0
+
+#log="build.log"
+
+log="$tmpdir/make.log"
+./configure
+make clean
+make -j3 2>&1 | tee "$log"
+
+list="$tmpdir/tidy.list"
+
+grep '^g[+][+] ' "$log" | grep ' [-]c ' > "$list"
+
+cat "$list" | while read line ; do
+
+    filename=${line##* }
+    remainder=${line% *}
+    cc=${remainder%% *}
+    ccargs=${remainder#* }
+
+    ccargs=$(echo "$ccargs" | sed 's/-flto //')
+
+    echo
+    
+    case "$filename" in
+        bq*) echo "ignoring $filename" ;;
+        o/*) echo "ignoring $filename" ;;
+        vamp-*) echo "ignoring $filename" ;;
+        dataquay/*) echo "ignoring $filename" ;;
+        src/*) echo "ignoring $filename" ;;
+        *) echo "not ignoring $filename"
+           echo clang-tidy $ctargs "$filename" -- $ccargs ;
+           clang-tidy $ctargs "$filename" -- $ccargs ;;
+    esac
+done
+
--- a/repoint-lock.json	Tue Dec 04 10:57:36 2018 +0000
+++ b/repoint-lock.json	Tue Dec 04 13:53:59 2018 +0000
@@ -4,13 +4,13 @@
       "pin": "da86fb0bccb3"
     },
     "svcore": {
-      "pin": "07f23b90701a"
+      "pin": "70e172e6cc59"
     },
     "svgui": {
-      "pin": "24234307c9b2"
+      "pin": "d057dcc827e7"
     },
     "svapp": {
-      "pin": "109a1dd59f45"
+      "pin": "8c5379570f36"
     },
     "checker": {
       "pin": "0d2d3c89fdf6"
--- a/repoint-project.json	Tue Dec 04 10:57:36 2018 +0000
+++ b/repoint-project.json	Tue Dec 04 13:53:59 2018 +0000
@@ -16,15 +16,18 @@
         },
         "svcore": {
             "vcs": "hg",
-            "service": "soundsoftware"
+            "service": "soundsoftware",
+            "branch": "fix-static-analysis"
         },
         "svgui": {
             "vcs": "hg",
-            "service": "soundsoftware"
+            "service": "soundsoftware",
+            "branch": "fix-static-analysis"
         },
         "svapp": {
             "vcs": "hg",
-	    "service": "soundsoftware"
+	    "service": "soundsoftware",
+            "branch": "fix-static-analysis"
         },
         "checker": {
             "vcs": "hg",