changeset 730:73a5884a0975 warnfix_no_size_t

Various size_t etc removals, and compiler warning fixes
author Chris Cannam
date Tue, 17 Jun 2014 16:42:51 +0100
parents b959148258a4
children c98731517def
files .hgsubstate main/MainWindow.cpp main/MainWindow.h main/OSCHandler.cpp main/main.cpp
diffstat 5 files changed, 33 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Tue Jun 03 11:13:53 2014 +0100
+++ b/.hgsubstate	Tue Jun 17 16:42:51 2014 +0100
@@ -1,5 +1,5 @@
-236814e07bd07473958c1ff89103124536a0c3c8 dataquay
+d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay
 3c5adc4a864fa75e5b1e67c260b77541aaa4f1f6 sv-dependency-builds
-e7a3fa8f4eec7c85ab80e5b1ddab1e2a60633c2c svapp
-49618f39ff091e72eb94dd0d8424da44cf10e272 svcore
-ddae586bc47bbe718d625109065b06d11d23db8a svgui
+0876ea394902e7aef3207732a7c407d94f49f008 svapp
+e06f03013f4647c512b7b4795d375e67f3168d7d svcore
+e4773943c9c179a4b29ced5b53f3ea21dbd0c739 svgui
--- a/main/MainWindow.cpp	Tue Jun 03 11:13:53 2014 +0100
+++ b/main/MainWindow.cpp	Tue Jun 17 16:42:51 2014 +0100
@@ -1137,6 +1137,11 @@
             QString mainText, shortcutText, tipText, channelText;
             LayerFactory::LayerType type = backgroundTypes[i];
             bool mono = true;
