changeset 2181:b0e8217719ed

Merge from branch fix-static-analysis
author Chris Cannam
date Wed, 09 Jan 2019 15:27:32 +0000
parents 52eda31c7b33 (current diff) 16315742840b (diff)
children f5355a088ca2
files main/MainWindow.cpp main/MainWindow.h repoint-lock.json repoint-project.json
diffstat 10 files changed, 176 insertions(+), 112 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Wed Jan 09 14:43:03 2019 +0000
+++ b/main/MainWindow.cpp	Wed Jan 09 15:27:32 2019 +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);
                     }
                 }
@@ -1970,7 +1970,7 @@
 
     m_templatesMenu->addSeparator();
 
-    QAction *action = 0;
+    QAction *action = nullptr;
 
     QStringList templates = ResourceFinder().getResourceFiles("templates", "svt");
 
@@ -2234,7 +2234,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"));
@@ -2483,19 +2483,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());
@@ -2763,7 +2763,7 @@
 
     bool multiple = false;
 
-    MultiSelection *selectionToWrite = 0;
+    MultiSelection *selectionToWrite = nullptr;
 
     if (selections.size() == 1) {
 
@@ -3146,7 +3146,7 @@
 
     settings.setValue("lastimageexportregion", deflt);
 
-    QImage *image = 0;
+    QImage *image = nullptr;
     
     if (item == items[0]) {
         image = pane->renderToNewImage();
@@ -3327,9 +3327,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	Wed Jan 09 14:43:03 2019 +0000
+++ b/main/MainWindow.h	Wed Jan 09 15:27:32 2019 +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);
@@ -67,12 +67,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();
@@ -81,12 +81,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();
@@ -95,13 +95,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);
 
@@ -112,36 +112,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();
@@ -150,7 +150,7 @@
     virtual void mouseEnteredWidget();
     virtual void mouseLeftWidget();
 
-    virtual void handleOSCMessage(const OSCMessage &);
+    void handleOSCMessage(const OSCMessage &) override;
     virtual void midiEventsAvailable();
     virtual void playStatusChanged(bool);
 
@@ -167,7 +167,7 @@
     virtual void about();
     virtual void whatsNew();
     virtual void keyReference();
-    virtual void newerVersionAvailable(QString);
+    void newerVersionAvailable(QString) override;
 
 protected:
     Overview                *m_overview;
@@ -282,7 +282,7 @@
 
     QString getReleaseText() const;
     
-    virtual void setupMenus();
+    void setupMenus() override;
     virtual void setupFileMenu();
     virtual void setupEditMenu();
     virtual void setupViewMenu();
@@ -294,17 +294,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	Wed Jan 09 14:43:03 2019 +0000
+++ b/main/OSCHandler.cpp	Wed Jan 09 15:27:32 2019 +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	Wed Jan 09 14:43:03 2019 +0000
+++ b/main/PreferencesDialog.cpp	Wed Jan 09 15:27:32 2019 +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	Wed Jan 09 14:43:03 2019 +0000
+++ b/main/SVSplash.h	Wed Jan 09 15:27:32 2019 +0000
@@ -31,7 +31,7 @@
     void finishSplash(QWidget *);
     
 protected:
-    void drawContents(QPainter *);
+    void drawContents(QPainter *) override;
     QPixmap *m_pixmap;
 };
 
--- a/main/Surveyer.cpp	Wed Jan 09 14:43:03 2019 +0000
+++ b/main/Surveyer.cpp	Wed Jan 09 15:27:32 2019 +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	Wed Jan 09 14:43:03 2019 +0000
+++ b/main/main.cpp	Wed Jan 09 15:27:32 2019 +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	Wed Jan 09 15:27:32 2019 +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	Wed Jan 09 14:43:03 2019 +0000
+++ b/repoint-lock.json	Wed Jan 09 15:27:32 2019 +0000
@@ -4,13 +4,13 @@
       "pin": "da86fb0bccb3"
     },
     "svcore": {
-      "pin": "9570ef94eaa3"
+      "pin": "841b2a3e606d"
     },
     "svgui": {
-      "pin": "0930a27ebea2"
+      "pin": "fa986b91d77f"
     },
     "svapp": {
-      "pin": "713b9a6b284a"
+      "pin": "6fd0ebfd2bbe"
     },
     "checker": {
       "pin": "0d2d3c89fdf6"
--- a/rubberband-all.cpp	Wed Jan 09 14:43:03 2019 +0000
+++ b/rubberband-all.cpp	Wed Jan 09 15:27:32 2019 +0000
@@ -9,6 +9,9 @@
 #define USE_KISSFFT 1
 #define USE_SPEEX 1
 
+#define SV_PROFILER_H 1 // Include guard - avoid reading two Profiler.h files.
+                        // Yes, it's gross
+
 #ifdef _MSC_VER
 #define __MSVC__
 #endif