changeset 735:048daa7513de

Merge from branch warnfix_no_size_t
author Chris Cannam
date Wed, 18 Jun 2014 13:55:01 +0100
parents 010933c50a9f (current diff) c65dde5537bd (diff)
children 2700e13716ef
files
diffstat 6 files changed, 31 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed Jun 18 13:54:36 2014 +0100
+++ b/configure	Wed Jun 18 13:55:01 2014 +0100
@@ -4223,7 +4223,7 @@
 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS"
 
 if test "x$GCC" = "xyes"; then
-        CXXFLAGS_DEBUG="-Wall -Woverloaded-virtual -Wextra -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe"
+        CXXFLAGS_DEBUG="-Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe"
    	CXXFLAGS_RELEASE="-g0 -O2 -Wall -pipe"
    	CXXFLAGS_MINIMAL="-g0 -O0"
 fi
--- a/configure.ac	Wed Jun 18 13:54:36 2014 +0100
+++ b/configure.ac	Wed Jun 18 13:55:01 2014 +0100
@@ -50,7 +50,7 @@
 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS"
 
 if test "x$GCC" = "xyes"; then
-        CXXFLAGS_DEBUG="-Wall -Woverloaded-virtual -Wextra -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe"
+        CXXFLAGS_DEBUG="-Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe"
    	CXXFLAGS_RELEASE="-g0 -O2 -Wall -pipe"
    	CXXFLAGS_MINIMAL="-g0 -O0"
 fi
--- a/main/MainWindow.cpp	Wed Jun 18 13:54:36 2014 +0100
+++ b/main/MainWindow.cpp	Wed Jun 18 13:55:01 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	Wed Jun 18 13:54:36 2014 +0100
+++ b/main/MainWindow.h	Wed Jun 18 13:55:01 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	Wed Jun 18 13:54:36 2014 +0100
+++ b/main/OSCHandler.cpp	Wed Jun 18 13:55:01 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	Wed Jun 18 13:54:36 2014 +0100
+++ b/main/main.cpp	Wed Jun 18 13:55:01 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();