changeset 2126:0b15f3b16776 fix-static-analysis

Use nullptr throughout
author Chris Cannam
date Mon, 26 Nov 2018 14:35:05 +0000
parents 124de219669f
children 292f6cc6b65e
files main/MainWindow.cpp main/OSCHandler.cpp main/PreferencesDialog.cpp main/Surveyer.cpp main/main.cpp
diffstat 5 files changed, 69 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Mon Nov 26 13:56:48 2018 +0000
+++ b/main/MainWindow.cpp	Mon Nov 26 14:35:05 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/OSCHandler.cpp	Mon Nov 26 13:56:48 2018 +0000
+++ b/main/OSCHandler.cpp	Mon Nov 26 14:35:05 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	Mon Nov 26 13:56:48 2018 +0000
+++ b/main/PreferencesDialog.cpp	Mon Nov 26 14:35:05 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/Surveyer.cpp	Mon Nov 26 13:56:48 2018 +0000
+++ b/main/Surveyer.cpp	Mon Nov 26 14:35:05 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	Mon Nov 26 13:56:48 2018 +0000
+++ b/main/main.cpp	Mon Nov 26 14:35:05 2018 +0000
@@ -201,13 +201,13 @@
         QApplication(argc, argv),
         m_readyForFiles(false),
         m_filepathQueue(QStringList()),
-        m_mainWindow(0)
+        m_mainWindow(nullptr)
     {
     }
     ~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;
@@ -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;