diff data/model/WaveFileModel.cpp @ 225:185454896a76

* Return ranges from RangeSummarisableTimeValueModel::getRanges by references instead of by return value. Trying to isolate a Win32 problem.
author Chris Cannam
date Wed, 07 Feb 2007 14:21:14 +0000
parents e2bbb58e6df6
children 03a24547cf3c
line wrap: on
line diff
--- a/data/model/WaveFileModel.cpp	Thu Feb 01 14:31:28 2007 +0000
+++ b/data/model/WaveFileModel.cpp	Wed Feb 07 14:21:14 2007 +0000
@@ -218,16 +218,16 @@
     return i;
 }
 
-WaveFileModel::RangeBlock
+void
 WaveFileModel::getRanges(size_t channel, size_t start, size_t end,
-			 size_t &blockSize) const
+                         RangeBlock &ranges, size_t &blockSize) const
 {
-    RangeBlock ranges;
-    if (!isOK()) return ranges;
+    ranges.clear();
+    if (!isOK()) return;
 
     if (end <= start) {
 	std::cerr << "WARNING: Internal error: end <= start in WaveFileModel::getRanges (end = " << end << ", start = " << start << ", blocksize = " << blockSize << ")" << std::endl;
-	return ranges;
+	return;
     }
 
     int cacheType = 0;
@@ -276,7 +276,7 @@
             ranges.push_back(Range(min, max, total / count));
 	}
 
-	return ranges;
+	return;
 
     } else {
 
@@ -328,7 +328,7 @@
     }
 
     //cerr << "returning " << ranges.size() << " ranges" << endl;
-    return ranges;
+    return;
 }
 
 WaveFileModel::Range
@@ -354,7 +354,8 @@
     if (blockStart < start) blockStart += blockSize;
         
     if (blockEnd > blockStart) {
-        RangeBlock ranges = getRanges(channel, blockStart, blockEnd, blockSize);
+        RangeBlock ranges;
+        getRanges(channel, blockStart, blockEnd, ranges, blockSize);
         for (size_t i = 0; i < ranges.size(); ++i) {
             if (first || ranges[i].min < range.min) range.min = ranges[i].min;
             if (first || ranges[i].max > range.max) range.max = ranges[i].max;