diff data/fft/FFTFileCache.cpp @ 259:dc46851837d6

* Fix many compile warnings, remove some debug output
author Chris Cannam
date Mon, 30 Apr 2007 13:36:23 +0000
parents 91fdc752e540
children 2268963dabd1
line wrap: on
line diff
--- a/data/fft/FFTFileCache.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/data/fft/FFTFileCache.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -40,7 +40,7 @@
            mode == MatrixFile::ReadOnly)),
     m_storageType(storageType)
 {
-    std::cerr << "FFTFileCache: storage type is " << (storageType == Compact ? "Compact" : storageType == Polar ? "Polar" : "Rectangular") << std::endl;
+//    std::cerr << "FFTFileCache: storage type is " << (storageType == Compact ? "Compact" : storageType == Polar ? "Polar" : "Rectangular") << std::endl;
 }
 
 FFTFileCache::~FFTFileCache()
@@ -234,7 +234,12 @@
 //    std::cerr << "Normalization factor: " << factor << ", max " << maxFactor << " (height " << getHeight() << ")" << std::endl;
 
     if (m_storageType == Compact) {
-        ((uint16_t *)m_writebuf)[h * 2] = factor * 65535.0;
+        if (factor < 0.f || factor > 1.f) {
+            std::cerr << "WARNING: FFTFileCache::setColumnAt: Normalization factor " << factor << " out of range" << std::endl;
+            if (factor < 0.f) factor = 0.f;
+            if (factor > 1.f) factor = 1.f;
+        }
+        ((uint16_t *)m_writebuf)[h * 2] = (uint16_t)(factor * 65535.0);
     } else {
         ((float *)m_writebuf)[h * 2] = factor;
     }