diff data/model/EditableDenseThreeDimensionalModel.cpp @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents 0009b2b066e0
children a1cd5abcb38b
line wrap: on
line diff
--- a/data/model/EditableDenseThreeDimensionalModel.cpp	Tue Mar 03 09:33:59 2015 +0000
+++ b/data/model/EditableDenseThreeDimensionalModel.cpp	Tue Mar 03 15:18:24 2015 +0000
@@ -61,19 +61,19 @@
     return m_sampleRate;
 }
 
-int
+sv_frame_t
 EditableDenseThreeDimensionalModel::getStartFrame() const
 {
     return m_startFrame;
 }
 
 void
-EditableDenseThreeDimensionalModel::setStartFrame(int f)
+EditableDenseThreeDimensionalModel::setStartFrame(sv_frame_t f)
 {
     m_startFrame = f; 
 }
 
-int
+sv_frame_t
 EditableDenseThreeDimensionalModel::getEndFrame() const
 {
     return m_resolution * m_data.size() + (m_resolution - 1);
@@ -255,7 +255,7 @@
                     tcol[i - bcount] = values.at(i);
                 }
                 m_data[index] = tcol;
-                m_trunc[index] = -tdist;
+                m_trunc[index] = (signed char)(-tdist);
                 return;
             } else {
                 // create a new column with h - tcount values from 0 up
@@ -266,7 +266,7 @@
                     tcol[i] = values.at(i);
                 }
                 m_data[index] = tcol;
-                m_trunc[index] = tdist;
+                m_trunc[index] = (signed char)(tdist);
                 return;
             }
         }
@@ -465,7 +465,7 @@
 
     if (sample.empty()) return false;
     for (int j = 0; j < sample.size(); ++j) {
-        if (n[j]) sample[j] /= n[j];
+        if (n[j]) sample[j] /= float(n[j]);
     }
     
     return LogRange::useLogScale(sample.toStdVector());
@@ -515,13 +515,13 @@
 }
 
 QString
-EditableDenseThreeDimensionalModel::toDelimitedDataStringSubset(QString delimiter, int f0, int f1) const
+EditableDenseThreeDimensionalModel::toDelimitedDataStringSubset(QString delimiter, sv_frame_t f0, sv_frame_t f1) const
 {
     QReadLocker locker(&m_lock);
     QString s;
     for (int i = 0; i < m_data.size(); ++i) {
-        int fr = m_startFrame + i * m_resolution;
-        if (fr >= int(f0) && fr < int(f1)) {
+        sv_frame_t fr = m_startFrame + i * m_resolution;
+        if (fr >= f0 && fr < f1) {
             QStringList list;
             for (int j = 0; j < m_data.at(i).size(); ++j) {
                 list << QString("%1").arg(m_data.at(i).at(j));