+
+// Avoid warnings/errors with -Wextra because we aren't explicitly
+// handling all layer types (-Wall is OK with this because of the
+// default but the stricter level insists)
+#pragma GCC diagnostic ignored "-Wswitch-enum"
             
             switch (type) {
                     
@@ -2313,8 +2318,8 @@
 
     QString description;
 
-    size_t ssr = getMainModel()->getSampleRate();
-    size_t tsr = ssr;
+    int ssr = getMainModel()->getSampleRate();
+    int tsr = ssr;
     if (m_playSource) tsr = m_playSource->getTargetSampleRate();
 
     if (ssr != tsr) {
@@ -2780,7 +2785,7 @@
     visible = pane->getImageSize(pane->getFirstVisibleFrame(),
                                  pane->getLastVisibleFrame());
 
-    size_t sf0 = 0, sf1 = 0;
+    int sf0 = 0, sf1 = 0;
  
     if (haveSelection) {
         MultiSelection::SelectionList selections = m_viewManager->getSelections();
@@ -2943,26 +2948,6 @@
 }
 
 void
-MainWindow::openSession()
-{
-    if (!checkSaveModified()) return;
-
-    QString orig = m_audioFile;
-    if (orig == "") orig = ".";
-    else orig = QFileInfo(orig).absoluteDir().canonicalPath();
-
-    QString path = getOpenFileName(FileFinder::SessionFile);
-
-    if (path.isEmpty()) return;
-
-    if (openSessionFile(path) == FileOpenFailed) {
-        emit hideSplash();
-	QMessageBox::critical(this, tr("Failed to open file"),
-			      tr("<b>File open failed</b><p>Session file \"%1\" could not be opened").arg(path));
-    }
-}
-
-void
 MainWindow::openSomething()
 {
     QString orig = m_audioFile;
@@ -3709,8 +3694,8 @@
         if (defaultInputModel) break;
     }
     
-    size_t startFrame = 0, duration = 0;
-    size_t endFrame = 0;
+    int startFrame = 0, duration = 0;
+    int endFrame = 0;
     m_viewManager->getSelection().getExtents(startFrame, endFrame);
     if (endFrame > startFrame) duration = endFrame - startFrame;
     else startFrame = 0;
@@ -3909,7 +3894,7 @@
     }
 
     bool haveSelection = false;
-    size_t startFrame = 0, endFrame = 0;
+    int startFrame = 0, endFrame = 0;
 
     if (m_viewManager && m_viewManager->haveInProgressSelection()) {
 
@@ -3960,7 +3945,7 @@
     if (!statusBar()->isVisible()) return;
 
     Pane *pane = 0;
-    size_t frame = m_viewManager->getPlaybackFrame();
+    int frame = m_viewManager->getPlaybackFrame();
 
     if (m_paneStack) pane = m_paneStack->getCurrentPane();
     if (!pane) return;
@@ -3987,7 +3972,7 @@
 }
 
 void
-MainWindow::sampleRateMismatch(size_t requested, size_t actual,
+MainWindow::sampleRateMismatch(int requested, int actual,
                                bool willResample)
 {
     if (!willResample) {
@@ -4044,7 +4029,7 @@
 
         MIDIEvent ev(m_midiInput->readEvent());
 
-        size_t frame = currentPane->alignFromReference(ev.getTime());
+        int frame = currentPane->alignFromReference(ev.getTime());
 
         bool noteOn = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON &&
                        ev.getVelocity() > 0);
@@ -4099,7 +4084,7 @@
 }    
 
 void
-MainWindow::playStatusChanged(bool playing)
+MainWindow::playStatusChanged(bool )
 {
     Pane *currentPane = 0;
     NoteLayer *currentNoteLayer = 0;
@@ -4221,7 +4206,7 @@
 }
 
 void
-MainWindow::modelGenerationWarning(QString transformName, QString message)
+MainWindow::modelGenerationWarning(QString /* transformName */, QString message)
 {
     emit hideSplash();
 
@@ -4255,7 +4240,8 @@
 
 void
 MainWindow::modelRegenerationWarning(QString layerName,
-                                     QString transformName, QString message)
+                                     QString /* transformName */,
+                                     QString message)
 {
     emit hideSplash();
 
--- a/main/MainWindow.h	Tue Jun 03 11:13:53 2014 +0100
+++ b/main/MainWindow.h	Tue Jun 17 16:42:51 2014 +0100
@@ -47,7 +47,6 @@
     void endFullScreen();
 
 protected slots:
-    virtual void openSession();
     virtual void importAudio();
     virtual void importMoreAudio();
     virtual void replaceMainAudio();
@@ -66,7 +65,7 @@
     virtual void closeSession();
     virtual void preferences();
 
-    virtual void sampleRateMismatch(size_t, size_t, bool);
+    virtual void sampleRateMismatch(int, int, bool);
     virtual void audioOverloadPluginDisabled();
     virtual void audioTimeStretchMultiChannelDisabled();
 
--- a/main/OSCHandler.cpp	Tue Jun 03 11:13:53 2014 +0100
+++ b/main/OSCHandler.cpp	Tue Jun 17 16:42:51 2014 +0100
@@ -123,7 +123,7 @@
 
         if (getMainModel()) {
 
-            unsigned long frame = m_viewManager->getPlaybackFrame();
+            int frame = m_viewManager->getPlaybackFrame();
             bool selection = false;
             bool play = (message.getMethod() == "play");
 
@@ -255,7 +255,7 @@
                 Layer *layer = 0;
                 if (pane) layer = pane->getSelectedLayer();
                 if (layer) {
-                    size_t resolution;
+                    int resolution;
                     layer->snapToFeatureFrame(pane, f0, resolution,
                                               Layer::SnapLeft);
                     layer->snapToFeatureFrame(pane, f1, resolution,
--- a/main/main.cpp	Tue Jun 03 11:13:53 2014 +0100
+++ b/main/main.cpp	Tue Jun 17 16:42:51 2014 +0100
@@ -317,7 +317,7 @@
 
     QIcon icon;
     int sizes[] = { 16, 22, 24, 32, 48, 64, 128 };
-    for (int i = 0; i < sizeof(sizes)/sizeof(sizes[0]); ++i) {
+    for (int i = 0; i < int(sizeof(sizes)/sizeof(sizes[0])); ++i) {
         icon.addFile(QString(":icons/sv-%1x%2.png").arg(sizes[i]).arg(sizes[i]));
     }
     QApplication::setWindowIcon(icon);
@@ -478,7 +478,14 @@
 }
 
 bool SVApplication::event(QEvent *event){
+
+// Avoid warnings/errors with -Wextra because we aren't explicitly
+// handling all event types (-Wall is OK with this because of the
+// default but the stricter level insists)
+#pragma GCC diagnostic ignored "-Wswitch-enum"
+
     QString thePath;
+
     switch (event->type()) {
     case QEvent::FileOpen:
         thePath = static_cast<QFileOpenEvent *>(event)->file();