diff data/model/IntervalModel.h @ 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 bfe724787abf
children a1cd5abcb38b
line wrap: on
line diff
--- a/data/model/IntervalModel.h	Tue Mar 03 09:33:59 2015 +0000
+++ b/data/model/IntervalModel.h	Tue Mar 03 15:18:24 2015 +0000
@@ -55,7 +55,7 @@
      * given frame.  Consequently this can be very slow (optimised
      * data structures still to be done!).
      */
-    virtual typename SparseValueModel<PointType>::PointList getPoints(long frame) const;
+    virtual typename SparseValueModel<PointType>::PointList getPoints(sv_frame_t frame) const;
 
     virtual const typename SparseModel<PointType>::PointList &getPoints() const {
         return SparseModel<PointType>::getPoints(); 
@@ -107,7 +107,7 @@
 
         switch (column) {
         // column cannot be 0 or 1, those cases were handled above
-        case 2: point.value = value.toDouble(); break;
+        case 2: point.value = float(value.toDouble()); break;
         case 3: point.duration = value.toInt(); break;
         }
 
@@ -125,7 +125,7 @@
 
 template <typename PointType>
 typename SparseValueModel<PointType>::PointList
-IntervalModel<PointType>::getPoints(long start, long end) const
+IntervalModel<PointType>::getPoints(sv_frame_t start, sv_frame_t end) const
 {
     typedef IntervalModel<PointType> I;
 
@@ -146,7 +146,7 @@
     for (typename I::PointListConstIterator i = endItr; i != I::m_points.begin(); ) {
         --i;
         if (i->frame < start) {
-            if (i->frame + long(i->duration) >= start) {
+            if (i->frame + i->duration >= start) {
                 rv.insert(*i);
             }
         } else if (i->frame <= end) {
@@ -159,7 +159,7 @@
 
 template <typename PointType>
 typename SparseValueModel<PointType>::PointList
-IntervalModel<PointType>::getPoints(long frame) const
+IntervalModel<PointType>::getPoints(sv_frame_t frame) const
 {
     typedef IntervalModel<PointType> I;
 
@@ -168,8 +168,8 @@
 
     if (I::m_resolution == 0) return typename I::PointList();
 
-    long start = (frame / I::m_resolution) * I::m_resolution;
-    long end = start + I::m_resolution;
+    sv_frame_t start = (frame / I::m_resolution) * I::m_resolution;
+    sv_frame_t end = start + I::m_resolution;
 
     PointType endPoint(end);
     
@@ -180,7 +180,7 @@
     for (typename I::PointListConstIterator i = endItr; i != I::m_points.begin(); ) {
         --i;
         if (i->frame < start) {
-            if (i->frame + long(i->duration) >= start) {
+            if (i->frame + i->duration >= start) {
                 rv.insert(*i);
             }
         } else if (i->frame <= end) {