changeset 922:a16456ca5e71 cxx11

More type fixes. We now build with -Wconversion, on this platform (64-bit Linux) at least.
author Chris Cannam
date Tue, 10 Mar 2015 17:23:45 +0000
parents 67540751da93
children 6de549288477
files .hgsubstate configure configure.ac main/MainWindow.cpp main/OSCHandler.cpp main/PreferencesDialog.h
diffstat 6 files changed, 23 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Tue Mar 10 17:02:52 2015 +0000
+++ b/.hgsubstate	Tue Mar 10 17:23:45 2015 +0000
@@ -1,5 +1,5 @@
 d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay
 879bdc878826bebec67130326f99397c430419b1 sv-dependency-builds
-72c662fe7ea311077a1a163dd3afa32581587805 svapp
-26cf6d5251ec93b965a5d4b20bb76f6da9ef85ae svcore
-4a578a360011e1bca3a5885e15835564e398a200 svgui
+167fe01d56311d9e888b8a57ab94a257ea419926 svapp
+c7e9afcbf07063c99e25f696c9f6d61b3d76ff45 svcore
+251dd0abc7b7c53bfbdb09e585f2036c5e0ab085 svgui
--- a/configure	Tue Mar 10 17:02:52 2015 +0000
+++ b/configure	Tue Mar 10 17:23:45 2015 +0000
@@ -4364,9 +4364,10 @@
 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS"
 
 if test "x$GCC" = "xyes"; then
-        CXXFLAGS_DEBUG="-std=c++11 -Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe"
-   	CXXFLAGS_RELEASE="-std=c++11 -g0 -O2 -Wall -pipe"
-   	CXXFLAGS_MINIMAL="-std=c++11 -g0 -O0"
+   	CXXFLAGS_ANY="-std=c++11 -Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe"
+        CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g"
+   	CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O2"
+   	CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0"
 fi
 
 CXXFLAGS_BUILD="$CXXFLAGS_RELEASE"
--- a/configure.ac	Tue Mar 10 17:02:52 2015 +0000
+++ b/configure.ac	Tue Mar 10 17:23:45 2015 +0000
@@ -53,9 +53,10 @@
 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS"
 
 if test "x$GCC" = "xyes"; then
-        CXXFLAGS_DEBUG="-std=c++11 -Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -g -pipe"
-   	CXXFLAGS_RELEASE="-std=c++11 -g0 -O2 -Wall -pipe"
-   	CXXFLAGS_MINIMAL="-std=c++11 -g0 -O0"
+   	CXXFLAGS_ANY="-std=c++11 -Wall -Wextra -Werror -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe"
+        CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g"
+   	CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O2"
+   	CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0"
 fi
 
 CXXFLAGS_BUILD="$CXXFLAGS_RELEASE"
--- a/main/MainWindow.cpp	Tue Mar 10 17:02:52 2015 +0000
+++ b/main/MainWindow.cpp	Tue Mar 10 17:23:45 2015 +0000
@@ -2342,8 +2342,8 @@
 
     QString description;
 
-    int ssr = getMainModel()->getSampleRate();
-    int tsr = ssr;
+    sv_samplerate_t ssr = getMainModel()->getSampleRate();
+    sv_samplerate_t tsr = ssr;
     if (m_playSource) tsr = m_playSource->getTargetSampleRate();
 
     if (ssr != tsr) {
@@ -2808,7 +2808,7 @@
     visible = pane->getImageSize(pane->getFirstVisibleFrame(),
                                  pane->getLastVisibleFrame());
 
-    int sf0 = 0, sf1 = 0;
+    sv_frame_t sf0 = 0, sf1 = 0;
  
     if (haveSelection) {
         MultiSelection::SelectionList selections = m_viewManager->getSelections();
@@ -3874,14 +3874,14 @@
 {
     PlaySpeedRangeMapper mapper(0, 200);
 
-    float percent = m_playSpeed->mappedValue();
-    float factor = mapper.getFactorForValue(percent);
+    double percent = m_playSpeed->mappedValue();
+    double factor = mapper.getFactorForValue(percent);
 
 //    cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << endl;
 
     bool something = (position != 100);
 
-    int pc = lrintf(percent);
+    int pc = int(lrint(percent));
 
     if (!something) {
         contextHelpChanged(tr("Playback speed: Normal"));
@@ -3972,7 +3972,7 @@
     }
 
     bool haveSelection = false;
-    int startFrame = 0, endFrame = 0;
+    sv_frame_t startFrame = 0, endFrame = 0;
 
     if (m_viewManager && m_viewManager->haveInProgressSelection()) {
 
@@ -4025,7 +4025,7 @@
     if (!statusBar()->isVisible()) return;
 
     Pane *pane = 0;
-    int frame = m_viewManager->getPlaybackFrame();
+    sv_frame_t frame = m_viewManager->getPlaybackFrame();
 
     if (m_paneStack) pane = m_paneStack->getCurrentPane();
     if (!pane) return;
@@ -4119,7 +4119,7 @@
 
         MIDIEvent ev(m_midiInput->readEvent());
 
-        int frame = currentPane->alignFromReference(ev.getTime());
+        sv_frame_t frame = currentPane->alignFromReference(ev.getTime());
 
         bool noteOn = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON &&
                        ev.getVelocity() > 0);
--- a/main/OSCHandler.cpp	Tue Mar 10 17:02:52 2015 +0000
+++ b/main/OSCHandler.cpp	Tue Mar 10 17:23:45 2015 +0000
@@ -123,7 +123,7 @@
 
         if (getMainModel()) {
 
-            int frame = m_viewManager->getPlaybackFrame();
+            sv_frame_t frame = m_viewManager->getPlaybackFrame();
             bool selection = false;
             bool play = (message.getMethod() == "play");
 
@@ -452,7 +452,7 @@
                 double level = message.getArg(0).toDouble();
                 Pane *currentPane = m_paneStack->getCurrentPane();
                 if (level < 1.0) level = 1.0;
-                if (currentPane) currentPane->setZoomLevel(lrint(level));
+                if (currentPane) currentPane->setZoomLevel(int(lrint(level)));
             }
         }
 
--- a/main/PreferencesDialog.h	Tue Mar 10 17:02:52 2015 +0000
+++ b/main/PreferencesDialog.h	Tue Mar 10 17:23:45 2015 +0000
@@ -90,7 +90,7 @@
     int m_spectrogramSmoothing;
     int m_spectrogramXSmoothing;
     int m_propertyLayout;
-    float m_tuningFrequency;
+    double m_tuningFrequency;
     int m_audioDevice;
     int m_resampleQuality;
     bool m_resampleOnLoad;